neuron-7.6.3/000077500000000000000000000000001340731477100130445ustar00rootroot00000000000000neuron-7.6.3/Copyright000077500000000000000000000022071340731477100147430ustar00rootroot00000000000000Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University Copyright (c) 1991 Silicon Graphics, Inc. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that (i) the above copyright notices and this permission notice appear in all copies of the software and related documentation, and (ii) the names of Stanford and Silicon Graphics may not be used in any advertising or publicity relating to the software without the specific, prior written permission of Stanford and Silicon Graphics. THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. neuron-7.6.3/INSTALL000077500000000000000000000233401340731477100141020ustar00rootroot00000000000000Brief instructions: Do the following: % configure --prefix=/where/you/want/it % make % make install If you don't specify a prefix, it defaults to /usr/local. That's pretty much it. You might possibly need to specify the location of your X11 files; do "configure --help" and look at the --with-X options. If you need to track down a bug, you might want to build the static libraries with --enable-static. Automake and autoconf scripts were originally done for this package by Gary Holt (holt@LNC.usc.edu). These replace the ugly Imakefile jungle. Following are the generic installation instructions for any package with a configure script. ------------------------------------------------------------------------------- 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, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. 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. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for variables by setting them in the environment. You can do that on the command line like this: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Environment Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you 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 support 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' cannot 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 cannot guess the host type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are _building_ compiler tools for cross-compiling, you should use the `--target=TYPE' option to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the host platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. In this case, you should also specify the build platform with `--build=TYPE', because, in this case, it may not be possible to guess the build platform (it sometimes involves compiling and running simple test programs, and this can't be done if the compiler is a cross compiler). 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. Environment Variables ===================== Variables not defined in a site shell script can be set in the environment passed to configure. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc will cause the specified gcc to be used as the C compiler (unless it is overridden in the site shell script). `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. neuron-7.6.3/Makefile.in000077500000000000000000000055111340731477100151160ustar00rootroot00000000000000# Makefile.in generated automatically by automake 1.4a from Makefile.am # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include DESTDIR = pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . AUTOCONF = autoconf @SET_MAKE@ SUBDIRS = src subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = DIST_SOURCES = DIST_COMMON = README INSTALL Makefile.in aclocal.m4 \ config.guess config.sub configure configure.in install-sh \ ltconfig ltmain.sh mkinstalldirs DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) # 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. all install clean mostlyclean uninstall: @topdir=`pwd`; \ for dir in $(SUBDIRS); do \ echo "Making $@ in $$dir"; \ cd $$dir; \ $(MAKE) $@; \ cd $$topdir; \ done distclean: @topdir=`pwd`; \ for dir in $(SUBDIRS); do \ echo "Making $@ in $$dir"; \ cd $$dir; \ $(MAKE) $@; \ cd $$topdir; \ done $(RM) config.cache config.status config.log Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) .PHONY: all install clean mostlyclean distclean uninstall dist zip-dist # 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: neuron-7.6.3/README000077500000000000000000000336621340731477100137410ustar00rootroot00000000000000Here is the original README for InterViews 3.1. Ignore the installation instructions; to install it, see the file INSTALL instead. This version of interviews has been hacked from the original distribution to be portable to a few more platforms, and to use an autoconfigure script. All of the imake garbage has been removed, including the imake configuration files, the ivmkmf script, and other related things. Do not use this library for new development efforts! Use a more modern one, like gtkmm or Qt or wxwindows. This library is only for legacy code. ------------------------------------------------------------------------------- README for InterViews 3.1 The iv subdirectory in this directory contains the InterViews 3.1 distribution from Stanford University and Silicon Graphics. You should read the release notes in iv/src/man/refman/refman.PS for information about differences between 3.0 and 3.1. You should read the rest of this file for information about how to build, install, and use InterViews. If you have a bug report, please send it to interviews-bugs@interviews.stanford.edu If you have any questions or problems, please post them in the USENET newsgroup comp.windows.interviews If you do not have access to news and you wish to be on the InterViews mailing list which is gatewayed with comp.windows.interviews, send a request to interviews-requests@interviews.stanford.edu The mailing list alias is interviews@interviews.stanford.edu Please post to only the newsgroup or only the mailing list but not both since whatever you post in one will appear in the other too. * What else to get You should have gotten a C++ compiler which accepts revision 2.0 or later of the language. You should have installed the X11R4 or X11R5 distribution from MIT. If you use a vendor's X11 product, the product should be based on R4 or later and the product should include imake, makedepend, and the config files. If imake and makedepend are not in the same place where the other X11 binaries are or anywhere else on your system, you can get the sources for imake and makedepend from the X11R4 distribution at several public ftp archives (such as expo.lcs.mit.edu). The X11R4 distribution also contains platform-specific configuration files (*.cf) which you must put in /usr/lib/X11/config or a similar place before building InterViews. * What to do before building InterViews You should check that you have about 50Mb of free space before you unpack the 3.1 tar file. If you have SunOS shared libraries, you can get by with about 35Mb. The InterViews source tree itself occupies only 8Mb, but saying "make World" will add 17Mb to iv and saying "make install" will add another 18Mb. You should read and edit iv/src/config/InterViews/local.def before building InterViews. This file is the place to set parameters which may need to be changed for your site. To find out which parameters you can set, read params.def in the same directory. For example, you might add the lines #undef CCDriver #define CCDriver /usr/CC/sun4/CC #undef DependCCFlags #define DependCCFlags $(CCDEFINES) $(CCINCLUDES) -I/usr/CC/incl #undef SharedCCFlags #define SharedCCFlags -PIC to local.def if you use Sun C++ 2.0. Sun C++ 2.0 will not be able to build libIV.so.3.0 unless you use -PIC instead of -pic. You must decide whether to change the definition of InstalledRoot in local.def before building InterViews since the name will be compiled into InterViews applications. For example, the application "doc" will expect to get its menus from /interviews/lib/all/app-defaults/Doc at startup unless you set InstalledRoot to something else before building InterViews. Other parameters you may also have to set are where to find the X11 config files, includes, and libraries. If the X11 config files are not in /usr/lib/X11/config, the X11 includes are not in /usr/include, or the X11 libraries are not in /lib, /usr/lib, or /usr/local/lib, then you should specify their actual locations in local.def. For example, you might add the lines #undef XConfigDir #define XConfigDir /usr/X11R5/lib/X11/config #undef XIncDir #define XIncDir /usr/X11R5/include #undef XLibDir #define XLibDir /usr/X11R5/lib if you are using X11R5 and it is installed in /usr/X11R5. You will also have to override XCONFIGDIR when saying "make World"; see below. You should read the X11 platform-specific .cf file that will be used when you build InterViews. It probably will set a few InterViews parameters like extra compiler flags, extra defines, or extra libraries so you should check that all of these extra flags work with your C++ compiler as well as with your C compiler. If your C++ compiler will not accept some of them or it needs some additional flags, you can set the affected InterViews parameters in the corresponding iv-*.cf file before xparams.cf sets them. See iv-sgi.cf and iv-ultrix.cf for examples. The iv-*.cf file is the only other file besides local.def which you should ever need to change. (If you have to change this file, please send us the changes so we can incorporate them in the next release.) * How to build InterViews After you set any necessary parameters in local.def, you can build InterViews with the following commands (but read the rest of this section first!): cd iv setenv CPU `make CPU` make World XCONFIGDIR= As the first command shows, you should be in the iv directory (below this README) before starting to build InterViews. The second command assigns the name of your machine's architecture to the environment variable CPU. Saying "make CPU" by itself will print the name that you should assign to CPU (MIPSEL, SUN4, etc.). If you do not set CPU, the Makefiles will not be able to create the appropriate subdirectories in which to put the object code files and you will not be able to build InterViews. The third command builds everything for you. If the X11 config files are not in /usr/lib/X11/config, you must override XCONFIGDIR on the command line as well as set XConfigDir in local.def or "make World" will not work correctly. You may want to redirect the output of "make World" to a file and inspect it later since the build will take more than two hours to complete on a system with the performance of a DECstation 3100 or SPARCstation 1. Once the build concludes, you can find errors in the output quickly by searching for the character ':' (unfortunately, this will not work very well if your C++ compiler driver prints verbose output showing the execution of each phase). * How to install InterViews To install InterViews, say make install in the same directory where you said "make World". This command will create a new subdirectory called installed and install inside this directory everything that you will need to use InterViews. Since "make install" will not try to install anything outside of iv/installed, you can say it without having to become the superuser. The only additional step you may need to take is to create a symbolic link elsewhere that points at iv/installed. If you did not change the definition of InstalledRoot in local.def, then this symbolic link should have the name "/interviews". This link allows InterViews applications to find installed data files at startup time. For example, the application "doc" will not be very functional if it cannot read its menus from /interviews/lib/all/app-defaults/Doc. Once you finish the installation of InterViews, you will no longer need iv/src (the source tree). You can say "make clean" to save disk space by removing all object code files in the source tree. You can even copy iv/installed to another computer and use InterViews on that computer without iv/src having to be present. If you have a symbolic link that points at iv/installed, your PATH can be the same on any computer which contains iv/installed as long as they all have the same name for the symbolic link (like /interviews). * How to use InterViews If /interviews is a symbolic link to iv/installed, you can start using InterViews by putting the following lines in your .cshrc: setenv CPU SUN4 # or MIPSEL or whatever setenv MANPATH $MANPATH:/interviews/man setenv PATH $PATH:/interviews/bin/$CPU Once you have /interviews/bin/$CPU in your PATH, you can use the InterViews script "ivmkmf" to generate Makefiles for your own InterViews applications. You have to write an Imakefile first, but you can do that by copying one of the Imakefiles in iv/src/bin and replacing the filenames with the names of your application's source files. Saying "ivmkmf" will generate a Makefile that contains the appropriate -I and -L flags for using the InterViews includes and libraries when building your application. * How to write an Imakefile The easiest way to write an Imakefile is to start with a copy of a similar Imakefile and modify it. If you use only 3.1 classes, you can copy alert's Imakefile. If you use both 3.1 and 2.6 classes, you can copy doc's Imakefile. If you use only 2.6 classes, you can copy dclock's Imakefile. If you use the Unidraw library, you can copy idraw's Imakefile. Reading the config files to understand how the rules are defined will also help if you need to do anything complicated. Some make variables are reserved for your application's use. You can compile your application with special compiler flags, defines, includes, linker flags, or libraries by setting APP_CCFLAGS, APP_CCDEFINES, APP_CCINCLUDES, APP_CCLDFLAGS, or APP_CCLDLIBS in your Imakefile. You can make your application depend on libraries by setting APP_CCDEPLIBS. You can cause your application to be linked with InterViews libraries bu using one and only one of the macros Use_libInterViews(), Use_libUnidraw(), and Use_libgraphic(). Both libUnidraw and libgraphic depend on libInterViews so saying Use_libUnidraw() or Use_libgraphic() makes saying Use_libInterViews() unnecessary. You cannot say both Use_libUnidraw() and Use_libgraphic() because libUnidraw and libgraphic conflict with each other. All of these macros also add -lXext -lX11 -lm to CCLDLIBS for you. If your application uses classes from the "old" InterViews 2.6, Unidraw, or graphic libraries, you should use the macro Use_2_6() as well as one of the macros Use_libInterViews(), Use_libUnidraw(), or Use_libgraphic(). Many 3.1 classes have the same names as 2.6 classes so the shorter names are reserved for the 3.1 classes and the 2.6 classes' names are prefixed with "iv2_6_". The macro Use_2_6() allows you to use the classes' shorter 2.6 names instead of their real names and their shorter include paths () instead of their real include paths (. If you want to use both 3.1 and 2.6 classes in the same application, you will need to omit Use_2_6() and use the 2.6 classes' real names and include paths. You can use the macro ComplexProgramTarget(dest) to build a program. The parameter specifies the name you want the program to have after it's installed. The make variable $(AOUT), which defaults to "a.out," specifies the name the program will have when it's built. The make variable $(OBJS), which defaults to "*.o," specifies the list of object code files which must be linked together. You don't have to define either $(AOUT) or $(OBJS) in the Imakefile because the generated Makefile will assign default values to them. You don't have to define the list of object files in $(OBJS) because the Imakefile will generate dependencies between the program and its object code files of the form a.out: $(CC) $(OBJS) a.out: a.o a.out: b.o a.out: c.o which is equivalent to the traditional form a.out: a.o b.o c.o $(CC) $(OBJS) You will define these dependencies automatically when you use the macros MakeObjectFromSrc(file) and MakeObjectFromSrcFlags(file, flags) for each source file in the program. Each source file must have its own rule (hence the macro) because the implicit make rule cannot compile source files which are not in the current directory. However, you won't have to specify the name of the source file again in any other place in the Imakefile. You should surround the Imakefile with the following lines, #ifdef InObjectCodeDir #else MakeInObjectCodeDir() #endif so that saying "make Makefiles" will create a subdirectory in which to put the object code files. You do not have to use these lines, but if you do not you will not be able to build optimized, debuggable, and non-shared object code files alongside of each other in separate subdirectories. You also will not be able to build object code files for different machine architectures alongside of each other in separate subdirectories. On the SPARCstation, such object code directories will have the names SUN4, SUN4.debug, and SUN4.noshared (the latter two will be created only if you use a special make command, see below). After you finish writing your Imakefile, saying "ivmkmf" will generate the corresponding Makefile. Then you can say "make Makefiles; make depend; make all" to build your program. If you make a new change to the Imakefile, all you have to do is to say "make Makefile"---you don't have to use "ivmkmf" again. Saying "make Makefiles.debug" and/or "make Makefiles.noshared" will create the special object code subdirectories and saying "make depend.debug", "make depend.noshared", "make all.debug", or "make all.noshared" will build in them just like the normal subdirectories. Note that the Makefile will provide the "make *.noshared" targets only if you're on a computer which has shared libraries (currently we support only SunOS shared libraries). If you write a Makefile by hand instead of writing an Imakefile, you'll have to specify everything that make needs to know. For example, you'll have to specify the -I and -L flags needed to use the InterViews includes and libraries when compiling your application. You'll also have to specify any extra flags that your system may need even though you may have to change them when building on a different system (when you use an Imakefile, the platform-specific X11 .cf file specifies these flags for you so they don't have to be in the Imakefile). neuron-7.6.3/acinclude.m4000077500000000000000000000123741340731477100152470ustar00rootroot00000000000000dnl This was shamelessly stolen from the readline distribution. dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7) AC_DEFUN([BASH_SIGNAL_CHECK], [AC_REQUIRE([AC_TYPE_SIGNAL]) AC_MSG_CHECKING(for type of signal functions) AC_CACHE_VAL(bash_cv_signal_vintage, [ AC_TRY_LINK([#include ],[ sigset_t ss; struct sigaction sa; sigemptyset(&ss); sigsuspend(&ss); sigaction(SIGINT, &sa, (struct sigaction *) 0); sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0); ], bash_cv_signal_vintage=posix, [ AC_TRY_LINK([#include ], [ int mask = sigmask(SIGINT); sigsetmask(mask); sigblock(mask); sigpause(mask); ], bash_cv_signal_vintage=4.2bsd, [ AC_TRY_LINK([ #include RETSIGTYPE foo() { }], [ int mask = sigmask(SIGINT); sigset(SIGINT, foo); sigrelse(SIGINT); sighold(SIGINT); sigpause(SIGINT); ], bash_cv_signal_vintage=svr3, bash_cv_signal_vintage=v7 )] )] ) ]) AC_MSG_RESULT($bash_cv_signal_vintage) if test "$bash_cv_signal_vintage" = posix; then AC_DEFINE(HAVE_POSIX_SIGNALS,,use sigprocmask, etc.) elif test "$bash_cv_signal_vintage" = "4.2bsd"; then AC_DEFINE(HAVE_BSD_SIGNALS,, use sigsetmask, etc.) elif test "$bash_cv_signal_vintage" = svr3; then AC_DEFINE(HAVE_USG_SIGHOLD,, use sigset, sighold, etc.) fi ]) dnl dnl This was stolen from readlin-4.0. dnl dnl AC_DEFUN([BASH_CHECK_LIB_TERMCAP], [ if test "X$bash_cv_termcap_lib" = "X"; then _bash_needmsg=yes else AC_MSG_CHECKING(which library has the termcap functions) _bash_needmsg= fi AC_CACHE_VAL(bash_cv_termcap_lib, [AC_CHECK_LIB(termcap, tgetent, bash_cv_termcap_lib=libtermcap, [AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses, [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses, bash_cv_termcap_lib=gnutermcap)])])]) if test "X$_bash_needmsg" = "Xyes"; then AC_MSG_CHECKING(which library has the termcap functions) fi AC_MSG_RESULT(using $bash_cv_termcap_lib) if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then LDFLAGS="$LDFLAGS -L./lib/termcap" TERMCAP_LIB="./lib/termcap/libtermcap.a" TERMCAP_DEP="./lib/termcap/libtermcap.a" elif test $bash_cv_termcap_lib = libtermcap && test -z "$prefer_curses"; then TERMCAP_LIB=-ltermcap TERMCAP_DEP= elif test $bash_cv_termcap_lib = libncurses; then TERMCAP_LIB=-lncurses TERMCAP_DEP= else TERMCAP_LIB=-lcurses TERMCAP_DEP= fi ]) dnl Stolen from the autoconf archive dnl @synopsis AC_CXX_NAMESPACES dnl dnl If the compiler can prevent names clashes using namespaces, define dnl HAVE_NAMESPACES. dnl dnl @version $Id: acinclude.m4 1403 2005-08-29 12:57:28Z hines $ dnl @author Luc Maisonobe dnl AC_DEFUN([AC_CXX_NAMESPACES], [AC_CACHE_CHECK(whether the compiler implements namespaces, ac_cv_cxx_namespaces, [AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}], [using namespace Outer::Inner; return i;], ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no) AC_LANG_RESTORE ]) if test "$ac_cv_cxx_namespaces" = yes; then AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces]) fi ]) dnl @synopsis AC_CXX_HAVE_STL dnl dnl If the compiler supports the Standard Template Library, define HAVE_STL. dnl dnl @version $Id: acinclude.m4 1403 2005-08-29 12:57:28Z hines $ dnl @author Luc Maisonobe dnl AC_DEFUN([AC_CXX_HAVE_STL], [AC_CACHE_CHECK(whether the compiler supports Standard Template Library, ac_cv_cxx_have_stl, [AC_REQUIRE([AC_CXX_NAMESPACES]) AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([#include #include #ifdef HAVE_NAMESPACES using namespace std; #endif],[list x; x.push_back(5); list::iterator iter = x.begin(); if (iter != x.end()) ++iter; return 0;], ac_cv_cxx_have_stl=yes, ac_cv_cxx_have_stl=no) AC_LANG_RESTORE ]) if test "$ac_cv_cxx_have_stl" = yes; then AC_DEFINE(HAVE_STL,,[define if the compiler supports Standard Template Library]) fi ]) dnl If the C++ library has a working stringstream, define HAVE_SSTREAM dnl Ben Stanley dnl 1.1 (2001/03/16) AC_DEFUN([AC_CXX_HAVE_SSTREAM], [AC_CACHE_CHECK(whether the compiler has stringstream, ac_cv_cxx_have_sstream, [AC_REQUIRE([AC_CXX_NAMESPACES]) AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([#include #ifdef HAVE_NAMESPACES using namespace std; #endif],[stringstream message; message << "Hello"; return 0;], ac_cv_cxx_have_sstream=yes, ac_cv_cxx_have_sstream=no) AC_LANG_RESTORE ]) if test "$ac_cv_cxx_have_sstream" = yes; then AC_DEFINE(HAVE_SSTREAM,,[define if the compiler has stringstream]) fi ]) dnl decide whether to use std::fabs or ::fabs or declare it explicitly AC_DEFUN([NRN_FABS],[ AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([ #include #include #include #define myfabs ::fabs ],[ double d; d = -25.0; d = myfabs(d); return (d == 25.0)?0:1; ], ivos_fabs="::fabs" , ivos_fabs="" ) if test "$ivos_fabs" = "" ; then AC_TRY_COMPILE([ #include #include #include #define myfabs std::fabs ],[ double d; d = -25.0; d = myfabs(d); return (d == 25.0)?0:1; ], ivos_fabs="std::fabs" , ivos_fabs="" ) fi if test "$ivos_fabs" != "" ; then AC_DEFINE_UNQUOTED(IVOS_FABS,$ivos_fabs,[undefined or ::fabs or std::fabs]) fi AC_LANG_RESTORE ])dnl neuron-7.6.3/aclocal.m4000066400000000000000000012062571340731477100147210ustar00rootroot00000000000000# generated automatically by aclocal 1.16.1 -*- Autoconf -*- # Copyright (C) 1996-2018 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool 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 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . ]) # serial 58 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_PREPARE_CC_BASENAME # ----------------------- m4_defun([_LT_PREPARE_CC_BASENAME], [ # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in @S|@*""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } ])# _LT_PREPARE_CC_BASENAME # _LT_CC_BASENAME(CC) # ------------------- # It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, # but that macro is also expanded into generated libtool script, which # arranges for $SED and $ECHO to be set by different means. m4_defun([_LT_CC_BASENAME], [m4_require([_LT_PREPARE_CC_BASENAME])dnl AC_REQUIRE([_LT_DECL_SED])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl func_cc_basename $1 cc_basename=$func_cc_basename_result ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl m4_require([_LT_CMD_TRUNCATE])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from 'configure', and 'config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # 'config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain=$ac_aux_dir/ltmain.sh ])# _LT_PROG_LTMAIN # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the 'libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to 'config.status' so that its # declaration there will have the same value as in 'configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags='_LT_TAGS'dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the 'libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into 'config.status', and then the shell code to quote escape them in # for loops in 'config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # '#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test 0 = "$lt_write_fail" && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ '$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test 0 != $[#] do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try '$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try '$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test yes = "$silent" && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 _LT_COPYING _LT_LIBTOOL_TAGS # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE _LT_PREPARE_MUNGE_PATH_LIST _LT_PREPARE_CC_BASENAME # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS=$save_LDFLAGS ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[[012]][[,.]]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test yes = "$lt_cv_ld_force_load"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" m4_if([$1], [CXX], [ if test yes != "$lt_cv_apple_cc_single_mod"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script that will find a shell with a builtin # printf (that we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case $ECHO in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], [Search for dependent libraries within DIR (or the compiler's sysroot if not specified).])], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([$with_sysroot]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and where our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test yes = "[$]$2"; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS ]) if test yes = "[$]$2"; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n "$lt_cv_sys_max_cmd_len"; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test yes = "$cross_compiling"; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[ lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen=shl_load], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen=dlopen], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld]) ]) ]) ]) ]) ]) ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links=nottested if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test no = "$hard_links"; then AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/", [Define to the sub-directory where libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then # We can hardcode non-existent directories. if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test relink = "$_LT_TAGVAR(hardcode_action, $1)" || test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_PREPARE_MUNGE_PATH_LIST # --------------------------- # Make sure func_munge_path_list() is defined correctly. m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], [[# func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x@S|@2 in x) ;; *:) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" ;; x:*) eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; *::*) eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" ;; *) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; esac } ]])# _LT_PREPARE_PATH_LIST # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown AC_ARG_VAR([LT_SYS_LIBRARY_PATH], [User-defined run-time library search path.]) case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a[(]lib.so.V[)]' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2], [Detected run-time system search path for libraries]) _LT_DECL([], [configure_time_lt_sys_library_path], [2], [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program that can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$1"; then lt_cv_path_MAGIC_CMD=$ac_dir/"$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac]) MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program that can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test no = "$withval" || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], [if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi]) rm -f conftest.i conftest2.i conftest.out]) ])# _LT_PATH_DD # _LT_CMD_TRUNCATE # ---------------- # find command to truncate a binary pipe m4_defun([_LT_CMD_TRUNCATE], [m4_require([_LT_PATH_DD]) AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], [printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) _LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], [Command to truncate a binary pipe]) ])# _LT_CMD_TRUNCATE # _LT_CHECK_MAGIC_METHOD # ---------------------- # how to check for library dependencies # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_MAGIC_METHOD], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) AC_CACHE_CHECK([how to recognize dependent libraries], lt_cv_deplibs_check_method, [lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[[4-9]]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[[45]]*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi]) if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # _LT_DLL_DEF_P([FILE]) # --------------------- # True iff FILE is a Windows DLL '.def' file. # Keep in sync with func_dll_def_p in the libtool script AC_DEFUN([_LT_DLL_DEF_P], [dnl test DEF = "`$SED -n dnl -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl -e q dnl Only consider the first "real" line $1`" dnl ])# _LT_DLL_DEF_P # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw) AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM=-lm) ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test yes = "$GCC"; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1], [Transform the output of nm into a list of symbols to manually relocate]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([nm_interface], [lt_cv_nm_interface], [1], [The name lister interface]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' if test ia64 != "$host_cpu"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64, which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test yes = "$GCC"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS=$save_LDFLAGS]) if test yes = "$lt_cv_irix_exported_symbol"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(ld_shlibs, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; osf3*) if test yes = "$GCC"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test yes = "$GCC"; then wlarc='$wl' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test yes,yes = "$GCC,$enable_shared"; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting $shlibpath_var if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to 'libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC=$CC AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report what library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC=$lt_save_CC ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to 'libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test no != "$CXX" && ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || (test g++ != "$CXX"))); then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_caught_CXX_error"; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test yes = "$GXX"; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test yes = "$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='$wl' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GXX"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag=$shared_flag' $wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. # The "-G" linker flag allows undefined symbols. _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ func_to_tool_file "$lt_outputfile"~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes,no = "$GXX,$with_gnu_ld"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test yes,no = "$GXX,$with_gnu_ld"; then _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(GCC, $1)=$GXX _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test yes != "$_lt_caught_CXX_error" AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case @S|@2 in .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $prev$p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test x-L = "$p" || test x-R = "$p"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test no = "$pre_test_object_deps_done"; then case $prev in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)=$prev$p else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test no = "$pre_test_object_deps_done"; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)=$p else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)=$p else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test no = "$F77"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_disable_F77"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)=$G77 _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test yes != "$_lt_disable_F77" AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test no = "$FC"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_disable_FC"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test yes != "$_lt_disable_FC" AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code=$lt_simple_compile_test_code # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f "$lt_ac_sed" && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test 10 -lt "$lt_ac_count" && break lt_ac_count=`expr $lt_ac_count + 1` if test "$lt_ac_count" -gt "$lt_ac_max"; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine what file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS # Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 8 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option '$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl 'shared' nor 'disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], [_LT_WITH_AIX_SONAME([aix])]) ]) ])# _LT_SET_OPTIONS # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the 'shared' and # 'disable-shared' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the 'static' and # 'disable-static' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the 'fast-install' # and 'disable-fast-install' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_AIX_SONAME([DEFAULT]) # ---------------------------------- # implement the --with-aix-soname flag, and support the `aix-soname=aix' # and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT # is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. m4_define([_LT_WITH_AIX_SONAME], [m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[[5-9]]*,yes) AC_MSG_CHECKING([which variant of shared library versioning to provide]) AC_ARG_WITH([aix-soname], [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], [case $withval in aix|svr4|both) ;; *) AC_MSG_ERROR([Unknown argument to --with-aix-soname]) ;; esac lt_cv_with_aix_soname=$with_aix_soname], [AC_CACHE_VAL([lt_cv_with_aix_soname], [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) with_aix_soname=$lt_cv_with_aix_soname]) AC_MSG_RESULT([$with_aix_soname]) if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac _LT_DECL([], [shared_archive_member_spec], [0], [Shared archive member basename, for filename based shared library versioning on AIX])dnl ])# _LT_WITH_AIX_SONAME LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the 'pic-only' and 'no-pic' # LT_INIT options. # MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac], [pic_mode=m4_default([$1], [default])]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59, which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) # ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 4179 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.6]) m4_define([LT_PACKAGE_REVISION], [2.4.6]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.6' macro_revision='2.4.6' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software # Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) m4_include([acinclude.m4]) neuron-7.6.3/build.sh000077500000000000000000000013211340731477100144770ustar00rootroot00000000000000#!/bin/sh # how to build from just the cvs sources ltarg="-i" if test -f "`which glibtoolize`" ; then ltver=`glibtoolize --version | sed -n '1s/.* \([0-9]\).*/\1/p'` if test "${ltver}" = 1 ; then ltarg="" ; fi echo "glibtoolize -c -f $ltarg" glibtoolize -c -f $ltarg else ltver=`libtoolize --version | sed -n '1s/.* \([0-9]\).*/\1/p'` if test "${ltver}" = 1 ; then ltarg="" ; fi echo "libtoolize -c -f $ltarg" libtoolize -c -f $ltarg fi #fix ltmain for cygwin to allow dlls sed '/undefined on the libtool link/,/allow_undefined/s/allow_undefined=yes/allow_undefined=no/' ltmain.sh > temp mv temp ltmain.sh chmod 755 ltmain.sh aclocal autoheader autoconf #./configure --prefix=`pwd` # make # make install neuron-7.6.3/chkstream.m4000077500000000000000000000033021340731477100152700ustar00rootroot00000000000000dnl make sure we can use the output and input for a stream AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_CXX_NAMESPACES AC_CXX_HAVE_SSTREAM xCXXFLAGS="$CXXFLAGS" if test "$ac_cv_cxx_have_sstream" != yes; then AC_CHECK_HEADERS(stream.h,[xstmt="define HAVE_STREAM_H"],[xstmt="undef HAVE_STREAM_H"]) ystmt="undef NO_OUTPUT_OPENMODE" AC_TRY_COMPILE([ #include "src/include/ivstrm.h" ],[ filebuf obuf; obuf.open("name", IOS_OUT); ],[ echo "ivstream.h works with #${xstmt}" ],[ echo "in ivstream.h, the obuf.open("name", output) does not work with #${xstmt}" echo " trying the NO_OUTPUT_OPENMODE definition" ystmt="define NO_OUTPUT_OPENMODE" CXXFLAGS="$CXXFLAGS -DNO_OUTPUT_OPENMODE" AC_TRY_COMPILE([ #${ystmt} #include "src/include/ivstrm.h" ],[ filebuf obuf; obuf.open("name", IOS_OUT); ],[ echo "ivstream.h works with #${xstmt} and #${ystmt}" AC_DEFINE(NO_OUTPUT_OPENMODE,1,[define if stream.h is isufficient by itself]) ],[ echo "in ivstream.h, obuf.open("name", std::ios_base::out) does not work with #${xstmt}" echo " Fix iv-14/src/include/ivstream.h in such a way that configure" echo " does not stop here." exit 1 ]) ]) fi AC_TRY_LINK([ #${ystmt} #include "src/include/ivstrm.h" #if defined(HAVE_NAMESPACES) using namespace std; #endif ],[ filebuf obuf; obuf.open("name", IOS_OUT); ],[ echo "We are able to link a c++ program that uses streams" ],[ echo "The attempt to link a program with the statment" echo " obuf.open("name", IOS_OUT);" echo "failed. (Although it compiled in an earlier test)." echo 'Perhaps you need to add another library. eg setenv LIBS "-lstdc++".' echo " Fix LIBS or src/include/ivstream.h.in in such a way that configure" echo " does not stop here." exit 1 ]) CXXFLAGS="$xCXXFLAGS" AC_LANG_RESTORE neuron-7.6.3/config.guess000077500000000000000000001236721340731477100153770ustar00rootroot00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2015 Free Software Foundation, Inc. timestamp='2015-01-01' # This file 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 3 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, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` ;; esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/lslpp ] ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: neuron-7.6.3/config.h.in000066400000000000000000000132131340731477100150670ustar00rootroot00000000000000/* config.h.in. Generated from configure.in by autoheader. */ #ifndef H_config_included #define H_config_included 1 /* define if using cygwin */ #undef CYGWIN /* use sigsetmask */ #undef HAVE_BSD_SIGNALS /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ #undef HAVE_DOPRNT /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `getcwd' function. */ #undef HAVE_GETCWD /* Define to 1 if you have the `gethostname' function. */ #undef HAVE_GETHOSTNAME /* Define to 1 if you have the `getpagesize' function. */ #undef HAVE_GETPAGESIZE /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MALLOC_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP /* define if the compiler implements namespaces */ #undef HAVE_NAMESPACES /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_OSFCN_H /* use sigprocmask */ #undef HAVE_POSIX_SIGNALS /* Define to 1 if you have the `regcomp' function. */ #undef HAVE_REGCOMP /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT /* Define to 1 if you have the `socket' function. */ #undef HAVE_SOCKET /* define if the compiler has stringstream */ #undef HAVE_SSTREAM /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strcspn' function. */ #undef HAVE_STRCSPN /* Define to 1 if you have the header file. */ #undef HAVE_STREAM_H /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_STROPTS_H /* Define to 1 if you have the `strtod' function. */ #undef HAVE_STRTOD /* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL /* Define to 1 if you have the header file. */ #undef HAVE_SYS_CONF_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_FILE_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MMAN_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SELECT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if you have the `uname' function. */ #undef HAVE_UNAME /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* use sigset */ #undef HAVE_USG_SIGHOLD /* Define to 1 if you have the `vprintf' function. */ #undef HAVE_VPRINTF /* undefined or ::fabs or std::fabs */ #undef IVOS_FABS /* Define to the sub-directory where libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* define if using mingw */ #undef MINGW /* do we need the prototype for gettimeofday */ #undef NEED_GETTIMEOFDAY_PROTOTYPE /* define if stream.h is isufficient by itself */ #undef NO_OUTPUT_OPENMODE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME /* Define to 1 if the X Window System is missing or not being used. */ #undef X_DISPLAY_MISSING /* Define to `int' if doesn't define. */ #undef gid_t /* Define to `long int' if does not define. */ #undef off_t /* Define to `int' if does not define. */ #undef pid_t /* Define to `unsigned int' if does not define. */ #undef size_t /* Define to `int' if doesn't define. */ #undef uid_t #if defined(__cplusplus) #include #endif #if defined(CYGWIN) || defined(MINGW) #define WIN32 1 #endif #if defined(carbon) #include #endif #endif /* H_config_included */ neuron-7.6.3/config.sub000077500000000000000000001062321340731477100150330ustar00rootroot00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2015 Free Software Foundation, Inc. timestamp='2015-01-01' # This file 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 3 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, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; leon|leon[3-9]) basic_machine=sparc-$basic_machine ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; leon-*|leon[3-9]-*) basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: neuron-7.6.3/configure000077500000000000000000022352221340731477100147630ustar00rootroot00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= PACKAGE_URL= ac_unique_file="src/bin/iclass/classbuffer.cpp" ac_default_prefix=/usr/local/iv # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_header_list= ac_subst_vars='LTLIBOBJS LIBOBJS MINGW_TRUE MINGW_FALSE CYGWIN_TRUE CYGWIN_FALSE X_EXTRA_LIBS X_LIBS X_PRE_LIBS X_CFLAGS XMKMF LIBM CXXCPP CPP LT_SYS_LIBRARY_PATH OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL AWK RANLIB STRIP ac_ct_AR AR DLLTOOL OBJDUMP NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED ac_ct_CC CFLAGS CC LIBTOOL SET_MAKE LN_S INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM OBJEXT EXEEXT ac_ct_CXX CPPFLAGS LDFLAGS CXXFLAGS CXX MINGW_LIBS CARBON_TRUE CARBON_FALSE host_os host_vendor host_cpu host build_os build_vendor build_cpu build VERSION PACKAGE target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_static enable_shared enable_UniversalMacBinary with_pic enable_fast_install with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock with_x ' ac_precious_vars='build_alias host_alias target_alias CXX CXXFLAGS LDFLAGS LIBS CPPFLAGS CCC CC CFLAGS LT_SYS_LIBRARY_PATH CPP CXXCPP XMKMF' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF X features: --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-static[=PKGS] build static libraries [default=no] --enable-shared[=PKGS] build shared libraries [default=yes] --enable-UniversalMacBinary combined binary for ppc and i386, fake arch is called umac --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-aix-soname=aix|svr4|both shared library versioning (aka "SONAME") variant to provide on AIX, [default=aix]. --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --with-x use the X Window System Some influential environment variables: CXX C++ compiler command CXXFLAGS C++ compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CC C compiler command CFLAGS C compiler flags LT_SYS_LIBRARY_PATH User-defined run-time library search path. CPP C preprocessor CXXCPP C++ preprocessor XMKMF Path to xmkmf, Makefile generator for X Window System Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_cxx_try_cpp LINENO # ------------------------ # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_cpp # ac_fn_cxx_try_link LINENO # ------------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_link # ac_fn_cxx_check_header_mongrel LINENO HEADER VAR INCLUDES # --------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_cxx_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_cxx_check_header_mongrel # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi as_fn_append ac_header_list " stdlib.h" as_fn_append ac_header_list " unistd.h" as_fn_append ac_header_list " sys/param.h" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h src/include/ivstream.h" if test "$prefix" = NONE ; then prefix=/usr/local/iv fi mlh_cxxflag="$CXXFLAGS" PACKAGE=iv VERSION=3.2b.hines18 ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac case $host_os in *cygwin* ) CYGWIN=yes;; * ) CYGWIN=no;; esac if test "$CYGWIN" = "yes" ; then MINGW="no" fi case $host_os in mingw*) MINGW="yes" CYGWIN="no" ;; esac echo "CYGWIN=$CYGWIN" echo "MINGW=$MINGW" if test "$enable_carbon" == 'yes' ; then CARBON_FALSE='#' CARBON_TRUE= else CARBON_FALSE= CARBON_TRUE='#' fi MINGW_LIBS="" if test "$CYGWIN" = "yes" ; then # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac else enable_static=no fi # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac else enable_shared=yes fi LIBS="-lgdi32 -lcomdlg32" elif test "$MINGW" = "yes" ; then # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac else enable_static=no fi # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac else enable_shared=yes fi MINGW_LIBS="-lgdi32 -lcomdlg32" else # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac else enable_static=no fi # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac else enable_shared=yes fi fi # Check whether --enable-UniversalMacBinary was given. if test "${enable_UniversalMacBinary+set}" = set; then : enableval=$enable_UniversalMacBinary; CFLAGS="$CFLAGS -arch ppc -arch i386" CXXFLAGS="$CXXFLAGS -arch ppc -arch i386" host_cpu=umac fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 $as_echo "$CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5 $as_echo_n "checking whether the C++ compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C++ compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5 $as_echo_n "checking for C++ compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C++ compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if ${ac_cv_cxx_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } if ${ac_cv_prog_cxx_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes else CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : else ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.6' macro_revision='2.4.6' ltmain=$ac_aux_dir/ltmain.sh # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case $ECHO in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n "$lt_cv_sys_max_cmd_len"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test yes != "$GCC"; then reload_cmds=false fi ;; darwin*) if test yes = "$GCC"; then reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 $as_echo "$with_sysroot" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 $as_echo_n "checking for a working dd... " >&6; } if ${ac_cv_path_lt_DD+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} if test -z "$lt_DD"; then ac_path_lt_DD_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in dd; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_lt_DD" || continue if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi $ac_path_lt_DD_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_lt_DD"; then : fi else ac_cv_path_lt_DD=$lt_DD fi rm -f conftest.i conftest2.i conftest.out fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 $as_echo "$ac_cv_path_lt_DD" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 $as_echo_n "checking how to truncate binary pipes... " >&6; } if ${lt_cv_truncate_bin+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 $as_echo "$lt_cv_truncate_bin" >&6; } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[012][,.]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done func_stripname_cnf () { case $2 in .*) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%\\\\$2\$%%"`;; *) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%$2\$%%"`;; esac } # func_stripname_cnf # Set options enable_dlopen=no enable_win32_dll=no # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac else pic_mode=default fi # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac else enable_fast_install=yes fi shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 $as_echo_n "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. if test "${with_aix_soname+set}" = set; then : withval=$with_aix_soname; case $withval in aix|svr4|both) ;; *) as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 ;; esac lt_cv_with_aix_soname=$with_aix_soname else if ${lt_cv_with_aix_soname+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 $as_echo "$with_aix_soname" >&6; } if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o func_cc_basename $compiler cc_basename=$func_cc_basename_result # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/${ac_tool_prefix}file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC=$CC ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test yes = "$GCC"; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test yes = "$GCC"; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi lt_prog_compiler_pic='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works"; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test yes = "$lt_cv_prog_compiler_static_works"; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test no = "$hard_links"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' export_dynamic_flag_spec='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='$wl--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs=yes ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) export_dynamic_flag_spec='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test no = "$ld_shlibs"; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct=no hardcode_direct_absolute=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' $wl-bernotok' allow_undefined_flag=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test yes = "$GCC"; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test yes = "$lt_cv_prog_compiler__b"; then archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler ld_shlibs=yes archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' else archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='$wl-rpath,$libdir' fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; osf3*) if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test yes = "$GCC"; then wlarc='$wl' archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='$wl-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='$wl-z,text' allow_undefined_flag='$wl-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='$wl-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test no = "$ld_shlibs" && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([A-Za-z]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test yes = "$hardcode_automatic"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && test no != "$hardcode_minus_L"; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test relink = "$hardcode_action" || test yes = "$inherit_rpath"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen=shl_load else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen=dlopen else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld fi fi fi fi fi fi ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test yes = "$cross_compiling"; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test yes = "$cross_compiling"; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report what library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC if test -n "$CXX" && ( test no != "$CXX" && ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || (test g++ != "$CXX"))); then ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 $as_echo_n "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then if ${ac_cv_prog_CXXCPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 $as_echo "$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu else _lt_caught_CXX_error=yes fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu archive_cmds_need_lc_CXX=no allow_undefined_flag_CXX= always_export_symbols_CXX=no archive_expsym_cmds_CXX= compiler_needs_object_CXX=no export_dynamic_flag_spec_CXX= hardcode_direct_CXX=no hardcode_direct_absolute_CXX=no hardcode_libdir_flag_spec_CXX= hardcode_libdir_separator_CXX= hardcode_minus_L_CXX=no hardcode_shlibpath_var_CXX=unsupported hardcode_automatic_CXX=no inherit_rpath_CXX=no module_cmds_CXX= module_expsym_cmds_CXX= link_all_deplibs_CXX=unknown old_archive_cmds_CXX=$old_archive_cmds reload_flag_CXX=$reload_flag reload_cmds_CXX=$reload_cmds no_undefined_flag_CXX= whole_archive_flag_spec_CXX= enable_shared_with_static_runtimes_CXX=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o objext_CXX=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_caught_CXX_error"; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC compiler_CXX=$CC func_cc_basename $compiler cc_basename=$func_cc_basename_result if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test yes = "$GXX"; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test yes = "$GXX"; then # Set up default GNU C++ configuration # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test yes = "$with_gnu_ld"; then archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='$wl' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec_CXX= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } ld_shlibs_CXX=yes case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aix[4-9]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_CXX='' hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes file_list_spec_CXX='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct_CXX=no hardcode_direct_absolute_CXX=no ;; esac if test yes = "$GXX"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct_CXX=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_CXX=yes hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_libdir_separator_CXX= fi esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag=$shared_flag' $wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec_CXX='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. always_export_symbols_CXX=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. # The "-G" linker flag allows undefined symbols. no_undefined_flag_CXX='-bernotok' # Determine the default libpath from the value encoded in an empty # executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__CXX+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec_CXX='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag_CXX="-z nodefs" archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__CXX+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' $wl-bernotok' allow_undefined_flag_CXX=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX='$convenience' fi archive_cmds_need_lc_CXX=yes archive_expsym_cmds_CXX='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$RM -r $output_objdir/$realname.d' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs_CXX=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_CXX=' ' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=yes file_list_spec_CXX='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' enable_shared_with_static_runtimes_CXX=yes # Don't use ranlib old_postinstall_cmds_CXX='chmod 644 $oldlib' postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ func_to_tool_file "$lt_outputfile"~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' export_dynamic_flag_spec_CXX='$wl--export-all-symbols' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_CXX=no fi ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec_CXX='' fi link_all_deplibs_CXX=yes allow_undefined_flag_CXX=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds_CXX="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" module_expsym_cmds_CXX="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" if test yes != "$lt_cv_apple_cc_single_mod"; then archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" archive_expsym_cmds_CXX="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi else ld_shlibs_CXX=no fi ;; os2*) hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_minus_L_CXX=yes allow_undefined_flag_CXX=unsupported shrext_cmds=.dll archive_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds_CXX='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes_CXX=yes ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes ;; haiku*) archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs_CXX=yes ;; hpux9*) hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='$wl-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) ;; *) export_dynamic_flag_spec_CXX='$wl-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; *) hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; interix[3-9]*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' export_dynamic_flag_spec_CXX='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_CXX='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' fi fi link_all_deplibs_CXX=yes ;; esac hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' hardcode_libdir_separator_CXX=: inherit_rpath_CXX=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac archive_cmds_need_lc_CXX=no hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [1-5].* | *pgcpp\ [1-5].*) prelink_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' old_archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='$wl--rpath $wl$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' whole_archive_flag_spec_CXX='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' ;; cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' hardcode_libdir_flag_spec_CXX='-R$libdir' whole_archive_flag_spec_CXX='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object_CXX=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) ld_shlibs_CXX=yes ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no hardcode_direct_absolute_CXX=yes archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' export_dynamic_flag_spec_CXX='$wl-E' whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else ld_shlibs_CXX=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) case $host in osf3*) allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' ;; *) allow_undefined_flag_CXX=' -expect_unresolved \*' archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ $RM $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' ;; esac hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes,no = "$GXX,$with_gnu_ld"; then allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' case $host in osf3*) archive_cmds_CXX='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; *) archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs_CXX=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test yes,no = "$GXX,$with_gnu_ld"; then no_undefined_flag_CXX=' $wl-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. archive_cmds_CXX='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi hardcode_libdir_flag_spec_CXX='$wl-R $wl$libdir' case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) whole_archive_flag_spec_CXX='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_CXX='$wl-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_CXX='$wl-z,text' allow_undefined_flag_CXX='$wl-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='$wl-R,$libdir' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes export_dynamic_flag_spec_CXX='$wl-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ '"$old_archive_cmds_CXX" reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ '"$reload_cmds_CXX" ;; *) archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } test no = "$ld_shlibs_CXX" && can_build_shared=no GCC_CXX=$GXX LD_CXX=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... # Dependencies to place before and after the object being linked: predep_objects_CXX= postdep_objects_CXX= predeps_CXX= postdeps_CXX= compiler_lib_search_path_CXX= cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $prev$p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test x-L = "$p" || test x-R = "$p"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test no = "$pre_test_object_deps_done"; then case $prev in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_CXX"; then compiler_lib_search_path_CXX=$prev$p else compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} $prev$p" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$postdeps_CXX"; then postdeps_CXX=$prev$p else postdeps_CXX="${postdeps_CXX} $prev$p" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test no = "$pre_test_object_deps_done"; then if test -z "$predep_objects_CXX"; then predep_objects_CXX=$p else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then postdep_objects_CXX=$p else postdep_objects_CXX="$postdep_objects_CXX $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling CXX test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken case $host_os in interix[3-9]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= postdep_objects_CXX= postdeps_CXX= ;; esac case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac compiler_lib_search_dirs_CXX= if test -n "${compiler_lib_search_path_CXX}"; then compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | $SED -e 's! -L! !g' -e 's!^ !!'` fi lt_prog_compiler_wl_CXX= lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= # C++ specific cases for pic, static, wl, etc. if test yes = "$GXX"; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi lt_prog_compiler_pic_CXX='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic_CXX='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic_CXX='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static_CXX='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_CXX='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static_CXX= ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_CXX=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac else case $host_os in aix[4-9]*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; dgux*) case $cc_basename in ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='$wl-a ${wl}archive' if test ia64 != "$host_cpu"; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='$wl-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64, which still supported -KPIC. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fPIC' lt_prog_compiler_static_CXX='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) # IBM XL 8.0, 9.0 on PPC and BlueGene lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-qpic' lt_prog_compiler_static_CXX='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) lt_prog_compiler_can_build_shared_CXX=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; *) lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 $as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; } lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works_CXX=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works_CXX"; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; esac else lt_prog_compiler_pic_CXX= lt_prog_compiler_can_build_shared_CXX=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works_CXX=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works_CXX=yes fi else lt_cv_prog_compiler_static_works_CXX=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; } if test yes = "$lt_cv_prog_compiler_static_works_CXX"; then : else lt_prog_compiler_static_CXX= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o_CXX" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test no = "$hard_links"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' case $host_os in aix[4-9]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) export_symbols_cmds_CXX=$ltdll_cmds ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' ;; esac ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } test no = "$ld_shlibs_CXX" && can_build_shared=no with_gnu_ld_CXX=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_CXX" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds_CXX in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_CXX pic_flag=$lt_prog_compiler_pic_CXX compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_CXX allow_undefined_flag_CXX= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc_CXX=no else lt_cv_archive_cmds_need_lc_CXX=yes fi allow_undefined_flag_CXX=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 $as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; } archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec_CXX='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || test -n "$runpath_var_CXX" || test yes = "$hardcode_automatic_CXX"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct_CXX" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" && test no != "$hardcode_minus_L_CXX"; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_CXX=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_CXX=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 $as_echo "$hardcode_action_CXX" >&6; } if test relink = "$hardcode_action_CXX" || test yes = "$inherit_rpath_CXX"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test yes != "$_lt_caught_CXX_error" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_commands="$ac_config_commands libtool" # Only expand once: LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mwvalidcheckl in -lmw" >&5 $as_echo_n "checking for _mwvalidcheckl in -lmw... " >&6; } if ${ac_cv_lib_mw__mwvalidcheckl+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lmw $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char _mwvalidcheckl (); int main () { return _mwvalidcheckl (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_mw__mwvalidcheckl=yes else ac_cv_lib_mw__mwvalidcheckl=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mw__mwvalidcheckl" >&5 $as_echo "$ac_cv_lib_mw__mwvalidcheckl" >&6; } if test "x$ac_cv_lib_mw__mwvalidcheckl" = xyes; then : LIBM=-lmw fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5 $as_echo_n "checking for cos in -lm... " >&6; } if ${ac_cv_lib_m_cos+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char cos (); int main () { return cos (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_m_cos=yes else ac_cv_lib_m_cos=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5 $as_echo "$ac_cv_lib_m_cos" >&6; } if test "x$ac_cv_lib_m_cos" = xyes; then : LIBM="$LIBM -lm" fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5 $as_echo_n "checking for cos in -lm... " >&6; } if ${ac_cv_lib_m_cos+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char cos (); int main () { return cos (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_m_cos=yes else ac_cv_lib_m_cos=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5 $as_echo "$ac_cv_lib_m_cos" >&6; } if test "x$ac_cv_lib_m_cos" = xyes; then : LIBM=-lm fi ;; esac LIBS="$LIBS $LIBM" ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler implements namespaces" >&5 $as_echo_n "checking whether the compiler implements namespaces... " >&6; } if ${ac_cv_cxx_namespaces+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ namespace Outer { namespace Inner { int i = 0; }} int main () { using namespace Outer::Inner; return i; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_cxx_namespaces=yes else ac_cv_cxx_namespaces=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_namespaces" >&5 $as_echo "$ac_cv_cxx_namespaces" >&6; } if test "$ac_cv_cxx_namespaces" = yes; then $as_echo "#define HAVE_NAMESPACES /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler has stringstream" >&5 $as_echo_n "checking whether the compiler has stringstream... " >&6; } if ${ac_cv_cxx_have_sstream+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifdef HAVE_NAMESPACES using namespace std; #endif int main () { stringstream message; message << "Hello"; return 0; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_cxx_have_sstream=yes else ac_cv_cxx_have_sstream=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_have_sstream" >&5 $as_echo "$ac_cv_cxx_have_sstream" >&6; } if test "$ac_cv_cxx_have_sstream" = yes; then $as_echo "#define HAVE_SSTREAM /**/" >>confdefs.h fi xCXXFLAGS="$CXXFLAGS" if test "$ac_cv_cxx_have_sstream" != yes; then for ac_header in stream.h do : ac_fn_cxx_check_header_mongrel "$LINENO" "stream.h" "ac_cv_header_stream_h" "$ac_includes_default" if test "x$ac_cv_header_stream_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STREAM_H 1 _ACEOF xstmt="define HAVE_STREAM_H" else xstmt="undef HAVE_STREAM_H" fi done ystmt="undef NO_OUTPUT_OPENMODE" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "src/include/ivstrm.h" int main () { filebuf obuf; obuf.open("name", IOS_OUT); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : echo "ivstream.h works with #${xstmt}" else echo "in ivstream.h, the obuf.open("name", output) does not work with #${xstmt}" echo " trying the NO_OUTPUT_OPENMODE definition" ystmt="define NO_OUTPUT_OPENMODE" CXXFLAGS="$CXXFLAGS -DNO_OUTPUT_OPENMODE" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #${ystmt} #include "src/include/ivstrm.h" int main () { filebuf obuf; obuf.open("name", IOS_OUT); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : echo "ivstream.h works with #${xstmt} and #${ystmt}" $as_echo "#define NO_OUTPUT_OPENMODE 1" >>confdefs.h else echo "in ivstream.h, obuf.open("name", std::ios_base::out) does not work with #${xstmt}" echo " Fix iv-14/src/include/ivstream.h in such a way that configure" echo " does not stop here." exit 1 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #${ystmt} #include "src/include/ivstrm.h" #if defined(HAVE_NAMESPACES) using namespace std; #endif int main () { filebuf obuf; obuf.open("name", IOS_OUT); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : echo "We are able to link a c++ program that uses streams" else echo "The attempt to link a program with the statment" echo " obuf.open("name", IOS_OUT);" echo "failed. (Although it compiled in an earlier test)." echo 'Perhaps you need to add another library. eg setenv LIBS "-lstdc++".' echo " Fix LIBS or src/include/ivstream.h.in in such a way that configure" echo " does not stop here." exit 1 fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CXXFLAGS="$xCXXFLAGS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } if eval \${$as_ac_Header+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include <$ac_hdr> int main () { if ((DIR *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_ac_Header=yes" else eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$as_ac_Header { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF ac_header_dirent=$ac_hdr; break fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } if ${ac_cv_search_opendir+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' dir; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_opendir=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_opendir+:} false; then : break fi done if ${ac_cv_search_opendir+:} false; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 $as_echo "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } if ${ac_cv_search_opendir+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' x; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_opendir=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_opendir+:} false; then : break fi done if ${ac_cv_search_opendir+:} false; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 $as_echo "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 $as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } if ${ac_cv_header_sys_wait_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main () { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_sys_wait_h=yes else ac_cv_header_sys_wait_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 $as_echo "$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi for ac_header in fcntl.h malloc.h sys/file.h sys/ioctl.h sys/time.h unistd.h osfcn.h sys/select.h sys/stat.h sys/mman.h stropts.h sys/conf.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$CYGWIN" = "yes" ; then echo " CYGWIN defined so make MSWwin version" build_cygwin=yes elif test "$MINGW" = "yes" ; then echo " MINGW defined so make MSWwin version" build_mingw=yes elif test "$enable_carbon" != "yes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5 $as_echo_n "checking for X... " >&6; } # Check whether --with-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 case $x_includes,$x_libraries in #( *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #( *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then : $as_echo_n "(cached) " >&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 -f -r conftest.dir if mkdir conftest.dir; then cd conftest.dir cat >Imakefile <<'_ACEOF' incroot: @echo incroot='${INCROOT}' usrlibdir: @echo usrlibdir='${USRLIBDIR}' libdir: @echo libdir='${LIBDIR}' _ACEOF if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. for ac_var in incroot usrlibdir libdir; do eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" done # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl dylib la dll; 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) ac_x_includes= ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac case $ac_im_usrlibdir in /usr/lib | /usr/lib64 | /lib | /lib64) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi cd .. rm -f -r conftest.dir fi # Standard set of common directories for X headers. # Check X11 before X11Rn because it is often a symlink to the current release. ac_x_header_dirs=' /usr/X11/include /usr/X11R7/include /usr/X11R6/include /usr/X11R5/include /usr/X11R4/include /usr/include/X11 /usr/include/X11R7 /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 /usr/local/X11/include /usr/local/X11R7/include /usr/local/X11R6/include /usr/local/X11R5/include /usr/local/X11R4/include /usr/local/include/X11 /usr/local/include/X11R7 /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' if test "$ac_x_includes" = no; then # Guess where to find include files, by looking for Xlib.h. # First, try using that file with no special directory specified. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # We can compile using X headers with no special include directory. ac_x_includes= else for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Xlib.h"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest.err conftest.i conftest.$ac_ext fi # $ac_x_includes = no if test "$ac_x_libraries" = no; then # Check for the libraries. # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS=$LIBS LIBS="-lX11 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { XrmInitialize () ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= else LIBS=$ac_save_LIBS for ac_dir in `$as_echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl dylib la dll; do if test -r "$ac_dir/libX11.$ac_extension"; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no case $ac_x_includes,$ac_x_libraries in #( no,* | *,no | *\'*) # Didn't find X, or a directory has "'" in its name. ac_cv_have_x="have_x=no";; #( *) # 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'" esac fi ;; #( *) have_x=yes;; esac eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5 $as_echo "$have_x" >&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'" { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5 $as_echo "libraries $x_libraries, headers $x_includes" >&6; } fi if test "$no_x" = yes; then # Not all programs may use this symbol, but it does not hurt to define it. $as_echo "#define X_DISPLAY_MISSING 1" >>confdefs.h 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 . . . . { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -R must be followed by a space" >&5 $as_echo_n "checking whether -R must be followed by a space... " >&6; } ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" ac_xsave_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } X_LIBS="$X_LIBS -R$x_libraries" else LIBS="$ac_xsave_LIBS -R $x_libraries" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } X_LIBS="$X_LIBS -R $x_libraries" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: neither works" >&5 $as_echo "neither works" >&6; } fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_c_werror_flag=$ac_xsave_c_werror_flag LIBS=$ac_xsave_LIBS 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 says this is needed for Ultrix, if the X # libraries were built with DECnet support. And Karl Berry says # the Alpha needs dnet_stub (dnet does not exist). ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char XOpenDisplay (); int main () { return XOpenDisplay (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet" >&5 $as_echo_n "checking for dnet_ntoa in -ldnet... " >&6; } if ${ac_cv_lib_dnet_dnet_ntoa+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dnet_ntoa (); int main () { return dnet_ntoa (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dnet_dnet_ntoa=yes else ac_cv_lib_dnet_dnet_ntoa=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 $as_echo "$ac_cv_lib_dnet_dnet_ntoa" >&6; } if test "x$ac_cv_lib_dnet_dnet_ntoa" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet_stub" >&5 $as_echo_n "checking for dnet_ntoa in -ldnet_stub... " >&6; } if ${ac_cv_lib_dnet_stub_dnet_ntoa+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet_stub $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dnet_ntoa (); int main () { return dnet_ntoa (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dnet_stub_dnet_ntoa=yes else ac_cv_lib_dnet_stub_dnet_ntoa=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 $as_echo "$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; } if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" fi fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_xsave_LIBS" # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, # to get the SysV transport functions. # Chad R. Larson 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 T.E. Dickey. # The functions gethostbyname, getservbyname, and inet_addr are # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" if test "x$ac_cv_func_gethostbyname" = xyes; then : fi if test $ac_cv_func_gethostbyname = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 $as_echo_n "checking for gethostbyname in -lnsl... " >&6; } if ${ac_cv_lib_nsl_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_nsl_gethostbyname=yes else ac_cv_lib_nsl_gethostbyname=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 $as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" fi if test $ac_cv_lib_nsl_gethostbyname = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lbsd" >&5 $as_echo_n "checking for gethostbyname in -lbsd... " >&6; } if ${ac_cv_lib_bsd_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_bsd_gethostbyname=yes else ac_cv_lib_bsd_gethostbyname=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_gethostbyname" >&5 $as_echo "$ac_cv_lib_bsd_gethostbyname" >&6; } if test "x$ac_cv_lib_bsd_gethostbyname" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" fi 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 Leinen: it contains gethostby* # variants that don't use the name server (or something). -lsocket # must be given before -lnsl if both are needed. We assume that # if connect needs -lnsl, so does gethostbyname. ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect" if test "x$ac_cv_func_connect" = xyes; then : fi if test $ac_cv_func_connect = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5 $as_echo_n "checking for connect in -lsocket... " >&6; } if ${ac_cv_lib_socket_connect+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char connect (); int main () { return connect (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_socket_connect=yes else ac_cv_lib_socket_connect=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5 $as_echo "$ac_cv_lib_socket_connect" >&6; } if test "x$ac_cv_lib_socket_connect" = xyes; then : X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" fi fi # Guillermo Gomez says -lposix is necessary on A/UX. ac_fn_c_check_func "$LINENO" "remove" "ac_cv_func_remove" if test "x$ac_cv_func_remove" = xyes; then : fi if test $ac_cv_func_remove = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for remove in -lposix" >&5 $as_echo_n "checking for remove in -lposix... " >&6; } if ${ac_cv_lib_posix_remove+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lposix $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char remove (); int main () { return remove (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_posix_remove=yes else ac_cv_lib_posix_remove=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix_remove" >&5 $as_echo "$ac_cv_lib_posix_remove" >&6; } if test "x$ac_cv_lib_posix_remove" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" fi fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. ac_fn_c_check_func "$LINENO" "shmat" "ac_cv_func_shmat" if test "x$ac_cv_func_shmat" = xyes; then : fi if test $ac_cv_func_shmat = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shmat in -lipc" >&5 $as_echo_n "checking for shmat in -lipc... " >&6; } if ${ac_cv_lib_ipc_shmat+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lipc $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shmat (); int main () { return shmat (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ipc_shmat=yes else ac_cv_lib_ipc_shmat=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ipc_shmat" >&5 $as_echo "$ac_cv_lib_ipc_shmat" >&6; } if test "x$ac_cv_lib_ipc_shmat" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" 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. # John Interrante, Karl Berry { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IceConnectionNumber in -lICE" >&5 $as_echo_n "checking for IceConnectionNumber in -lICE... " >&6; } if ${ac_cv_lib_ICE_IceConnectionNumber+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char IceConnectionNumber (); int main () { return IceConnectionNumber (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ICE_IceConnectionNumber=yes else ac_cv_lib_ICE_IceConnectionNumber=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 $as_echo "$ac_cv_lib_ICE_IceConnectionNumber" >&6; } if test "x$ac_cv_lib_ICE_IceConnectionNumber" = xyes; then : X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" fi LDFLAGS=$ac_save_LDFLAGS fi if test "$no_x" = "yes" ; then as_fn_error $? "cannot find X11" "$LINENO" 5 fi fi if test x$build_cygwin = xyes ; then CYGWIN_FALSE='#' CYGWIN_TRUE= $as_echo "#define CYGWIN /**/" >>confdefs.h else CYGWIN_FALSE= CYGWIN_TRUE='#' fi if test x$build_mingw = xyes ; then MINGW_FALSE='#' MINGW_TRUE= $as_echo "#define MINGW /**/" >>confdefs.h else MINGW_FALSE= MINGW_TRUE='#' fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #define myfabs ::fabs int main () { double d; d = -25.0; d = myfabs(d); return (d == 25.0)?0:1; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ivos_fabs="::fabs" else ivos_fabs="" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test "$ivos_fabs" = "" ; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #define myfabs std::fabs int main () { double d; d = -25.0; d = myfabs(d); return (d == 25.0)?0:1; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ivos_fabs="std::fabs" else ivos_fabs="" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "$ivos_fabs" != "" ; then cat >>confdefs.h <<_ACEOF #define IVOS_FABS $ivos_fabs _ACEOF fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" if test "x$ac_cv_type_off_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define off_t long int _ACEOF fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" if test "x$ac_cv_type_pid_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if ${ac_cv_header_time+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else ac_cv_header_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 $as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } if ${ac_cv_struct_tm+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { struct tm tm; int *p = &tm.tm_sec; return !p; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_struct_tm=time.h else ac_cv_struct_tm=sys/time.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5 $as_echo "$ac_cv_struct_tm" >&6; } if test $ac_cv_struct_tm = sys/time.h; then $as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 $as_echo_n "checking for uid_t in sys/types.h... " >&6; } if ${ac_cv_type_uid_t+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "uid_t" >/dev/null 2>&1; then : ac_cv_type_uid_t=yes else ac_cv_type_uid_t=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 $as_echo "$ac_cv_type_uid_t" >&6; } if test $ac_cv_type_uid_t = no; then $as_echo "#define uid_t int" >>confdefs.h $as_echo "#define gid_t int" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 $as_echo_n "checking for working memcmp... " >&6; } if ${ac_cv_func_memcmp_working+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_memcmp_working=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Some versions of memcmp are not 8-bit clean. */ char c0 = '\100', c1 = '\200', c2 = '\201'; if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) return 1; /* The Next x86 OpenStep bug shows up only when comparing 16 bytes or more and with at least one buffer not starting on a 4-byte boundary. William Lewis provided this test program. */ { char foo[21]; char bar[21]; int i; for (i = 0; i < 4; i++) { char *a = foo + i; char *b = bar + i; strcpy (a, "--------01111111"); strcpy (b, "--------10000000"); if (memcmp (a, b, 16) >= 0) return 1; } return 0; } ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_memcmp_working=yes else ac_cv_func_memcmp_working=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5 $as_echo "$ac_cv_func_memcmp_working" >&6; } test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in *" memcmp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;; esac for ac_header in $ac_header_list do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in getpagesize do : ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize" if test "x$ac_cv_func_getpagesize" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETPAGESIZE 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5 $as_echo_n "checking for working mmap... " >&6; } if ${ac_cv_func_mmap_fixed_mapped+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_mmap_fixed_mapped=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default /* malloc might have been renamed as rpl_malloc. */ #undef malloc /* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: mmap private not fixed mmap private fixed at somewhere currently unmapped mmap private fixed at somewhere already mapped mmap shared not fixed mmap shared fixed at somewhere currently unmapped mmap shared fixed at somewhere already mapped For private mappings, we should verify that changes cannot be read() back from the file, nor mmap's back from the file at a different address. (There have been systems where private was not correctly implemented like the infamous i386 svr4.0, and systems where the VM page cache was not coherent with the file system buffer cache like early versions of FreeBSD and possibly contemporary NetBSD.) For shared mappings, we should conversely verify that changes get propagated back to all the places they're supposed to be. Grep wants private fixed already mapped. The main things grep needs to know about mmap are: * does it exist and is it safe to write into the mmap'd area * how to use it (BSD variants) */ #include #include #if !defined STDC_HEADERS && !defined HAVE_STDLIB_H char *malloc (); #endif /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE # ifdef _SC_PAGESIZE # define getpagesize() sysconf(_SC_PAGESIZE) # else /* no _SC_PAGESIZE */ # ifdef HAVE_SYS_PARAM_H # include # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE # else /* no EXEC_PAGESIZE */ # ifdef NBPG # define getpagesize() NBPG * CLSIZE # ifndef CLSIZE # define CLSIZE 1 # endif /* no CLSIZE */ # else /* no NBPG */ # ifdef NBPC # define getpagesize() NBPC # else /* no NBPC */ # ifdef PAGESIZE # define getpagesize() PAGESIZE # endif /* PAGESIZE */ # endif /* no NBPC */ # endif /* no NBPG */ # endif /* no EXEC_PAGESIZE */ # else /* no HAVE_SYS_PARAM_H */ # define getpagesize() 8192 /* punt totally */ # endif /* no HAVE_SYS_PARAM_H */ # endif /* no _SC_PAGESIZE */ #endif /* no HAVE_GETPAGESIZE */ int main () { char *data, *data2, *data3; const char *cdata2; int i, pagesize; int fd, fd2; pagesize = getpagesize (); /* First, make a file with some known garbage in it. */ data = (char *) malloc (pagesize); if (!data) return 1; for (i = 0; i < pagesize; ++i) *(data + i) = rand (); umask (0); fd = creat ("conftest.mmap", 0600); if (fd < 0) return 2; if (write (fd, data, pagesize) != pagesize) return 3; close (fd); /* Next, check that the tail of a page is zero-filled. File must have non-zero length, otherwise we risk SIGBUS for entire page. */ fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600); if (fd2 < 0) return 4; cdata2 = ""; if (write (fd2, cdata2, 1) != 1) return 5; data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L); if (data2 == MAP_FAILED) return 6; for (i = 0; i < pagesize; ++i) if (*(data2 + i)) return 7; close (fd2); if (munmap (data2, pagesize)) return 8; /* Next, try to mmap the file at a fixed address which already has something else allocated at it. If we can, also make sure that we see the same garbage. */ fd = open ("conftest.mmap", O_RDWR); if (fd < 0) return 9; if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, fd, 0L)) return 10; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data2 + i)) return 11; /* Finally, make sure that changes to the mapped area do not percolate back to the file as seen by read(). (This is a bug on some variants of i386 svr4.0.) */ for (i = 0; i < pagesize; ++i) *(data2 + i) = *(data2 + i) + 1; data3 = (char *) malloc (pagesize); if (!data3) return 12; if (read (fd, data3, pagesize) != pagesize) return 13; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data3 + i)) return 14; close (fd); return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_mmap_fixed_mapped=yes else ac_cv_func_mmap_fixed_mapped=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_fixed_mapped" >&5 $as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; } if test $ac_cv_func_mmap_fixed_mapped = yes; then $as_echo "#define HAVE_MMAP 1" >>confdefs.h fi rm -f conftest.mmap conftest.txt { $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 $as_echo_n "checking return type of signal handlers... " >&6; } if ${ac_cv_type_signal+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { return *(signal (0, 0)) (0) == 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_type_signal=int else ac_cv_type_signal=void fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 $as_echo "$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF for ac_func in vprintf do : ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf" if test "x$ac_cv_func_vprintf" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VPRINTF 1 _ACEOF ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt" if test "x$ac_cv_func__doprnt" = xyes; then : $as_echo "#define HAVE_DOPRNT 1" >>confdefs.h fi fi done for ac_func in getcwd gethostname gettimeofday regcomp select socket strcspn strerror strtod strtol uname do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for prototype for gettimeofday" >&5 $as_echo_n "checking for prototype for gettimeofday... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif int main () { struct timeval curtime; gettimeofday(&curtime, 0); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 $as_echo "found" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 $as_echo "not found" >&6; } $as_echo "#define NEED_GETTIMEOFDAY_PROTOTYPE /**/" >>confdefs.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type of signal functions" >&5 $as_echo_n "checking for type of signal functions... " >&6; } if ${bash_cv_signal_vintage+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { sigset_t ss; struct sigaction sa; sigemptyset(&ss); sigsuspend(&ss); sigaction(SIGINT, &sa, (struct sigaction *) 0); sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : bash_cv_signal_vintage=posix else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { int mask = sigmask(SIGINT); sigsetmask(mask); sigblock(mask); sigpause(mask); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : bash_cv_signal_vintage=4.2bsd else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include RETSIGTYPE foo() { } int main () { int mask = sigmask(SIGINT); sigset(SIGINT, foo); sigrelse(SIGINT); sighold(SIGINT); sigpause(SIGINT); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : bash_cv_signal_vintage=svr3 else bash_cv_signal_vintage=v7 fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_signal_vintage" >&5 $as_echo "$bash_cv_signal_vintage" >&6; } if test "$bash_cv_signal_vintage" = posix; then $as_echo "#define HAVE_POSIX_SIGNALS /**/" >>confdefs.h elif test "$bash_cv_signal_vintage" = "4.2bsd"; then $as_echo "#define HAVE_BSD_SIGNALS /**/" >>confdefs.h elif test "$bash_cv_signal_vintage" = svr3; then $as_echo "#define HAVE_USG_SIGHOLD /**/" >>confdefs.h fi if test -z "$mlh_cxxflag" ; then if test "$GXX"='yes' ; then zzz="`$CXX -v 2>&1 | sed -n '2s/ /_/gp'`" case "$zzz" in *version_2.8.1 ) echo "Compiling deck2_6.cpp and xfont.cpp will fail with an internal error" echo "because of a g++-2.8.1 optimization bug. Setting CXXFLAGS=-g" CXXFLAGS=-g ;; esac fi fi case "$exec_prefix" in NONE*) exec_prefix="${prefix}/${host_cpu}" ;; esac ac_config_files="$ac_config_files Makefile src/Makefile src/bin/Makefile src/bin/idemo/Makefile src/bin/idraw/Makefile src/bin/iclass/Makefile src/include/Makefile src/lib/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_import \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ lt_cv_nm_interface \ nm_file_list_spec \ lt_cv_truncate_bin \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib \ compiler_lib_search_dirs \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ LD_CXX \ reload_flag_CXX \ compiler_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_wl_CXX \ lt_prog_compiler_static_CXX \ lt_cv_prog_compiler_c_o_CXX \ export_dynamic_flag_spec_CXX \ whole_archive_flag_spec_CXX \ compiler_needs_object_CXX \ with_gnu_ld_CXX \ allow_undefined_flag_CXX \ no_undefined_flag_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_separator_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX \ file_list_spec_CXX \ compiler_lib_search_dirs_CXX \ predep_objects_CXX \ postdep_objects_CXX \ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ configure_time_dlsearch_path \ configure_time_lt_sys_library_path \ reload_cmds_CXX \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ old_archive_from_expsyms_cmds_CXX \ archive_cmds_CXX \ archive_expsym_cmds_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ export_symbols_cmds_CXX \ prelink_cmds_CXX \ postlink_cmds_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "src/include/ivstream.h") CONFIG_HEADERS="$CONFIG_HEADERS src/include/ivstream.h" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/bin/Makefile") CONFIG_FILES="$CONFIG_FILES src/bin/Makefile" ;; "src/bin/idemo/Makefile") CONFIG_FILES="$CONFIG_FILES src/bin/idemo/Makefile" ;; "src/bin/idraw/Makefile") CONFIG_FILES="$CONFIG_FILES src/bin/idraw/Makefile" ;; "src/bin/iclass/Makefile") CONFIG_FILES="$CONFIG_FILES src/bin/iclass/Makefile" ;; "src/include/Makefile") CONFIG_FILES="$CONFIG_FILES src/include/Makefile" ;; "src/lib/Makefile") CONFIG_FILES="$CONFIG_FILES src/lib/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "libtool":C) # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool 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 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # The names of the tagged configurations supported by this script. available_tags='CXX ' # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shared archive member basename,for filename based shared library versioning on AIX. shared_archive_member_spec=$shared_archive_member_spec # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm into a list of symbols to manually relocate. global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # The name lister interface. nm_interface=$lt_lt_cv_nm_interface # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and where our libraries should be installed. lt_sysroot=$lt_sysroot # Command to truncate a binary pipe. lt_truncate_bin=$lt_lt_cv_truncate_bin # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Detected run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path # Explicit LT_SYS_LIBRARY_PATH set during ./configure time. configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects postdep_objects=$lt_postdep_objects predeps=$lt_predeps postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain=$ac_aux_dir/ltmain.sh # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" cat <<_LT_EOF >> "$ofile" # ### BEGIN LIBTOOL TAG CONFIG: CXX # The linker used to build libraries. LD=$lt_LD_CXX # How to create reloadable object files. reload_flag=$lt_reload_flag_CXX reload_cmds=$lt_reload_cmds_CXX # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds_CXX # A language specific compiler. CC=$lt_compiler_CXX # Is the compiler the GNU compiler? with_gcc=$GCC_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_CXX # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_CXX # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object_CXX # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds_CXX archive_expsym_cmds=$lt_archive_expsym_cmds_CXX # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds_CXX module_expsym_cmds=$lt_module_expsym_cmds_CXX # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld_CXX # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_CXX # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_CXX # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct_CXX # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute_CXX # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L_CXX # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic_CXX # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath_CXX # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols_CXX # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_CXX # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_CXX # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_CXX # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds_CXX # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds_CXX # Specify filename containing input files. file_list_spec=$lt_file_list_spec_CXX # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_CXX # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects_CXX postdep_objects=$lt_postdep_objects_CXX predeps=$lt_predeps_CXX postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # ### END LIBTOOL TAG CONFIG: CXX _LT_EOF ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi neuron-7.6.3/configure.in000077500000000000000000000107201340731477100153600ustar00rootroot00000000000000dnl Process this file with autoconf to produce a configure script. AC_INIT(src/bin/iclass/classbuffer.cpp) dnl some random source file. AC_CONFIG_HEADER(config.h src/include/ivstream.h) AH_TOP([ #ifndef H_config_included #define H_config_included 1 ]) AH_BOTTOM([ #if defined(__cplusplus) #include #endif #if defined(CYGWIN) || defined(MINGW) #define WIN32 1 #endif #if defined(carbon) #include #endif #endif /* H_config_included */ ]) dnl following does not seem to work in the sense of dnl causing problems with exec_prefix AC_PREFIX_DEFAULT(/usr/local/iv) dnl so do it explicitly if test "$prefix" = NONE ; then prefix=/usr/local/iv fi dnl This does the useful stuff from AM_INIT_AUTOMAKE, which we don't include dnl because I couldn't get automake to work properly. mlh_cxxflag="$CXXFLAGS" PACKAGE=iv VERSION=3.2b.hines18 AC_SUBST(PACKAGE) AC_SUBST(VERSION) AC_CYGWIN if test "$CYGWIN" = "yes" ; then MINGW="no" fi case $host_os in mingw*) MINGW="yes" CYGWIN="no" ;; esac echo "CYGWIN=$CYGWIN" echo "MINGW=$MINGW" if test "$enable_carbon" == 'yes' ; then CARBON_FALSE='#' CARBON_TRUE= else CARBON_FALSE= CARBON_TRUE='#' fi AC_SUBST(CARBON_FALSE) AC_SUBST(CARBON_TRUE) dnl Don't bother building static libraries if we can avoid it. MINGW_LIBS="" if test "$CYGWIN" = "yes" ; then AC_DISABLE_STATIC AC_ENABLE_SHARED LIBS="-lgdi32 -lcomdlg32" elif test "$MINGW" = "yes" ; then AC_DISABLE_STATIC AC_ENABLE_SHARED MINGW_LIBS="-lgdi32 -lcomdlg32" else AC_DISABLE_STATIC AC_ENABLE_SHARED fi AC_SUBST(MINGW_LIBS) AC_ARG_ENABLE([UniversalMacBinary], AC_HELP_STRING([--enable-UniversalMacBinary], [combined binary for ppc and i386, fake arch is called umac]),[ CFLAGS="$CFLAGS -arch ppc -arch i386" CXXFLAGS="$CXXFLAGS -arch ppc -arch i386" host_cpu=umac ]) dnl Checks for programs. AC_PROG_CXX AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_LIBTOOL dnl Checks for libraries. AC_CHECK_LIBM LIBS="$LIBS $LIBM" sinclude(./chkstream.m4) dnl Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(fcntl.h malloc.h sys/file.h sys/ioctl.h sys/time.h unistd.h osfcn.h sys/select.h sys/stat.h sys/mman.h stropts.h sys/conf.h) if test "$CYGWIN" = "yes" ; then echo " CYGWIN defined so make MSWwin version" build_cygwin=yes elif test "$MINGW" = "yes" ; then echo " MINGW defined so make MSWwin version" build_mingw=yes elif test "$enable_carbon" != "yes" ; then AC_PATH_XTRA if test "$no_x" = "yes" ; then AC_MSG_ERROR([cannot find X11]) fi fi dnl fake automake if if test x$build_cygwin = xyes ; then CYGWIN_FALSE='#' CYGWIN_TRUE= AC_DEFINE(CYGWIN,,[define if using cygwin]) else CYGWIN_FALSE= CYGWIN_TRUE='#' fi AC_SUBST(CYGWIN_FALSE) AC_SUBST(CYGWIN_TRUE) if test x$build_mingw = xyes ; then MINGW_FALSE='#' MINGW_TRUE= AC_DEFINE(MINGW,,[define if using mingw]) else MINGW_FALSE= MINGW_TRUE='#' fi AC_SUBST(MINGW_FALSE) AC_SUBST(MINGW_TRUE) NRN_FABS dnl Checks for typedefs, structures, and compiler characteristics. AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_HEADER_TIME AC_STRUCT_TM AC_TYPE_UID_T dnl Checks for library functions. AC_FUNC_MEMCMP AC_FUNC_MMAP AC_TYPE_SIGNAL AC_FUNC_VPRINTF AC_CHECK_FUNCS(getcwd gethostname gettimeofday regcomp select socket strcspn strerror strtod strtol uname) dnl See whether we need the prototype for gettimeofday. AC_MSG_CHECKING([for prototype for gettimeofday]) AC_TRY_COMPILE([#if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif ],[struct timeval curtime; gettimeofday(&curtime, 0);], [AC_MSG_RESULT(found)], [ AC_MSG_RESULT(not found) AC_DEFINE(NEED_GETTIMEOFDAY_PROTOTYPE,,do we need the prototype for gettimeofday) ]) BASH_SIGNAL_CHECK dnl special problem work arounds dnl c++ compiler internal errors if test -z "$mlh_cxxflag" ; then if test "$GXX"='yes' ; then zzz="`$CXX -v 2>&1 | sed -n '2s/ /_/gp'`" case "$zzz" in *version_2.8.1 ) dnl -O fails on deck2_6.cpp and xfont.cpp echo "Compiling deck2_6.cpp and xfont.cpp will fail with an internal error" echo "because of a g++-2.8.1 optimization bug. Setting CXXFLAGS=-g" CXXFLAGS=-g ;; esac fi fi case "$exec_prefix" in NONE*) exec_prefix="${prefix}/${host_cpu}" ;; esac AC_OUTPUT([Makefile src/Makefile src/bin/Makefile src/bin/idemo/Makefile src/bin/idraw/Makefile src/bin/iclass/Makefile src/include/Makefile src/lib/Makefile ]) neuron-7.6.3/install-sh000077500000000000000000000345231340731477100150570ustar00rootroot00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2013-12-25.23; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # 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. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: neuron-7.6.3/iv_def.h000077500000000000000000000003111340731477100144470ustar00rootroot00000000000000#pragma precompile_target "iv_def.h" #define MSL_USE_PRECOMPILED_HEADERS 1 #include #define SYSV 1 #define MAC 1 #define motif_kit #define sgi_motif_kit #define default_kit SMFKit neuron-7.6.3/ltmain.sh000077500000000000000000011707701340731477100147040ustar00rootroot00000000000000#! /bin/sh ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in ## by inline-source v2014-01-03.01 # libtool (GNU libtool) 2.4.6 # Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool 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. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . PROGRAM=libtool PACKAGE=libtool VERSION=2.4.6 package_revision=2.4.6 ## ------ ## ## Usage. ## ## ------ ## # Run './libtool --help' for help with using this script from the # command line. ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # After configure completes, it has a better idea of some of the # shell tools we need than the defaults used by the functions shared # with bootstrap, so set those here where they can still be over- # ridden by the user, but otherwise take precedence. : ${AUTOCONF="autoconf"} : ${AUTOMAKE="automake"} ## -------------------------- ## ## Source external libraries. ## ## -------------------------- ## # Much of our low-level functionality needs to be sourced from external # libraries, which are installed to $pkgauxdir. # Set a version string for this script. scriptversion=2015-01-20.17; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 # Copyright (C) 2004-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # 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 3 of the License, or # (at your option) any later version. # As a special exception to the GNU General Public License, if you distribute # this file as part of a program or library that is built using GNU Libtool, # you may include this file under the same distribution terms that you use # for the rest of that program. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # Evaluate this file near the top of your script to gain access to # the functions and variables defined here: # # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh # # If you need to override any of the default environment variable # settings, do that before evaluating this file. ## -------------------- ## ## Shell normalisation. ## ## -------------------- ## # Some shells need a little help to be as Bourne compatible as possible. # Before doing anything else, make sure all that help has been provided! DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # NLS nuisances: We save the old values in case they are required later. _G_user_locale= _G_safe_locale= for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test set = \"\${$_G_var+set}\"; then save_$_G_var=\$$_G_var $_G_var=C export $_G_var _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" fi" done # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Make sure IFS has a sensible default sp=' ' nl=' ' IFS="$sp $nl" # There are apparently some retarded systems that use ';' as a PATH separator! if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi ## ------------------------- ## ## Locate command utilities. ## ## ------------------------- ## # func_executable_p FILE # ---------------------- # Check that FILE is an executable regular file. func_executable_p () { test -f "$1" && test -x "$1" } # func_path_progs PROGS_LIST CHECK_FUNC [PATH] # -------------------------------------------- # Search for either a program that responds to --version with output # containing "GNU", or else returned by CHECK_FUNC otherwise, by # trying all the directories in PATH with each of the elements of # PROGS_LIST. # # CHECK_FUNC should accept the path to a candidate program, and # set $func_check_prog_result if it truncates its output less than # $_G_path_prog_max characters. func_path_progs () { _G_progs_list=$1 _G_check_func=$2 _G_PATH=${3-"$PATH"} _G_path_prog_max=0 _G_path_prog_found=false _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} for _G_dir in $_G_PATH; do IFS=$_G_save_IFS test -z "$_G_dir" && _G_dir=. for _G_prog_name in $_G_progs_list; do for _exeext in '' .EXE; do _G_path_prog=$_G_dir/$_G_prog_name$_exeext func_executable_p "$_G_path_prog" || continue case `"$_G_path_prog" --version 2>&1` in *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; *) $_G_check_func $_G_path_prog func_path_progs_result=$func_check_prog_result ;; esac $_G_path_prog_found && break 3 done done done IFS=$_G_save_IFS test -z "$func_path_progs_result" && { echo "no acceptable sed could be found in \$PATH" >&2 exit 1 } } # We want to be able to use the functions in this file before configure # has figured out where the best binaries are kept, which means we have # to search for them ourselves - except when the results are already set # where we skip the searches. # Unless the user overrides by setting SED, search the path for either GNU # sed, or the sed that truncates its output the least. test -z "$SED" && { _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for _G_i in 1 2 3 4 5 6 7; do _G_sed_script=$_G_sed_script$nl$_G_sed_script done echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed _G_sed_script= func_check_prog_sed () { _G_path_prog=$1 _G_count=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo '' >> conftest.nl "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin rm -f conftest.sed SED=$func_path_progs_result } # Unless the user overrides by setting GREP, search the path for either GNU # grep, or the grep that truncates its output the least. test -z "$GREP" && { func_check_prog_grep () { _G_path_prog=$1 _G_count=0 _G_path_prog_max=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo 'GREP' >> conftest.nl "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin GREP=$func_path_progs_result } ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # All uppercase variable names are used for environment variables. These # variables can be overridden by the user before calling a script that # uses them if a suitable command of that name is not already available # in the command search PATH. : ${CP="cp -f"} : ${ECHO="printf %s\n"} : ${EGREP="$GREP -E"} : ${FGREP="$GREP -F"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} ## -------------------- ## ## Useful sed snippets. ## ## -------------------- ## sed_dirname='s|/[^/]*$||' sed_basename='s|^.*/||' # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s|\([`"$\\]\)|\\\1|g' # Same as above, but do not quote variable references. sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' # Sed substitution that converts a w32 file name or path # that contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-'\' parameter expansions in output of sed_double_quote_subst that # were '\'-ed in input to the same. If an odd number of '\' preceded a # '$' in input to sed_double_quote_subst, that '$' was protected from # expansion. Since each input '\' is now two '\'s, look for any number # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. _G_bs='\\' _G_bs2='\\\\' _G_bs4='\\\\\\\\' _G_dollar='\$' sed_double_backslash="\ s/$_G_bs4/&\\ /g s/^$_G_bs2$_G_dollar/$_G_bs&/ s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g s/\n//g" ## ----------------- ## ## Global variables. ## ## ----------------- ## # Except for the global variables explicitly listed below, the following # functions in the '^func_' namespace, and the '^require_' namespace # variables initialised in the 'Resource management' section, sourcing # this file will not pollute your global namespace with anything # else. There's no portable way to scope variables in Bourne shell # though, so actually running these functions will sometimes place # results into a variable named after the function, and often use # temporary variables in the '^_G_' namespace. If you are careful to # avoid using those namespaces casually in your sourcing script, things # should continue to work as you expect. And, of course, you can freely # overwrite any of the functions or variables defined here before # calling anything to customize them. EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. # Allow overriding, eg assuming that you follow the convention of # putting '$debug_cmd' at the start of all your functions, you can get # bash to show function call trace with: # # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name debug_cmd=${debug_cmd-":"} exit_cmd=: # By convention, finish your script with: # # exit $exit_status # # so that you can set exit_status to non-zero if you want to indicate # something went wrong during execution without actually bailing out at # the point of failure. exit_status=$EXIT_SUCCESS # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath=$0 # The name of this program. progname=`$ECHO "$progpath" |$SED "$sed_basename"` # Make sure we have an absolute progpath for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` progdir=`cd "$progdir" && pwd` progpath=$progdir/$progname ;; *) _G_IFS=$IFS IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS=$_G_IFS test -x "$progdir/$progname" && break done IFS=$_G_IFS test -n "$progdir" || progdir=`pwd` progpath=$progdir/$progname ;; esac ## ----------------- ## ## Standard options. ## ## ----------------- ## # The following options affect the operation of the functions defined # below, and should be set appropriately depending on run-time para- # meters passed on the command line. opt_dry_run=false opt_quiet=false opt_verbose=false # Categories 'all' and 'none' are always available. Append any others # you will pass as the first argument to func_warning from your own # code. warning_categories= # By default, display warnings according to 'opt_warning_types'. Set # 'warning_func' to ':' to elide all warnings, or func_fatal_error to # treat the next displayed warning as a fatal error. warning_func=func_warn_and_continue # Set to 'all' to display all warnings, 'none' to suppress all # warnings, or a space delimited list of some subset of # 'warning_categories' to display only the listed warnings. opt_warning_types=all ## -------------------- ## ## Resource management. ## ## -------------------- ## # This section contains definitions for functions that each ensure a # particular resource (a file, or a non-empty configuration variable for # example) is available, and if appropriate to extract default values # from pertinent package files. Call them using their associated # 'require_*' variable to ensure that they are executed, at most, once. # # It's entirely deliberate that calling these functions can set # variables that don't obey the namespace limitations obeyed by the rest # of this file, in order that that they be as useful as possible to # callers. # require_term_colors # ------------------- # Allow display of bold text on terminals that support it. require_term_colors=func_require_term_colors func_require_term_colors () { $debug_cmd test -t 1 && { # COLORTERM and USE_ANSI_COLORS environment variables take # precedence, because most terminfo databases neglect to describe # whether color sequences are supported. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} if test 1 = "$USE_ANSI_COLORS"; then # Standard ANSI escape sequences tc_reset='' tc_bold=''; tc_standout='' tc_red=''; tc_green='' tc_blue=''; tc_cyan='' else # Otherwise trust the terminfo database after all. test -n "`tput sgr0 2>/dev/null`" && { tc_reset=`tput sgr0` test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` tc_standout=$tc_bold test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` } fi } require_term_colors=: } ## ----------------- ## ## Function library. ## ## ----------------- ## # This section contains a variety of useful functions to call in your # scripts. Take note of the portable wrappers for features provided by # some modern shells, which will fall back to slower equivalents on # less featureful shells. # func_append VAR VALUE # --------------------- # Append VALUE onto the existing contents of VAR. # We should try to minimise forks, especially on Windows where they are # unreasonably slow, so skip the feature probes when bash or zsh are # being used: if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then : ${_G_HAVE_ARITH_OP="yes"} : ${_G_HAVE_XSI_OPS="yes"} # The += operator was introduced in bash 3.1 case $BASH_VERSION in [12].* | 3.0 | 3.0*) ;; *) : ${_G_HAVE_PLUSEQ_OP="yes"} ;; esac fi # _G_HAVE_PLUSEQ_OP # Can be empty, in which case the shell is probed, "yes" if += is # useable or anything else if it does not work. test -z "$_G_HAVE_PLUSEQ_OP" \ && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ && _G_HAVE_PLUSEQ_OP=yes if test yes = "$_G_HAVE_PLUSEQ_OP" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_append () { $debug_cmd eval "$1+=\$2" }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_append () { $debug_cmd eval "$1=\$$1\$2" } fi # func_append_quoted VAR VALUE # ---------------------------- # Quote VALUE and append to the end of shell variable VAR, separated # by a space. if test yes = "$_G_HAVE_PLUSEQ_OP"; then eval 'func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1+=\\ \$func_quote_for_eval_result" }' else func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1=\$$1\\ \$func_quote_for_eval_result" } fi # func_append_uniq VAR VALUE # -------------------------- # Append unique VALUE onto the existing contents of VAR, assuming # entries are delimited by the first character of VALUE. For example: # # func_append_uniq options " --another-option option-argument" # # will only append to $options if " --another-option option-argument " # is not already present somewhere in $options already (note spaces at # each end implied by leading space in second argument). func_append_uniq () { $debug_cmd eval _G_current_value='`$ECHO $'$1'`' _G_delim=`expr "$2" : '\(.\)'` case $_G_delim$_G_current_value$_G_delim in *"$2$_G_delim"*) ;; *) func_append "$@" ;; esac } # func_arith TERM... # ------------------ # Set func_arith_result to the result of evaluating TERMs. test -z "$_G_HAVE_ARITH_OP" \ && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ && _G_HAVE_ARITH_OP=yes if test yes = "$_G_HAVE_ARITH_OP"; then eval 'func_arith () { $debug_cmd func_arith_result=$(( $* )) }' else func_arith () { $debug_cmd func_arith_result=`expr "$@"` } fi # func_basename FILE # ------------------ # Set func_basename_result to FILE with everything up to and including # the last / stripped. if test yes = "$_G_HAVE_XSI_OPS"; then # If this shell supports suffix pattern removal, then use it to avoid # forking. Hide the definitions single quotes in case the shell chokes # on unsupported syntax... _b='func_basename_result=${1##*/}' _d='case $1 in */*) func_dirname_result=${1%/*}$2 ;; * ) func_dirname_result=$3 ;; esac' else # ...otherwise fall back to using sed. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` if test "X$func_dirname_result" = "X$1"; then func_dirname_result=$3 else func_append func_dirname_result "$2" fi' fi eval 'func_basename () { $debug_cmd '"$_b"' }' # func_dirname FILE APPEND NONDIR_REPLACEMENT # ------------------------------------------- # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. eval 'func_dirname () { $debug_cmd '"$_d"' }' # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT # -------------------------------------------------------- # Perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # For efficiency, we do not delegate to the functions above but instead # duplicate the functionality here. eval 'func_dirname_and_basename () { $debug_cmd '"$_b"' '"$_d"' }' # func_echo ARG... # ---------------- # Echo program name prefixed message. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname: $_G_line" done IFS=$func_echo_IFS } # func_echo_all ARG... # -------------------- # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_echo_infix_1 INFIX ARG... # ------------------------------ # Echo program name, followed by INFIX on the first line, with any # additional lines not showing INFIX. func_echo_infix_1 () { $debug_cmd $require_term_colors _G_infix=$1; shift _G_indent=$_G_infix _G_prefix="$progname: $_G_infix: " _G_message=$* # Strip color escape sequences before counting printable length for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" do test -n "$_G_tc" && { _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` } done _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes func_echo_infix_1_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_infix_1_IFS $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 _G_prefix=$_G_indent done IFS=$func_echo_infix_1_IFS } # func_error ARG... # ----------------- # Echo program name prefixed message to standard error. func_error () { $debug_cmd $require_term_colors func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 } # func_fatal_error ARG... # ----------------------- # Echo program name prefixed message to standard error, and exit. func_fatal_error () { $debug_cmd func_error "$*" exit $EXIT_FAILURE } # func_grep EXPRESSION FILENAME # ----------------------------- # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $debug_cmd $GREP "$1" "$2" >/dev/null 2>&1 } # func_len STRING # --------------- # Set func_len_result to the length of STRING. STRING may not # start with a hyphen. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_len () { $debug_cmd func_len_result=${#1} }' else func_len () { $debug_cmd func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` } fi # func_mkdir_p DIRECTORY-PATH # --------------------------- # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { $debug_cmd _G_directory_path=$1 _G_dir_list= if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then # Protect directory names starting with '-' case $_G_directory_path in -*) _G_directory_path=./$_G_directory_path ;; esac # While some portion of DIR does not yet exist... while test ! -d "$_G_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. _G_dir_list=$_G_directory_path:$_G_dir_list # If the last portion added has no slash in it, the list is done case $_G_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` done _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` func_mkdir_p_IFS=$IFS; IFS=: for _G_dir in $_G_dir_list; do IFS=$func_mkdir_p_IFS # mkdir can fail with a 'File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$_G_dir" 2>/dev/null || : done IFS=$func_mkdir_p_IFS # Bail out if we (or some other process) failed to create a directory. test -d "$_G_directory_path" || \ func_fatal_error "Failed to create '$1'" fi } # func_mktempdir [BASENAME] # ------------------------- # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, BASENAME is the basename for that directory. func_mktempdir () { $debug_cmd _G_template=${TMPDIR-/tmp}/${1-$progname} if test : = "$opt_dry_run"; then # Return a directory name, but don't create it in dry-run mode _G_tmpdir=$_G_template-$$ else # If mktemp works, use that first and foremost _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` if test ! -d "$_G_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race _G_tmpdir=$_G_template-${RANDOM-0}$$ func_mktempdir_umask=`umask` umask 0077 $MKDIR "$_G_tmpdir" umask $func_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$_G_tmpdir" || \ func_fatal_error "cannot create temporary directory '$_G_tmpdir'" fi $ECHO "$_G_tmpdir" } # func_normal_abspath PATH # ------------------------ # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. func_normal_abspath () { $debug_cmd # These SED scripts presuppose an absolute path with a trailing slash. _G_pathcar='s|^/\([^/]*\).*$|\1|' _G_pathcdr='s|^/[^/]*||' _G_removedotparts=':dotsl s|/\./|/|g t dotsl s|/\.$|/|' _G_collapseslashes='s|/\{1,\}|/|g' _G_finalslash='s|/*$|/|' # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` while :; do # Processed it all yet? if test / = "$func_normal_abspath_tpath"; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result"; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_notquiet ARG... # -------------------- # Echo program name prefixed message only when not in quiet mode. func_notquiet () { $debug_cmd $opt_quiet || func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_relative_path SRCDIR DSTDIR # -------------------------------- # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. func_relative_path () { $debug_cmd func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=$func_dirname_result if test -z "$func_relative_path_tlibdir"; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test -n "$func_stripname_result"; then func_append func_relative_path_result "/$func_stripname_result" fi # Normalisation. If bindir is libdir, return '.' else relative path. if test -n "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result" func_relative_path_result=$func_stripname_result fi test -n "$func_relative_path_result" || func_relative_path_result=. : } # func_quote_for_eval ARG... # -------------------------- # Aesthetically quote ARGs to be evaled later. # This function returns two values: # i) func_quote_for_eval_result # double-quoted, suitable for a subsequent eval # ii) func_quote_for_eval_unquoted_result # has all characters that are still active within double # quotes backslashified. func_quote_for_eval () { $debug_cmd func_quote_for_eval_unquoted_result= func_quote_for_eval_result= while test 0 -lt $#; do case $1 in *[\\\`\"\$]*) _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; *) _G_unquoted_arg=$1 ;; esac if test -n "$func_quote_for_eval_unquoted_result"; then func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" else func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" fi case $_G_unquoted_arg in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and variable expansion # for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_quoted_arg=\"$_G_unquoted_arg\" ;; *) _G_quoted_arg=$_G_unquoted_arg ;; esac if test -n "$func_quote_for_eval_result"; then func_append func_quote_for_eval_result " $_G_quoted_arg" else func_append func_quote_for_eval_result "$_G_quoted_arg" fi shift done } # func_quote_for_expand ARG # ------------------------- # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { $debug_cmd case $1 in *[\\\`\"]*) _G_arg=`$ECHO "$1" | $SED \ -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; *) _G_arg=$1 ;; esac case $_G_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_arg=\"$_G_arg\" ;; esac func_quote_for_expand_result=$_G_arg } # func_stripname PREFIX SUFFIX NAME # --------------------------------- # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_stripname () { $debug_cmd # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary variable first. func_stripname_result=$3 func_stripname_result=${func_stripname_result#"$1"} func_stripname_result=${func_stripname_result%"$2"} }' else func_stripname () { $debug_cmd case $2 in .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; esac } fi # func_show_eval CMD [FAIL_EXP] # ----------------------------- # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} func_quote_for_expand "$_G_cmd" eval "func_notquiet $func_quote_for_expand_result" $opt_dry_run || { eval "$_G_cmd" _G_status=$? if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_show_eval_locale CMD [FAIL_EXP] # ------------------------------------ # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} $opt_quiet || { func_quote_for_expand "$_G_cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || { eval "$_G_user_locale $_G_cmd" _G_status=$? eval "$_G_safe_locale" if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_tr_sh # ---------- # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { $debug_cmd case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_verbose ARG... # ------------------- # Echo program name prefixed message in verbose mode only. func_verbose () { $debug_cmd $opt_verbose && func_echo "$*" : } # func_warn_and_continue ARG... # ----------------------------- # Echo program name prefixed warning message to standard error. func_warn_and_continue () { $debug_cmd $require_term_colors func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 } # func_warning CATEGORY ARG... # ---------------------------- # Echo program name prefixed warning message to standard error. Warning # messages can be filtered according to CATEGORY, where this function # elides messages where CATEGORY is not listed in the global variable # 'opt_warning_types'. func_warning () { $debug_cmd # CATEGORY must be in the warning_categories list! case " $warning_categories " in *" $1 "*) ;; *) func_internal_error "invalid warning category '$1'" ;; esac _G_category=$1 shift case " $opt_warning_types " in *" $_G_category "*) $warning_func ${1+"$@"} ;; esac } # func_sort_ver VER1 VER2 # ----------------------- # 'sort -V' is not generally available. # Note this deviates from the version comparison in automake # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a # but this should suffice as we won't be specifying old # version formats or redundant trailing .0 in bootstrap.conf. # If we did want full compatibility then we should probably # use m4_version_compare from autoconf. func_sort_ver () { $debug_cmd printf '%s\n%s\n' "$1" "$2" \ | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n } # func_lt_ver PREV CURR # --------------------- # Return true if PREV and CURR are in the correct order according to # func_sort_ver, otherwise false. Use it like this: # # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." func_lt_ver () { $debug_cmd test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: #! /bin/sh # Set a version string for this script. scriptversion=2014-01-07.03; # UTC # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 # Copyright (C) 2010-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # 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 3 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, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # This file is a library for parsing options in your shell scripts along # with assorted other useful supporting features that you can make use # of too. # # For the simplest scripts you might need only: # # #!/bin/sh # . relative/path/to/funclib.sh # . relative/path/to/options-parser # scriptversion=1.0 # func_options ${1+"$@"} # eval set dummy "$func_options_result"; shift # ...rest of your script... # # In order for the '--version' option to work, you will need to have a # suitably formatted comment like the one at the top of this file # starting with '# Written by ' and ending with '# warranty; '. # # For '-h' and '--help' to work, you will also need a one line # description of your script's purpose in a comment directly above the # '# Written by ' line, like the one at the top of this file. # # The default options also support '--debug', which will turn on shell # execution tracing (see the comment above debug_cmd below for another # use), and '--verbose' and the func_verbose function to allow your script # to display verbose messages only when your user has specified # '--verbose'. # # After sourcing this file, you can plug processing for additional # options by amending the variables from the 'Configuration' section # below, and following the instructions in the 'Option parsing' # section further down. ## -------------- ## ## Configuration. ## ## -------------- ## # You should override these variables in your script after sourcing this # file so that they reflect the customisations you have added to the # option parser. # The usage line for option parsing errors and the start of '-h' and # '--help' output messages. You can embed shell variables for delayed # expansion at the time the message is displayed, but you will need to # quote other shell meta-characters carefully to prevent them being # expanded when the contents are evaled. usage='$progpath [OPTION]...' # Short help message in response to '-h' and '--help'. Add to this or # override it after sourcing this library to reflect the full set of # options your script accepts. usage_message="\ --debug enable verbose shell tracing -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -v, --verbose verbosely report processing --version print version information and exit -h, --help print short or long help message and exit " # Additional text appended to 'usage_message' in response to '--help'. long_help_message=" Warning categories include: 'all' show all warnings 'none' turn off all the warnings 'error' warnings are treated as fatal errors" # Help message printed before fatal option parsing errors. fatal_help="Try '\$progname --help' for more information." ## ------------------------- ## ## Hook function management. ## ## ------------------------- ## # This section contains functions for adding, removing, and running hooks # to the main code. A hook is just a named list of of function, that can # be run in order later on. # func_hookable FUNC_NAME # ----------------------- # Declare that FUNC_NAME will run hooks added with # 'func_add_hook FUNC_NAME ...'. func_hookable () { $debug_cmd func_append hookable_fns " $1" } # func_add_hook FUNC_NAME HOOK_FUNC # --------------------------------- # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must # first have been declared "hookable" by a call to 'func_hookable'. func_add_hook () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not accept hook functions." ;; esac eval func_append ${1}_hooks '" $2"' } # func_remove_hook FUNC_NAME HOOK_FUNC # ------------------------------------ # Remove HOOK_FUNC from the list of functions called by FUNC_NAME. func_remove_hook () { $debug_cmd eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' } # func_run_hooks FUNC_NAME [ARG]... # --------------------------------- # Run all hook functions registered to FUNC_NAME. # It is assumed that the list of hook functions contains nothing more # than a whitespace-delimited list of legal shell function names, and # no effort is wasted trying to catch shell meta-characters or preserve # whitespace. func_run_hooks () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not support hook funcions.n" ;; esac eval _G_hook_fns=\$$1_hooks; shift for _G_hook in $_G_hook_fns; do eval $_G_hook '"$@"' # store returned options list back into positional # parameters for next 'cmd' execution. eval _G_hook_result=\$${_G_hook}_result eval set dummy "$_G_hook_result"; shift done func_quote_for_eval ${1+"$@"} func_run_hooks_result=$func_quote_for_eval_result } ## --------------- ## ## Option parsing. ## ## --------------- ## # In order to add your own option parsing hooks, you must accept the # full positional parameter list in your hook function, remove any # options that you action, and then pass back the remaining unprocessed # options in '_result', escaped suitably for # 'eval'. Like this: # # my_options_prep () # { # $debug_cmd # # # Extend the existing usage message. # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' # # func_quote_for_eval ${1+"$@"} # my_options_prep_result=$func_quote_for_eval_result # } # func_add_hook func_options_prep my_options_prep # # # my_silent_option () # { # $debug_cmd # # # Note that for efficiency, we parse as many options as we can # # recognise in a loop before passing the remainder back to the # # caller on the first unrecognised argument we encounter. # while test $# -gt 0; do # opt=$1; shift # case $opt in # --silent|-s) opt_silent=: ;; # # Separate non-argument short options: # -s*) func_split_short_opt "$_G_opt" # set dummy "$func_split_short_opt_name" \ # "-$func_split_short_opt_arg" ${1+"$@"} # shift # ;; # *) set dummy "$_G_opt" "$*"; shift; break ;; # esac # done # # func_quote_for_eval ${1+"$@"} # my_silent_option_result=$func_quote_for_eval_result # } # func_add_hook func_parse_options my_silent_option # # # my_option_validation () # { # $debug_cmd # # $opt_silent && $opt_verbose && func_fatal_help "\ # '--silent' and '--verbose' options are mutually exclusive." # # func_quote_for_eval ${1+"$@"} # my_option_validation_result=$func_quote_for_eval_result # } # func_add_hook func_validate_options my_option_validation # # You'll alse need to manually amend $usage_message to reflect the extra # options you parse. It's preferable to append if you can, so that # multiple option parsing hooks can be added safely. # func_options [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the # individual implementations for details. func_hookable func_options func_options () { $debug_cmd func_options_prep ${1+"$@"} eval func_parse_options \ ${func_options_prep_result+"$func_options_prep_result"} eval func_validate_options \ ${func_parse_options_result+"$func_parse_options_result"} eval func_run_hooks func_options \ ${func_validate_options_result+"$func_validate_options_result"} # save modified positional parameters for caller func_options_result=$func_run_hooks_result } # func_options_prep [ARG]... # -------------------------- # All initialisations required before starting the option parse loop. # Note that when calling hook functions, we pass through the list of # positional parameters. If a hook function modifies that list, and # needs to propogate that back to rest of this script, then the complete # modified list must be put in 'func_run_hooks_result' before # returning. func_hookable func_options_prep func_options_prep () { $debug_cmd # Option defaults: opt_verbose=false opt_warning_types= func_run_hooks func_options_prep ${1+"$@"} # save modified positional parameters for caller func_options_prep_result=$func_run_hooks_result } # func_parse_options [ARG]... # --------------------------- # The main option parsing loop. func_hookable func_parse_options func_parse_options () { $debug_cmd func_parse_options_result= # this just eases exit handling while test $# -gt 0; do # Defer to hook functions for initial option parsing, so they # get priority in the event of reusing an option name. func_run_hooks func_parse_options ${1+"$@"} # Adjust func_parse_options positional parameters to match eval set dummy "$func_run_hooks_result"; shift # Break out of the loop if we already parsed every option. test $# -gt 0 || break _G_opt=$1 shift case $_G_opt in --debug|-x) debug_cmd='set -x' func_echo "enabling shell trace mode" $debug_cmd ;; --no-warnings|--no-warning|--no-warn) set dummy --warnings none ${1+"$@"} shift ;; --warnings|--warning|-W) test $# = 0 && func_missing_arg $_G_opt && break case " $warning_categories $1" in *" $1 "*) # trailing space prevents matching last $1 above func_append_uniq opt_warning_types " $1" ;; *all) opt_warning_types=$warning_categories ;; *none) opt_warning_types=none warning_func=: ;; *error) opt_warning_types=$warning_categories warning_func=func_fatal_error ;; *) func_fatal_error \ "unsupported warning category: '$1'" ;; esac shift ;; --verbose|-v) opt_verbose=: ;; --version) func_version ;; -\?|-h) func_usage ;; --help) func_help ;; # Separate optargs to long options (plugins may need this): --*=*) func_split_equals "$_G_opt" set dummy "$func_split_equals_lhs" \ "$func_split_equals_rhs" ${1+"$@"} shift ;; # Separate optargs to short options: -W*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "$func_split_short_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-v*|-x*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} func_parse_options_result=$func_quote_for_eval_result } # func_validate_options [ARG]... # ------------------------------ # Perform any sanity checks on option settings and/or unconsumed # arguments. func_hookable func_validate_options func_validate_options () { $debug_cmd # Display all warnings if -W was not given. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" func_run_hooks func_validate_options ${1+"$@"} # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE # save modified positional parameters for caller func_validate_options_result=$func_run_hooks_result } ## ----------------- ## ## Helper functions. ## ## ----------------- ## # This section contains the helper functions used by the rest of the # hookable option parser framework in ascii-betical order. # func_fatal_help ARG... # ---------------------- # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { $debug_cmd eval \$ECHO \""Usage: $usage"\" eval \$ECHO \""$fatal_help"\" func_error ${1+"$@"} exit $EXIT_FAILURE } # func_help # --------- # Echo long help message to standard output and exit. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message" exit 0 } # func_missing_arg ARGNAME # ------------------------ # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $debug_cmd func_error "Missing argument for '$1'." exit_cmd=exit } # func_split_equals STRING # ------------------------ # Set func_split_equals_lhs and func_split_equals_rhs shell variables after # splitting STRING at the '=' sign. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_equals () { $debug_cmd func_split_equals_lhs=${1%%=*} func_split_equals_rhs=${1#*=} test "x$func_split_equals_lhs" = "x$1" \ && func_split_equals_rhs= }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_equals () { $debug_cmd func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` func_split_equals_rhs= test "x$func_split_equals_lhs" = "x$1" \ || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` } fi #func_split_equals # func_split_short_opt SHORTOPT # ----------------------------- # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_short_opt () { $debug_cmd func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"} }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_short_opt () { $debug_cmd func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` } fi #func_split_short_opt # func_usage # ---------- # Echo short help message to standard output and exit. func_usage () { $debug_cmd func_usage_message $ECHO "Run '$progname --help |${PAGER-more}' for full usage" exit 0 } # func_usage_message # ------------------ # Echo short help message to standard output. func_usage_message () { $debug_cmd eval \$ECHO \""Usage: $usage"\" echo $SED -n 's|^# || /^Written by/{ x;p;x } h /^Written by/q' < "$progpath" echo eval \$ECHO \""$usage_message"\" } # func_version # ------------ # Echo version message to standard output and exit. func_version () { $debug_cmd printf '%s\n' "$progname $scriptversion" $SED -n ' /(C)/!b go :more /\./!{ N s|\n# | | b more } :go /^# Written by /,/# warranty; / { s|^# || s|^# *$|| s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| p } /^# Written by / { s|^# || p } /^warranty; /q' < "$progpath" exit $? } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: # Set a version string. scriptversion='(GNU libtool) 2.4.6' # func_echo ARG... # ---------------- # Libtool also displays the current mode in messages, so override # funclib.sh func_echo with this custom definition. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" done IFS=$func_echo_IFS } # func_warning ARG... # ------------------- # Libtool warnings are not categorized, so override funclib.sh # func_warning with this simpler definition. func_warning () { $debug_cmd $warning_func ${1+"$@"} } ## ---------------- ## ## Options parsing. ## ## ---------------- ## # Hook in the functions to make sure our own options are parsed during # the option parsing loop. usage='$progpath [OPTION]... [MODE-ARG]...' # Short help message in response to '-h'. usage_message="Options: --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --mode=MODE use operation mode MODE --no-warnings equivalent to '-Wnone' --preserve-dup-deps don't remove duplicate dependency libraries --quiet, --silent don't print informational messages --tag=TAG use configuration variables from tag TAG -v, --verbose print more informational messages than default --version print version information -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -h, --help, --help-all print short, long, or detailed help message " # Additional text appended to 'usage_message' in response to '--help'. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. When passed as first option, '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. Try '$progname --help --mode=MODE' for a more detailed description of MODE. When reporting a bug, please describe a test case to reproduce it and include the following information: host-triplet: $host shell: $SHELL compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) version: $progname (GNU libtool) 2.4.6 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` Report bugs to . GNU libtool home page: . General help using GNU software: ." exit 0 } # func_lo2o OBJECT-NAME # --------------------- # Transform OBJECT-NAME from a '.lo' suffix to the platform specific # object suffix. lo2o=s/\\.lo\$/.$objext/ o2lo=s/\\.$objext\$/.lo/ if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_lo2o () { case $1 in *.lo) func_lo2o_result=${1%.lo}.$objext ;; * ) func_lo2o_result=$1 ;; esac }' # func_xform LIBOBJ-OR-SOURCE # --------------------------- # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) # suffix to a '.lo' libtool-object suffix. eval 'func_xform () { func_xform_result=${1%.*}.lo }' else # ...otherwise fall back to using sed. func_lo2o () { func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` } func_xform () { func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` } fi # func_fatal_configuration ARG... # ------------------------------- # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func__fatal_error ${1+"$@"} \ "See the $PACKAGE documentation for more information." \ "Fatal configuration error." } # func_config # ----------- # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # ------------- # Display the features supported by this script. func_features () { echo "host: $host" if test yes = "$build_libtool_libs"; then echo "enable shared libraries" else echo "disable shared libraries" fi if test yes = "$build_old_libs"; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag TAGNAME # ----------------------- # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname=$1 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf=/$re_begincf/,/$re_endcf/p # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # ------------------------ # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # libtool_options_prep [ARG]... # ----------------------------- # Preparation for options parsed by libtool. libtool_options_prep () { $debug_mode # Option defaults: opt_config=false opt_dlopen= opt_dry_run=false opt_help=false opt_mode= opt_preserve_dup_deps=false opt_quiet=false nonopt= preserve_args= # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Pass back the list of options. func_quote_for_eval ${1+"$@"} libtool_options_prep_result=$func_quote_for_eval_result } func_add_hook func_options_prep libtool_options_prep # libtool_parse_options [ARG]... # --------------------------------- # Provide handling for libtool specific options. libtool_parse_options () { $debug_cmd # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do _G_opt=$1 shift case $_G_opt in --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) func_config ;; --dlopen|-dlopen) opt_dlopen="${opt_dlopen+$opt_dlopen }$1" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) func_features ;; --finish) set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $_G_opt && break opt_mode=$1 case $1 in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $_G_opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_quiet=false func_append preserve_args " $_G_opt" ;; --no-warnings|--no-warning|--no-warn) opt_warning=false func_append preserve_args " $_G_opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $_G_opt" ;; --silent|--quiet) opt_quiet=: opt_verbose=false func_append preserve_args " $_G_opt" ;; --tag) test $# = 0 && func_missing_arg $_G_opt && break opt_tag=$1 func_append preserve_args " $_G_opt $1" func_enable_tag "$1" shift ;; --verbose|-v) opt_quiet=false opt_verbose=: func_append preserve_args " $_G_opt" ;; # An option not handled by this hook function: *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} libtool_parse_options_result=$func_quote_for_eval_result } func_add_hook func_parse_options libtool_parse_options # libtool_validate_options [ARG]... # --------------------------------- # Perform any sanity checks on option settings and/or unconsumed # arguments. libtool_validate_options () { # save first non-option argument if test 0 -lt $#; then nonopt=$1 shift fi # preserve --debug test : = "$debug_cmd" || func_append preserve_args " --debug" case $host in # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match test yes != "$build_libtool_libs" \ && test yes != "$build_old_libs" \ && func_fatal_configuration "not configured to build any kind of library" # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test execute != "$opt_mode"; then func_error "unrecognized option '-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help=$help help="Try '$progname --help --mode=$opt_mode' for more information." } # Pass back the unparsed argument list func_quote_for_eval ${1+"$@"} libtool_validate_options_result=$func_quote_for_eval_result } func_add_hook func_validate_options libtool_validate_options # Process options as early as possible so that --help and --version # can return quickly. func_options ${1+"$@"} eval set dummy "$func_options_result"; shift ## ----------- ## ## Main. ## ## ----------- ## magic='%%%MAGIC variable%%%' magic_exe='%%%MAGIC EXE variable%%%' # Global variables. extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # func_generated_by_libtool # True iff stdin has been generated by Libtool. This function is only # a basic sanity check; it will hardly flush out determined imposters. func_generated_by_libtool_p () { $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p } # func_lalib_unsafe_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if 'file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case $lalib_p_line in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test yes = "$lalib_p" } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { test -f "$1" && $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $debug_cmd save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # 'FILE.' does not work on cygwin managed mounts. func_source () { $debug_cmd case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case $lt_sysroot:$1 in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result='='$func_stripname_result ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $debug_cmd if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with '--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=$1 if test yes = "$build_libtool_libs"; then write_lobj=\'$2\' else write_lobj=none fi if test yes = "$build_old_libs"; then write_oldobj=\'$3\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $debug_cmd # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result= if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result"; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $debug_cmd if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $debug_cmd # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $debug_cmd if test -z "$2" && test -n "$1"; then func_error "Could not determine host file name corresponding to" func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result=$1 fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $debug_cmd if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " '$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result=$3 fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $debug_cmd case $4 in $1 ) func_to_host_path_result=$3$func_to_host_path_result ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via '$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $debug_cmd $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $debug_cmd case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result=$1 } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result=$func_convert_core_msys_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result=$func_convert_core_file_wine_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via '$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $debug_cmd if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd=func_convert_path_$func_stripname_result fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $debug_cmd func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result=$1 } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_msys_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_path_wine_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_dll_def_p FILE # True iff FILE is a Windows DLL '.def' file. # Keep in sync with _LT_DLL_DEF_P in libtool.m4 func_dll_def_p () { $debug_cmd func_dll_def_p_tmp=`$SED -n \ -e 's/^[ ]*//' \ -e '/^\(;.*\)*$/d' \ -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ -e q \ "$1"` test DEF = "$func_dll_def_p_tmp" } # func_mode_compile arg... func_mode_compile () { $debug_cmd # Get the compilation command and the source file. base_compile= srcfile=$nonopt # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg=$arg arg_mode=normal ;; target ) libobj=$arg arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify '-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs=$IFS; IFS=, for arg in $args; do IFS=$save_ifs func_append_quoted lastarg "$arg" done IFS=$save_ifs func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg=$srcfile srcfile=$arg ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with '-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj=$func_basename_result } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from '$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test yes = "$build_libtool_libs" \ || func_fatal_configuration "cannot build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name '$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname=$func_basename_result xdir=$func_dirname_result lobj=$xdir$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test yes = "$build_old_libs"; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test no = "$compiler_c_o"; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext lockfile=$output_obj.lock else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test yes = "$need_locks"; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test warn = "$need_locks"; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test yes = "$build_libtool_libs"; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test no != "$pic_mode"; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test yes = "$suppress_opt"; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test yes = "$build_old_libs"; then if test yes != "$pic_mode"; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test yes = "$compiler_c_o"; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test no != "$need_locks"; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test compile = "$opt_mode" && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a '.o' file suitable for static linking -static only build a '.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a 'standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix '.c' with the library object suffix, '.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to '-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the '--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the 'install' or 'cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE use a list of object files found in FILE to specify objects -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with '-') are ignored. Every other argument is treated as a filename. Files ending in '.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in '.la', then a libtool library is created, only library objects ('.lo' files) may be specified, and '-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created using 'ar' and 'ranlib', or on Windows using 'lib'. If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode '$opt_mode'" ;; esac echo $ECHO "Try '$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test : = "$opt_help"; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | $SED -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | $SED '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $debug_cmd # The first argument is the command name. cmd=$nonopt test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "'$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "'$file' was not linked with '-export-dynamic'" continue fi func_dirname "$file" "" "." dir=$func_dirname_result if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir=$func_dirname_result ;; *) func_warning "'-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir=$absdir # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic=$magic # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file=$progdir/$program elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file=$progdir/$program fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if $opt_dry_run; then # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS else if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd=\$cmd$args fi } test execute = "$opt_mode" && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $debug_cmd libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "'$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument '$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and '=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_quiet && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the '-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the '$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the '$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the '$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test finish = "$opt_mode" && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $debug_cmd # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=false stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=: ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test X-m = "X$prev" && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the '$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=: if $isdir; then destdir=$dest destname= else func_dirname_and_basename "$dest" "" "." destdir=$func_dirname_result destname=$func_basename_result # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "'$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "'$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir=$func_dirname_result func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking '$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname=$1 shift srcname=$realname test -n "$relink_command" && srcname=${realname}T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme=$stripme case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme= ;; esac ;; os2*) case $realname in *_dll.a) tstripme= ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try 'ln -sf' first, because the 'ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib=$destdir/$realname func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name=$func_basename_result instname=$dir/${name}i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest=$destfile destfile= ;; *) func_fatal_help "cannot copy a libtool object to '$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test yes = "$build_old_libs"; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext= case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=.exe fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script '$wrapper'" finalize=: for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` if test -n "$libdir" && test ! -f "$libfile"; then func_warning "'$lib' has not been installed in '$libdir'" finalize=false fi done relink_command= func_source "$wrapper" outputname= if test no = "$fast_install" && test -n "$relink_command"; then $opt_dry_run || { if $finalize; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file=$func_basename_result outputname=$tmpdir/$file # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_quiet || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink '$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file=$outputname else func_warning "cannot relink '$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name=$func_basename_result # Set up the ranlib parameters. oldlib=$destdir/$name func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run '$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test install = "$opt_mode" && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $debug_cmd my_outputname=$1 my_originator=$2 my_pic_p=${3-false} my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms=${my_outputname}S.c else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist=$output_objdir/$my_outputname.nm func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* External symbol declarations for the compiler. */\ " if test yes = "$dlself"; then func_verbose "generating symbol list for '$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from '$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols=$output_objdir/$outputname.exp $opt_dry_run || { $RM $export_symbols eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from '$dlprefile'" func_basename "$dlprefile" name=$func_basename_result case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename= if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname"; then func_basename "$dlprefile_dlname" dlprefile_dlbasename=$func_basename_result else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename"; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi func_show_eval '$RM "${nlist}I"' if test -n "$global_symbol_to_import"; then eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[];\ " if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ static void lt_syminit(void) { LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; for (; symbol->name; ++symbol) {" $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" echo >> "$output_objdir/$my_dlsyms" "\ } }" fi echo >> "$output_objdir/$my_dlsyms" "\ LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = { {\"$my_originator\", (void *) 0}," if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ {\"@INIT@\", (void *) <_syminit}," fi case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) $my_pic_p && pic_flag_for_symtable=" $pic_flag" ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' # Transform the symbol file into the correct name. symfileobj=$output_objdir/${my_outputname}S.$objext case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for '$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $debug_cmd win32_libid_type=unknown win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then case $nm_interface in "MS dumpbin") if func_cygming_ms_implib_p "$1" || func_cygming_gnu_implib_p "$1" then win32_nmres=import else win32_nmres= fi ;; *) func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s|.*|import| p q } }'` ;; esac case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $debug_cmd sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $debug_cmd match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive that possess that section. Heuristic: eliminate # all those that have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $debug_cmd if func_cygming_gnu_implib_p "$1"; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1"; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result= fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $debug_cmd f_ex_an_ar_dir=$1; shift f_ex_an_ar_oldlib=$1 if test yes = "$lock_old_archive_extraction"; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test yes = "$lock_old_archive_extraction"; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $debug_cmd my_gentop=$1; shift my_oldlibs=${1+"$@"} my_oldobjs= my_xlib= my_xabs= my_xdir= for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib=$func_basename_result my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir=$my_gentop/$my_xlib_u func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` func_basename "$darwin_archive" darwin_base_archive=$func_basename_result darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches; do func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" cd "unfat-$$/$darwin_base_archive-$darwin_arch" func_extract_an_archive "`pwd`" "$darwin_base_archive" cd "$darwin_curdir" $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result=$my_oldobjs } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory where it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ that is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options that match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test yes = "$fast_install"; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else \$ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* declarations of non-ANSI functions */ #if defined __MINGW32__ # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined __CYGWIN__ # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined other_platform || defined ... */ #endif /* portability defines, excluding path handling macros */ #if defined _MSC_VER # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC #elif defined __MINGW32__ # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined __CYGWIN__ # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined other platforms ... */ #endif #if defined PATH_MAX # define LT_PATHMAX PATH_MAX #elif defined MAXPATHLEN # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ defined __OS2__ # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free (stale); stale = 0; } \ } while (0) #if defined LT_DEBUGWRAPPER static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; size_t tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined HAVE_DOS_BASED_FILE_SYSTEM if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined HAVE_DOS_BASED_FILE_SYSTEM } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = (size_t) (q - p); p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (STREQ (str, pat)) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else size_t len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { size_t orig_value_len = strlen (orig_value); size_t add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ size_t len = strlen (new_value); while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[--len] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $debug_cmd case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_suncc_cstd_abi # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! # Several compiler flags select an ABI that is incompatible with the # Cstd library. Avoid specifying it if any are in CXXFLAGS. func_suncc_cstd_abi () { $debug_cmd case " $compile_command " in *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) suncc_use_cstd_abi=no ;; *) suncc_use_cstd_abi=yes ;; esac } # func_mode_link arg... func_mode_link () { $debug_cmd case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # what system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll that has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=no ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= os2dllname= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=false prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module=$wl-single_module func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test yes != "$build_libtool_libs" \ && func_fatal_configuration "cannot build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg=$1 shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir=$arg prev= continue ;; dlfiles|dlprefiles) $preload || { # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=: } case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test no = "$dlself"; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test dlprefiles = "$prev"; then dlself=yes elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test dlfiles = "$prev"; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols=$arg test -f "$arg" \ || func_fatal_error "symbol file '$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex=$arg prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir=$arg prev= continue ;; mllvm) # Clang does not use LLVM to link, so we can simply discard any # '-mllvm $arg' options when doing the link step. prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result if test none != "$pic_object"; then # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object fi # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file '$arg' does not exist" fi arg=$save_arg prev= continue ;; os2dllname) os2dllname=$arg prev= continue ;; precious_regex) precious_files_regex=$arg prev= continue ;; release) release=-$arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test rpath = "$prev"; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds=$arg prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg=$arg case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "'-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test X-export-symbols = "X$arg"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between '-L' and '$1'" else func_fatal_error "need path for '-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of '$dir'" dir=$absdir ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test X-lc = "X$arg" || test X-lm = "X$arg"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test X-lc = "X$arg" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc due to us having libc/libc_r. test X-lc = "X$arg" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test X-lc = "X$arg" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test X-lc = "X$arg" && continue ;; esac elif test X-lc_r = "X$arg"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -mllvm) prev=mllvm continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module=$wl-multi_module continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "'-no-install' is ignored for $host" func_warning "assuming '-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -os2dllname) prev=os2dllname continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # -fstack-protector* stack protector flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization # -stdlib=* select c++ std lib with clang -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; -Z*) if test os2 = "`expr $host : '.*\(os2\)'`"; then # OS/2 uses -Zxxx to specify OS/2-specific options compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case $arg in -Zlinker | -Zstack) prev=xcompiler ;; esac continue else # Otherwise treat like 'Some other compiler flag' below func_quote_for_eval "$arg" arg=$func_quote_for_eval_result fi ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result test none = "$pic_object" || { # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object } # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test dlfiles = "$prev"; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test dlprefiles = "$prev"; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the '$prevarg' option requires an argument" if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname=$func_basename_result libobjs_save=$libobjs if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" # Definition is injected by LT_CONFIG during libtool generation. func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" func_dirname "$output" "/" "" output_objdir=$func_dirname_result$objdir func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test lib = "$linkmode"; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=false newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test lib,link = "$linkmode,$pass"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs=$tmp_deplibs fi if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass"; then libs=$deplibs deplibs= fi if test prog = "$linkmode"; then case $pass in dlopen) libs=$dlfiles ;; dlpreopen) libs=$dlprefiles ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test lib,dlpreopen = "$linkmode,$pass"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs=$dlprefiles fi if test dlopen = "$pass"; then # Collect dlpreopened libraries save_deplibs=$deplibs deplibs= fi for deplib in $libs; do lib= found=false case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test lib != "$linkmode" && test prog != "$linkmode"; then func_warning "'-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test lib = "$linkmode"; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib=$searchdir/lib$name$search_ext if test -f "$lib"; then if test .la = "$search_ext"; then found=: else found=false fi break 2 fi done done if $found; then # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll=$l done if test "X$ll" = "X$old_library"; then # only static version available found=false func_dirname "$lib" "" "." ladir=$func_dirname_result lib=$ladir/$old_library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi else # deplib doesn't seem to be a libtool library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi ;; # -l *.ltframework) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test conv = "$pass" && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi if test scan = "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "'-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test link = "$pass"; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=false case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=: fi ;; pass_all) valid_a_lib=: ;; esac if $valid_a_lib; then echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" else echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." fi ;; esac continue ;; prog) if test link != "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test conv = "$pass"; then deplibs="$deplib $deplibs" elif test prog = "$linkmode"; then if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=: continue ;; esac # case $deplib $found || test -f "$lib" \ || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "'$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir=$func_dirname_result dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass" || { test prog != "$linkmode" && test lib != "$linkmode"; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test conv = "$pass"; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for '$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" elif test prog != "$linkmode" && test lib != "$linkmode"; then func_fatal_error "'$lib' is not a convenience library" fi tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test yes = "$prefer_static_libs" || test built,no = "$prefer_static_libs,$installed"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib=$l done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for '$lib'" fi # This library was specified with -dlopen. if test dlopen = "$pass"; then test -z "$libdir" \ && func_fatal_error "cannot -dlopen a convenience library: '$lib'" if test -z "$dlname" || test yes != "$dlopen_support" || test no = "$build_libtool_libs" then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of '$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir=$ladir fi ;; esac func_basename "$lib" laname=$func_basename_result # Find the relevant object directory and library name. if test yes = "$installed"; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library '$lib' was moved." dir=$ladir absdir=$abs_ladir libdir=$abs_ladir else dir=$lt_sysroot$libdir absdir=$lt_sysroot$libdir fi test yes = "$hardcode_automatic" && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir=$ladir absdir=$abs_ladir # Remove this search path later func_append notinst_path " $abs_ladir" else dir=$ladir/$objdir absdir=$abs_ladir/$objdir # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test dlpreopen = "$pass"; then if test -z "$libdir" && test prog = "$linkmode"; then func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" fi case $host in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test lib = "$linkmode"; then deplibs="$dir/$old_library $deplibs" elif test prog,link = "$linkmode,$pass"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test prog = "$linkmode" && test link != "$pass"; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=false if test no != "$link_all_deplibs" || test -z "$library_names" || test no = "$build_libtool_libs"; then linkalldeplibs=: fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if $linkalldeplibs; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test prog,link = "$linkmode,$pass"; then if test -n "$library_names" && { { test no = "$prefer_static_libs" || test built,yes = "$prefer_static_libs,$installed"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then # Make sure the rpath contains only unique directories. case $temp_rpath: in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if $alldeplibs && { test pass_all = "$deplibs_check_method" || { test yes = "$build_libtool_libs" && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test built = "$use_static_libs" && test yes = "$installed"; then use_static_libs=no fi if test -n "$library_names" && { test no = "$use_static_libs" || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc* | *os2*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test no = "$installed"; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule= for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule=$dlpremoduletest break fi done if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then echo if test prog = "$linkmode"; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test lib = "$linkmode" && test yes = "$hardcode_into_libs"; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname=$1 shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname=$dlname elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc* | *os2*) func_arith $current - $age major=$func_arith_result versuffix=-$major ;; esac eval soname=\"$soname_spec\" else soname=$realname fi # Make a new name for the extract_expsyms_cmds to use soroot=$soname func_basename "$soroot" soname=$func_basename_result func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from '$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for '$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test prog = "$linkmode" || test relink != "$opt_mode"; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test no = "$hardcode_direct"; then add=$dir/$linklib case $host in *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; *-*-sysv4*uw2*) add_dir=-L$dir ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir=-L$dir ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we cannot # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library"; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add=$dir/$old_library fi elif test -n "$old_library"; then add=$dir/$old_library fi fi esac elif test no = "$hardcode_minus_L"; then case $host in *-*-sunos*) add_shlibpath=$dir ;; esac add_dir=-L$dir add=-l$name elif test no = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; relink) if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$dir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$absdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name elif test yes = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; *) lib_linked=no ;; esac if test yes != "$lib_linked"; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test prog = "$linkmode"; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test yes != "$hardcode_direct" && test yes != "$hardcode_minus_L" && test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test prog = "$linkmode" || test relink = "$opt_mode"; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$libdir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$libdir add=-l$name elif test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add=-l$name elif test yes = "$hardcode_automatic"; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib"; then add=$inst_prefix_dir$libdir/$linklib else add=$libdir/$linklib fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir=-L$libdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name fi if test prog = "$linkmode"; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test prog = "$linkmode"; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test unsupported != "$hardcode_direct"; then test -n "$old_library" && linklib=$old_library compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test yes = "$build_libtool_libs"; then # Not a shared library if test pass_all != "$deplibs_check_method"; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system cannot link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test yes = "$module"; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test lib = "$linkmode"; then if test -n "$dependency_libs" && { test yes != "$hardcode_into_libs" || test yes = "$build_old_libs" || test yes = "$link_static"; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs=$temp_deplibs fi func_append newlib_search_path " $absdir" # Link against this library test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test no != "$link_all_deplibs"; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path=$deplib ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of '$dir'" absdir=$dir fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names"; then for tmp in $deplibrary_names; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl"; then depdepl=$absdir/$objdir/$depdepl darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" path= fi fi ;; *) path=-L$absdir/$objdir ;; esac else eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "'$deplib' seems to be moved" path=-L$absdir fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test link = "$pass"; then if test prog = "$linkmode"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs=$newdependency_libs if test dlpreopen = "$pass"; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test dlopen != "$pass"; then test conv = "$pass" || { # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= } if test prog,link = "$linkmode,$pass"; then vars="compile_deplibs finalize_deplibs" else vars=deplibs fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Add Sun CC postdeps if required: test CXX = "$tagname" && { case $host_os in linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; solaris*) func_cc_basename "$CC" case $func_cc_basename_result in CC* | sunCC*) func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; esac } # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i= ;; esac if test -n "$i"; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test prog = "$linkmode"; then dlfiles=$newdlfiles fi if test prog = "$linkmode" || test lib = "$linkmode"; then dlprefiles=$newdlprefiles fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "'-R' is ignored for archives" test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "'-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "'-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs=$output func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form 'libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test no = "$module" \ && func_fatal_help "libtool library '$output' must begin with 'lib'" if test no != "$need_lib_prefix"; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test pass_all != "$deplibs_check_method"; then func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test no = "$dlself" \ || func_warning "'-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test 1 -lt "$#" \ && func_warning "ignoring multiple '-rpath's for a libtool library" install_libdir=$1 oldlibs= if test -z "$rpath"; then if test yes = "$build_libtool_libs"; then # Building a libtool convenience library. # Some compilers have problems with a '.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "'-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs=$IFS; IFS=: set dummy $vinfo 0 0 0 shift IFS=$save_ifs test -n "$7" && \ func_fatal_help "too many parameters to '-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major=$1 number_minor=$2 number_revision=$3 # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # that has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|freebsd-elf|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_revision ;; freebsd-aout|qnx|sunos) current=$number_major revision=$number_minor age=0 ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_minor lt_irix_increment=no ;; esac ;; no) current=$1 revision=$2 age=$3 ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT '$current' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION '$revision' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE '$age' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE '$age' is greater than the current interface number '$current'" func_fatal_error "'$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" # On Darwin other compilers case $CC in nagfor*) verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" ;; *) verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; esac ;; freebsd-aout) major=.$current versuffix=.$current.$revision ;; freebsd-elf) func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; irix | nonstopux) if test no = "$lt_irix_increment"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring=$verstring_prefix$major.$revision # Add in all the interfaces that we are compatible with. loop=$revision while test 0 -ne "$loop"; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring_prefix$major.$iface:$verstring done # Before this point, $major must not contain '.'. major=.$major versuffix=$major.$revision ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=.$current.$age.$revision verstring=$current.$age.$revision # Add in all the interfaces that we are compatible with. loop=$age while test 0 -ne "$loop"; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring:$iface.0 done # Make executables depend on our current version. func_append verstring ":$current.0" ;; qnx) major=.$current versuffix=.$current ;; sco) major=.$current versuffix=.$current ;; sunos) major=.$current versuffix=.$current.$revision ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 file systems. func_arith $current - $age major=$func_arith_result versuffix=-$major ;; *) func_fatal_configuration "unknown library version type '$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring=0.0 ;; esac if test no = "$need_version"; then versuffix= else versuffix=.0.0 fi fi # Remove version info from name if versioning should be avoided if test yes,no = "$avoid_version,$need_version"; then major= versuffix= verstring= fi # Check to see if the archive will have undefined symbols. if test yes = "$allow_undefined"; then if test unsupported = "$allow_undefined_flag"; then if test yes = "$build_old_libs"; then func_warning "undefined symbols not allowed in $host shared libraries; building static only" build_libtool_libs=no else func_fatal_error "can't build $host shared library unless -no-undefined is specified" fi fi else # Don't allow undefined symbols. allow_undefined_flag=$no_undefined_flag fi fi func_generate_dlsyms "$libname" "$libname" : func_append libobjs " $symfileobj" test " " = "$libobjs" && libobjs= if test relink != "$opt_mode"; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) if test -n "$precious_files_regex"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles=$dlfiles dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles=$dlprefiles dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test yes = "$build_libtool_libs"; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test yes = "$build_libtool_need_lc"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release= versuffix= major= newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib=$potent_lib while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | $SED 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib= ;; esac fi if test -n "$a_deplib"; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib=$potent_lib # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs= tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test yes = "$allow_libtool_libs_with_static_runtimes"; then for i in $predeps $postdeps; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test none = "$deplibs_check_method"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test yes = "$droppeddeps"; then if test yes = "$module"; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test no = "$allow_undefined"; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs=$new_libs # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test yes = "$build_libtool_libs"; then # Remove $wl instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test yes = "$hardcode_into_libs"; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath=$finalize_rpath test relink = "$opt_mode" || rpath=$compile_rpath$rpath for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath=$finalize_shlibpath test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname=$1 shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname=$realname fi if test -z "$dlname"; then dlname=$soname fi lib=$output_objdir/$realname linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols=$output_objdir/$libname.uexp func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile func_dll_def_p "$export_symbols" || { # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols=$export_symbols export_symbols= always_export_symbols=yes } fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs=$IFS; IFS='~' for cmd1 in $cmds; do IFS=$save_ifs # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test yes = "$try_normal_branch" \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=$output_objdir/$output_la.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS=$save_ifs if test -n "$export_symbols_regex" && test : != "$skipped_export"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test : != "$skipped_export" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs=$tmp_deplibs if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test yes = "$compiler_needs_object" && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test : != "$skipped_export" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then output=$output_objdir/$output_la.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then output=$output_objdir/$output_la.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test yes = "$compiler_needs_object"; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-$k.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test -z "$objlist" || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test 1 -eq "$k"; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-$k.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-$k.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi ${skipped_export-false} && { func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi } test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs=$IFS; IFS='~' for cmd in $concat_cmds; do IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi ${skipped_export-false} && { if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi } libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs=$IFS; IFS='~' for cmd in $cmds; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs # Restore the uninstalled library and exit if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test yes = "$module" || test yes = "$export_dynamic"; then # On all known operating systems, these are identical. dlname=$soname fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "'-R' is ignored for objects" test -n "$vinfo" && \ func_warning "'-version-info' is ignored for objects" test -n "$release" && \ func_warning "'-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object '$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj=$output ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # if reload_cmds runs $LD directly, get rid of -Wl from # whole_archive_flag_spec and hope we can get by with turning comma # into space. case $reload_cmds in *\$LD[\ \$]*) wl= ;; esac if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags else gentop=$output_objdir/${obj}x func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test yes = "$build_libtool_libs" || libobjs=$non_pic_objects # Create the old-style object. reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs output=$obj func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi test yes = "$build_libtool_libs" || { if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS } if test -n "$pic_flag" || test default != "$pic_mode"; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output=$libobj func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "'-version-info' is ignored for programs" test -n "$release" && \ func_warning "'-release' is ignored for programs" $preload \ && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test CXX = "$tagname"; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " $wl-bind_at_load" func_append finalize_command " $wl-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs=$new_libs func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath=$rpath rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath=$rpath if test -n "$libobjs" && test yes = "$build_old_libs"; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" false # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=: case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=false ;; *cygwin* | *mingw* ) test yes = "$build_libtool_libs" || wrappers_required=false ;; *) if test no = "$need_relink" || test yes != "$build_libtool_libs"; then wrappers_required=false fi ;; esac $wrappers_required || { # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command=$compile_command$compile_rpath # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.$objext"; then func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' fi exit $exit_status } if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test yes = "$no_install"; then # We don't need to create a wrapper script. link_command=$compile_var$compile_command$compile_rpath # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi case $hardcode_action,$fast_install in relink,*) # Fast installation is not supported link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath func_warning "this platform does not like uninstalled shared libraries" func_warning "'$output' will be relinked during installation" ;; *,yes) link_command=$finalize_var$compile_command$finalize_rpath relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` ;; *,no) link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath ;; *,needless) link_command=$finalize_var$compile_command$finalize_rpath relink_command= ;; esac # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource=$output_path/$objdir/lt-$output_name.c cwrapper=$output_path/$output_name.exe $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host"; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do case $build_libtool_libs in convenience) oldobjs="$libobjs_save $symfileobj" addlibs=$convenience build_libtool_libs=no ;; module) oldobjs=$libobjs_save addlibs=$old_convenience build_libtool_libs=no ;; *) oldobjs="$old_deplibs $non_pic_objects" $preload && test -f "$symfileobj" \ && func_append oldobjs " $symfileobj" addlibs=$old_convenience ;; esac if test -n "$addlibs"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase=$func_basename_result case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj"; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test -z "$oldobjs"; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test yes = "$build_old_libs" && old_library=$libname.$libext func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test yes = "$hardcode_automatic"; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test yes = "$installed"; then if test -z "$install_libdir"; then break fi output=$output_objdir/${outputname}i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name=$func_basename_result func_resolve_sysroot "$deplib" eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs=$newdependency_libs newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles=$newdlprefiles else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles=$newdlprefiles fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test -n "$bindir"; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result/$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that cannot go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test no,yes = "$installed,$need_relink"; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } if test link = "$opt_mode" || test relink = "$opt_mode"; then func_mode_link ${1+"$@"} fi # func_mode_uninstall arg... func_mode_uninstall () { $debug_cmd RM=$nonopt files= rmforce=false exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic for arg do case $arg in -f) func_append RM " $arg"; rmforce=: ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir=$func_dirname_result if test . = "$dir"; then odir=$objdir else odir=$dir/$objdir fi func_basename "$file" name=$func_basename_result test uninstall = "$opt_mode" && odir=$dir # Remember odir for removal later, being careful to avoid duplicates if test clean = "$opt_mode"; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif $rmforce; then continue fi rmfiles=$file case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case $opt_mode in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test none != "$pic_object"; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test none != "$non_pic_object"; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test clean = "$opt_mode"; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.$objext" if test yes = "$fast_install" && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name"; then func_append rmfiles " $odir/lt-$noexename.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the $objdir's in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then func_mode_uninstall ${1+"$@"} fi test -z "$opt_mode" && { help=$generic_help func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode '$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # where we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: neuron-7.6.3/makedist000077500000000000000000000025721340731477100146010ustar00rootroot00000000000000#!/bin/sh ver="`sed -n 's/.*iv_hines_version \(.*\)/\1/p' < src/include/ivversion.h`" IV=iv-${ver} echo $IV if false ; then #from the cvs archive cd $HOME/tmp /bin/rm -r -f ${IV} cvs -d :ext:anonymous@www.neuron.yale.edu:/home/cvsroot export -D "now" -r iv-rel15 -d ${IV} iv cd ${IV} aclocal autoheader autoconf cd .. tar cf ${IV}.tar ${IV} gzip ${IV}.tar /bin/mv ${IV}.tar.z $HOME/nrndev/iv/${IV}.tar.gz else # from this working directory /bin/rm iv.zip zip iv.zip `find src -name \*.cpp -print` zip iv.zip `find src -name \*.c -print` zip iv.zip `find src -name \*.h -print` zip iv.zip `find src -name \*.bm -print` zip iv.zip `find src -name \*.in -print` zip iv.zip Makefile.in config.h.in configure.in zip iv.zip \ src/lib/TIFF/Copyright \ src/lib/TIFF/HOWTO \ src/lib/TIFF/README \ src/lib/TIFF/VERSION \ src/lib/app-defaults/Idemo \ src/lib/app-defaults/Doc \ src/lib/app-defaults/InterViews \ src/include/Dispatch/_gendefs \ src/include/InterViews/_gendefs \ src/include/OS/_gendefs \ src/include/Unidraw/_gendefs \ Copyright \ INSTALL \ README \ acinclude.m4 \ build.sh \ chkstream.m4 \ config.guess \ config.sub \ install-sh \ ltmain.sh \ mkinstalldirs \ aclocal.m4 \ iv_def.h \ makedist \ configure /bin/rm -r -f tmpdist mkdir tmpdist mkdir tmpdist/${IV} cd tmpdist/${IV} unzip ../../iv.zip cd .. tar cf ${IV}.tar ${IV} gzip ${IV}.tar mv ${IV}.tar.gz .. cd .. mv iv.zip ${IV}.zip fi neuron-7.6.3/mkinstalldirs000077500000000000000000000013201340731477100156460ustar00rootroot00000000000000#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain # $Id: mkinstalldirs 1341 2003-02-11 20:21:16Z eamonn $ 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 neuron-7.6.3/src/000077500000000000000000000000001340731477100136335ustar00rootroot00000000000000neuron-7.6.3/src/Makefile.in000077500000000000000000000034341340731477100157070ustar00rootroot00000000000000SHELL = @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 = .. @SET_MAKE@ SUBDIRS = lib include bin subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status # 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. all install clean mostlyclean uninstall: @topdir=`pwd`; \ for dir in $(SUBDIRS); do \ echo "Making $@ in $$dir"; \ cd $$dir; \ $(MAKE) $@; \ cd $$topdir; \ done distclean: @topdir=`pwd`; \ for dir in $(SUBDIRS); do \ echo "Making $@ in $$dir"; \ cd $$dir; \ $(MAKE) $@; \ cd $$topdir; \ done rm -f Makefile .PHONY: all install clean mostlyclean distclean uninstall # 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: neuron-7.6.3/src/bin/000077500000000000000000000000001340731477100144035ustar00rootroot00000000000000neuron-7.6.3/src/bin/Makefile.in000077500000000000000000000040051340731477100164520ustar00rootroot00000000000000SHELL = @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 = ../.. @SET_MAKE@ @CARBON_FALSE@@CYGWIN_FALSE@@MINGW_FALSE@SUBDIRS = iclass idemo idraw @CYGWIN_TRUE@SUBDIRS = idemo @MINGW_TRUE@SUBDIRS = idemo @CARBON_TRUE@SUBDIRS = idemo subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status # 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. all install clean mostlyclean uninstall: @topdir=`pwd`; \ for dir in $(SUBDIRS); do \ echo "Making $@ in $$dir"; \ cd $$dir; \ $(MAKE) $@; \ cd $$topdir; \ done distclean: @topdir=`pwd`; \ for dir in $(SUBDIRS); do \ echo "Making $@ in $$dir"; \ cd $$dir; \ $(MAKE) $@; \ cd $$topdir; \ done rm -f Makefile .PHONY: all install clean mostlyclean distclean uninstall # 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: neuron-7.6.3/src/bin/iclass/000077500000000000000000000000001340731477100156615ustar00rootroot00000000000000neuron-7.6.3/src/bin/iclass/Makefile.in000077500000000000000000000052531340731477100177360ustar00rootroot00000000000000# Makefile.in generated automatically by automake 1.4a from Makefile.am # Well, it used to be generated by automake, but automake can't handle files # in subdirectories very well so I got rid of it. SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_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 = ../../.. INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_FLAG = NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : @SET_MAKE@ CC = @CC@ CXX = @CXX@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ RANLIB = @RANLIB@ INCLUDES = -I../../include/IV-2_6 -I../../include $(X_CFLAGS) IVLIBS = ../../lib/libIVhines.la ../../lib/libUnidrawhines.la $(X_LIBS) # # Lists of objects that go into the libraries: # ICLASS_OBJECTS = classbuffer.o classeditor.o classinfo.o dialogs.o \ direct.o globals.o iclass.o main.o subdir = src/bin/iclass mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = DEFS = @DEFS@ -I. -I$(srcdir) -Div2_6_compatible CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ X_CFLAGS = @X_CFLAGS@ X_LIBS = @X_LIBS@ -lX11 -lXext X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) LTCCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) CCOMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) CXXFLAGS = @CXXFLAGS@ CFLAGS = @CFLAGS@ CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(CXXFLAGS) $(LDFLAGS) DATA = $(data_DATA) PACKAGE = @PACKAGE@ VERSION = @VERSION@ all: iclass .SUFFIXES: .cpp .o Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status clean: rm -f *.o iclass rm -rf .libs distclean: clean rm -f Makefile install: iclass $(mkinstalldirs) $(DESTDIR)$(bindir) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) iclass $(DESTDIR)$(bindir)/iclass uninstall: $(LIBTOOL) --mode=uninstall $(DESTDIR)$(bindir)/iclass .cpp.o: $(CXXCOMPILE) -c -o $@ $< iclass: $(ICLASS_OBJECTS) $(CXXLINK) -o $@ $(ICLASS_OBJECTS) $(IVLIBS) $(LIBS) .PHONY: all clean distclean install uninstall neuron-7.6.3/src/bin/iclass/classbuffer.cpp000066400000000000000000000245311340731477100206710ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1989 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * ClassBuffer implementation. */ #undef UMK #define UMK 1 // for cray #include "classbuffer.h" #include "classinfo.h" #include "direct.h" #include "globals.h" #include #include #include #include #include #include #include #include #include #include #ifndef S_ISDIR #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) #endif /*****************************************************************************/ static const int MINTEXTSIZE = 10000; /*****************************************************************************/ class Classes { public: Classes(); ~Classes(); void Include(ClassInfo*); ClassInfo* Class(int index); ClassInfo* Find(const char* className); void Clear(); private: void Insert(ClassInfo*, int index); void Remove(int index); int Index(ClassInfo*); int Position(ClassInfo*); private: ClassInfo** _buf; int _bufsize; int _count; }; Classes::Classes () { const int defaultSize = 64; _bufsize = defaultSize; _buf = new ClassInfo*[_bufsize]; _count = 0; } Classes::~Classes () { Clear(); delete _buf; } void Classes::Include (ClassInfo* info) { Insert(info, Position(info)); } ClassInfo* Classes::Class (int index) { return (0 <= index && index < _count) ? _buf[index] : nil; } ClassInfo* Classes::Find (const char* className) { for (int i = 0; i < _count; ++i) { if (strcmp(className, _buf[i]->Name()) == 0) { return _buf[i]; } } return nil; } void Classes::Insert (ClassInfo* info, int index) { BufInsert(info, index, (const void**&) _buf, _bufsize, _count); } void Classes::Remove (int index) { if (0 <= index && index < _count) { BufRemove(index, (const void**) _buf, _count); } } int Classes::Index (ClassInfo* info) { for (int i = 0; i < _count; ++i) { if (info == _buf[i]) { return i; } } return -1; } int Classes::Position (ClassInfo* info) { for (int i = 0; i < _count; ++i) { if (strcmp(info->Name(), _buf[i]->Name()) < 0) { return i; } } return _count; } void Classes::Clear () { for (int i = 0; i < _count; ++i) { delete _buf[i]; } _count = 0; } /*****************************************************************************/ ClassBuffer::ClassBuffer ( bool recursive, bool verbose, bool CPlusPlusFiles ) { _classes = new Classes; _recursive = recursive; _verbose = verbose; _CPlusPlusFiles = CPlusPlusFiles; } ClassBuffer::~ClassBuffer () { delete _classes; } const char* ClassBuffer::Class (int index) { ClassInfo* info = _classes->Class(index); return (info == nil) ? nil : info->Name(); } const char* ClassBuffer::Parent (const char* className, int index) { ClassInfo* info = _classes->Find(className); ClassInfo* parentInfo = (info == nil) ? nil : info->Parent(index); return (parentInfo == nil) ? nil : parentInfo->Name(); } const char* ClassBuffer::Child (const char* className, int index) { ClassInfo* info = _classes->Find(className); ClassInfo* childInfo = (info == nil) ? nil : info->Child(index); return (childInfo == nil) ? nil : childInfo->Name(); } const char* ClassBuffer::Path (const char* className) { ClassInfo* info = _classes->Find(className); return (info == nil) ? nil : info->Path(); } int ClassBuffer::LineNumber (const char* className) { ClassInfo* info = _classes->Find(className); return (info == nil) ? nil : info->LineNumber(); } ClassInfo* ClassBuffer::Info (const char* className) { return _classes->Find(className); } inline bool DotOrDotDot (const char* dir) { return strcmp(dir, ".") == 0 || strcmp(dir, "..") == 0; } inline bool HeaderFile (const char* file) { int length = strlen(file); return file[length-1] == 'h' && file[length-2] == '.'; } inline bool CPlusPlusFile (const char* file) { int length = strlen(file); return file[length-1] == 'C' && file[length-2] == '.'; } static bool IsADirectory (const char* path, struct stat& filestats) { stat(path, &filestats); return S_ISDIR(filestats.st_mode); } void ClassBuffer::Search (const char* path) { struct stat filestats; if (IsADirectory(path, filestats)) { if (_recursive) { SearchDirs(path); } else { SearchDir(path); } } else if (HeaderFile(path) || (_CPlusPlusFiles && CPlusPlusFile(path))) { SearchFile(path, filestats); } } void ClassBuffer::SearchDir (const char* path) { Directory dir(path); if (_verbose) { printf("searching directory %s\n", path); } for (int i = 0; i < dir.Count(); ++i) { const char* file = dir.File(i); if (HeaderFile(file) || (_CPlusPlusFiles && CPlusPlusFile(path))) { struct stat filestats; char filePath[MAXPATHLEN+1]; strcpy(filePath, dir.Normalize(path)); strcat(filePath, file); if (!IsADirectory(filePath, filestats)) { SearchFile(filePath, filestats); } } } } void ClassBuffer::SearchDirs (const char* path) { Directory dir(path); if (_verbose) { printf("recursively searching directory %s\n", path); } for (int i = 0; i < dir.Count(); ++i) { const char* file = dir.File(i); if (!DotOrDotDot(file)) { char filePath[MAXPATHLEN+1]; strcpy(filePath, dir.Normalize(path)); strcat(filePath, file); Search(filePath); } } } #include #include #include void ClassBuffer::SearchFile (const char* path, struct stat&) { InputFile* f = InputFile::open(path); if (f == nil) { return; } const char* buf; int len = f->read(buf); if (len <= 0) { return; } if (_verbose) { printf("searching file %s size %d\n", path, len); } /* * stupid regular expression requires writable strings to guarantee * null-termination */ char* tbuf = new char[len + 1]; Memory::copy(buf, tbuf, len); tbuf[len] = '\0'; TextBuffer textbuf(tbuf, len, len); SearchTextBuffer(&textbuf, path); delete [] tbuf; f->close(); delete f; } void ClassBuffer::SearchTextBuffer (TextBuffer* tb, const char* path) { int beg = 0; for (;;) { char* className = FindClassDecl(tb, beg); if (className == nil) { break; } ClassInfo* info = _classes->Find(className); if (info == nil) { info = new ClassInfo(className, path, tb->LineNumber(beg)); _classes->Include(info); } else { info->Path(path); info->LineNumber(tb->LineNumber(beg)); } for (;;) { char* parentName = ParentName(tb, beg); if (parentName == nil) { break; } ClassInfo* parentInfo = _classes->Find(parentName); if (parentInfo == nil) { parentInfo = new ClassInfo(parentName); _classes->Include(parentInfo); } info->IncludeParent(parentInfo); parentInfo->IncludeChild(info); delete parentName; } delete className; } } inline bool KeyWord (const char* string) { return strcmp(string, "public") == 0 || strcmp(string, "protected") == 0 || strcmp(string, "private") == 0 || strcmp(string, "virtual") == 0; } char* ClassBuffer::ParentName (TextBuffer* tb, int& beg) { Regexp delimiter("{"); int delim = tb->ForwardSearch(&delimiter, beg); if (delim < 0) { return nil; } for (;;) { char* string = Identifier(tb, beg); if (string == nil || beg >= delim) { delete string; beg = delim; return nil; } else if (KeyWord(string)) { delete string; string = nil; } else { return string; } } } char* ClassBuffer::FindClassDecl (TextBuffer* tb, int& beg) { Regexp classKeyWord("^class[ $]"); Regexp delimiter("[:{;]"); char* className = nil; for (;;) { beg = tb->ForwardSearch(&classKeyWord, beg); if (beg < 0) { break; } int tmp = beg; int delim = tb->ForwardSearch(&delimiter, tmp); if (delim >= 0 && *tb->Text(delim-1) != ';') { className = Identifier(tb, beg); break; } } return className; } inline bool IsValidChar (char c) { return isalpha(c) || c == '_' || c == '$'; } char* ClassBuffer::Identifier (TextBuffer* tb, int& beg) { int i, j; const char* text = tb->Text(); char* string = nil; for (i = beg; i < tb->Length(); ++i) { if (IsValidChar(text[i])) { break; } } for (j = i+1; j < tb->Length(); ++j) { char c = text[j]; if (!IsValidChar(c) && !isdigit(c)) { break; } } if (j < tb->Length()) { string = strnnew(&text[i], j-i); beg = j; } return string; } neuron-7.6.3/src/bin/iclass/classbuffer.h000066400000000000000000000043701340731477100203350ustar00rootroot00000000000000/* * Copyright (c) 1989 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * ClassBuffer - caches information about class hierarchies from header files. */ #ifndef classbuffer_h #define classbuffer_h #include #include #include #include class Classes; class ClassInfo; class TextBuffer; class ClassBuffer { public: ClassBuffer( bool recursive = false, bool verbose = false, bool CPlusPlusFiles = false ); virtual ~ClassBuffer(); void Search(const char* path); const char* Class(int index); const char* Parent(const char* classname, int index = 0); const char* Child(const char*, int index = 0); const char* Path(const char*); int LineNumber(const char*); ClassInfo* Info(const char*); private: void SearchDir(const char* path); void SearchDirs(const char* path); void SearchFile(const char* path, struct stat&); void SearchTextBuffer(TextBuffer*, const char* path); char* FindClassDecl(TextBuffer*, int&); char* ParentName(TextBuffer*, int&); char* Identifier(TextBuffer*, int&); private: Classes* _classes; bool _recursive, _verbose, _CPlusPlusFiles; }; #endif neuron-7.6.3/src/bin/iclass/classeditor.cpp000066400000000000000000000120121340731477100206750ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1989 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * ClassEditor implementation */ #include "classeditor.h" #include #include #include #include #include #include /*****************************************************************************/ static const char FirstLine = 'g'; static const char LastLine = 'G'; static const char NextLine = 'n'; static const char PrevLine= 'p'; static const char ScrollDown = 'j'; static const char ScrollUp = 'k'; static const char PageDown = ' '; static const char PageUp = 'b'; static const char HalfPageDown = 'd'; static const char HalfPageUp = 'u'; /*****************************************************************************/ ClassEditor::ClassEditor ( ButtonState* bs, int r, int c, int t, int h, const char* done ) : TextEditor(r, c, t, h) { Init(bs, done); } ClassEditor::ClassEditor ( ButtonState* bs, const char* name, int r, int c, int t, int h, const char* done ) : TextEditor(name, r, c, t, h) { Init(bs, done); } void ClassEditor::Init (ButtonState* bs, const char* done) { SetClassName("ClassEditor"); input = new Sensor; input->Catch(DownEvent); input->Catch(KeyEvent); _state = bs; _done = done; } void ClassEditor::ScrollBy (int lines) { TextEditor::ScrollBy(0, -lines*shape->vunits); // explicit TextEditor:: works around cfront 1.2 bug int line = text->LineNumber(Dot()); Coord b = display->Base(line); Coord t = display->Top(line); if (b < 0) { Select(Locate(0, 0)); } else if (t > ymax) { Select(Locate(0, ymax)); } } void ClassEditor::Handle (Event& e) { if (e.eventType == KeyEvent) { HandleKeyEvent(e); } else { bool done = false; do { switch (e.eventType) { case DownEvent: done = HandleDownEvent(e); break; case KeyEvent: done = HandleKeyEvent(e); break; } if (!done) { Read(e); } } while (!done); } } bool ClassEditor::HandleKeyEvent (Event& e) { bool done = false; if (e.len != 0) { done = HandleChar(e.keystring[0]); } return done; } bool ClassEditor::HandleDownEvent (Event& e) { bool done = true; if (e.target == this) { switch (e.button) { case LEFTMOUSE: Select(Locate(e.x, e.y)); done = false; break; case MIDDLEMOUSE: GrabScroll(e); break; case RIGHTMOUSE: RateScroll(e); break; } } else { UnRead(e); } return done; } bool ClassEditor::HandleChar (char c) { bool done = false; int lines = display->LineNumber(0) - display->LineNumber(ymax) + 1; int i; switch (c) { case FirstLine: BeginningOfText(); ScrollToSelection(); break; case LastLine: EndOfText(); ScrollToSelection(); break; case PrevLine: BackwardLine(); ScrollToSelection(); break; case NextLine: ForwardLine(); ScrollToSelection(); break; case PageDown: ForwardPage(); ScrollToSelection(); break; case PageUp: BackwardPage(1); ScrollToSelection(); break; case HalfPageDown: ForwardLine(lines/2); ScrollToSelection(); break; case HalfPageUp: BackwardLine(lines/2); ScrollToSelection(); break; case ScrollDown: ScrollBy(1); break; case ScrollUp: ScrollBy(-1); break; default: for (i = 0; _done[i] != '\0'; ++i) { if (c == _done[i]) { _state->SetValue(c); done = true; } } break; } return done; } neuron-7.6.3/src/bin/iclass/classeditor.h000066400000000000000000000036101340731477100203460ustar00rootroot00000000000000/* * Copyright (c) 1989 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * ClassEditor - edits a class definition */ #ifndef classeditor_h #define classeditor_h #include static const char* CEDone = "\r\t\007\033"; class ButtonState; class ClassEditor : public TextEditor { public: ClassEditor( ButtonState*, int rows, int cols, int tab, int highlight, const char* done = CEDone ); ClassEditor( ButtonState*, const char* name, int r, int c, int t, int h, const char* done = CEDone ); void ScrollBy(int lines); virtual void Handle(Event&); private: bool HandleDownEvent(Event&); bool HandleKeyEvent(Event&); bool HandleChar(char); private: void Init(ButtonState*, const char*); private: const char* _done; ButtonState* _state; }; #endif neuron-7.6.3/src/bin/iclass/classinfo.cpp000077500000000000000000000073331340731477100203570ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1989 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * ClassInfo implementation. */ #include "classinfo.h" #include "globals.h" #include #include /*****************************************************************************/ ClassInfo::ClassInfo (const char* name, const char* path, int lineno) { const int defaultSize = 8; _name = strnew(name); _path = nil; _lineno = lineno; Path(path); _childbufsize = _parentbufsize = defaultSize; _childbuf = new ClassInfo*[_childbufsize]; _parentbuf = new ClassInfo*[_parentbufsize]; _childcount = _parentcount = 0; } ClassInfo::~ClassInfo () { delete _name; delete _path; delete _childbuf; delete _parentbuf; } void ClassInfo::Path (const char* path) { delete _path; _path = (path == nil) ? nil : strnew(path); } void ClassInfo::IncludeChild (ClassInfo* child) { Insert( child, Position(child, _childbuf, _childcount), _childbuf, _childbufsize, _childcount ); } void ClassInfo::IncludeParent (ClassInfo* parent) { Insert( parent, Position(parent, _parentbuf, _parentcount), _parentbuf, _parentbufsize, _parentcount ); } int ClassInfo::ChildIndex (const char* child) { return Index(child, _childbuf, _childcount); } int ClassInfo::ParentIndex (const char* parent) { return Index(parent, _parentbuf, _parentcount); } ClassInfo* ClassInfo::Child (int index) { return Info(index, _childbuf, _childcount); } ClassInfo* ClassInfo::Parent (int index) { return Info(index, _parentbuf, _parentcount); } void ClassInfo::Insert ( ClassInfo* info, int index, ClassInfo**& buf, int& bufsize, int& count ) { BufInsert(info, index, (const void**&) buf, bufsize, count); } void ClassInfo::Remove (int index, ClassInfo** buf, int& count) { if (0 <= index && index < count) { BufRemove(index, (const void**) buf, count); } } int ClassInfo::Index (const char* s, ClassInfo** buf, int count) { for (int i = 0; i < count; ++i) { if (strcmp(s, buf[i]->Name()) == 0) { return i; } } return -1; } ClassInfo* ClassInfo::Info (int index, ClassInfo** buf, int count) { return (0 <= index && index < count) ? buf[index] : nil; } int ClassInfo::Position (ClassInfo* info, ClassInfo** buf, int count) { for (int i = 0; i < count; ++i) { if (strcmp(info->Name(), buf[i]->Name()) < 0) { return i; } } return count; } void ClassInfo::Clear (ClassInfo** buf, int count) { for (int i = 0; i < count; ++i) { delete buf[i]; } count = 0; } neuron-7.6.3/src/bin/iclass/classinfo.h000077500000000000000000000047111340731477100200210ustar00rootroot00000000000000/* * Copyright (c) 1989 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * ClassInfo - an object containing information about a class. */ #ifndef classinfo_h #define classinfo_h #include class ClassInfo { public: ClassInfo(const char* className, const char* path = "", int lineno = 1); ~ClassInfo(); const char* Name(); const char* Path(); void Path(const char*); int LineNumber(); void LineNumber(int); void IncludeChild(ClassInfo*); void IncludeParent(ClassInfo*); int ChildIndex(const char* child); int ParentIndex(const char* parent); ClassInfo* Child(int index); ClassInfo* Parent(int index); private: void Insert(ClassInfo*, int index, ClassInfo**&, int&, int&); void Remove(int index, ClassInfo**, int&); int Index(const char*, ClassInfo**, int); ClassInfo* Info(int index, ClassInfo**, int); int Position(ClassInfo*, ClassInfo**, int); void Clear(ClassInfo**, int); private: char* _name; char* _path; int _lineno; ClassInfo** _childbuf; int _childbufsize; int _childcount; ClassInfo** _parentbuf; int _parentbufsize; int _parentcount; }; inline const char* ClassInfo::Name () { return _name; } inline const char* ClassInfo::Path () { return _path; } inline int ClassInfo::LineNumber () { return _lineno; } inline void ClassInfo::LineNumber (int n) { _lineno = n; } #endif neuron-7.6.3/src/bin/iclass/dialogs.cpp000066400000000000000000000236621340731477100200200ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1989 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of various dialogs boxes. */ #include "dialogs.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_OSFCN_H #include #endif #ifdef HAVE_UNISTD_H #include #else // #if !defined(AIXV3) && !defined(hpux) && !defined(sun) && !defined(sgi) /* sigh, not all systems have this prototype */ extern "C" { char* getcwd(char*, size_t); } #endif /*****************************************************************************/ static const float fspace = .375; // space in cm static const int MAX_PATH_LENGTH = 256; /*****************************************************************************/ BasicDialog::BasicDialog () : Dialog(new ButtonState, nil) { input = new Sensor; input->Catch(KeyEvent); } bool BasicDialog::Accept () { Event e; int v = 0; state->SetValue(0); do { Read(e); if (e.target == nil) { break; } if (!KeyEquiv(e)) { Forward(e); } state->GetValue(v); } while (v == 0); return v == '\r'; } void BasicDialog::Forward (Event& e) { Coord x = e.x, y = e.y; e.target->GetRelative(x, y, this); if (x >= 0 && y >= 0 && x <= xmax && y <= ymax) { e.target->Handle(e); } } bool BasicDialog::KeyEquiv (Event& e) { bool keyEquiv = false; if (e.eventType == KeyEvent && e.len > 0) { char c = e.keystring[0]; if (c == '\r' || c == '\004' || c == '\007' || c == '\033') { state->SetValue(c); keyEquiv = true; } } return keyEquiv; } /*****************************************************************************/ AcknowledgeDialog::AcknowledgeDialog (const char* msg, const char* btnLbl) { int space = iv26_round(fspace*cm); Insert( new MarginFrame( new VBox( new Message(msg), new VGlue(space), new HBox( new HGlue, new PushButton(btnLbl, state, '\r'), new HGlue ) ), space, space, 0 ) ); } void AcknowledgeDialog::Acknowledge () { Event e; int v = 0; state->SetValue(v); do { Read(e); if (e.target == nil) { break; } if (!KeyEquiv(e)) { Forward(e); } state->GetValue(v); } while (v == 0); } /*****************************************************************************/ ConfirmDialog::ConfirmDialog (const char* msg) { Insert(Interior(msg)); input = new Sensor(noEvents); input->Catch(KeyEvent); } inline bool Confirmed (int v) { return v == 'y' || v == 'n' || v == '\007'; } char ConfirmDialog::Confirm () { Event e; int v = 0; state->SetValue(v); do { Read(e); if (e.target == nil) { break; } if (e.eventType == KeyEvent) { state->SetValue(e.keystring[0]); } else { Forward(e); } state->GetValue(v); } while (!Confirmed(v)); return v; } Interactor* ConfirmDialog::Interior (const char* msg) { const int space = iv26_round(.5*cm); return new MarginFrame( new VBox( new HBox(new Message(msg), new HGlue), new VGlue(space), new HBox( new HGlue, new PushButton(" Yes ", state, 'y'), new HGlue(space, 0), new PushButton(" No ", state, 'n'), new HGlue(space, 0), new PushButton("Cancel", state, '\007'), new HGlue ) ), space, space/2, 0 ); } /*****************************************************************************/ StringDialog::StringDialog ( const char* msg, const char* sample, const char* confirmLbl ) { Init(msg, confirmLbl); _sedit->Message(sample); } StringDialog::StringDialog ( const char* msg, int width, const char* confirmLbl ) { Init(msg, confirmLbl, width); } void StringDialog::Select () { _sedit->Select(0, strlen(_sedit->Text())); } void StringDialog::Select (int pos) { _sedit->Select(pos); } void StringDialog::Select (int left, int right) { _sedit->Select(left, right);} void StringDialog::Init (const char* msg, const char* confirmLbl, int width) { int space = iv26_round(fspace*cm); _sedit = new StringEditor(state, ""); HBox* framedSedit = new HBox; if (width == 0) { framedSedit->Insert(_sedit); } else { framedSedit->Insert(new HGlue); framedSedit->Insert( new VBox( new Frame(new MarginFrame(_sedit, 2)), new HGlue(width, 0, 0) ) ); framedSedit->Insert(new HGlue); } Insert( new MarginFrame( new VBox( new Message(msg), new VGlue(space), framedSedit, new VGlue(space), new HBox( new HGlue, new PushButton(" Cancel ", state, '\007'), new HGlue(space, 0), new PushButton(confirmLbl, state, '\r') ) ), space, space, 0 ) ); } const char* StringDialog::String () { return _sedit->Text(); } bool StringDialog::Accept () { Event e; int v = 0; state->SetValue(0); Select(); _sedit->Edit(); for (;;) { state->GetValue(v); if (v != 0) { break; } Read(e); if (e.target == nil) { break; } if (!KeyEquiv(e)) { Forward(e); } } return v == '\r'; } /*****************************************************************************/ FileDialog::FileDialog ( const char* msg, const char* dir, const char* confirmLbl ) { int space = iv26_round(fspace*cm); _browser = new FileBrowser(state, dir, 20, 35, false, Reversed,"\000\007"); _dirs = new FileBrowser( "dirBrowser", state, dir, 20, 24, true, Reversed,"d\007" ); _dirs->SetTextFilter("^$"); // show directories only _dirs->Update(); _cur_dir = new MarginFrame(new Message("path", FullPath(_dirs))); HBox* dirBox = new HBox( new Message("Directory: "), _cur_dir, new HGlue ); dirBox->Propagate(false); Insert( new MarginFrame( new VBox( new HBox( new VBox( new Message("Change directory to:", Left, 0, hfil), new Frame(AddScroller(_dirs)) ), new HGlue(space, 0), new VBox( new Message(msg, Left, 0, hfil), new Frame(AddScroller(_browser)) ) ), new VGlue(space, 0), dirBox, new VGlue(space, 0), new HBox( new HGlue, new PushButton(" Cancel ", state, '\007'), new HGlue(space, 0), new PushButton(confirmLbl, state, '\r') ) ), space, space, 0 ) ); } Interactor* FileDialog::AddScroller (Interactor* i) { return new HBox( new MarginFrame(i, 2), new VBorder, new VScrollBar(i) ); } bool FileDialog::Accept () { Event e; int v = 0; state->SetValue(0); do { Read(e); if (e.target == nil) { break; } if (!KeyEquiv(e)) { Forward(e); } state->GetValue(v); if (v == 'd') { if (_dirs->Selections() > 0) { int sel = _dirs->Selection(); char path[MAX_PATH_LENGTH]; strcpy(path, _dirs->Path(sel)); _browser->SetDirectory(path); _dirs->SetDirectory(path); Message* path_msg = new Message("path", FullPath(_dirs)); _cur_dir->Insert(path_msg); _cur_dir->Change(path_msg); } state->SetValue(0); v = 0; } } while (v == 0); return v == '\r'; } const char* FileDialog::FullPath (const char* relpath) { return FullPath(_dirs, relpath); } const char* FileDialog::FullPath (FileBrowser* fb, const char* rp) { const char* relpath = (rp == nil) ? fb->GetDirectory() : rp; char path[MAX_PATH_LENGTH]; if (getcwd(path, sizeof(path) - strlen(relpath) - 1) != 0) { ; } strcat(path, "/"); strcat(path, relpath); return fb->Normalize(path); } neuron-7.6.3/src/bin/iclass/dialogs.h000066400000000000000000000054501340731477100174600ustar00rootroot00000000000000/* * Copyright (c) 1989 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Various dialog boxes. */ #ifndef dialogs_h #define dialogs_h #include class FileBrowser; class MarginFrame; class StringEditor; class BasicDialog : public Dialog { public: BasicDialog(); virtual bool Accept(); protected: void Forward(Event&); bool KeyEquiv(Event&); }; class AcknowledgeDialog : public BasicDialog { public: AcknowledgeDialog(const char* msg, const char* btnLbl = " OK "); virtual void Acknowledge(); }; class ConfirmDialog : public BasicDialog { public: ConfirmDialog(const char* title); virtual char Confirm(); private: Interactor* Interior(const char*); }; class StringDialog : public BasicDialog { public: StringDialog( const char* msg, const char* sample = "", const char* confirmLbl = " OK " ); StringDialog( const char* msg, int width, const char* confirmLbl = " OK " ); const char* String(); void Select(); void Select(int); void Select(int, int); virtual bool Accept(); private: void Init(const char*, const char*, int width = 0); private: StringEditor* _sedit; }; class FileDialog : public BasicDialog { public: FileDialog( const char* msg, const char* dir = "~", const char* confirmLbl = " OK " ); FileBrowser* GetBrowser(); const char* FullPath(const char* relpath); virtual bool Accept(); private: Interactor* AddScroller(Interactor*); const char* FullPath(FileBrowser*, const char* relpath = nil); private: FileBrowser* _browser; FileBrowser* _dirs; MarginFrame* _cur_dir; }; inline FileBrowser* FileDialog::GetBrowser () { return _browser; } #endif neuron-7.6.3/src/bin/iclass/direct.cpp000066400000000000000000000163071340731477100176460ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1989 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Directory object implementation. */ #include "direct.h" #include "globals.h" #include #include #include #include #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_OSFCN_H #include #endif #include #include #include #include #ifdef __DECCXX extern "C" { extern uid_t getuid(); extern struct passwd* getpwuid(uid_t); } #endif #undef File #undef Directory #define SysDir _lib_os(Directory) class DirectoryRep { private: friend class Directory; SysDir* dir; }; static const int MAX_PATH_LENGTH = 256; /*****************************************************************************/ Directory::Directory (const char* name) { rep_ = new DirectoryRep; rep_->dir = nil; LoadDirectory(name); } Directory::~Directory () { delete rep_->dir; delete rep_; } const char* Directory::RealPath (const char* path) { const char* realpath; if (*path == '\0') { realpath = "./"; } else { realpath = InterpTilde(InterpSlashSlash(path)); } return realpath; } bool Directory::LoadDirectory (const char* name) { char buf[MAX_PATH_LENGTH+2]; const char* path = buf; strcpy(buf, ValidDirectories(RealPath(name))); return Reset(buf); } int Directory::Index (const char* name) { _lib_os(String) s(name); return rep_->dir == nil ? -1 : rep_->dir->index(s); } bool Directory::Reset (char* path) { SysDir* d = SysDir::open(_lib_os(String)(path)); if (d != nil) { delete rep_->dir; rep_->dir = d; return true; } return false; } bool Directory::IsADirectory (const char* path) { struct stat filestats; stat(path, &filestats); return filestats.st_mode & S_IFDIR; } int Directory::Count() { return rep_->dir == nil ? 0 : rep_->dir->count(); } const char* Directory::File(int index) { if (rep_->dir == nil) { return nil; } const _lib_os(String)* s = rep_->dir->name(index); if (s == nil) { return nil; } return s->string(); } const char* Directory::Home (const char* name) { struct passwd* pw = (name == nil) ? getpwuid(getuid()) : getpwnam(name); return (pw == nil) ? nil : pw->pw_dir; } inline bool DotSlash (const char* path) { return path[0] != '\0' && path[0] == '.' && (path[1] == '/' || path[1] == '\0'); } inline bool DotDotSlash (const char* path) { return path[0] != '\0' && path[1] != '\0' && path[0] == '.' && path[1] == '.' && (path[2] == '/' || path[2] == '\0'); } const char* Directory::Normalize (const char* path) { static char newpath[MAX_PATH_LENGTH+1]; const char* buf; buf = InterpSlashSlash(path); buf = ElimDot(buf); buf = ElimDotDot(buf); buf = InterpTilde(buf); if (*buf == '\0') { strcpy(newpath, "./"); } else if (!DotSlash(buf) && !DotDotSlash(buf) && *buf != '/') { strcpy(newpath, "./"); strcat(newpath, buf); } else { strcpy(newpath, buf); } if (IsADirectory(newpath) && newpath[strlen(newpath)-1] != '/') { strcat(newpath, "/"); } return newpath; } const char* Directory::ValidDirectories (const char* path) { static char buf[MAX_PATH_LENGTH+1]; strcpy(buf, path); int i = strlen(path); while (!IsADirectory(RealPath(buf)) && i >= 0) { for (--i; buf[i] != '/' && i >= 0; --i); buf[i+1] = '\0'; } return buf; } const char* Directory::InterpSlashSlash (const char* path) { for (int i = strlen(path)-1; i > 0; --i) { if (path[i] == '/' && path[i-1] == '/') { return &path[i]; } } return path; } const char* Directory::ElimDot (const char* path) { static char newpath[MAX_PATH_LENGTH+1]; const char* src; char* dest = newpath; for (src = path; src < &path[strlen(path)]; ++src) { if (!DotSlash(src)) { *dest++ = *src; } else if (*(dest-1) == '/') { ++src; } else { *dest++ = *src; } } *dest = '\0'; return newpath; } static bool CollapsedDotDotSlash (char* path, char*& start) { if (path == start || *(start-1) != '/') { return false; } else if (path == start-1 && *path == '/') { return true; } else if (path == start-2) { // NB: won't handle '//' right start = path; return *start != '.'; } else if (path < start-2 && !DotDotSlash(start-3)) { for (start -= 2; path <= start; --start) { if (*start == '/') { ++start; return true; } } start = path; return true; } return false; } const char* Directory::ElimDotDot (const char* path) { static char newpath[MAX_PATH_LENGTH+1]; const char* src; char* dest = newpath; for (src = path; src < &path[strlen(path)]; ++src) { if (DotDotSlash(src) && CollapsedDotDotSlash(newpath, dest)) { src += 2; } else { *dest++ = *src; } } *dest = '\0'; return newpath; } const char* Directory::InterpTilde (const char* path) { static char realpath[MAX_PATH_LENGTH+1]; const char* beg = strrchr(path, '~'); bool validTilde = beg != nil && (beg == path || *(beg-1) == '/'); if (validTilde) { const char* end = strchr(beg, '/'); int length = (end == nil) ? strlen(beg) : end - beg; const char* expandedTilde = ExpandTilde(beg, length); if (expandedTilde == nil) { validTilde = false; } else { strcpy(realpath, expandedTilde); if (end != nil) { strcat(realpath, end); } } } return validTilde ? realpath : path; } const char* Directory::ExpandTilde (const char* tildeName, int length) { const char* name = nil; if (length > 1) { static char buf[MAX_PATH_LENGTH+1]; strncpy(buf, tildeName+1, length-1); buf[length-1] = '\0'; name = buf; } return Home(name); } neuron-7.6.3/src/bin/iclass/direct.h000066400000000000000000000037311340731477100173100ustar00rootroot00000000000000/* * Copyright (c) 1989 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Directory - a class interface to Unix directory operations. */ #ifndef direct_h #define direct_h #include class DirectoryRep; class Directory { public: Directory(const char* name); ~Directory(); bool LoadDirectory(const char*); const char* Normalize(const char*); const char* ValidDirectories(const char*); int Index(const char*); const char* File(int index); int Count(); bool IsADirectory(const char*); private: const char* Home(const char* = nil); const char* ElimDot(const char*); const char* ElimDotDot(const char*); const char* InterpSlashSlash(const char*); const char* InterpTilde(const char*); const char* ExpandTilde(const char*, int); const char* RealPath(const char*); bool Reset(char*); private: DirectoryRep* rep_; }; #endif neuron-7.6.3/src/bin/iclass/globals.cpp000077500000000000000000000060361340731477100200200ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1989 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of global definitions. */ #include "globals.h" #include #include #include #include /*****************************************************************************/ char* strnew (const char* s) { char* dup = new char[strlen(s) + 1]; strcpy(dup, s); return dup; } char* strnnew (const char* s, int len) { char* dup = new char[len + 1]; strncpy(dup, s, len); dup[len] = '\0'; return dup; } void BufCheck (const void**& buf, int& bufsize, int count, int index) { void** newbuf; if (index >= bufsize) { int length = count*sizeof(void*); bufsize = (index+1) * 2; newbuf = new void*[bufsize]; Memory::copy(buf, newbuf, length); delete buf; buf = (const void**)newbuf; } } void BufInsert ( const void* s, int index, const void**& buf, int& bufsize, int& count ) { const void** spot; index = (index < 0) ? count : index; if (index < count) { BufCheck(buf, bufsize, count, count+1); spot = &buf[index]; Memory::copy(spot, spot+1, (count - index)*sizeof(void*)); } else { BufCheck(buf, bufsize, count, index); spot = &buf[index]; } *spot = s; ++count; } void BufRemove (int index, const void** buf, int& count) { if (index < --count) { const void** spot = &buf[index]; Memory::copy(spot+1, spot, (count - index)*sizeof(void*)); } } int BufFind ( int index, const void** srcbuf, int srccount, const void** dstbuf, int dstcount ) { if (0 <= index && index < srccount) { const void* s = srcbuf[index]; if (s != nil) { for (int i = 0; i < dstcount; ++i) { if (dstbuf[i] == s) { return i; } } } } return -1; } neuron-7.6.3/src/bin/iclass/globals.h000077500000000000000000000031721340731477100174630ustar00rootroot00000000000000/* * Copyright (c) 1989 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Global definitions. */ #ifndef globals_h #define globals_h extern char* strnew(const char*); extern char* strnnew(const char*, int); extern void BufCheck(const void**& buf, int& bufsize, int count, int index); extern void BufInsert( const void* s, int index, const void**& buf, int& bufsize, int& count ); extern void BufRemove(int index, const void** buf, int& count); extern int BufFind ( int index, const void** srcbuf, int srccount, const void** dstbuf, int dstcount ); #endif neuron-7.6.3/src/bin/iclass/iclass.cpp000066400000000000000000000421021340731477100176420ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1989 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * IClass implementation. */ #include "classbuffer.h" #include "classeditor.h" #include "classinfo.h" #include "dialogs.h" #include "globals.h" #include "iclass.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ static const float fspace = .375; // space in cm static const char* NONE = ""; static const int BUFFERSIZE = 100; static const int FILENAMESIZE = 100; static const int MINTEXTSIZE = 10000; #define BSRCH_LBL "^R" #define BSRCH_CODE '\022' #define FSRCH_LBL "^S" #define FSRCH_CODE '\023' #define GOTO_LBL "^N" #define GOTO_CODE '\016' #define QUIT_LBL "^Q" #define QUIT_CODE '\021' #define SCAN_LBL "^V" #define SCAN_CODE '\026' #define CLEAR_LBL "^C" #define CLEAR_CODE '\003' /*****************************************************************************/ class Command : public MenuItem { public: Command(const char* lbl, const char* klbl, char kcode, IClass*); virtual void Do(); private: IClass* _iclass; char _kcode; }; Command::Command ( const char* lbl, const char* klbl, char kcode, IClass* s ) : MenuItem((Interactor*) nil) { Insert( new HBox( new Message(lbl, Left, 2, hfil), new Message(" ", Center, 2, hfil), new Message(klbl, Right, 2, hfil) ) ); _iclass = s; _kcode = kcode; } void Command::Do () { _iclass->Command(_kcode); } struct MenuInfo { const char* _lbl; const char* _klbl; char _kcode; }; /*****************************************************************************/ IClass::IClass (ClassBuffer* cb) { SetClassName("IClass"); Init(cb); Visit(""); _editor->Edit(_text); } IClass::~IClass () { delete _cbuf; delete _buf; delete _text; delete _lastFile; _state->Detach(this); Unref(_state); if (_scanner != nil) delete _scanner; if (_fwdSearch != nil) delete _fwdSearch; if (_bwdSearch != nil) delete _bwdSearch; if (_goto != nil) delete _goto; if (_completions != nil) delete _completions; } void IClass::Init (ClassBuffer* cb) { _cbuf = cb; _state = new ButtonState; _state->Attach(this); _curClass = new CompletionEditor(_state, ""); _focus = _curClass; _classes = new StringBrowser(_state, 5, 24); _parents = new StringBrowser(_state, 2, 24); _children = new StringBrowser(_state, 5, 24); _fileIndic = new MarginFrame(new Message("testing")); _editor = new ClassEditor(_state, 24, 80, 8, Reversed); _editor->SetScrollAlignment(TopLeft); _scanner = new FileDialog("Scan through files/directories:", "."); _fwdSearch = nil; _bwdSearch = nil; _goto = nil; _buf = nil; _text = nil; _lastFile = nil; _completions = nil; input = new Sensor; input->Catch(KeyEvent); Insert(Interior()); UpdateClassesBrowser(); } void IClass::Visit (const char* filename) { if (_lastFile == nil || strcmp(_lastFile, filename) != 0) { class Message* msg = new Message(_scanner->FullPath(filename)); _fileIndic->Insert(msg); _fileIndic->Change(msg); delete _lastFile; _lastFile = strnew(filename); delete _buf; delete _text; FILE* f = nil; if (strlen(filename) != 0) { /* cast to work around bug in prototype on some systems */ f = fopen((char*)filename, "r"); } if (f != nil) { struct stat filestats; stat(filename, &filestats); _bufsize = max(iv26_round(filestats.st_size * 1.2), MINTEXTSIZE); _buf = new char[_bufsize]; char* b = _buf; int remaining = _bufsize; while (remaining > 1 && fgets(b, remaining, f) != nil) { int l = strlen(b); remaining -= l; b += l; } fclose(f); _text = new TextBuffer(_buf, b-_buf, _bufsize); } else { _bufsize = MINTEXTSIZE; _buf = new char[_bufsize]; _text = new TextBuffer(_buf, 0, _bufsize); } } } void IClass::Run () { Event e; int value; do { Read(e); if (e.target == nil) { /* probably quit from window manager */ break; } Handle(e); _state->GetValue(value); } while (value != QUIT_CODE); } void IClass::Handle (Event& e) { if (e.eventType == KeyEvent && e.len > 0) { char c = e.keystring[0]; if (!Command(c)) { _focus->Handle(e); } } else if (e.target != this && e.eventType != KeyEvent) { bool focusable = e.target == _classes || e.target == _parents || e.target == _children || e.target == _editor; if (focusable && e.button == LEFTMOUSE) { UnselectCurClass(); UnselectBrowsers(); _focus = e.target; } e.target->Handle(e); } } bool IClass::Command (char c) { bool executed = true; switch (c) { case BSRCH_CODE: BackwardSearchCmd(); break; case FSRCH_CODE: ForwardSearchCmd(); break; case GOTO_CODE: GotoCmd(); break; case QUIT_CODE: QuitCmd(); break; case SCAN_CODE: ScanCmd(); break; case CLEAR_CODE: ClearCmd(); break; default: executed = false; break; } return executed; } bool IClass::ForwardSearch (const char* string) { Regexp re(string); bool successful = false; if ( _text->ForwardSearch(&re, _editor->Dot()) >= 0 || _text->ForwardSearch(&re, _text->BeginningOfText()) >= 0 ) { _editor->Select(re.EndOfMatch(), re.BeginningOfMatch()); successful = true; } return successful; } bool IClass::BackwardSearch (const char* string) { Regexp re(string); bool successful = false; if ( _text->BackwardSearch(&re, _editor->Mark()) >= 0 || _text->BackwardSearch(&re, _text->EndOfText()) >= 0 ) { _editor->Select(re.EndOfMatch(), re.BeginningOfMatch()); successful = true; } return successful; } void IClass::UnselectBrowsers () { int index; if ((index = _classes->Selection()) >= 0) { _classes->UnselectAll(); } else if ((index = _parents->Selection()) >= 0) { _parents->UnselectAll(); } else if ((index = _children->Selection()) >= 0) { _children->UnselectAll(); } } void IClass::Update () { int value; _state->GetValue(value); if (value == '\r') { UpdateCurClass(); UpdateParentBrowser(); UpdateChildBrowser(); } else if (value == '\t' || value == '\033') { SelectCurClass(); _focus = _curClass; } else if (value == '\007') { Complain(); } if (value != QUIT_CODE) { UnselectBrowsers(); _state->SetValue('\0'); } } void IClass::UpdateCurClass () { int index; if ((index = _classes->Selection()) >= 0) { UpdateCurClass(_classes->String(index)); } else if ((index = _parents->Selection()) >= 0) { UpdateCurClass(_parents->String(index)); } else if ((index = _children->Selection()) >= 0) { UpdateCurClass(_children->String(index)); } else { UpdateCurClass(_curClass->Text()); } } void IClass::UpdateCurClass (const char* string) { if (strcmp(string, NONE) != 0) { if (strcmp(string, _curClass->Text()) != 0) { _curClass->Message(string); } ClassInfo* info = _cbuf->Info(string); if (info == nil) { SelectCurClass(); Complain(); } else { Visit(info->Path()); int line = info->LineNumber(); _editor->Edit(_text, _text->LineIndex(line)); ForwardSearch(info->Name()); _focus = _editor; } } } void IClass::UpdateClassesBrowser () { const char* className; int i = 0; _classes->Clear(); int count = 0; for (;;) { className = _cbuf->Class(i++); if (className == nil) { break; } else { _classes->Append(className); ++count; } } if (_completions != nil) { delete _completions; } _completions = new const char*[count]; for (i = 0; i < count; ++i) { _completions[i] = _cbuf->Class(i); } _curClass->Completions(_completions, count); } void IClass::UpdateParentBrowser () { const char* parent1; int i = 0; _parents->Clear(); for (;;) { parent1 = _cbuf->Parent(_curClass->Text(), i++); if (parent1 == nil) { if (i == 1) { _parents->Append(NONE); } break; } else { _parents->Append(parent1); } } } void IClass::UpdateChildBrowser () { const char* child; int i = 0; _children->Clear(); for (;;) { child = _cbuf->Child(_curClass->Text(), i++); if (child == nil) { if (i == 1) { _children->Append(NONE); } break; } else { _children->Append(child); } } } void IClass::SelectCurClass () { _curClass->Select(0, strlen(_curClass->Text())); } void IClass::UnselectCurClass () { _curClass->Select(strlen(_curClass->Text())); } Interactor* IClass::Interior () { int space = iv26_round(fspace*cm); const char* showButton = GetAttribute("showButton"); Interactor* selector = SelectedClass(); if (showButton != nil && strcmp(showButton, "true") == 0) { selector = new HBox( selector, new HGlue(space, space, 0), new PushButton(" Show ", _state, '\r') ); } return new VBox( new HBox(Commands(), new HGlue), new HBorder, new MarginFrame( new VBox( new HBox( Classes(), new HGlue(space, space, 0), new VBox( selector, new VGlue(space, space, 0), Parents(), new VGlue(space, space, 0), Children() ) ), new VGlue(space, space, 0), Editor() ), space, space, 0 ) ); } static MenuInfo fileMenu[] = { { "Scan Files/Directories...", SCAN_LBL, SCAN_CODE }, { "Clear Classes", CLEAR_LBL, CLEAR_CODE }, { "Quit", QUIT_LBL, QUIT_CODE }, { nil } }; static MenuInfo searchMenu[] = { { "Forward Search...", FSRCH_LBL, FSRCH_CODE }, { "Backward Search...", BSRCH_LBL, BSRCH_CODE }, { "Go to Line...", GOTO_LBL, GOTO_CODE }, { nil } }; static PulldownMenu* MakePulldown( const char* name, MenuInfo* item, IClass* ic ) { PulldownMenu* menu = new PulldownMenu( new Message(name, Left, iv26_round(.1*cm)) ); for (MenuInfo* i = item; i->_lbl != nil; i++) { menu->Include(new Command(i->_lbl, i->_klbl, i->_kcode, ic)); } return menu; } Interactor* IClass::Commands () { MenuBar* menuBar = new MenuBar; menuBar->Include(MakePulldown("File", fileMenu, this)); menuBar->Include(MakePulldown("Search", searchMenu, this)); return menuBar; } Interactor* IClass::Classes () { return new VBox( new HBox( new Message("classes"), new HGlue ), new Frame( AddScroller(_classes) ) ); } Interactor* IClass::SelectedClass () { return new VBox( new HBox( new Message("selected class"), new HGlue ), new Frame(new MarginFrame(_curClass, 2)) ); } Interactor* IClass::Parents () { return new VBox( new HBox( new Message("parents"), new HGlue ), new Frame(AddScroller(_parents)) ); } Interactor* IClass::Children () { return new VBox( new HBox( new Message("children"), new HGlue ), new Frame(AddScroller(_children)) ); } Interactor* IClass::Editor () { HBox* fileBox = new HBox( new Message("file: "), _fileIndic, new HGlue ); fileBox->Propagate(false); return new VBox( fileBox, new Frame(AddScroller(_editor)) ); } Interactor* IClass::AddScroller (Interactor* i) { return new HBox( new MarginFrame(i, 2), new VBorder, new VScrollBar(i) ); } void IClass::InsertDialog (Interactor* dialog) { World* world1 = GetWorld(); Coord x, y; Align(Center, 0, 0, x, y); GetRelative(x, y, world1); world1->InsertTransient(dialog, this, x, y, Center); } void IClass::RemoveDialog (Interactor* dialog) { GetWorld()->Remove(dialog); } void IClass::Complain (const char* msg) { if (msg == nil) { fprintf(stderr, "%c", '\007'); } else { AcknowledgeDialog complaint(msg); InsertDialog(&complaint); complaint.Acknowledge(); RemoveDialog(&complaint); } } void IClass::ScanCmd () { InsertDialog(_scanner); if (_scanner->Accept()) { FileBrowser* browser = _scanner->GetBrowser(); for (int i = 0; i < browser->Selections(); ++i) { int index = browser->Selection(i); _cbuf->Search(browser->Path(index)); } } RemoveDialog(_scanner); UpdateClassesBrowser(); } void IClass::ClearCmd () { ConfirmDialog dialog("Really clear all classes?"); InsertDialog(&dialog); bool accepted = dialog.Confirm() == 'y'; RemoveDialog(&dialog); if (accepted) { World* world1 = GetWorld(); const char* recursive = world1->GetAttribute("recursive"); const char* verbose = world1->GetAttribute("verbose"); const char* CPlusPlusFiles = world1->GetAttribute("CPlusPlusFiles"); delete _cbuf; _cbuf = new ClassBuffer( strcmp(recursive, "true") == 0, strcmp(verbose, "true") == 0, strcmp(CPlusPlusFiles, "true") == 0 ); UpdateClassesBrowser(); UpdateParentBrowser(); UpdateChildBrowser(); } } void IClass::QuitCmd () { _state->SetValue(QUIT_CODE); } void IClass::ForwardSearchCmd () { if (_fwdSearch == nil) { _fwdSearch = new StringDialog("Search forward for: ", iv26_round(3*inches)); } InsertDialog(_fwdSearch); if (_fwdSearch->Accept()) { if (ForwardSearch(_fwdSearch->String())) { _editor->ScrollToSelection(); } else { Complain(); } } RemoveDialog(_fwdSearch); } void IClass::BackwardSearchCmd () { if (_bwdSearch == nil) { _bwdSearch = new StringDialog("Search backward for:", iv26_round(3*inches)); } InsertDialog(_bwdSearch); if (_bwdSearch->Accept()) { if (BackwardSearch(_bwdSearch->String())) { _editor->ScrollToSelection(); } else { Complain(); } } RemoveDialog(_bwdSearch); } void IClass::GotoCmd () { if (_goto == nil) { int width = output->GetFont()->Width("9999999"); _goto = new StringDialog("Go to line:", width); } InsertDialog(_goto); if (_goto->Accept()) { const char* string = _goto->String(); int line = atoi(string); _editor->Select(_text->LineIndex(line-1)); _editor->ScrollToSelection(); } RemoveDialog(_goto); } neuron-7.6.3/src/bin/iclass/iclass.h000066400000000000000000000057011340731477100173130ustar00rootroot00000000000000/* * Copyright (c) 1989 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * IClass - interface to choosing classes. */ #ifndef iclass_h #define iclass_h #include class ButtonState; class ClassBuffer; class ClassEditor; class CompletionEditor; class FileDialog; class MarginFrame; class StringBrowser; class StringDialog; class TextBuffer; class IClass : public MonoScene { public: IClass(ClassBuffer*); virtual ~IClass(); void Run(); bool Command(char); void ScanCmd(); void ClearCmd(); void QuitCmd(); void ForwardSearchCmd(); void BackwardSearchCmd(); void GotoCmd(); virtual void Handle(Event&); virtual void Update(); private: void Init(ClassBuffer*); Interactor* Commands(); Interactor* Classes(); Interactor* SelectedClass(); Interactor* Parents(); Interactor* Children(); Interactor* Editor(); Interactor* Interior(); Interactor* AddScroller(Interactor*); void InsertDialog(Interactor*); void RemoveDialog(Interactor*); void Visit(const char*); void Complain(const char* = nil); bool ForwardSearch(const char*); bool BackwardSearch(const char*); void UpdateClassesBrowser(); void UpdateParentBrowser(); void UpdateChildBrowser(); void UpdateCurClass(); void UpdateCurClass(const char*); void UnselectBrowsers(); void SelectCurClass(); void UnselectCurClass(); private: ButtonState* _state; ClassBuffer* _cbuf; CompletionEditor* _curClass; Interactor* _focus; StringBrowser* _classes; StringBrowser* _children; StringBrowser* _parents; MarginFrame* _fileIndic; FileDialog* _scanner; StringDialog* _fwdSearch; StringDialog* _bwdSearch; StringDialog* _goto; TextBuffer* _text; ClassEditor* _editor; const char** _completions; char* _lastFile; char* _buf; int _bufsize; }; #endif neuron-7.6.3/src/bin/iclass/main.cpp000077500000000000000000000067101340731477100173200ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1989 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * InterViews class browser main program. */ #include "classbuffer.h" #include "iclass.h" #include #include #include #include #include /*****************************************************************************/ static PropertyData properties[] = { { "*Message*font", "*helvetica-bold-r-normal--10*" }, { "*Dialog*Message*font", "*helvetica-bold-r-normal--12*" }, { "*path*font", "*helvetica-bold-r-normal--12*" }, { "*PulldownMenu*Message*font", "*helvetica-bold-r-normal--12*" }, { "*PushButton*font", "*helvetica-bold-r-normal--12*" }, { "*StringBrowser*font", "*helvetica-bold-r-normal--10*" }, { "*dirBrowser*font", "*helvetica-bold-r-normal--10*" }, { "*StringEditor*font", "*helvetica-bold-r-normal--10*" }, { "*recursive", "false" }, { "*verbose", "false" }, { "*CPlusPlusFiles", "false" }, { "*showButton", "true" }, { "*dirBrowser*singleClick", "on" }, { nil } }; static OptionDesc options[] = { { "-r", "*recursive", OptionValueImplicit, "true" }, { "-v", "*verbose", OptionValueImplicit, "true" }, { "-c", "*CPlusPlusFiles", OptionValueImplicit, "true" }, { nil } }; /*****************************************************************************/ int main (int argc, char** argv) { World world("iclass", argc, argv, options, properties); const char* recursive = world.GetAttribute("recursive"); const char* verbose = world.GetAttribute("verbose"); const char* CPlusPlusFiles = world.GetAttribute("CPlusPlusFiles"); ClassBuffer* buffer = new ClassBuffer( strcmp(recursive, "true") == 0, strcmp(verbose, "true") == 0, strcmp(CPlusPlusFiles, "true") == 0 ); for (int i = 1; i < argc; ++i) { buffer->Search(argv[i]); } IClass* iclass = new IClass(buffer); ApplicationWindow* window = new ApplicationWindow(iclass); Style* s = new Style(Session::instance()->style()); s->attribute("name", "InterViews class browser"); s->attribute("iconName", "iclass"); window->style(s); window->map(); iclass->Run(); return 0; } neuron-7.6.3/src/bin/idemo/000077500000000000000000000000001340731477100155005ustar00rootroot00000000000000neuron-7.6.3/src/bin/idemo/Makefile.in000077500000000000000000000056511340731477100175570ustar00rootroot00000000000000# Makefile.in generated automatically by automake 1.4a from Makefile.am # Well, it used to be generated by automake, but automake can't handle files # in subdirectories very well so I got rid of it. SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_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 = ../../.. INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_FLAG = NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : @SET_MAKE@ CC = @CC@ CXX = @CXX@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ RANLIB = @RANLIB@ INCLUDES = -I../../include $(X_CFLAGS) @CARBON_FALSE@@CYGWIN_FALSE@@MINGW_FALSE@IVLIBS = ../../lib/libUnidrawhines.la ../../lib/libIVhines.la $(X_LIBS) @CYGWIN_FALSE@CYG = @CYGWIN_TRUE@IVLIBS = ../../lib/libIVhines.la @CYGWIN_TRUE@CYG = @MINGW_TRUE@IVLIBS = ../../lib/libIVhines.la @MINGW_TRUE@CYG = @CARBON_TRUE@IVLIBS = ../../lib/libIVhines.la # # Lists of objects that go into the libraries: # IDEMO_OBJECTS = main.o subdir = src/bin/idemo mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = DEFS = @DEFS@ -I. -I$(srcdir) CPPFLAGS = @CPPFLAGS@ @CARBON_FALSE@LDFLAGS = @LDFLAGS@ @CARBON_TRUE@LDFLAGS = @LDFLAGS@ -framework Carbon LIBS = @LIBS@ X_CFLAGS = @X_CFLAGS@ X_LIBS = @X_LIBS@ -lX11 -lXext X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) LTCCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) CCOMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @CARBON_FALSE@CXXFLAGS = @CXXFLAGS@ @CARBON_TRUE@CXXFLAGS = @CXXFLAGS@ -DMAC=1 -Dcarbon=1 -DSYSV=1 CFLAGS = @CFLAGS@ CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(CXXFLAGS) $(LDFLAGS) DATA = $(data_DATA) PACKAGE = @PACKAGE@ VERSION = @VERSION@ .SUFFIXES: .cpp .o all: idemo Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status clean: rm -f *.o idemo rm -rf .libs distclean: clean rm -f Makefile install: idemo $(mkinstalldirs) $(DESTDIR)$(bindir) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) idemo $(DESTDIR)$(bindir)/idemo uninstall: $(LIBTOOL) --mode=uninstall $(DESTDIR)$(bindir)/idemo .cpp.o: $(CXXCOMPILE) -c -o $@ $< idemo: $(IDEMO_OBJECTS) $(CXXLINK) $(CYG) -o $@ $(IDEMO_OBJECTS) $(IVLIBS) $(LIBS) .PHONY: all clean distclean install uninstall neuron-7.6.3/src/bin/idemo/main.cpp000077500000000000000000000371641340731477100171460ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static const Coord tool_scale = 12.0; struct CommandInfo; class App { public: App(); ~App(); int run(int, char**); void open(); void save(); void cut(); void copy(); void paste(); void black(); void red(); void green(); void blue(); void do_nothing(); void quit(); private: WidgetKit* kit_; LayoutKit* layout_; Style* style_; Style* title_style_; Menu* file_; Composition* body_; Glyph* sep_; Coord size_; ApplicationWindow* main_; FileChooser* dialog_; Menu* menubar(); Menu* make_menu(Menu*, CommandInfo*, int = 0); MenuItem* make_submenu(MenuItem*, Menu*); MenuItem* make_item(MenuItem*, Action*); void add(const char* label, Glyph*); }; App::App() { main_ = nil; dialog_ = nil; } App::~App() { Resource::unref(dialog_); } declareActionCallback(App) implementActionCallback(App) struct CommandInfo { const char* str; ActionMemberFunction(App) func; CommandInfo* submenu; int options; }; CommandInfo filemenu[] = { { "File Chooser ...", &App::open }, { "Save", &App::save }, { "", nil }, { "Quit", &App::quit }, { nil } }; CommandInfo editmenu[] = { { "Cut", &App::cut }, { "Copy", &App::copy }, { "Paste", &App::paste }, { nil } }; CommandInfo times_menu[] = { { "Normal", &App::do_nothing }, { "Bold", &App::do_nothing }, { "Italic", &App::do_nothing }, { nil } }; CommandInfo helv_menu[] = { { "Normal", &App::do_nothing }, { "Bold", &App::do_nothing }, { "Oblique", &App::do_nothing }, { nil } }; CommandInfo fontmenu[] = { { "Times", nil, times_menu, 2 }, { "Helvetica", nil, helv_menu, 2 }, { nil } }; CommandInfo colormenu[] = { { "Black", &App::black }, { "Red", &App::red }, { "Green", &App::green }, { "Blue", &App::blue }, { nil } }; class BoundedValue : public Adjustable { protected: BoundedValue(); public: BoundedValue(Coord lower, Coord upper); virtual ~BoundedValue(); virtual void lower_bound(Coord); virtual void upper_bound(Coord); virtual void current_value(Coord); virtual void scroll_incr(Coord); virtual void page_incr(Coord); virtual Coord lower(DimensionName) const; virtual Coord upper(DimensionName) const; virtual Coord length(DimensionName) const; virtual Coord cur_lower(DimensionName) const; virtual Coord cur_upper(DimensionName) const; virtual Coord cur_length(DimensionName) const; virtual void scroll_to(DimensionName, Coord position); virtual void scroll_forward(DimensionName); virtual void scroll_backward(DimensionName); virtual void page_forward(DimensionName); virtual void page_backward(DimensionName); private: Coord curvalue_; Coord lower_; Coord span_; Coord scroll_incr_; Coord page_incr_; }; class Valuator : public MonoGlyph, public Observer { public: Valuator(BoundedValue*, Style*); virtual ~Valuator(); virtual InputHandler* focusable() const; virtual void update(Observable*); virtual void disconnect(Observable*); private: BoundedValue* bvalue_; FieldEditor* editor_; void accept_editor(FieldEditor*); void cancel_editor(FieldEditor*); }; static OptionDesc options[] = { { "-titlefg", "Idemo*title*foreground", OptionValueNext }, { "-chiseled", "Idemo*labelStyle", OptionValueImplicit, "chiseled" }, { "-flattext", "Idemo*labelStyle", OptionValueImplicit, "normal" }, { "-raised", "Idemo*labelStyle", OptionValueImplicit, "raised" }, { "-rot", "Idemo*rotation", OptionValueNext }, { "-rotate", "Idemo*rotation", OptionValueNext }, { nil } }; int main(int argc, char** argv) { App* a = new App; return a->run(argc, argv); } int App::run(int argc, char** argv) { Session* session = new Session("Idemo", argc, argv, options); kit_ = WidgetKit::instance(); layout_ = LayoutKit::instance(); WidgetKit& kit = *kit_; const LayoutKit& layout = *layout_; style_ = kit_->style(); title_style_ = new Style(style_); Resource::ref(title_style_); title_style_->alias("title"); const Font* f = kit_->font(); size_ = tool_scale * f->width('m'); body_ = new LRComposition( layout.vbox(), new TeXCompositor(10), nil, size_ + 1.0 + size_ + 1.0 + size_ + 2.0 ); Glyph* space = layout.spaces(2, 0.5, f, kit_->foreground()); Glyph* begin_par = layout.vstrut(0, 0, 0, fil, 0); Glyph* end_par = layout.strut(f, 0, fil, 0); Glyph* begin_line = layout.vstrut(0, 0, 0, fil, 0); Glyph* end_line = layout.strut(f, 0, fil, 0); Glyph* vfil = layout.vglue(); Glyph* vspace1 = layout.vspace(1.0); Glyph* vspace2 = layout.vspace(2.0); Glyph* vspace4 = layout.vspace(4.0); sep_ = layout.discretionary( 0, space, end_line, layout.discretionary(0, vfil, vfil, nil, nil), begin_line ); sep_ = layout.vcenter(sep_, 1.0); Style* s = style_; Transformer t; float rotation; s->find_attribute("rotation", rotation); t.rotate(rotation); Action* action = new ActionCallback(App)(this, &App::do_nothing); add( "Labels", layout.vbox( layout.center(kit.label("Normal text"), 0.5, 1.0), vspace2, layout.hcenter( new TransformSetter(kit.label("Rotated text"), t) ) ) ); body_->append(sep_); Button* disabled = kit.push_button("Disabled", nil); disabled->state()->set(TelltaleState::is_enabled, false); add( "Push buttons", layout.vbox( layout.hcenter(kit.push_button("Do nothing", action)), vspace2, layout.hcenter(disabled), vspace2, layout.hcenter(kit.push_button("Quit", kit_->quit())) ) ); body_->append(sep_); Button* column_c = kit.check_box("Column C", nil); column_c->state()->set(TelltaleState::is_chosen, true); column_c->state()->set(TelltaleState::is_enabled, false); add( "Check boxes", layout.vbox( kit.check_box("Column A", action), vspace2, kit.check_box("Column B", nil), vspace2, column_c ) ); body_->append(sep_); TelltaleGroup* group = new TelltaleGroup; add( "Radio buttons", layout.vbox( kit.radio_button(group, "Able", action), vspace4, kit_->radio_button(group, "Baker", nil), vspace4, kit_->radio_button(group, "Charlie", nil) ) ); body_->append(sep_); add( "Palette buttons", layout.vbox( layout.vcenter(kit.palette_button("One", nil), 1.0), vspace2, kit.palette_button("Two", nil), vspace2, kit.palette_button("Three", nil) ) ); body_->append(sep_); BoundedValue* bv1 = new BoundedValue(0.0, 100.0); bv1->current_value(50.0); bv1->scroll_incr(5.0); bv1->page_incr(20.0); BoundedValue* bv2 = new BoundedValue(0.0, 100.0); bv2->current_value(50.0); bv2->scroll_incr(5.0); bv2->page_incr(10.0); Valuator* v1 = new Valuator(bv1, s); Valuator* v2 = new Valuator(bv2, s); InputHandler* vgroup = new InputHandler( layout.vbox(v1, vspace4, v2, layout.vspace(15.0)), s ); vgroup->append_input_handler(v1->focusable()); vgroup->append_input_handler(v2->focusable()); add("Field editors", vgroup); body_->append(sep_); add( "Panner", layout.fixed_span(kit.panner(bv1, bv2), size_ - 10.0, size_ - 10.0) ); body_->append(sep_); add( "HScrollBar", layout.vcenter(layout.h_fixed_span(kit.hscroll_bar(bv1), size_ - 8.0)) ); body_->append(sep_); add( "VScrollBar", layout.hcenter(layout.v_fixed_span(kit.vscroll_bar(bv2), size_ - 8.0)) ); body_->append( layout.vcenter( layout.discretionary( PenaltyGood, end_par, end_par, layout.discretionary(0, vfil, vfil, nil, nil), begin_par ), 1.0 ) ); body_->repair(); main_ = new ApplicationWindow( new Background( layout.vcenter( layout.vbox( layout.vcenter(menubar(), 1.0), body_ ) ), kit.background() ) ); return session->run_window(main_); } declareFileChooserCallback(App) implementFileChooserCallback(App) void App::open() { if (dialog_ == nil) { dialog_ = DialogKit::instance()->file_chooser(".", style_); Resource::ref(dialog_); } if (dialog_->post_for(main_)) { const String* name = dialog_->selected(); if (name != nil) { printf("%.*s\n", name->length(), name->string()); fflush(stdout); } } } void App::save() { printf("save\n"); } void App::cut() { printf("cut\n"); } void App::copy() { printf("copy\n"); } void App::paste() { printf("paste\n"); } void App::black() { printf("black\n"); } void App::red() { printf("red\n"); } void App::green() { printf("green\n"); } void App::blue() { printf("blue\n"); } void App::do_nothing() { printf("do nothing\n"); } void App::quit() { // delete main_; kit_->quit()->execute(); } Menu* App::menubar() { WidgetKit& kit = *kit_; Menu* m = kit.menubar(); Menu* file = make_menu(kit.pulldown(), filemenu); m->append_item(make_submenu(kit.menubar_item("Dialog"), file)); m->append_item( make_submenu( kit.menubar_item("Edit"), make_menu(kit.pulldown(), editmenu, 1) ) ); m->append_item( make_submenu( kit.menubar_item("Font"), make_menu(kit.pulldown(), fontmenu, 2) ) ); /* disable save */ file->item(1)->state()->set(TelltaleState::is_enabled, false); return m; } Menu* App::make_menu(Menu* m, CommandInfo* info, int options) { WidgetKit& kit = *kit_; TelltaleGroup* group = nil; for (CommandInfo* i = info; i->str != nil; i++) { if (i->str[0] == '\0') { m->append_item(kit.menu_item_separator()); } else { Glyph* g = layout_->r_margin(kit.label(i->str), 0.0, fil, 0.0); MenuItem* item; switch (options) { case 1: item = kit.check_menu_item(g); break; case 2: if (group == nil) { group = new TelltaleGroup; } item = kit.radio_menu_item(group, g); break; default: item = kit.menu_item(g); break; } if (i->func == nil) { if (i->submenu != nil) { make_submenu( item, make_menu(kit.pullright(), i->submenu, i->options) ); } } else { make_item(item, new ActionCallback(App)(this, i->func)); } m->append_item(item); } } return m; } MenuItem* App::make_submenu(MenuItem* i, Menu* s) { i->menu(s); return i; } MenuItem* App::make_item(MenuItem* i, Action* a) { i->action(a); return i; } void App::add(const char* title, Glyph* glyph) { const LayoutKit& layout = *layout_; Glyph* g = layout.margin( glyph, 0.0, fil, 0.0, 0.0, fil, 0.0, 0.0, 0.25*fil, 0.0, 0.0, 0.75*fil, 0.0 ); if (title != nil) { WidgetKit& kit = *kit_; kit.push_style(); kit.style(title_style_); g = layout.overlay( layout.center(g), layout.center( layout.margin( kit.fancy_label(title), 0.0, fil, 0.0, 0.0, fil, 0.0, 0.0, 0.90*fil, 0.0, 0.0, 0.10*fil, 0.0 ) ) ); kit.pop_style(); } body_->append( layout.center(layout.fixed_span(g, size_, size_), 0.0, 1.0) ); } /* class BoundedValue */ BoundedValue::BoundedValue() { scroll_incr_ = 0.0; page_incr_ = 0.0; } BoundedValue::BoundedValue(Coord lower, Coord upper) { lower_ = lower; span_ = upper - lower; scroll_incr_ = span_ * 0.04; page_incr_ = span_ * 0.4; curvalue_ = (lower + upper) * 0.5; } BoundedValue::~BoundedValue() { } void BoundedValue::lower_bound(Coord c) { lower_ = c; } void BoundedValue::upper_bound(Coord c) { span_ = c - lower_; } void BoundedValue::current_value(Coord value) { curvalue_ = value; constrain(Dimension_X, curvalue_); notify(Dimension_X); notify(Dimension_Y); } void BoundedValue::scroll_incr(Coord c) { scroll_incr_ = c; } void BoundedValue::page_incr(Coord c) { page_incr_ = c; } Coord BoundedValue::lower(DimensionName) const { return lower_; } Coord BoundedValue::upper(DimensionName) const { return lower_ + span_; } Coord BoundedValue::length(DimensionName) const { return span_; } Coord BoundedValue::cur_lower(DimensionName) const { return curvalue_; } Coord BoundedValue::cur_upper(DimensionName) const { return curvalue_; } Coord BoundedValue::cur_length(DimensionName) const { return 0; } void BoundedValue::scroll_to(DimensionName d, Coord position) { Coord p = position; constrain(d, p); if (p != curvalue_) { curvalue_ = p; notify(Dimension_X); notify(Dimension_Y); } } void BoundedValue::scroll_forward(DimensionName d) { scroll_to(d, curvalue_ + scroll_incr_); } void BoundedValue::scroll_backward(DimensionName d) { scroll_to(d, curvalue_ - scroll_incr_); } void BoundedValue::page_forward(DimensionName d) { scroll_to(d, curvalue_ + page_incr_); } void BoundedValue::page_backward(DimensionName d) { scroll_to(d, curvalue_ - page_incr_); } /* class Valuator */ declareFieldEditorCallback(Valuator) implementFieldEditorCallback(Valuator) Valuator::Valuator(BoundedValue* bv, Style* style) : MonoGlyph(nil) { Style* s = new Style(style); s->alias("Valuator"); bvalue_ = bv; bv->attach(Dimension_X, this); editor_ = DialogKit::instance()->field_editor( "100.00", s, new FieldEditorCallback(Valuator)( this, &Valuator::accept_editor, &Valuator::cancel_editor ) ); body(editor_); update(bv->observable(Dimension_X)); } Valuator::~Valuator() { if (bvalue_ != nil) { bvalue_->detach(Dimension_X, this); } } InputHandler* Valuator::focusable() const { return editor_; } void Valuator::update(Observable*) { Coord v = bvalue_->cur_lower(Dimension_X); char buf[20]; sprintf(buf, "%.2f", v); editor_->field(buf); } void Valuator::disconnect(Observable*) { bvalue_ = nil; } void Valuator::accept_editor(FieldEditor*) { Coord v; const String& value = *editor_->text(); if (value.convert(v)) { bvalue_->current_value(v); } } void Valuator::cancel_editor(FieldEditor*) { update(bvalue_->observable(Dimension_X)); } neuron-7.6.3/src/bin/idraw/000077500000000000000000000000001340731477100155115ustar00rootroot00000000000000neuron-7.6.3/src/bin/idraw/Makefile.in000077500000000000000000000053051340731477100175640ustar00rootroot00000000000000# Makefile.in generated automatically by automake 1.4a from Makefile.am # Well, it used to be generated by automake, but automake can't handle files # in subdirectories very well so I got rid of it. SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_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 = ../../.. INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_FLAG = NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : @SET_MAKE@ CC = @CC@ CXX = @CXX@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ RANLIB = @RANLIB@ INCLUDES = -I../../include/IV-2_6 -I../../include $(X_CFLAGS) IVLIBS = ../../lib/libUnidrawhines.la ../../lib/libIVhines.la $(X_LIBS) # # Lists of objects that go into the libraries: # IDRAW_OBJECTS = idarrow.o idarrowhead.o idarrows.o idcatalog.o idcmds.o \ idcomp.o idcreator.o iddialogs.o ided.o idkybd.o idvars.o main.o subdir = src/bin/idraw mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = DEFS = @DEFS@ -I. -I$(srcdir) -Div2_6_compatible CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ X_CFLAGS = @X_CFLAGS@ X_LIBS = @X_LIBS@ -lX11 -lXext X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) LTCCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) CCOMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) CXXFLAGS = @CXXFLAGS@ CFLAGS = @CFLAGS@ CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(CXXFLAGS) $(LDFLAGS) DATA = $(data_DATA) PACKAGE = @PACKAGE@ VERSION = @VERSION@ all: idraw .SUFFIXES: .cpp .o Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status clean: rm -f *.o idraw rm -rf .libs distclean: clean rm -f Makefile install: idraw $(mkinstalldirs) $(DESTDIR)$(bindir) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) idraw $(DESTDIR)$(bindir)/idraw uninstall: $(LIBTOOL) --mode=uninstall $(DESTDIR)$(bindir)/idraw .cpp.o: $(CXXCOMPILE) -c -o $@ $< idraw: $(IDRAW_OBJECTS) $(CXXLINK) -o $@ $(IDRAW_OBJECTS) $(IVLIBS) $(LIBS) .PHONY: all clean distclean install uninstall neuron-7.6.3/src/bin/idraw/idarrow.cpp000066400000000000000000000562011340731477100176700ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of ArrowLineComp, ArrowLineView, PSArrowLine */ #include "idarrow.h" #include "idarrows.h" #include "idvars.h" #include "idclasses.h" #include "idcmds.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ class _ArrowData : public Data { public: _ArrowData(int, int); public: int _head : 16; int _tail : 16; }; _ArrowData::_ArrowData (int head, int tail) { _head = head; _tail = tail; } /****************************************************************************/ ArrowLineComp::ArrowLineComp (ArrowLine* graphic) : LineComp(graphic) { } ArrowLine* ArrowLineComp::GetArrowLine () { return (ArrowLine*) GetGraphic(); } ClassId ArrowLineComp::GetClassId() { return ARROWLINE_COMP; } ClassId ArrowLineComp::GetSubstId (const char*& delim) { delim = "%END_ARROWLINE_COMP%"; return LineComp::GetClassId(); } bool ArrowLineComp::IsA (ClassId id) { return ARROWLINE_COMP == id || LineComp::IsA(id); } Component* ArrowLineComp::Copy () { return new ArrowLineComp((ArrowLine*) GetGraphic()->Copy()); } void ArrowLineComp::Interpret (Command* cmd) { if (cmd->IsA(ARROW_CMD)) { ArrowLine* line = GetArrowLine(); if (line != nil) { ArrowCmd* arrowCmd = (ArrowCmd*) cmd; cmd->Store(this, new _ArrowData(line->Head(), line->Tail())); line->SetArrows(arrowCmd->Head(), arrowCmd->Tail()); Notify(); } } else if (cmd->IsA(PATTERN_CMD)) { GraphicComp::Interpret(cmd); } else { LineComp::Interpret(cmd); } } void ArrowLineComp::Uninterpret (Command* cmd) { if (cmd->IsA(ARROW_CMD)) { ArrowLine* line = GetArrowLine(); if (line != nil) { _ArrowData* ad = (_ArrowData*) cmd->Recall(this); if (ad != nil) { line->SetArrows(ad->_head, ad->_tail); Notify(); } } } else { LineComp::Uninterpret(cmd); } } void ArrowLineComp::Read (istream& in) { LineComp::Read(in); Line* line = GetLine(); Coord x0, y0, x1, y1; int h, t; float scale; line->GetOriginal(x0, y0, x1, y1); in >> h >> t >> scale; ArrowLine* arrow = new ArrowLine(x0, y0, x1, y1, h, t, scale, line); arrow->SetPattern(ReadPattern(in)); SetGraphic(arrow); delete line; } void ArrowLineComp::Write (ostream& out) { LineComp::Write(out); ArrowLine* arrow = GetArrowLine(); out << arrow->Head() << " " << arrow->Tail() << " "; out << arrow->ArrowScale() << " "; WritePattern(arrow->GetPattern(), out); } /****************************************************************************/ ArrowLineComp* ArrowLineView::GetArrowLineComp () { return (ArrowLineComp*) GetSubject(); } ArrowLineView::ArrowLineView (ArrowLineComp* subj) : LineView(subj) { } ClassId ArrowLineView::GetClassId () { return ARROWLINE_VIEW; } bool ArrowLineView::IsA (ClassId id) { return ARROWLINE_VIEW == id || LineView::IsA(id); } void ArrowLineView::Update () { ArrowLine* line = (ArrowLine*) GetGraphic(); ArrowLine* subj = GetArrowLineComp()->GetArrowLine(); IncurDamage(line); *line = *subj; IncurDamage(line); EraseHandles(); } Command* ArrowLineView::InterpretManipulator (Manipulator* m) { DragManip* dm = (DragManip*) m; Editor* ed = dm->GetViewer()->GetEditor(); Tool* tool = dm->GetTool(); Transformer* rel = dm->GetTransformer(); Command* cmd = nil; ArrowVar* aVar = (ArrowVar*) ed->GetState("ArrowVar"); if (tool->IsA(GRAPHIC_COMP_TOOL)) { RubberLine* rl = (RubberLine*) dm->GetRubberband(); Coord x0, y0, x1, y1; rl->GetCurrent(x0, y0, x1, y1); if (x0 != x1 || y0 != y1) { BrushVar* brVar = (BrushVar*) ed->GetState("BrushVar"); ColorVar* colVar = (ColorVar*) ed->GetState("ColorVar"); PatternVar* patVar = (PatternVar*) ed->GetState("PatternVar"); if (rel != nil) { rel = new Transformer(rel); rel->Invert(); } ArrowLine* aline = new ArrowLine( x0, y0, x1, y1, aVar->Head(), aVar->Tail(), dm->GetViewer()->GetMagnification(), stdgraphic ); if (brVar != nil) aline->SetBrush(brVar->GetBrush()); if (patVar != nil) { aline->SetPattern(patVar->GetPattern()); } if (colVar != nil) { aline->SetColors(colVar->GetFgColor(), colVar->GetBgColor()); } aline->SetTransformer(rel); Unref(rel); cmd = new PasteCmd(ed, new Clipboard(new ArrowLineComp(aline))); } } else if (tool->IsA(RESHAPE_TOOL)) { RubberLine* rl = (RubberLine*) dm->GetRubberband(); Coord epx0, epy0, epx1, epy1; GetEndpoints(epx0, epy0, epx1, epy1); Coord x0, y0, x1, y1; rl->GetCurrent(x0, y0, x1, y1); if (x0 == epx1 && y0 == epy1) { x0 = x1; y0 = y1; x1 = epx1; y1 = epy1; } if (rel != nil) { rel = new Transformer(rel); rel->Invert(); } ArrowLine* orig = GetArrowLineComp()->GetArrowLine(); ArrowLine* aline = new ArrowLine( x0, y0, x1, y1, orig->Head(), orig->Tail(), dm->GetViewer()->GetMagnification(), GetGraphic() ); aline->SetTransformer(rel); Unref(rel); cmd = new ReplaceCmd(ed, new ArrowLineComp(aline)); } else { cmd = LineView::InterpretManipulator(m); } return cmd; } /****************************************************************************/ PSArrowLine::PSArrowLine (ArrowLineComp* subj) : PSLine (subj) { } ClassId PSArrowLine::GetClassId () { return PS_ARROWLINE; } bool PSArrowLine::IsA (ClassId id) { return PS_ARROWLINE == id || PSLine::IsA(id); } bool PSArrowLine::Definition (ostream& out) { ArrowLineComp* comp = (ArrowLineComp*) GetSubject(); ArrowLine* aline = comp->GetArrowLine(); Coord x0, y0, x1, y1; aline->GetOriginal(x0, y0, x1, y1); float arrow_scale = aline->ArrowScale(); out << "Begin " << MARK << " Line\n"; MinGS(out); out << MARK << "\n"; out << x0 << " " << y0 << " " << x1 << " " << y1 << " Line\n"; out << MARK << " " << arrow_scale << "\n"; out << "End\n\n"; return out.good(); } // this code is entirely for compatibility with older versions of idraw void PSArrowLine::Brush (ostream& out) { ArrowLineComp* comp = (ArrowLineComp*) GetSubject(); PSBrush* brush = (PSBrush*) GetGraphicComp()->GetGraphic()->GetBrush(); bool head, tail; head = comp->GetArrowLine()->Head(); tail = comp->GetArrowLine()->Tail(); if (brush == nil) { out << MARK << " b u\n"; } else if (brush->None()) { out << "none SetB " << MARK << " b n\n"; } else { int p = brush->GetLinePattern(); out << MARK << " b " << p << "\n"; int w = brush->Width(); out << w << " " << head << " " << tail << " "; const int* dashpat = brush->GetDashPattern(); int dashpatsize = brush->GetDashPatternSize(); int dashoffset = brush->GetDashOffset(); if (dashpatsize <= 0) { out << "[] " << dashoffset << " "; } else { out << "["; int i; for (i = 0; i < dashpatsize - 1; i++) { out << dashpat[i] << " "; } out << dashpat[i] << "] " << dashoffset << " "; } out << "SetB\n"; } } /****************************************************************************/ ArrowMultiLineComp::ArrowMultiLineComp (ArrowMultiLine* g) : MultiLineComp(g){} ArrowMultiLine* ArrowMultiLineComp::GetArrowMultiLine () { return (ArrowMultiLine*) GetGraphic(); } ClassId ArrowMultiLineComp::GetClassId() { return ARROWMULTILINE_COMP; } ClassId ArrowMultiLineComp::GetSubstId (const char*& delim) { delim = "%END_ARROWMULTILINE_COMP%"; return MultiLineComp::GetClassId(); } bool ArrowMultiLineComp::IsA (ClassId id) { return ARROWMULTILINE_COMP == id || MultiLineComp::IsA(id); } Component* ArrowMultiLineComp::Copy () { return new ArrowMultiLineComp((ArrowMultiLine*) GetGraphic()->Copy()); } void ArrowMultiLineComp::Interpret (Command* cmd) { if (cmd->IsA(ARROW_CMD)) { ArrowMultiLine* amline = GetArrowMultiLine(); if (amline != nil) { ArrowCmd* arrowCmd = (ArrowCmd*) cmd; cmd->Store(this, new _ArrowData(amline->Head(), amline->Tail())); amline->SetArrows(arrowCmd->Head(), arrowCmd->Tail()); Notify(); } } else if (cmd->IsA(PATTERN_CMD)) { GraphicComp::Interpret(cmd); } else { MultiLineComp::Interpret(cmd); } } void ArrowMultiLineComp::Uninterpret (Command* cmd) { if (cmd->IsA(ARROW_CMD)) { ArrowMultiLine* amline = GetArrowMultiLine(); if (amline != nil) { _ArrowData* ad = (_ArrowData*) cmd->Recall(this); if (ad != nil) { amline->SetArrows(ad->_head, ad->_tail); Notify(); } } } else { MultiLineComp::Uninterpret(cmd); } } void ArrowMultiLineComp::Read (istream& in) { MultiLineComp::Read(in); SF_MultiLine* ml = GetMultiLine(); Coord* x, *y; int count, h, t; float scale; const Coord* cx, * cy; count = ml->GetOriginal(cx, cy); x = (Coord*)cx; y = (Coord*)cy; in >> h >> t >> scale; ArrowMultiLine* aml = new ArrowMultiLine(x, y, count, h, t, scale, ml); SetGraphic(aml); delete ml; } void ArrowMultiLineComp::Write (ostream& out) { MultiLineComp::Write(out); ArrowMultiLine* aml = GetArrowMultiLine(); out << aml->Head() << " " << aml->Tail() << " " <ArrowScale() << " "; } /****************************************************************************/ ArrowMultiLineComp* ArrowMultiLineView::GetArrowMultiLineComp () { return (ArrowMultiLineComp*) GetSubject(); } ArrowMultiLineView::ArrowMultiLineView ( ArrowMultiLineComp* s ) : MultiLineView(s) { } ClassId ArrowMultiLineView::GetClassId () { return ARROWMULTILINE_VIEW; } bool ArrowMultiLineView::IsA (ClassId id) { return ARROWMULTILINE_VIEW == id || MultiLineView::IsA(id); } void ArrowMultiLineView::Update () { ArrowMultiLine* amline = (ArrowMultiLine*) GetGraphic(); ArrowMultiLine* subj = GetArrowMultiLineComp()->GetArrowMultiLine(); IncurDamage(amline); *amline = *subj; IncurDamage(amline); EraseHandles(); } Command* ArrowMultiLineView::InterpretManipulator (Manipulator* m) { DragManip* dm = (DragManip*) m; Editor* ed = dm->GetViewer()->GetEditor(); Tool* tool = dm->GetTool(); Transformer* rel = dm->GetTransformer(); Command* cmd = nil; ArrowVar* aVar = (ArrowVar*) ed->GetState("ArrowVar"); if (tool->IsA(GRAPHIC_COMP_TOOL)) { GrowingVertices* gv = (GrowingVertices*) dm->GetRubberband(); Coord* x, *y; int n; gv->GetCurrent(x, y, n); if (n > 2 || x[0] != x[1] || y[0] != y[1]) { BrushVar* brVar = (BrushVar*) ed->GetState("BrushVar"); PatternVar* patVar = (PatternVar*) ed->GetState("PatternVar"); ColorVar* colVar = (ColorVar*) ed->GetState("ColorVar"); if (rel != nil) { rel = new Transformer(rel); rel->Invert(); } ArrowMultiLine* aml = new ArrowMultiLine( x, y, n, aVar->Head(), aVar->Tail(), dm->GetViewer()->GetMagnification(), stdgraphic ); if (brVar != nil) aml->SetBrush(brVar->GetBrush()); if (patVar != nil) aml->SetPattern(patVar->GetPattern()); if (colVar != nil) { aml->SetColors(colVar->GetFgColor(), colVar->GetBgColor()); } aml->SetTransformer(rel); Unref(rel); cmd = new PasteCmd(ed, new Clipboard(new ArrowMultiLineComp(aml))); } delete x; delete y; } else if (tool->IsA(RESHAPE_TOOL)) { GrowingVertices* gv = (GrowingVertices*) dm->GetRubberband(); Coord* x, *y; int n, pt; gv->RemoveVertex(); gv->GetCurrent(x, y, n, pt); if (rel != nil) { rel = new Transformer(rel); rel->Invert(); } ArrowMultiLine* orig = GetArrowMultiLineComp()->GetArrowMultiLine(); ArrowMultiLine* aml = new ArrowMultiLine( x, y, n, orig->Head(), orig->Tail(), dm->GetViewer()->GetMagnification(), GetGraphic() ); delete x; delete y; aml->SetTransformer(rel); Unref(rel); cmd = new ReplaceCmd(ed, new ArrowMultiLineComp(aml)); } else { cmd = MultiLineView::InterpretManipulator(m); } return cmd; } /****************************************************************************/ PSArrowMultiLine::PSArrowMultiLine (ArrowMultiLineComp* s) : PSMultiLine(s) { } ClassId PSArrowMultiLine::GetClassId () { return PS_ARROWLINE; } bool PSArrowMultiLine::IsA (ClassId id) { return PS_ARROWMULTILINE == id || PSMultiLine::IsA(id); } bool PSArrowMultiLine::Definition (ostream& out) { ArrowMultiLineComp* comp = (ArrowMultiLineComp*) GetSubject(); ArrowMultiLine* aml = comp->GetArrowMultiLine(); const Coord* x, *y; int n = aml->GetOriginal(x, y); float arrow_scale = aml->ArrowScale(); out << "Begin " << MARK << " " << Name() << "\n"; MinGS(out); out << MARK << " " << n << "\n"; for (int i = 0; i < n; i++) { out << x[i] << " " << y[i] << "\n"; } out << n << " " << Name() << "\n"; out << MARK << " " << arrow_scale << "\n"; out << "End\n\n"; return out.good(); } // this code is entirely for compatibility with older versions of idraw void PSArrowMultiLine::Brush (ostream& out) { ArrowMultiLineComp* comp = (ArrowMultiLineComp*) GetSubject(); PSBrush* brush = (PSBrush*) GetGraphicComp()->GetGraphic()->GetBrush(); bool head, tail; head = comp->GetArrowMultiLine()->Head(); tail = comp->GetArrowMultiLine()->Tail(); if (brush == nil) { out << MARK << " b u\n"; } else if (brush->None()) { out << "none SetB " << MARK << " b n\n"; } else { int p = brush->GetLinePattern(); out << MARK << " b " << p << "\n"; int w = brush->Width(); out << w << " " << head << " " << tail << " "; const int* dashpat = brush->GetDashPattern(); int dashpatsize = brush->GetDashPatternSize(); int dashoffset = brush->GetDashOffset(); if (dashpatsize <= 0) { out << "[] " << dashoffset << " "; } else { out << "["; int i; for (i = 0; i < dashpatsize - 1; i++) { out << dashpat[i] << " "; } out << dashpat[i] << "] " << dashoffset << " "; } out << "SetB\n"; } } /****************************************************************************/ ArrowSplineComp::ArrowSplineComp (ArrowOpenBSpline* g) : SplineComp(g) {} ArrowOpenBSpline* ArrowSplineComp::GetArrowOpenBSpline () { return (ArrowOpenBSpline*) GetGraphic(); } ClassId ArrowSplineComp::GetClassId() { return ARROWSPLINE_COMP; } ClassId ArrowSplineComp::GetSubstId (const char*& delim) { delim = "%END_ARROWSPLINE_COMP%"; return SplineComp::GetClassId(); } bool ArrowSplineComp::IsA (ClassId id) { return ARROWSPLINE_COMP == id || SplineComp::IsA(id); } Component* ArrowSplineComp::Copy () { return new ArrowSplineComp((ArrowOpenBSpline*) GetGraphic()->Copy()); } void ArrowSplineComp::Interpret (Command* cmd) { if (cmd->IsA(ARROW_CMD)) { ArrowOpenBSpline* amline = GetArrowOpenBSpline(); if (amline != nil) { ArrowCmd* arrowCmd = (ArrowCmd*) cmd; cmd->Store(this, new _ArrowData(amline->Head(), amline->Tail())); amline->SetArrows(arrowCmd->Head(), arrowCmd->Tail()); Notify(); } } else if (cmd->IsA(PATTERN_CMD)) { GraphicComp::Interpret(cmd); } else { SplineComp::Interpret(cmd); } } void ArrowSplineComp::Uninterpret (Command* cmd) { if (cmd->IsA(ARROW_CMD)) { ArrowOpenBSpline* amline = GetArrowOpenBSpline(); if (amline != nil) { _ArrowData* ad = (_ArrowData*) cmd->Recall(this); if (ad != nil) { amline->SetArrows(ad->_head, ad->_tail); Notify(); } } } else { SplineComp::Uninterpret(cmd); } } void ArrowSplineComp::Read (istream& in) { SplineComp::Read(in); SFH_OpenBSpline* spl = GetSpline(); Coord* x, *y; int count, h, t; float scale; const Coord* cx, * cy; count = spl->GetOriginal(cx, cy); x = (Coord*)cx; y = (Coord*)cy; in >> h >> t >> scale; ArrowOpenBSpline* as = new ArrowOpenBSpline(x, y, count, h, t, scale, spl); SetGraphic(as); delete spl; } void ArrowSplineComp::Write (ostream& out) { SplineComp::Write(out); ArrowOpenBSpline* as = GetArrowOpenBSpline(); out << as->Head() << " " << as->Tail() << " " << as->ArrowScale() << " "; } /****************************************************************************/ ArrowSplineComp* ArrowSplineView::GetArrowSplineComp () { return (ArrowSplineComp*) GetSubject(); } ArrowSplineView::ArrowSplineView (ArrowSplineComp* s) : SplineView(s) { } ClassId ArrowSplineView::GetClassId () { return ARROWSPLINE_VIEW; } bool ArrowSplineView::IsA (ClassId id) { return ARROWSPLINE_VIEW == id || SplineView::IsA(id); } void ArrowSplineView::Update () { ArrowOpenBSpline* amline = (ArrowOpenBSpline*) GetGraphic(); ArrowOpenBSpline* subj = GetArrowSplineComp()->GetArrowOpenBSpline(); IncurDamage(amline); *amline = *subj; IncurDamage(amline); EraseHandles(); } Command* ArrowSplineView::InterpretManipulator (Manipulator* m) { DragManip* dm = (DragManip*) m; Editor* ed = dm->GetViewer()->GetEditor(); Tool* tool = dm->GetTool(); Transformer* rel = dm->GetTransformer(); Command* cmd = nil; ArrowVar* aVar = (ArrowVar*) ed->GetState("ArrowVar"); if (tool->IsA(GRAPHIC_COMP_TOOL)) { GrowingVertices* gv = (GrowingVertices*) dm->GetRubberband(); Coord* x, *y; int n; gv->GetCurrent(x, y, n); if (n > 2 || x[0] != x[1] || y[0] != y[1]) { BrushVar* brVar = (BrushVar*) ed->GetState("BrushVar"); PatternVar* patVar = (PatternVar*) ed->GetState("PatternVar"); ColorVar* colVar = (ColorVar*) ed->GetState("ColorVar"); if (rel != nil) { rel = new Transformer(rel); rel->Invert(); } ArrowOpenBSpline* aml = new ArrowOpenBSpline( x, y, n, aVar->Head(), aVar->Tail(), dm->GetViewer()->GetMagnification(), stdgraphic ); if (brVar != nil) aml->SetBrush(brVar->GetBrush()); if (patVar != nil) aml->SetPattern(patVar->GetPattern()); if (colVar != nil) { aml->SetColors(colVar->GetFgColor(), colVar->GetBgColor()); } aml->SetTransformer(rel); Unref(rel); cmd = new PasteCmd(ed, new Clipboard(new ArrowSplineComp(aml))); } delete x; delete y; } else if (tool->IsA(RESHAPE_TOOL)) { GrowingVertices* gv = (GrowingVertices*) dm->GetRubberband(); Coord* x, *y; int n, pt; gv->RemoveVertex(); gv->GetCurrent(x, y, n, pt); if (rel != nil) { rel = new Transformer(rel); rel->Invert(); } ArrowOpenBSpline* orig = GetArrowSplineComp()->GetArrowOpenBSpline(); ArrowOpenBSpline* aml = new ArrowOpenBSpline( x, y, n, orig->Head(), orig->Tail(), dm->GetViewer()->GetMagnification(), GetGraphic() ); delete x; delete y; aml->SetTransformer(rel); Unref(rel); cmd = new ReplaceCmd(ed, new ArrowSplineComp(aml)); } else { cmd = SplineView::InterpretManipulator(m); } return cmd; } /****************************************************************************/ PSArrowSpline::PSArrowSpline (ArrowSplineComp* s) : PSSpline(s) { } ClassId PSArrowSpline::GetClassId () { return PS_ARROWLINE; } bool PSArrowSpline::IsA (ClassId id) { return PS_ARROWSPLINE == id || PSSpline::IsA(id); } bool PSArrowSpline::Definition (ostream& out) { ArrowSplineComp* comp = (ArrowSplineComp*) GetSubject(); ArrowOpenBSpline* aml = comp->GetArrowOpenBSpline(); const Coord* x, *y; int n = aml->GetOriginal(x, y); float arrow_scale = aml->ArrowScale(); out << "Begin " << MARK << " " << Name() << "\n"; MinGS(out); out << MARK << " " << n << "\n"; for (int i = 0; i < n; i++) { out << x[i] << " " << y[i] << "\n"; } out << n << " " << Name() << "\n"; out << MARK << " " << arrow_scale << "\n"; out << "End\n\n"; return out.good(); } // this code is entirely for compatibility with older versions of idraw void PSArrowSpline::Brush (ostream& out) { ArrowSplineComp* comp = (ArrowSplineComp*) GetSubject(); PSBrush* brush = (PSBrush*) GetGraphicComp()->GetGraphic()->GetBrush(); bool head, tail; head = comp->GetArrowOpenBSpline()->Head(); tail = comp->GetArrowOpenBSpline()->Tail(); if (brush == nil) { out << MARK << " b u\n"; } else if (brush->None()) { out << "none SetB " << MARK << " b n\n"; } else { int p = brush->GetLinePattern(); out << MARK << " b " << p << "\n"; int w = brush->Width(); out << w << " " << head << " " << tail << " "; const int* dashpat = brush->GetDashPattern(); int dashpatsize = brush->GetDashPatternSize(); int dashoffset = brush->GetDashOffset(); if (dashpatsize <= 0) { out << "[] " << dashoffset << " "; } else { out << "["; int i; for (i = 0; i < dashpatsize - 1; i++) { out << dashpat[i] << " "; } out << dashpat[i] << "] " << dashoffset << " "; } out << "SetB\n"; } } neuron-7.6.3/src/bin/idraw/idarrow.h000066400000000000000000000104031340731477100173270ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * ArrowLineComp, ArrowMultiLineComp, ArrowSplineComp and related * classes for components with arrowheads. */ #ifndef idarrow_h #define idarrow_h #include #include class ArrowLine; class ArrowMultiLine; class ArrowOpenBSpline; class ArrowLineComp : public LineComp { public: ArrowLineComp(ArrowLine* = nil); ArrowLine* GetArrowLine(); virtual void Interpret(Command*); virtual void Uninterpret(Command*); virtual Component* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual ClassId GetSubstId(const char*&); virtual bool IsA(ClassId); }; class ArrowLineView : public LineView { public: ArrowLineView(ArrowLineComp* = nil); virtual Command* InterpretManipulator(Manipulator*); virtual void Update(); ArrowLineComp* GetArrowLineComp(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class PSArrowLine : public PSLine { public: PSArrowLine(ArrowLineComp* = nil); virtual bool Definition(ostream&); virtual void Brush(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class ArrowMultiLineComp : public MultiLineComp { public: ArrowMultiLineComp(ArrowMultiLine* = nil); ArrowMultiLine* GetArrowMultiLine(); virtual void Interpret(Command*); virtual void Uninterpret(Command*); virtual Component* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual ClassId GetSubstId(const char*&); virtual bool IsA(ClassId); }; class ArrowMultiLineView : public MultiLineView { public: ArrowMultiLineView(ArrowMultiLineComp* = nil); virtual Command* InterpretManipulator(Manipulator*); virtual void Update(); ArrowMultiLineComp* GetArrowMultiLineComp(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class PSArrowMultiLine : public PSMultiLine { public: PSArrowMultiLine(ArrowMultiLineComp* = nil); virtual bool Definition(ostream&); virtual void Brush(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class ArrowSplineComp : public SplineComp { public: ArrowSplineComp(ArrowOpenBSpline* = nil); ArrowOpenBSpline* GetArrowOpenBSpline(); virtual void Interpret(Command*); virtual void Uninterpret(Command*); virtual Component* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual ClassId GetSubstId(const char*&); virtual bool IsA(ClassId); }; class ArrowSplineView : public SplineView { public: ArrowSplineView(ArrowSplineComp* = nil); virtual Command* InterpretManipulator(Manipulator*); virtual void Update(); ArrowSplineComp* GetArrowSplineComp(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class PSArrowSpline : public PSSpline { public: PSArrowSpline(ArrowSplineComp* = nil); virtual bool Definition(ostream&); virtual void Brush(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; #endif neuron-7.6.3/src/bin/idraw/idarrowhead.cpp000077500000000000000000000106771340731477100205240ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Arrowhead implementation. */ #include "idarrowhead.h" #include #include /*****************************************************************************/ static const int COUNT = 4; static const int BOTLEFT = 0; static const int TIP = 1; static const int BOTRIGHT = 2; static const int BOTCTR = 3; /*****************************************************************************/ Arrowhead::Arrowhead ( Coord tx, Coord ty, Coord w, Coord h, Graphic* g ) : SF_Polygon(x(tx, w), y(ty, h), COUNT, g) { } Arrowhead::Arrowhead ( Coord* x, Coord* y, Graphic* g ) : SF_Polygon(x, y, COUNT, g) { } Graphic* Arrowhead::Copy () { return new Arrowhead(_x, _y, this); } #if 0 Graphic& Arrowhead::operator = (Graphic& g) { return Graphic::operator=(g); } #else // SUNWspro/bin/CC gives error for above construct. In fact, it is not // a full copy but I don't want to change it's behavior. If there is // a bug with arrowheads however, this is probably it. Arrowhead& Arrowhead::operator = (Arrowhead& g) { Graphic::operator=(g); return *this; } #endif Coord Arrowhead::CorrectedHeight (float t) { float w = _x[BOTRIGHT] - _x[BOTCTR]; float h = _y[TIP] - _y[BOTRIGHT]; float a = -4*h * w*w; float radicand = 4*w*w + 4*h*h - t*t; float root = (radicand < 0.) ? 0. : sqrt(radicand); float b = t*w * root; float c = t*t - 4*w*w; if (c == 0) return 0; Coord h1 = iv26_round((a + b) / c); Coord h2 = iv26_round((a - b) / c); return (h1 < h && h1 > 0) ? h1 : h2; } void Arrowhead::CorrectedTip ( Coord& tipx, Coord& tipy, PSBrush* br, Transformer* t ) { Transformer total(t); Transformer* my_t = GetTransformer(); concatTransformer(my_t, t, &total); float thk = UnscaledLength(br->Width(), &total); tipx = _x[TIP]; tipy = _y[BOTLEFT] + CorrectedHeight(thk); if (my_t != nil) my_t->Transform(tipx, tipy); } float Arrowhead::UnscaledLength (float length, Transformer* t) { Transformer inverse(t); inverse.Invert(); float x0 = 0, y0 = 0, x1 = length, y1 = 0; float tx0, ty0, tx1, ty1; inverse.Transform(x0, y0, tx0, ty0); inverse.Transform(x1, y1, tx1, ty1); return hypot(tx0-tx1, ty0-ty1); } void Arrowhead::draw (Canvas* c, Graphic* gs) { PSPattern* pat = gs->GetPattern(); PSBrush* br = gs->GetBrush(); if (br->None()) { _y[BOTCTR] = _y[BOTLEFT]; SF_Polygon::draw(c, gs); } else { Coord ytip = _y[TIP]; float thk = UnscaledLength(br->Width(), gs->GetTransformer()); Coord hcorrect = CorrectedHeight(thk); if (pat->None()) { _y[BOTCTR] = _y[TIP] = _y[BOTLEFT] + hcorrect; SF_Polygon::draw(c, gs); _y[BOTCTR] = _y[TIP] = ytip; } else { _y[BOTCTR] = _y[BOTLEFT]; _y[TIP] = _y[BOTLEFT] + hcorrect; SF_Polygon::draw(c, gs); _y[TIP] = ytip; } } } Coord* Arrowhead::x (Coord tipx, Coord w) { static Coord px[COUNT]; px[BOTLEFT] = tipx - w/2; px[TIP] = px[BOTCTR] = tipx; px[BOTRIGHT] = tipx + w/2; return px; } Coord* Arrowhead::y (Coord tipy, Coord h) { static Coord py[COUNT]; py[BOTLEFT] = py[BOTRIGHT] = py[BOTCTR] = tipy - h; py[TIP] = tipy; return py; } neuron-7.6.3/src/bin/idraw/idarrowhead.h000077500000000000000000000035111340731477100201560ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Definition of Arrowhead graphic. */ #ifndef idarrowhead_h #define idarrowhead_h #include class Arrowhead : public SF_Polygon { public: Arrowhead(Coord tipx, Coord tipy, Coord w, Coord h, Graphic* gr = nil); void CorrectedTip(Coord&, Coord&, PSBrush*, Transformer*); virtual Graphic* Copy(); // virtual Graphic& operator = (Graphic&); virtual Arrowhead& operator = (Arrowhead&); protected: Arrowhead(Coord*, Coord*, Graphic*); virtual void draw(Canvas*, Graphic*); Coord CorrectedHeight(float line_thk); float UnscaledLength(float length, Transformer* t); private: Coord* x(Coord, Coord); Coord* y(Coord, Coord); }; #endif neuron-7.6.3/src/bin/idraw/idarrows.cpp000066400000000000000000000400541340731477100200520ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of ArrowLine, ArrowMultiLine, and ArrowOpenBSpline graphics. */ #include "idarrowhead.h" #include "idarrows.h" #include #include #include #include #include #include /****************************************************************************/ ArrowLine::ArrowLine ( Coord x0, Coord y0, Coord x1, Coord y1, bool h, bool t, float arrow_scale, Graphic* gr ) : Line(x0, y0, x1, y1, gr) { _head = nil; _tail = nil; _arrow_scale = arrow_scale; _pat = nil; if (gr != nil) ArrowLine::SetPattern(gr->GetPattern()); SetArrows(h, t); } ArrowLine::ArrowLine ( Coord x0, Coord y0, Coord x1, Coord y1, Arrowhead* h, Arrowhead* t, float arrow_scale, Graphic* gr ) : Line(x0, y0, x1, y1, gr) { _head = h; _tail = t; _arrow_scale = arrow_scale; _pat = nil; if (gr != nil) ArrowLine::SetPattern(gr->GetPattern()); } ArrowLine::~ArrowLine () { delete _head; delete _tail; } void ArrowLine::SetPattern (PSPattern* pat) { if (_pat != pat) { Ref(pat); Unref(_pat); _pat = pat; invalidateCaches(); } } PSPattern* ArrowLine::GetPattern () { return _pat; } #if 0 Graphic& ArrowLine::operator = (Graphic& g) { return Graphic::operator=(g); } #endif ArrowLine& ArrowLine::operator = (ArrowLine& aline) { Graphic::operator=(aline); SetArrows(aline.Head(), aline.Tail()); if (Head()) *_head = *aline._head; if (Tail()) *_tail = *aline._tail; _arrow_scale = aline.ArrowScale(); return *this; } Graphic* ArrowLine::Copy () { Arrowhead* head = Head() ? (Arrowhead*) _head->Copy() : nil; Arrowhead* tail = Tail() ? (Arrowhead*) _tail->Copy() : nil; return new ArrowLine(_x0, _y0, _x1, _y1, head, tail, _arrow_scale, this); } void ArrowLine::ScaleArrows (float mag) { if (Head()) _head->Scale(mag, mag, _x0, _y0); if (Tail()) _tail->Scale(mag, mag, _x1, _y1); _arrow_scale = mag; invalidateCaches(); } void ArrowLine::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { Line::getExtent(l, b, cx, cy, tol, gs); Extent e(l, b, cx, cy, tol); if (Head()) e.Merge(ArrowheadExtent(_head, gs)); if (Tail()) e.Merge(ArrowheadExtent(_tail, gs)); l = e._left; b = e._bottom; cx = e._cx; cy = e._cy; tol = e._tol; } bool ArrowLine::contains (PointObj& po, Graphic* gs) { return Line::contains(po, gs) || (Head() && ArrowheadContains(_head, po, gs)) || (Tail() && ArrowheadContains(_tail, po, gs)); } bool ArrowLine::intersects (BoxObj& bo, Graphic* gs) { return Line::intersects(bo, gs) || (Head() && ArrowheadIntersects(_head, bo, gs)) || (Tail() && ArrowheadIntersects(_tail, bo, gs)); } void ArrowLine::draw (Canvas* c, Graphic* gs) { PSBrush* br = gs->GetBrush(); if (!br->None()) { Coord x0 = _x0, y0 = _y0, x1 = _x1, y1 = _y1; if (Head()) _head->CorrectedTip(x0, y0, br, gs->GetTransformer()); if (Tail()) _tail->CorrectedTip(x1, y1, br, gs->GetTransformer()); update(gs); _p->Line(c, x0, y0, x1, y1); } if (Head()) ArrowheadDraw(_head, c, gs); if (Tail()) ArrowheadDraw(_tail, c, gs); } Extent& ArrowLine::ArrowheadExtent (Arrowhead* arrow, Graphic* gs) { FullGraphic gstemp; Transformer ttemp; static Extent e; gstemp.SetTransformer(&ttemp); concatGraphic(arrow, arrow, gs, &gstemp); getExtentGraphic(arrow, e._left, e._bottom, e._cx, e._cy, e._tol, &gstemp); return e; } bool ArrowLine::ArrowheadContains ( Arrowhead* arrow, PointObj& po, Graphic* gs ) { FullGraphic gstemp; Transformer ttemp; gstemp.SetTransformer(&ttemp); concatGraphic(arrow, arrow, gs, &gstemp); return containsGraphic(arrow, po, &gstemp); } bool ArrowLine::ArrowheadIntersects ( Arrowhead* arrow, BoxObj& bo, Graphic* gs ) { FullGraphic gstemp; Transformer ttemp; gstemp.SetTransformer(&ttemp); concatGraphic(arrow, arrow, gs, &gstemp); return intersectsGraphic(arrow, bo, &gstemp); } void ArrowLine::ArrowheadDraw (Arrowhead* arrow, Canvas* c, Graphic* gs) { FullGraphic gstemp; Transformer ttemp; gstemp.SetTransformer(&ttemp); concatGraphic(arrow, arrow, gs, &gstemp); drawGraphic(arrow, c, &gstemp); } void ArrowLine::SetArrows (bool h, bool t) { delete _head; delete _tail; Coord width = iv26_round(ARROWWIDTH*points); Coord height = iv26_round(ARROWHEIGHT*points); _head = h ? new Arrowhead(_x0, _y0, width, height) : nil; _tail = t ? new Arrowhead(_x1, _y1, width, height) : nil; float angle = atan2(double(_y0-_y1), double(_x0-_x1))*180/M_PI; if (h) _head->Rotate(angle-90, _x0, _y0); if (t) _tail->Rotate(angle+90, _x1, _y1); ScaleArrows(_arrow_scale); invalidateCaches(); } /****************************************************************************/ ArrowMultiLine::ArrowMultiLine ( Coord* x, Coord* y, int count, bool h, bool t, float arrow_scale, Graphic* gr ) : SF_MultiLine(x, y, count, gr) { _head = nil; _tail = nil; _arrow_scale = arrow_scale; SetArrows(h, t); } ArrowMultiLine::ArrowMultiLine ( Coord* x, Coord* y, int count, Arrowhead* h, Arrowhead* t, float arrow_scale, Graphic* gr ) : SF_MultiLine(x, y, count, gr) { _head = h; _tail = t; _arrow_scale = arrow_scale; } ArrowMultiLine::~ArrowMultiLine () { delete _head; delete _tail; } #if 0 Graphic& ArrowMultiLine::operator = (Graphic& g) { return Graphic::operator=(g); } #endif ArrowMultiLine& ArrowMultiLine::operator = (ArrowMultiLine& aml) { Graphic::operator=(aml); SetArrows(aml.Head(), aml.Tail()); if (Head()) *_head = *aml._head; if (Tail()) *_tail = *aml._tail; _arrow_scale = aml.ArrowScale(); return *this; } Graphic* ArrowMultiLine::Copy () { Arrowhead* head = Head() ? (Arrowhead*) _head->Copy() : nil; Arrowhead* tail = Tail() ? (Arrowhead*) _tail->Copy() : nil; return new ArrowMultiLine(_x, _y, _count, head, tail, _arrow_scale, this); } void ArrowMultiLine::ScaleArrows (float mag) { if (Head()) _head->Scale(mag, mag, _x[0], _y[0]); if (Tail()) _tail->Scale(mag, mag, _x[_count-1], _y[_count-1]); _arrow_scale = mag; invalidateCaches(); } void ArrowMultiLine::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { SF_MultiLine::getExtent(l, b, cx, cy, tol, gs); Extent e(l, b, cx, cy, tol); if (Head()) e.Merge(ArrowheadExtent(_head, gs)); if (Tail()) e.Merge(ArrowheadExtent(_tail, gs)); l = e._left; b = e._bottom; cx = e._cx; cy = e._cy; tol = e._tol; } bool ArrowMultiLine::contains (PointObj& po, Graphic* gs) { return SF_MultiLine::contains(po, gs) || (Head() && ArrowheadContains(_head, po, gs)) || (Tail() && ArrowheadContains(_tail, po, gs)); } bool ArrowMultiLine::intersects (BoxObj& bo, Graphic* gs) { return SF_MultiLine::intersects(bo, gs) || (Head() && ArrowheadIntersects(_head, bo, gs)) || (Tail() && ArrowheadIntersects(_tail, bo, gs)); } void ArrowMultiLine::draw (Canvas* c, Graphic* gs) { PSBrush* br = gs->GetBrush(); if (!Head() && !Tail()) { SF_MultiLine::draw(c, gs); } else if (!br->None()) { int l = _count-1; Coord x0 = _x[0], y0 = _y[0], x1 = _x[l], y1 = _y[l]; Coord tx0 = x0, ty0 = y0, tx1 = x1, ty1 = y1; if (Head()) _head->CorrectedTip(tx0, ty0, br, gs->GetTransformer()); if (Tail()) _tail->CorrectedTip(tx1, ty1, br, gs->GetTransformer()); _x[0] = tx0; _y[0] = ty0; _x[l] = tx1; _y[l] = ty1; update(gs); _p->MultiLine(c, _x, _y, _count); _x[0] = x0; _y[0] = y0; _x[l] = x1; _y[l] = y1; if (Head()) ArrowheadDraw(_head, c, gs); if (Tail()) ArrowheadDraw(_tail, c, gs); } } Extent& ArrowMultiLine::ArrowheadExtent (Arrowhead* arrow, Graphic* gs) { FullGraphic gstemp; Transformer ttemp; static Extent e; gstemp.SetTransformer(&ttemp); concatGraphic(arrow, arrow, gs, &gstemp); getExtentGraphic(arrow, e._left, e._bottom, e._cx, e._cy, e._tol, &gstemp); return e; } bool ArrowMultiLine::ArrowheadContains ( Arrowhead* arrow, PointObj& po, Graphic* gs ) { FullGraphic gstemp; Transformer ttemp; gstemp.SetTransformer(&ttemp); concatGraphic(arrow, arrow, gs, &gstemp); return containsGraphic(arrow, po, &gstemp); } bool ArrowMultiLine::ArrowheadIntersects ( Arrowhead* arrow, BoxObj& bo, Graphic* gs ) { FullGraphic gstemp; Transformer ttemp; gstemp.SetTransformer(&ttemp); concatGraphic(arrow, arrow, gs, &gstemp); return intersectsGraphic(arrow, bo, &gstemp); } void ArrowMultiLine::ArrowheadDraw (Arrowhead* arrow, Canvas* c, Graphic* gs) { FullGraphic gstemp; Transformer ttemp; gstemp.SetTransformer(&ttemp); concatGraphic(arrow, arrow, gs, &gstemp); drawGraphic(arrow, c, &gstemp); } void ArrowMultiLine::SetArrows (bool h, bool t) { delete _head; delete _tail; Coord width = iv26_round(ARROWWIDTH*points); Coord height = iv26_round(ARROWHEIGHT*points); int k = _count-2; int l = _count-1; _head = h ? new Arrowhead(_x[0], _y[0], width, height) : nil; _tail = t ? new Arrowhead(_x[l], _y[l], width, height) : nil; float head_angle = atan2(double(_y[0]-_y[1]), double(_x[0]-_x[1]))*180/M_PI; float tail_angle = atan2(double(_y[k]-_y[l]), double(_x[k]-_x[l]))*180/M_PI; if (h) _head->Rotate(head_angle-90, _x[0], _y[0]); if (t) _tail->Rotate(tail_angle+90, _x[l], _y[l]); ScaleArrows(_arrow_scale); invalidateCaches(); } /****************************************************************************/ ArrowOpenBSpline::ArrowOpenBSpline ( Coord* x, Coord* y, int count, bool h, bool t, float arrow_scale, Graphic* gr ) : SFH_OpenBSpline(x, y, count, gr) { _head = nil; _tail = nil; _arrow_scale = arrow_scale; SetArrows(h, t); } ArrowOpenBSpline::ArrowOpenBSpline ( Coord* x, Coord* y, int count, Arrowhead* h, Arrowhead* t, float arrow_scale, Graphic* gr ) : SFH_OpenBSpline(x, y, count, gr) { _head = h; _tail = t; _arrow_scale = arrow_scale; } ArrowOpenBSpline::~ArrowOpenBSpline () { delete _head; delete _tail; } #if 0 Graphic& ArrowOpenBSpline::operator = (Graphic& g) { return Graphic::operator=(g); } #endif ArrowOpenBSpline& ArrowOpenBSpline::operator = (ArrowOpenBSpline& aml) { Graphic::operator=(aml); SetArrows(aml.Head(), aml.Tail()); if (Head()) *_head = *aml._head; if (Tail()) *_tail = *aml._tail; _arrow_scale = aml.ArrowScale(); return *this; } Graphic* ArrowOpenBSpline::Copy () { Arrowhead* head = Head() ? (Arrowhead*) _head->Copy() : nil; Arrowhead* tail = Tail() ? (Arrowhead*) _tail->Copy() : nil; Coord* x, *y; const Coord* cx, * cy; int count = GetOriginal(cx, cy); x = (Coord*)cx; y = (Coord*)cy; return new ArrowOpenBSpline(x, y, count, head, tail, _arrow_scale, this); } void ArrowOpenBSpline::ScaleArrows (float mag) { if (Head()) _head->Scale(mag, mag, _x[0], _y[0]); if (Tail()) _tail->Scale(mag, mag, _x[_count-1], _y[_count-1]); _arrow_scale = mag; invalidateCaches(); } void ArrowOpenBSpline::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { SFH_OpenBSpline::getExtent(l, b, cx, cy, tol, gs); Extent e(l, b, cx, cy, tol); if (Head()) e.Merge(ArrowheadExtent(_head, gs)); if (Tail()) e.Merge(ArrowheadExtent(_tail, gs)); l = e._left; b = e._bottom; cx = e._cx; cy = e._cy; tol = e._tol; } bool ArrowOpenBSpline::contains (PointObj& po, Graphic* gs) { return SFH_OpenBSpline::contains(po, gs) || (Head() && ArrowheadContains(_head, po, gs)) || (Tail() && ArrowheadContains(_tail, po, gs)); } bool ArrowOpenBSpline::intersects (BoxObj& bo, Graphic* gs) { return SFH_OpenBSpline::intersects(bo, gs) || (Head() && ArrowheadIntersects(_head, bo, gs)) || (Tail() && ArrowheadIntersects(_tail, bo, gs)); } void ArrowOpenBSpline::draw (Canvas* c, Graphic* gs) { PSBrush* br = gs->GetBrush(); if (!Head() && !Tail()) { SFH_OpenBSpline::draw(c, gs); } else if (!br->None()) { int j = _count-3, k = _count-2, l = _count-1; Coord x0 = _x[0], y0 = _y[0], x1 = _x[l], y1 = _y[l]; Coord tx0 = x0, ty0 = y0, tx1 = x1, ty1 = y1; if (Head()) _head->CorrectedTip(tx0, ty0, br, gs->GetTransformer()); if (Tail()) _tail->CorrectedTip(tx1, ty1, br, gs->GetTransformer()); _x[0] = _x[1] = _x[2] = tx0; _y[0] = _y[1] = _y[2] = ty0; _x[l] = _x[k] = _x[j] = tx1; _y[l] = _y[k] = _y[k] = ty1; update(gs); _p->BSpline(c, _x, _y, _count); _x[0] = _x[1] = _x[2] = x0; _y[0] = _y[1] = _y[2] = y0; _x[l] = _x[k] = _x[j] = x1; _y[l] = _y[k] = _y[j] = y1; if (Head()) ArrowheadDraw(_head, c, gs); if (Tail()) ArrowheadDraw(_tail, c, gs); } } Extent& ArrowOpenBSpline::ArrowheadExtent (Arrowhead* arrow, Graphic* gs) { FullGraphic gstemp; Transformer ttemp; static Extent e; gstemp.SetTransformer(&ttemp); concatGraphic(arrow, arrow, gs, &gstemp); getExtentGraphic(arrow, e._left, e._bottom, e._cx, e._cy, e._tol, &gstemp); return e; } bool ArrowOpenBSpline::ArrowheadContains ( Arrowhead* arrow, PointObj& po, Graphic* gs ) { FullGraphic gstemp; Transformer ttemp; gstemp.SetTransformer(&ttemp); concatGraphic(arrow, arrow, gs, &gstemp); return containsGraphic(arrow, po, &gstemp); } bool ArrowOpenBSpline::ArrowheadIntersects ( Arrowhead* arrow, BoxObj& bo, Graphic* gs ) { FullGraphic gstemp; Transformer ttemp; gstemp.SetTransformer(&ttemp); concatGraphic(arrow, arrow, gs, &gstemp); return intersectsGraphic(arrow, bo, &gstemp); } void ArrowOpenBSpline::ArrowheadDraw (Arrowhead* arrow,Canvas* c,Graphic* gs) { FullGraphic gstemp; Transformer ttemp; gstemp.SetTransformer(&ttemp); concatGraphic(arrow, arrow, gs, &gstemp); drawGraphic(arrow, c, &gstemp); } void ArrowOpenBSpline::SetArrows (bool h, bool t) { delete _head; delete _tail; Coord width = iv26_round(ARROWWIDTH*points); Coord height = iv26_round(ARROWHEIGHT*points); int l = _count-1; int k = l-3; _head = h ? new Arrowhead(_x[0], _y[0], width, height) : nil; _tail = t ? new Arrowhead(_x[l], _y[l], width, height) : nil; float head_angle = atan2(double(_y[0]-_y[3]), double(_x[0]-_x[3]))*180/M_PI; float tail_angle = atan2(double(_y[k]-_y[l]), double(_x[k]-_x[l]))*180/M_PI; if (h) _head->Rotate(head_angle-90, _x[0], _y[0]); if (t) _tail->Rotate(tail_angle+90, _x[l], _y[l]); ScaleArrows(_arrow_scale); invalidateCaches(); } neuron-7.6.3/src/bin/idraw/idarrows.h000066400000000000000000000127571340731477100175300ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * ArrowLine - a Line with arrows on the ends * ArrowMultiLine graphic -- a SF_MultiLine with arrows on the ends * ArrowOpenBSpline graphic -- an SF_OpenBSpline with arrows on the ends */ #ifndef idarrows_h #define idarrows_h #include #include static const float ARROWHEIGHT = 8; // in points static const float ARROWWIDTH = ARROWHEIGHT/2; class Arrowhead; class ArrowLine : public Line { public: ArrowLine( Coord x0, Coord y0, Coord x1, Coord y1, bool h, bool t, float arrow_scale, Graphic* gr = nil ); virtual ~ArrowLine(); void SetArrows(bool h, bool t); void ScaleArrows(float); bool Head(); bool Tail(); float ArrowScale(); virtual void SetPattern(PSPattern*); virtual PSPattern* GetPattern(); virtual Graphic* Copy(); // virtual Graphic& operator = (Graphic&); virtual ArrowLine& operator = (ArrowLine&); protected: ArrowLine( Coord,Coord,Coord,Coord, Arrowhead*, Arrowhead*, float, Graphic* = nil ); virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); private: Extent& ArrowheadExtent(Arrowhead*, Graphic* gs); bool ArrowheadContains(Arrowhead*, PointObj&, Graphic* gs); bool ArrowheadIntersects(Arrowhead*, BoxObj&, Graphic* gs); void ArrowheadDraw(Arrowhead*, Canvas*, Graphic* gs); private: PSPattern* _pat; Arrowhead* _head; Arrowhead* _tail; float _arrow_scale; }; inline bool ArrowLine::Head () { return _head != nil; } inline bool ArrowLine::Tail () { return _tail != nil; } inline float ArrowLine::ArrowScale () { return _arrow_scale; } class ArrowMultiLine : public SF_MultiLine { public: ArrowMultiLine( Coord* x, Coord* y, int count, bool h, bool t, float arrow_scale, Graphic* gr = nil ); virtual ~ArrowMultiLine(); void SetArrows(bool h, bool t); void ScaleArrows(float); bool Head(); bool Tail(); float ArrowScale(); virtual Graphic* Copy(); // virtual Graphic& operator = (Graphic&); virtual ArrowMultiLine& operator = (ArrowMultiLine&); protected: ArrowMultiLine( Coord*, Coord*, int, Arrowhead*, Arrowhead*, float, Graphic* gr = nil ); virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); private: Extent& ArrowheadExtent(class Arrowhead*, Graphic* gs); bool ArrowheadContains(Arrowhead*, PointObj&, Graphic* gs); bool ArrowheadIntersects(Arrowhead*, BoxObj&, Graphic* gs); void ArrowheadDraw(Arrowhead*, Canvas*, Graphic* gs); private: Arrowhead* _head; Arrowhead* _tail; float _arrow_scale; }; inline bool ArrowMultiLine::Head () { return _head != nil; } inline bool ArrowMultiLine::Tail () { return _tail != nil; } inline float ArrowMultiLine::ArrowScale () { return _arrow_scale; } class ArrowOpenBSpline : public SFH_OpenBSpline { public: ArrowOpenBSpline( Coord* x, Coord* y, int count, bool h, bool t, float arrow_scale, Graphic* gr = nil ); virtual ~ArrowOpenBSpline(); void SetArrows(bool h, bool t); void ScaleArrows(float); bool Head(); bool Tail(); float ArrowScale(); virtual Graphic* Copy(); // virtual Graphic& operator = (Graphic&); virtual ArrowOpenBSpline& operator = (ArrowOpenBSpline&); protected: ArrowOpenBSpline( Coord*, Coord*, int, Arrowhead*, Arrowhead*, float, Graphic* gr = nil ); virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); private: Extent& ArrowheadExtent(class Arrowhead*, Graphic* gs); bool ArrowheadContains(Arrowhead*, PointObj&, Graphic* gs); bool ArrowheadIntersects(Arrowhead*, BoxObj&, Graphic* gs); void ArrowheadDraw(Arrowhead*, Canvas*, Graphic* gs); private: Arrowhead* _head; Arrowhead* _tail; float _arrow_scale; }; inline bool ArrowOpenBSpline::Head () { return _head != nil; } inline bool ArrowOpenBSpline::Tail () { return _tail != nil; } inline float ArrowOpenBSpline::ArrowScale () { return _arrow_scale; } #endif neuron-7.6.3/src/bin/idraw/idcatalog.cpp000066400000000000000000000576401340731477100201600ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * IdrawCatalog implementation. */ #include "idarrow.h" #include "idarrows.h" #include "idcatalog.h" #include "idclasses.h" #include "idcomp.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ // octal converts a string of three octal digits to a character. static char octal(const char* p) { char c = *p - '0'; c = c*8 + *++p - '0'; c = c*8 + *++p - '0'; return c; } /*****************************************************************************/ char IdrawCatalog::_buf[CHARBUFSIZE]; float IdrawCatalog::_psversion; IdrawCatalog::IdrawCatalog ( const char* name, Creator* creator ) : Catalog(name, creator) { _psversion = PSV_ORIGINAL; } bool IdrawCatalog::Save (EditorInfo* o, const char* name) { return Catalog::Save(o, name); } bool IdrawCatalog::Save (Command* o, const char* name) { return Catalog::Save(o, name); } bool IdrawCatalog::Save (Tool* o, const char* name) { return Catalog::Save(o, name); } bool IdrawCatalog::Retrieve (const char* name, EditorInfo*& o) { return Catalog::Retrieve(name, o); } bool IdrawCatalog::Retrieve (const char* name, Command*& o) { return Catalog::Retrieve(name, o); } bool IdrawCatalog::Retrieve (const char* name, Tool*& o) { return Catalog::Retrieve(name, o); } bool IdrawCatalog::Save (Component* comp, const char* name) { bool ok = false; if (UnidrawFormat(name)) { ok = Catalog::Save(comp, name); } else { ExternView* ev = (ExternView*) comp->Create(POSTSCRIPT_VIEW); if (ev != nil) { filebuf fbuf; ok = fbuf.open(name, IOS_OUT) != 0; if (ok) { ostream out(&fbuf); comp->Attach(ev); ev->Update(); ok = ev->Emit(out); if (ok) { Forget(comp, name); Register(comp, name); } } delete ev; } } return ok; } bool IdrawCatalog::Retrieve (const char* name, Component*& comp) { if (Valid(name, comp)) { _valid = true; } else if (UnidrawFormat(name)) { _valid = Catalog::Retrieve(name, comp); } else { filebuf fbuf; _valid = fbuf.open(name, IOS_IN) != 0; if (_valid) { istream in(&fbuf); comp = ReadPostScript(in); if (_valid) { Forget(comp, name); Register(comp, name); } } } return _valid; } bool IdrawCatalog::UnidrawFormat (const char* name) { filebuf fbuf; bool unidraw_format = false; if (fbuf.open(name, IOS_IN) != 0) { istream in(&fbuf); Skip(in); in >> _buf; if (strcmp(_buf, "Unidraw") == 0) { unidraw_format = true; } } return unidraw_format; } GraphicComp* IdrawCatalog::ReadPostScript (istream& in) { Skip(in); in >> _buf >> _psversion; if (_psversion > PSV_LATEST) { fprintf(stderr, "warning: drawing version %g ", _psversion); fprintf(stderr, "newer than idraw version %g\n", PSV_LATEST); } float xincr, yincr; PSReadGridSpacing(in, xincr, yincr); IdrawComp* comp = new IdrawComp; comp->SetGridSpacing(xincr, yincr); if (_psversion < PSV_NONREDUNDANT) { Skip(in); } Graphic* g = comp->GetGraphic(); Transformer* t = g->GetTransformer(); PSReadPictGS(in, g); PSReadChildren(in, comp); ScaleToScreenCoords(g); if (_psversion < PSV_NONROTATED && t != nil && t->Rotated90()) { Transformer identity; *t = identity; g->Translate(0.0, -8.5*inches); g->Rotate(90.0, 0.0, 0.0); comp->Bequeath(); } _valid = in.good(); return comp; } /* * ScaleToScreenCoords scales the picture back to screen coordinates * if screen and Postscript inches are different. */ void IdrawCatalog::ScaleToScreenCoords (Graphic* g) { const double postscriptinch = 72.; if (inch != postscriptinch) { double toscreen = inch / postscriptinch; g->Scale(toscreen, toscreen); } } /* * reads data to initialize graphic comp and create children */ GraphicComp* IdrawCatalog::ReadPict (istream& in) { FullGraphic gs; PSReadPictGS(in, &gs); GraphicComp* pict = new GraphicComps; *pict->GetGraphic() = gs; PSReadChildren(in, pict); _valid = in.good(); return pict; } /* * PSReadChildren loops determining which kind of Component follows and * creating it until it reads "end" which means all of the children * have been created. */ void IdrawCatalog::PSReadChildren (istream& in, GraphicComp* comp) { while (in.good()) { Skip(in); GraphicComp* child = nil; in >> _buf; if (strcmp(_buf, "BSpl") == 0) child = ReadBSpline(in); else if (strcmp(_buf, "Circ") == 0) child = ReadCircle(in); else if (strcmp(_buf, "CBSpl") == 0) child = ReadClosedBSpline(in); else if (strcmp(_buf, "Elli") == 0) child = ReadEllipse(in); else if (strcmp(_buf, "Line") == 0) child = ReadLine(in); else if (strcmp(_buf, "MLine") == 0) child = ReadMultiLine(in); else if (strcmp(_buf, "Pict") == 0) child = ReadPict(in); else if (strcmp(_buf, "Poly") == 0) child = ReadPolygon(in); else if (strcmp(_buf, "Rect") == 0) child = ReadRect(in); else if (strcmp(_buf, "Text") == 0) child = ReadText(in); else if (strcmp(_buf, "SSten") == 0) child = ReadSStencil(in); else if (strcmp(_buf, "FSten") == 0) child = ReadFStencil(in); else if (strcmp(_buf, "Rast") == 0) child = ReadRaster(in); else if (strcmp(_buf, "eop") == 0) break; else { fprintf(stderr, "unknown graphical object %s, skipping\n", _buf); continue; } if (child != nil) { if (in.good()) { comp->Append(child); } else { delete child; } } } } /* * PSReadGridSpacing reads the grid spacing used by the drawing and * stores the new grid spacing value. It must correct the default * grid spacing it gives to old drawings for an implementation botch * in InterViews 2.4 that calculated point's value incorrectly using * 72.07/inch instead of inch/72.27 (it was a botch in TWO ways). */ void IdrawCatalog::PSReadGridSpacing (istream& in, float& xincr, float& yincr){ if (_psversion < PSV_GRIDSPACING) { const int oldspacing = 8; const double oldpoints = 72.07/inches; xincr = yincr = oldpoints * iv26_round(oldspacing * oldpoints); } else { in >> _buf; if (strcmp(_buf, "Grid") == 0) { in >> xincr; if (_psversion < PSV_UNIDRAW) { yincr = xincr; } else { in >> yincr; } } } } /* * PSReadGS reads data to initialize the graphic for IdrawComps * which don't contain any text. */ void IdrawCatalog::PSReadGS (istream& in, Graphic* gs) { PSReadBrush(in, gs); if (_psversion >= PSV_FGANDBGCOLOR) { PSReadFgColor(in, gs); PSReadBgColor(in, gs); gs->SetFont(nil); } else if (_psversion >= PSV_FGCOLOR) { PSReadFgColor(in, gs); gs->SetColors(gs->GetFgColor(), pswhite); gs->SetFont(nil); } else { gs->SetColors(psblack, pswhite); PSReadFont(in, gs); } PSReadPattern(in, gs); PSReadTransformer(in, gs); } /* * PSReadPictGS reads data to initialize the state of GraphicComps * which may contain some text. */ void IdrawCatalog::PSReadPictGS (istream& in, Graphic* gs) { PSReadBrush(in, gs); if (_psversion >= PSV_FGANDBGCOLOR) { PSReadFgColor(in, gs); PSReadBgColor(in, gs); } else if (_psversion >= PSV_FGCOLOR) { PSReadFgColor(in, gs); gs->SetColors(gs->GetFgColor(), nil); } else { gs->SetColors(nil, nil); } PSReadFont(in, gs); PSReadPattern(in, gs); PSReadTransformer(in, gs); } /* * PSReadTextGS reads data to initialize the graphic gs for * TextComp which doesn't need a brush or pattern. */ void IdrawCatalog::PSReadTextGS (istream& in, Graphic* gs) { if (_psversion >= PSV_FGCOLOR) { gs->SetBrush(nil); PSReadFgColor(in, gs); gs->SetColors(gs->GetFgColor(), nil); } else { PSReadBrush(in, gs); gs->SetColors(psblack, nil); } PSReadFont(in, gs); if (_psversion < PSV_NONREDUNDANT) { PSReadPattern(in, gs); PSPattern* pattern = gs->GetPattern(); float graylevel = pattern->GetGrayLevel(); const char* c = "Black"; int r = 0, g = 0, b = 0; if (graylevel != 0 && graylevel != -1) { if (graylevel == 1) { c = "White"; r = g = b = 65535; } else { c = "Gray"; r = g = b = 49152; } } PSColor* fgcolor = FindColor(c, r, g, b); gs->SetColors(fgcolor, nil); } else { gs->SetPattern(nil); } PSReadTransformer(in, gs); if (_psversion < PSV_TEXTOFFSET) { PSFont* f = gs->GetFont(); float sep = f->GetLineHt() - f->Height() - 1; CorrectTextVPos(gs, sep); } PSFont* f = gs->GetFont(); float sep = 1 - f->GetLineHt(); CorrectTextVPos(gs, sep); } void IdrawCatalog::CorrectTextVPos (Graphic* gs, float sep) { PSFont* f = gs->GetFont(); Transformer* t = gs->GetTransformer(); float dx = 0., dy = sep; if (t != nil) { float x0, y0, x1, y1; t->Transform(0., 0., x0, y0); t->Transform(0., sep, x1, y1); dx = x1 - x0; dy = y1 - y0; } gs->Translate(dx, dy); } /* * PSReadBrush reads data to set the IdrawComp's brush. */ void IdrawCatalog::PSReadBrush (istream& in, Graphic* gs) { Skip(in); in >> _buf; if (_buf[0] == 'b') { char lookahead = 'u'; bool undefined = false; bool none = false; int p = 0; int w = 0; int head = false; int tail = false; in >> lookahead; in.putback(lookahead); switch (lookahead) { case 'u': undefined = true; break; case 'n': none = true; break; default: in >> p >> w >> head >> tail; break; } _head = head; _tail = tail; if (undefined || !in.good()) { gs->SetBrush(nil); } else { PSBrush* brush = none ? FindNoneBrush() : FindBrush(p,w); gs->SetBrush(brush); } } } /* * PSReadFgColor reads data to set the IdrawComp's foreground color. */ void IdrawCatalog::PSReadFgColor (istream& in, Graphic* gs) { Skip(in); in >> _buf; if ( _buf[0] == 'c' && (_buf[1] == 'f' || _psversion < PSV_FGANDBGCOLOR) ) { char lookahead = 'u'; bool undefined = false; char name[100]; ColorIntensity r = 0, g = 0, b = 0; in >> lookahead; in.putback(lookahead); if (lookahead == 'u') { undefined = true; } else { in >> name; if (_psversion >= PSV_FGANDBGCOLOR) { in >> r >> g >> b; } } if (undefined || !in.good()) { gs->SetColors(nil, gs->GetBgColor()); } else { int ir = iv26_round(r * float(0xffff)); int ig = iv26_round(g * float(0xffff)); int ib = iv26_round(b * float(0xffff)); PSColor* fgcolor = FindColor(name, ir, ig, ib); gs->SetColors(fgcolor, gs->GetBgColor()); } } } /* * PSReadBgColor reads data to set the IdrawComp's background color. */ void IdrawCatalog::PSReadBgColor (istream& in, Graphic* gs) { Skip(in); in >> _buf; if (_buf[0] == 'c' && _buf[1] == 'b') { char lookahead = 'u'; bool undefined = false; char name[100]; ColorIntensity r = 0, g = 0, b = 0; in >> lookahead; in.putback(lookahead); if (lookahead == 'u') { undefined = true; } else { in >> name >> r >> g >> b; } if (undefined || !in.good()) { gs->SetColors(gs->GetFgColor(), nil); } else { int ir = iv26_round(r * float(0xffff)); int ig = iv26_round(g * float(0xffff)); int ib = iv26_round(b * float(0xffff)); PSColor* bgcolor = FindColor(name, ir, ig, ib); gs->SetColors(gs->GetFgColor(), bgcolor); } } } /* * PSReadFont reads data to set the IdrawComp's font. */ void IdrawCatalog::PSReadFont (istream& in, Graphic* gs) { Skip(in); in >> _buf; if (_buf[0] == 'f') { char lookahead = 'u'; bool undefined = false; char name[CHARBUFSIZE]; char printfont[CHARBUFSIZE]; char printsize[CHARBUFSIZE]; in >> lookahead; in.putback(lookahead); if (lookahead == 'u') { undefined = true; } else { in.get(name, CHARBUFSIZE); in >> printfont; in >> printsize; } if (undefined || !in.good()) { gs->SetFont(nil); } else { char* pf = printfont; if ( _psversion >= PSV_NONREDUNDANT && _psversion < PSV_ISOLATIN1 ) { pf = &printfont[1]; } PSFont* font = FindFont(name, pf, printsize); gs->SetFont(font); } } } /* * CalcGrayLevel calculates a 4x4 bitmap's gray level on the printer. * Since the gray level ranges in 0 = solid to 1 = clear, * CalcGrayLevel counts the number of 0 bits in the bitmap and divides * the sum by the total number of bits in the bitmap. */ float IdrawCatalog::CalcGrayLevel (int seed) { const int numbits = 16; int numzeros = 0; for (int i = 0; i < numbits; i++) { numzeros += !((seed >> i) & 0x1); } return float(numzeros) / numbits; } /* * PSReadPattern reads data to set the IdrawComp's pattern. */ void IdrawCatalog::PSReadPattern (istream& in, Graphic* gs) { Skip(in); in >> _buf; if (_buf[0] == 'p') { char lookahead = 'u'; bool undefined = false; bool none = false; float graylevel = 0; int data[patternHeight]; int size = 0; in >> lookahead; switch (lookahead) { case 'u': undefined = true; break; case 'n': none = true; break; case '<': graylevel = -1; break; default: in.putback(lookahead); break; } if (!undefined && !none && graylevel != -1) { if (_psversion >= PSV_FGANDBGCOLOR) { in >> graylevel; } else { in >> data[0]; graylevel = CalcGrayLevel(data[0]); } } else if (graylevel == -1) { int i; for (i = 0; in >> _buf && i < patternHeight; i++) { if (_buf[0] == '>' || sscanf(_buf, "%x", &data[i]) != 1) { break; } } if (_buf[0] == '>') { size = i; } else { undefined = true; } } if (undefined || !in.good()) { gs->SetPattern(nil); } else { PSPattern* pattern; if (none) { pattern = FindNonePattern(); } else if (graylevel == -1) { pattern = FindPattern(data, size); } else { pattern = FindGrayLevel(graylevel); } gs->SetPattern(pattern); } } } /* * PSReadTransformer reads data to set the IdrawComp's transformation * matrix. */ void IdrawCatalog::PSReadTransformer (istream& in, Graphic* gs) { Skip(in); in >> _buf; if (_buf[0] == 't') { char uorbracket = 'u'; bool undefined = false; float a00, a01, a10, a11, a20, a21; in >> uorbracket; if (uorbracket == 'u') { undefined = true; } else { if (_psversion < PSV_NONREDUNDANT) { in.putback(uorbracket); } in >> a00 >> a01 >> a10 >> a11 >> a20 >> a21; } if (in.good() && !undefined) { Transformer* t = new Transformer(a00, a01, a10, a11, a20, a21); gs->SetTransformer(t); Unref(t); } } } /* * PSReadPoints reads a set of points as efficiently as possible by * using dynamic static buffers instead of mallocing on every call. */ void IdrawCatalog::PSReadPoints (istream& in, const Coord*& x, const Coord*& y, int& n) { const int INITIALSIZE = 15; static int sizepoints = 0; static Coord* xcoords = nil; static Coord* ycoords = nil; Skip(in); in >> n; if (n > sizepoints) { delete xcoords; delete ycoords; sizepoints = max(n, INITIALSIZE); xcoords = new Coord[sizepoints]; ycoords = new Coord[sizepoints]; } for (int i = 0; i < n; i++) { if (_psversion < PSV_NONREDUNDANT) { Skip(in); } in >> xcoords[i] >> ycoords[i]; } x = xcoords; y = ycoords; } /* * ReadBSpline reads data to initialize its graphic comp and * create its components. */ GraphicComp* IdrawCatalog::ReadBSpline (istream& in) { FullGraphic gs; PSReadGS(in, &gs); Coord* x, *y; int n; const Coord* cx, * cy; PSReadPoints(in, cx, cy, n); x = (Coord*)cx; y = (Coord*)cy; float mag; if (_psversion < PSV_UNIDRAW) { mag = 1.; } else { Skip(in); in >> mag; } return new ArrowSplineComp( new ArrowOpenBSpline(x, y, n, _head, _tail, mag, &gs) ); } /* * ReadClosedBSpline reads data to initialize its graphic comp * and create the closed B-spline's filled interior and outline. */ GraphicComp* IdrawCatalog::ReadClosedBSpline (istream& in) { FullGraphic gs; PSReadGS(in, &gs); Coord* x, *y; int n; const Coord* cx, * cy; PSReadPoints(in, cx, cy, n); x = (Coord*)cx; y = (Coord*)cy; return new ClosedSplineComp(new SFH_ClosedBSpline(x, y, n, &gs)); } /* * ReadRect reads data to initialize its graphic comp and create * its filled interior and outline. */ GraphicComp* IdrawCatalog::ReadRect (istream& in) { FullGraphic gs; PSReadGS(in, &gs); Skip(in); Coord l, b, r, t; in >> l >> b >> r >> t; return new RectComp(new SF_Rect(l, b, r, t, &gs)); } GraphicComp* IdrawCatalog::ReadPolygon (istream& in) { FullGraphic gs; PSReadGS(in, &gs); Coord* x, *y; int n; const Coord* cx, * cy; PSReadPoints(in, cx, cy, n); x = (Coord*)cx; y = (Coord*)cy; return new PolygonComp(new SF_Polygon(x, y, n, &gs)); } /* * ReadLine reads data to initialize its graphic comp and create * its line. */ GraphicComp* IdrawCatalog::ReadLine (istream& in) { FullGraphic gs; PSReadGS(in, &gs); Skip(in); Coord x0, y0, x1, y1; in >> x0 >> y0 >> x1 >> y1; float mag; if (_psversion < PSV_UNIDRAW) { mag = 1.; } else { Skip(in); in >> mag; } return new ArrowLineComp(new ArrowLine(x0,y0,x1,y1,_head,_tail,mag,&gs)); } /* * ReadMultiLine reads data to initialize its graphic comp and * create its components. */ GraphicComp* IdrawCatalog::ReadMultiLine (istream& in) { FullGraphic gs; PSReadGS(in, &gs); Coord* x, *y; int n; const Coord* cx, * cy; PSReadPoints(in, cx, cy, n); x = (Coord*)cx; y = (Coord*)cy; float mag; if (_psversion < PSV_UNIDRAW) { mag = 1.; } else { Skip(in); in >> mag; } return new ArrowMultiLineComp( new ArrowMultiLine(x, y, n, _head, _tail, mag, &gs) ); } /* * ReadEllipse reads data to initialize its graphic comp and * create its filled interior and outline. */ GraphicComp* IdrawCatalog::ReadEllipse (istream& in) { FullGraphic gs; PSReadGS(in, &gs); Skip(in); Coord x0, y0; int rx, ry; in >> x0 >> y0 >> rx >> ry; return new EllipseComp(new SF_Ellipse(x0, y0, rx, ry, &gs)); } /* * ReadCircle reads data to initialize its graphic comp and * create its filled interior and outline. */ GraphicComp* IdrawCatalog::ReadCircle (istream& in) { FullGraphic gs; PSReadGS(in, &gs); Skip(in); Coord x0, y0; int r; in >> x0 >> y0 >> r; return new EllipseComp(new SF_Circle(x0, y0, r, &gs)); } /* * ReadText reads its graphic comp and text in a file. */ GraphicComp* IdrawCatalog::ReadText (istream& in) { FullGraphic gs; PSReadTextGS(in, &gs); const int sbuf_size = 10000; char sbuf[sbuf_size]; PSReadTextData(in, sbuf, sbuf_size); int lineHt = 0; PSFont* f = gs.GetFont(); if (f != nil) lineHt = f->GetLineHt(); TextGraphic* tg = new TextGraphic(sbuf, lineHt, &gs); tg->FillBg(false); return new TextComp(tg); } GraphicComp* IdrawCatalog::ReadSStencil (istream& in) { FullGraphic gs; PSReadFgColor(in, &gs); PSReadBgColor(in, &gs); PSReadTransformer(in, &gs); Skip(in); Coord w, h; in >> w >> h; Bitmap* bitmap = new Bitmap((void*) nil, w, h); ReadBitmapData(bitmap, in); return new StencilComp(new UStencil(bitmap, bitmap, &gs)); } GraphicComp* IdrawCatalog::ReadFStencil (istream& in) { FullGraphic gs; PSReadFgColor(in, &gs); PSReadBgColor(in, &gs); PSReadTransformer(in, &gs); Skip(in); Coord w, h; in >> w >> h; Bitmap* bitmap = new Bitmap((void*) nil, w, h); ReadBitmapData(bitmap, in); return new StencilComp(new UStencil(bitmap, nil, &gs)); } GraphicComp* IdrawCatalog::ReadRaster (istream& in) { FullGraphic gs; PSReadTransformer(in, &gs); Skip(in); Coord w, h; in >> w >> h; const char* sync_string = "colorimage"; int n = strlen(sync_string); while (GetToken(in, _buf, CHARBUFSIZE) != 0) { if (strncmp("colorimage", _buf, n) == 0) { break; } } Raster* raster = new Raster(w, h); ReadRasterData(raster, in); return new RasterComp(new RasterRect(raster, &gs)); } /* * PSReadTextData reads and returns the text contained in the PostScript * representation of the ReadText. */ void IdrawCatalog::PSReadTextData (istream& in, char* sbuf, int len) { TextBuffer stext(sbuf, 0, len); char nl = '\n'; char null = '\0'; if (_psversion >= PSV_EIGHTBIT) { Skip(in); char c = ' '; int dot = 0; while (c != '[' && in.get(c)); while (in >> c && c != ']') { while (c != '(' && in.get(c)); while (in.get(c) && c != ')') { if (c == '\\') { in.get(c); if (isdigit(c)) { char buf[4]; buf[0] = c; in.get(buf[1]); in.get(buf[2]); buf[3] = '\0'; c = octal(buf); } } dot += stext.Insert(dot, &c, 1); } dot += stext.Insert(dot, "\n", 1); } if (dot > 0) { stext.Delete(--dot, 1); // buffer must not terminate in '\n' } } else if (_psversion >= PSV_NONREDUNDANT) { Skip(in); char c = ' '; int dot = 0; while (c != '[' && in.get(c)); while (in >> c && c != ']') { while (c != '(' && in.get(c)); while (in.get(c) && c != ')') { if (c == '\\') { in.get(c); } stext.Insert(dot++, &c, 1); } stext.Insert(dot++, &nl, 1); } if (dot > 0) { stext.Delete(--dot, 1); // buffer must not terminate in '\n' } } else { int dot = 0; while (in >> _buf && strcmp(_buf, MARK) == 0) { char blank; in.get(blank); in.get(_buf, CHARBUFSIZE - 1); int buflen = strlen(_buf) + 1; _buf[buflen - 1] = '\n'; stext.Insert(dot, _buf, buflen); dot += buflen; } if (dot > 0) { stext.Delete(--dot, 1); // buffer must not terminate in '\n' } } stext.Insert(stext.Length(), &null, 1); } neuron-7.6.3/src/bin/idraw/idcatalog.h000066400000000000000000000065311340731477100176160ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * IdrawCatalog - can read and write components in traditional idraw * PostScript format. */ #ifndef idcatalog_h #define idcatalog_h #include class GraphicComp; class IdrawCatalog : public Catalog{ public: IdrawCatalog(const char*, Creator*); virtual bool Save(EditorInfo*, const char*); virtual bool Save(Component*, const char*); virtual bool Save(Command*, const char*); virtual bool Save(Tool*, const char*); virtual bool Retrieve(const char*, EditorInfo*&); virtual bool Retrieve(const char*, Component*&); virtual bool Retrieve(const char*, Command*&); virtual bool Retrieve(const char*, Tool*&); private: bool UnidrawFormat(const char*); void PSReadGridSpacing(istream&, float&, float&); void PSReadGS(istream&, Graphic*); void PSReadPictGS(istream&, Graphic*); void PSReadTextGS(istream&, Graphic*); void PSReadBrush(istream&, Graphic*); void PSReadFgColor(istream&, Graphic*); void PSReadBgColor(istream&, Graphic*); void PSReadFont(istream&, Graphic*); void PSReadPattern(istream&, Graphic*); void PSReadTransformer(istream&, Graphic*); void PSReadPoints(istream&, const Coord*&, const Coord*&, int&); void PSReadChildren(istream&, GraphicComp*); void PSReadTextData(istream&, char*, int); GraphicComp* ReadPostScript(istream&); GraphicComp* ReadPict(istream&); GraphicComp* ReadBSpline(istream&); GraphicComp* ReadCircle(istream&); GraphicComp* ReadClosedBSpline(istream&); GraphicComp* ReadEllipse(istream&); GraphicComp* ReadLine(istream&); GraphicComp* ReadMultiLine(istream&); GraphicComp* ReadPolygon(istream&); GraphicComp* ReadRect(istream&); GraphicComp* ReadText(istream&); GraphicComp* ReadSStencil(istream&); GraphicComp* ReadFStencil(istream&); GraphicComp* ReadRaster(istream&); void ScaleToScreenCoords(Graphic*); float CalcGrayLevel(int); void CorrectTextVPos(Graphic*, float); private: static char _buf[CHARBUFSIZE]; // contains storage for reading data static float _psversion; // stores version of drawing read from file bool _head, _tail; // stores arrow state for last GS read bool _valid; }; #endif neuron-7.6.3/src/bin/idraw/idclasses.h000077500000000000000000000044271340731477100176460ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Unique idraw class identifiers */ #ifndef idclasses_h #define idclasses_h #include #define ABOUT_CMD 1001 #define ARROWLINE_COMP 1002 #define ARROWMULTILINE_COMP 1003 #define ARROWSPLINE_COMP 1004 #define ARROW_CMD 1005 #define ARROW_VAR 1006 #define IDRAW_COMP 1007 #define IGRIDSPACING_CMD 1008 #define NEWVIEW_CMD 1009 #define OPEN_CMD 1010 #define PRECISEMOVE_CMD 1011 #define PRECISEROTATE_CMD 1012 #define PRECISESCALE_CMD 1013 #define ARROWLINE_VIEW Combine(ARROWLINE_COMP, COMPONENT_VIEW) #define ARROWMULTILINE_VIEW Combine(ARROWMULTILINE_COMP, COMPONENT_VIEW) #define ARROWSPLINE_VIEW Combine(ARROWSPLINE_COMP, COMPONENT_VIEW) #define IDRAW_VIEW Combine(IDRAW_COMP, COMPONENT_VIEW) #define PS_ARROWLINE Combine(ARROWLINE_COMP, POSTSCRIPT_VIEW) #define PS_ARROWMULTILINE Combine(ARROWMULTILINE_COMP, POSTSCRIPT_VIEW) #define PS_ARROWSPLINE Combine(ARROWSPLINE_COMP, POSTSCRIPT_VIEW) #define PS_IDRAW Combine(IDRAW_COMP, POSTSCRIPT_VIEW) #endif neuron-7.6.3/src/bin/idraw/idcmds.cpp000066400000000000000000000215621340731477100174660ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of idraw-specific commands. */ #include #include #include #include #include #include #include #include #include #include #include #include #undef FileChooser #define FileChooser _lib_iv(FileChooser) #include "ided.h" #include "idclasses.h" #include "idcmds.h" #include "idcomp.h" #include "iddialogs.h" #include "idvars.h" #include "idversion.h" #include /*****************************************************************************/ ClassId OpenCmd::GetClassId () { return OPEN_CMD; } bool OpenCmd::IsA (ClassId id) { return OPEN_CMD == id || ViewCompCmd::IsA(id); } OpenCmd::OpenCmd (ControlInfo* c, FileChooser* fc) : ViewCompCmd(c, fc) { } OpenCmd::OpenCmd (Editor* ed, FileChooser* fc) : ViewCompCmd(ed, fc) { } Command* OpenCmd::Copy () { Command* copy = new OpenCmd(CopyControlInfo()); InitCopy(copy); return copy; } void OpenCmd::Execute () { Editor* ed = GetEditor(); Component* orig_comp = ed->GetComponent(); ViewCompCmd::Execute(); Component* new_comp = ed->GetComponent(); if (new_comp != orig_comp) { IdrawComp* idcomp = (IdrawComp*) new_comp; Grid* grid = ed->GetViewer()->GetGrid(); float xincr, yincr; idcomp->GetGridSpacing(xincr, yincr); grid->SetSpacing(xincr, yincr); } } /*****************************************************************************/ ClassId PreciseMoveCmd::GetClassId () { return PRECISEMOVE_CMD; } bool PreciseMoveCmd::IsA (ClassId id) { return PRECISEMOVE_CMD == id || Command::IsA(id); } PreciseMoveCmd::PreciseMoveCmd (ControlInfo* c) : Command(c) { _dialog = nil; } PreciseMoveCmd::PreciseMoveCmd (Editor* ed) : Command(ed) { _dialog = nil; } PreciseMoveCmd::~PreciseMoveCmd () { delete _dialog; } Command* PreciseMoveCmd::Copy () { Command* copy = new PreciseMoveCmd(CopyControlInfo()); InitCopy(copy); return copy; } void PreciseMoveCmd::Execute () { float dx = 0.0, dy = 0.0; Editor* ed = GetEditor(); if (_dialog == nil) { _dialog = new MoveDialog(); } ed->InsertDialog(_dialog); bool accepted = _dialog->Accept(); ed->RemoveDialog(_dialog); if (accepted) { _dialog->GetValues(dx, dy); if (dx != 0.0 || dy != 0.0) { MoveCmd* moveCmd = new MoveCmd(ed, dx, dy); moveCmd->Execute(); moveCmd->Log(); } } } bool PreciseMoveCmd::Reversible () { return false; } /*****************************************************************************/ ClassId PreciseScaleCmd::GetClassId () { return PRECISESCALE_CMD; } bool PreciseScaleCmd::IsA (ClassId id) { return PRECISESCALE_CMD == id || Command::IsA(id); } PreciseScaleCmd::PreciseScaleCmd (ControlInfo* c) : Command(c) {_dialog = nil;} PreciseScaleCmd::PreciseScaleCmd (Editor* ed) : Command(ed) { _dialog = nil; } PreciseScaleCmd::~PreciseScaleCmd () { delete _dialog; } Command* PreciseScaleCmd::Copy () { Command* copy = new PreciseScaleCmd(CopyControlInfo()); InitCopy(copy); return copy; } void PreciseScaleCmd::Execute () { float x = 0.0, y = 0.0; Editor* ed = GetEditor(); if (_dialog == nil) { _dialog = new ScaleDialog(); } ed->InsertDialog(_dialog); bool accepted = _dialog->Accept(); ed->RemoveDialog(_dialog); if (accepted) { _dialog->GetValues(x, y); if (x != 0.0 && y != 0.0) { ScaleCmd* scaleCmd = new ScaleCmd(ed, x, y); scaleCmd->Execute(); scaleCmd->Log(); } } } bool PreciseScaleCmd::Reversible () { return false; } /*****************************************************************************/ ClassId PreciseRotateCmd::GetClassId () { return PRECISEROTATE_CMD; } bool PreciseRotateCmd::IsA (ClassId id) { return PRECISEROTATE_CMD == id || Command::IsA(id); } PreciseRotateCmd::PreciseRotateCmd (ControlInfo* c) : Command(c) {_dialog=nil;} PreciseRotateCmd::PreciseRotateCmd (Editor* ed) : Command(ed) { _dialog = nil;} PreciseRotateCmd::~PreciseRotateCmd () { delete _dialog; } Command* PreciseRotateCmd::Copy () { Command* copy = new PreciseRotateCmd(CopyControlInfo()); InitCopy(copy); return copy; } void PreciseRotateCmd::Execute () { float angle = 0.0; Editor* ed = GetEditor(); if (_dialog == nil) { _dialog = new RotateDialog(); } ed->InsertDialog(_dialog); bool accepted = _dialog->Accept(); ed->RemoveDialog(_dialog); if (accepted) { _dialog->GetValue(angle); if (angle != 0.0) { RotateCmd* rotateCmd = new RotateCmd(ed, angle); rotateCmd->Execute(); rotateCmd->Log(); } } } bool PreciseRotateCmd::Reversible () { return false; } /*****************************************************************************/ ClassId NewViewCmd::GetClassId () { return NEWVIEW_CMD; } bool NewViewCmd::IsA (ClassId id) { return NEWVIEW_CMD == id || Command::IsA(id); } NewViewCmd::NewViewCmd (ControlInfo* c) : Command(c) { } NewViewCmd::NewViewCmd (Editor* ed) : Command(ed) { } Command* NewViewCmd::Copy () { Command* copy = new NewViewCmd(CopyControlInfo()); InitCopy(copy); return copy; } void NewViewCmd::Execute () { Editor* ed = GetEditor(); Editor* newEd = new IdrawEditor(GetGraphicComp()); *newEd->GetState("ModifStatusVar") = *ed->GetState("ModifStatusVar"); unidraw->Open(newEd); } bool NewViewCmd::Reversible () { return false; } /*****************************************************************************/ ClassId ArrowCmd::GetClassId () { return ARROW_CMD; } bool ArrowCmd::IsA (ClassId id) {return ARROW_CMD==id || Command::IsA(id);} ArrowCmd::ArrowCmd (ControlInfo* c, bool head, bool tail) : Command(c) { _head = head; _tail = tail; } ArrowCmd::ArrowCmd (Editor* ed, bool head, bool tail) : Command(ed) { _head = head; _tail = tail; } Command* ArrowCmd::Copy () { Command* copy = new ArrowCmd(CopyControlInfo(), Head(), Tail()); InitCopy(copy); return copy; } void ArrowCmd::Execute () { ArrowVar* arrowVar = (ArrowVar*) GetEditor()->GetState("ArrowVar"); if (arrowVar != nil) { arrowVar->SetArrows(_head, _tail); } Command::Execute(); } /*****************************************************************************/ ClassId AboutCmd::GetClassId () { return ABOUT_CMD; } bool AboutCmd::IsA (ClassId id) {return ABOUT_CMD==id || Command::IsA(id);} AboutCmd::AboutCmd (ControlInfo* c) : Command(c) { } AboutCmd::AboutCmd (Editor* ed) : Command(ed) { } Command* AboutCmd::Copy () { Command* copy = new AboutCmd(CopyControlInfo()); InitCopy(copy); return copy; } void AboutCmd::Execute () { Editor* ed = GetEditor(); AcknowledgeDialog dialog(VERSION); ed->InsertDialog(&dialog); dialog.Acknowledge(); ed->RemoveDialog(&dialog); } bool AboutCmd::Reversible () { return false; } /*****************************************************************************/ ClassId IGridSpacingCmd::GetClassId () { return IGRIDSPACING_CMD; } bool IGridSpacingCmd::IsA (ClassId id) { return IGRIDSPACING_CMD == id || GridSpacingCmd::IsA(id); } IGridSpacingCmd::IGridSpacingCmd (ControlInfo* c) : GridSpacingCmd(c) { } IGridSpacingCmd::IGridSpacingCmd (Editor* ed) : GridSpacingCmd(ed) { } Command* IGridSpacingCmd::Copy () { Command* copy = new IGridSpacingCmd(CopyControlInfo()); InitCopy(copy); return copy; } void IGridSpacingCmd::Execute () { GridSpacingCmd::Execute(); float xincr, yincr; _dialog->GetValues(xincr, yincr); IdrawComp* idcomp = (IdrawComp*) GetEditor()->GetComponent()->GetRoot(); idcomp->SetGridSpacing(xincr, yincr); } neuron-7.6.3/src/bin/idraw/idcmds.h000066400000000000000000000075401340731477100171330ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Idraw-specific commands. */ #ifndef idcmds_h #define idcmds_h #include #include class MoveDialog; class RotateDialog; class ScaleDialog; class OpenCmd : public ViewCompCmd { public: OpenCmd(ControlInfo*, FileChooser* = nil); OpenCmd(Editor* = nil, FileChooser* = nil); virtual void Execute(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class PreciseMoveCmd : public Command { public: PreciseMoveCmd(ControlInfo*); PreciseMoveCmd(Editor* = nil); virtual ~PreciseMoveCmd(); virtual void Execute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); private: MoveDialog* _dialog; }; class PreciseScaleCmd : public Command { public: PreciseScaleCmd(ControlInfo*); PreciseScaleCmd(Editor* = nil); virtual ~PreciseScaleCmd(); virtual void Execute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); private: ScaleDialog* _dialog; }; class PreciseRotateCmd : public Command { public: PreciseRotateCmd(ControlInfo*); PreciseRotateCmd(Editor* = nil); virtual ~PreciseRotateCmd(); virtual void Execute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); private: RotateDialog* _dialog; }; class NewViewCmd : public Command { public: NewViewCmd(ControlInfo*); NewViewCmd(Editor* = nil); virtual void Execute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class ArrowCmd : public Command { public: ArrowCmd(ControlInfo*, bool head = false, bool tail = false); ArrowCmd(Editor* = nil, bool head = false, bool tail = false); virtual void Execute(); int Head(); int Tail(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: int _head : 16; int _tail : 16; }; inline int ArrowCmd::Head () { return _head; } inline int ArrowCmd::Tail () { return _tail; } class AboutCmd : public Command { public: AboutCmd(ControlInfo*); AboutCmd(Editor* = nil); virtual void Execute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class IGridSpacingCmd : public GridSpacingCmd { public: IGridSpacingCmd(ControlInfo*); IGridSpacingCmd(Editor* = nil); virtual void Execute(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; #endif neuron-7.6.3/src/bin/idraw/idcomp.cpp000066400000000000000000000206471340731477100175010ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * IdrawComp implementation. */ #include "idarrows.h" #include "idcomp.h" #include "idcatalog.h" #include "idclasses.h" #include #include #include /*****************************************************************************/ static const float GRID_XINCR = 8; // default grid spacing static const float GRID_YINCR = 8; /*****************************************************************************/ IdrawComp::IdrawComp () { SetGridSpacing(GRID_XINCR, GRID_YINCR); } ClassId IdrawComp::GetClassId () { return IDRAW_COMP; } ClassId IdrawComp::GetSubstId (const char*& delim) { delim = "%END_IDRAW_COMP%"; return GraphicComps::GetClassId(); } bool IdrawComp::IsA (ClassId id) { return IDRAW_COMP == id || GraphicComps::IsA(id); } void IdrawComp::SetGridSpacing (float xincr, float yincr) { _xincr = xincr; _yincr = yincr; } void IdrawComp::GetGridSpacing (float& xincr, float& yincr) { xincr = _xincr; yincr = _yincr; } /*****************************************************************************/ IdrawView::IdrawView (IdrawComp* subj) : GraphicViews(subj) { } ClassId IdrawView::GetClassId () { return IDRAW_VIEW; } bool IdrawView::IsA (ClassId id) { return IDRAW_VIEW == id || GraphicViews::IsA(id); } /*****************************************************************************/ PSIdraw::PSIdraw (IdrawComp* subj) : PostScriptViews(subj) { } ClassId PSIdraw::GetClassId () { return PS_IDRAW; } bool PSIdraw::IsA (ClassId id) { return PS_IDRAW == id || PostScriptViews::IsA(id); } void PSIdraw::Creator (ostream& out) { out << "%%Creator: idraw\n"; } void PSIdraw::Prologue (ostream& out) { out << "%%BeginIdrawPrologue\n"; ArrowHeader(out); out << "%%EndIdrawPrologue\n\n"; PostScriptView::Prologue(out); } void PSIdraw::GridSpacing (ostream& out) { float xincr, yincr; IdrawComp* comp = (IdrawComp*) GetSubject(); comp->GetGridSpacing(xincr, yincr); out << "Grid " << xincr << " " << yincr << " "; } void PSIdraw::ConstProcs (ostream& out) { int arrowWidth = iv26_round(ARROWWIDTH*points); int arrowHeight = iv26_round(ARROWHEIGHT*points); out << "/arrowHeight " << arrowHeight << " def\n"; out << "/arrowWidth " << arrowWidth << " def\n\n"; PostScriptViews::ConstProcs(out); } void PSIdraw::LineProc (ostream& out) { out << "/Line {\n"; out << "0 begin\n"; out << "2 storexyn\n"; out << "newpath\n"; out << "x 0 get y 0 get moveto\n"; out << "x 1 get y 1 get lineto\n"; out << "brushNone not { istroke } if\n"; out << "0 0 1 1 leftarrow\n"; out << "0 0 1 1 rightarrow\n"; out << "end\n"; out << "} dup 0 4 dict put def\n\n"; } void PSIdraw::MultiLineProc (ostream& out) { out << "/MLine {\n"; out << "0 begin\n"; out << "storexyn\n"; out << "newpath\n"; out << "n 1 gt {\n"; out << "x 0 get y 0 get moveto\n"; out << "1 1 n 1 sub {\n"; out << "/i exch def\n"; out << "x i get y i get lineto\n"; out << "} for\n"; out << "patternNone not brushLeftArrow not brushRightArrow not and and "; out << "{ ifill } if\n"; out << "brushNone not { istroke } if\n"; out << "0 0 1 1 leftarrow\n"; out << "n 2 sub dup n 1 sub dup rightarrow\n"; out << "} if\n"; out << "end\n"; out << "} dup 0 4 dict put def\n\n"; } void PSIdraw::BSplineProc (ostream& out) { out << "/BSpl {\n"; out << "0 begin\n"; out << "storexyn\n"; out << "newpath\n"; out << "n 1 gt {\n"; out << "0 0 0 0 0 0 1 1 true subspline\n"; out << "n 2 gt {\n"; out << "0 0 0 0 1 1 2 2 false subspline\n"; out << "1 1 n 3 sub {\n"; out << "/i exch def\n"; out << "i 1 sub dup i dup i 1 add dup i 2 add dup false subspline\n"; out << "} for\n"; out << "n 3 sub dup n 2 sub dup n 1 sub dup 2 copy false subspline\n"; out << "} if\n"; out << "n 2 sub dup n 1 sub dup 2 copy 2 copy false subspline\n"; out << "patternNone not brushLeftArrow not brushRightArrow not and and "; out << "{ ifill } if\n"; out << "brushNone not { istroke } if\n"; out << "0 0 1 1 leftarrow\n"; out << "n 2 sub dup n 1 sub dup rightarrow\n"; out << "} if\n"; out << "end\n"; out << "} dup 0 4 dict put def\n\n"; } void PSIdraw::SetBrushProc (ostream& out) { out << "/SetB {\n"; out << "dup type /nulltype eq {\n"; out << "pop\n"; out << "false /brushRightArrow idef\n"; out << "false /brushLeftArrow idef\n"; out << "true /brushNone idef\n"; out << "} {\n"; out << "/brushDashOffset idef\n"; out << "/brushDashArray idef\n"; out << "0 ne /brushRightArrow idef\n"; out << "0 ne /brushLeftArrow idef\n"; out << "/brushWidth idef\n"; out << "false /brushNone idef\n"; out << "} ifelse\n"; out << "} def\n\n"; } void PSIdraw::ArrowHeader (ostream& out) { out << "/arrowhead {\n"; out << "0 begin\n"; out << "transform originalCTM itransform\n"; out << "/taily exch def\n"; out << "/tailx exch def\n"; out << "transform originalCTM itransform\n"; out << "/tipy exch def\n"; out << "/tipx exch def\n"; out << "/dy tipy taily sub def\n"; out << "/dx tipx tailx sub def\n"; out << "/angle dx 0 ne dy 0 ne or { dy dx atan } { 90 } ifelse def\n"; out << "gsave\n"; out << "originalCTM setmatrix\n"; out << "tipx tipy translate\n"; out << "angle rotate\n"; out << "newpath\n"; out << "arrowHeight neg arrowWidth 2 div moveto\n"; out << "0 0 lineto\n"; out << "arrowHeight neg arrowWidth 2 div neg lineto\n"; out << "patternNone not {\n"; out << "originalCTM setmatrix\n"; out << "/padtip arrowHeight 2 exp 0.25 arrowWidth 2 exp mul add sqrt "; out << "brushWidth mul\n"; out << "arrowWidth div def\n"; out << "/padtail brushWidth 2 div def\n"; out << "tipx tipy translate\n"; out << "angle rotate\n"; out << "padtip 0 translate\n"; out << "arrowHeight padtip add padtail add arrowHeight div dup scale\n"; out << "arrowheadpath\n"; out << "ifill\n"; out << "} if\n"; out << "brushNone not {\n"; out << "originalCTM setmatrix\n"; out << "tipx tipy translate\n"; out << "angle rotate\n"; out << "arrowheadpath\n"; out << "istroke\n"; out << "} if\n"; out << "grestore\n"; out << "end\n"; out << "} dup 0 9 dict put def\n\n"; out << "/arrowheadpath {\n"; out << "newpath\n"; out << "arrowHeight neg arrowWidth 2 div moveto\n"; out << "0 0 lineto\n"; out << "arrowHeight neg arrowWidth 2 div neg lineto\n"; out << "} def\n\n"; out << "/leftarrow {\n"; out << "0 begin\n"; out << "y exch get /taily exch def\n"; out << "x exch get /tailx exch def\n"; out << "y exch get /tipy exch def\n"; out << "x exch get /tipx exch def\n"; out << "brushLeftArrow { tipx tipy tailx taily arrowhead } if\n"; out << "end\n"; out << "} dup 0 4 dict put def\n\n"; out << "/rightarrow {\n"; out << "0 begin\n"; out << "y exch get /tipy exch def\n"; out << "x exch get /tipx exch def\n"; out << "y exch get /taily exch def\n"; out << "x exch get /tailx exch def\n"; out << "brushRightArrow { tipx tipy tailx taily arrowhead } if\n"; out << "end\n"; out << "} dup 0 4 dict put def\n\n"; } neuron-7.6.3/src/bin/idraw/idcomp.h000066400000000000000000000044661340731477100171470ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * IdrawComp -- top level component that stores grid spacing info. */ #ifndef idcomp_h #define idcomp_h #include #include #include class IdrawComp : public GraphicComps { public: IdrawComp(); void SetGridSpacing(float, float); void GetGridSpacing(float&, float&); virtual ClassId GetClassId(); virtual ClassId GetSubstId(const char*&); virtual bool IsA(ClassId); private: float _xincr, _yincr; }; class IdrawView : public GraphicViews { public: IdrawView(IdrawComp* = nil); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class PSIdraw : public PostScriptViews { public: PSIdraw(IdrawComp* = nil); protected: virtual void Creator(ostream&); virtual void ArrowHeader(ostream&); virtual void ConstProcs(ostream&); virtual void GridSpacing(ostream&); virtual void LineProc(ostream&); virtual void MultiLineProc(ostream&); virtual void BSplineProc(ostream&); virtual void Prologue(ostream&); virtual void SetBrushProc(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; #endif neuron-7.6.3/src/bin/idraw/idcreator.cpp000077500000000000000000000063301340731477100201760ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Idraw object constructor class implementation. */ #include "idarrow.h" #include "idclasses.h" #include "idcmds.h" #include "idcomp.h" #include "idcreator.h" #include "idvars.h" #include /*****************************************************************************/ IdrawCreator::IdrawCreator () { } void* IdrawCreator::Create ( ClassId id, istream& in, ObjectMap* objmap, int objid ) { switch (id) { case ABOUT_CMD: CREATE(AboutCmd, in, objmap, objid); case ARROWLINE_COMP: CREATE(ArrowLineComp, in, objmap, objid); case ARROWMULTILINE_COMP: CREATE(ArrowMultiLineComp, in,objmap,objid); case ARROWSPLINE_COMP: CREATE(ArrowSplineComp, in, objmap, objid); case ARROW_CMD: CREATE(ArrowCmd, in, objmap, objid); case ARROW_VAR: CREATE(ArrowVar, in, objmap, objid); case IDRAW_COMP: CREATE(IdrawComp, in, objmap, objid); case IGRIDSPACING_CMD: CREATE(IGridSpacingCmd, in, objmap, objid); case NEWVIEW_CMD: CREATE(NewViewCmd, in, objmap, objid); case OPEN_CMD: CREATE(OpenCmd, in, objmap, objid); case PRECISEMOVE_CMD: CREATE(PreciseMoveCmd, in, objmap, objid); case PRECISEROTATE_CMD: CREATE(PreciseRotateCmd, in, objmap, objid); case PRECISESCALE_CMD: CREATE(PreciseScaleCmd, in, objmap, objid); default: return Creator::Create(id, in,objmap,objid); } } void* IdrawCreator::Create (ClassId id) { if (id == ARROWLINE_VIEW) return new ArrowLineView; if (id == ARROWMULTILINE_VIEW) return new ArrowMultiLineView; if (id == ARROWSPLINE_VIEW) return new ArrowSplineView; if (id == IDRAW_VIEW) return new IdrawView; if (id == PS_ARROWLINE) return new PSArrowLine; if (id == PS_ARROWMULTILINE) return new PSArrowMultiLine; if (id == PS_ARROWSPLINE) return new PSArrowSpline; if (id == PS_IDRAW) return new PSIdraw; return Creator::Create(id); } neuron-7.6.3/src/bin/idraw/idcreator.h000077500000000000000000000027671340731477100176550ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Idraw object creator class. */ #ifndef idcreator_h #define idcreator_h #include class IdrawCreator : public Creator { public: IdrawCreator(); virtual void* Create( // for subjects ClassId, istream&, ObjectMap* = nil, int = 0 ); virtual void* Create(ClassId); // for views }; #endif neuron-7.6.3/src/bin/idraw/iddialogs.cpp000066400000000000000000000156721340731477100201670ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of Idraw-specific dialog boxes. */ #include "iddialogs.h" #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ MoveDialog::MoveDialog () : BasicDialog( new ButtonState, "", "Enter X and Y movement:" ) { _medit = new MatchEditor(state, "9999999999999999999"); _medit->Message(""); _medit->Match("%f %f", false); _units = new ButtonState('p'); input = new Sensor; Ref(input); input->Catch(KeyEvent); Insert(Interior()); SelectMessage(); } void MoveDialog::Handle (Event& e) { _medit->Handle(e); } bool MoveDialog::Accept () { Event e; int v = 0; state->SetValue(0); _medit->Edit(); state->GetValue(v); while (v == 0) { Read(e); Forward(e); state->GetValue(v); } return v == '\r'; } void MoveDialog::SelectMessage () { _medit->Select(0, strlen(_medit->Text())); } Interactor* MoveDialog::Interior () { const int space = iv26_round(.5*cm); VBox* titleblock = new VBox( new HBox(_title, new HGlue), new HBox(_subtitle, new HGlue) ); HBox* rbuttons = new HBox( new RadioButton("Pixels", _units, 'p'), new HGlue(space, 0), new RadioButton("Points", _units, 'o'), new HGlue(space, 0), new RadioButton("Centimeters", _units, 'c'), new HGlue(space, 0), new RadioButton("Inches", _units, 'i') ); rbuttons->Insert(new HGlue); return new MarginFrame( new VBox( titleblock, new VGlue(space), new Frame(new MarginFrame(_medit, 2)), new VGlue(space/2, 0), rbuttons, new VGlue(space), new HBox( new HGlue, new PushButton("Cancel", state, '\007'), new HGlue(space, 0), new PushButton(" OK ", state, '\r') ) ), space, space/2, 0 ); } void MoveDialog::GetValues (float& x, float& y) { char* movement = nil; movement = strnew(_medit->Text()); if (sscanf(movement,"%f %f",&x, &y) != 2) { x = y = 0.0; } else { int unit; _units->GetValue(unit); switch (unit) { case 'i': x *= inches; y *= inches; break; case 'o': x *= points; y *= points; break; case 'c': x *= cm; y *= cm; break; } } delete movement; } /*****************************************************************************/ ScaleDialog::ScaleDialog () : BasicDialog( new ButtonState, "", "Enter X and Y scaling:" ) { _medit = new MatchEditor(state, "9999999999999999999"); _medit->Message(""); _medit->Match("%f %f", false); input = new Sensor; Ref(input); input->Catch(KeyEvent); Insert(Interior()); SelectMessage(); } void ScaleDialog::Handle (Event& e) { _medit->Handle(e); } bool ScaleDialog::Accept () { Event e; int v = 0; state->SetValue(0); _medit->Edit(); state->GetValue(v); while (v == 0) { Read(e); Forward(e); state->GetValue(v); } return v == '\r'; } void ScaleDialog::SelectMessage () { _medit->Select(0, strlen(_medit->Text())); } Interactor* ScaleDialog::Interior () { const int space = iv26_round(.5*cm); VBox* titleblock = new VBox( new HBox(_title, new HGlue), new HBox(_subtitle, new HGlue) ); return new MarginFrame( new VBox( titleblock, new VGlue(space), new Frame(new MarginFrame(_medit, 2)), new VGlue(space), new HBox( new HGlue, new PushButton("Cancel", state, '\007'), new HGlue(space, 0), new PushButton(" OK ", state, '\r') ) ), space, space/2, 0 ); } void ScaleDialog::GetValues (float& x, float& y) { char* movement = nil; movement = strnew(_medit->Text()); if (sscanf(movement,"%f %f",&x, &y) != 2) { x = y = 1.0; } delete movement; } /*****************************************************************************/ RotateDialog::RotateDialog () : BasicDialog( new ButtonState, "", "Enter rotation in degrees:" ) { _medit = new MatchEditor(state, "9999999999999999999"); _medit->Message(""); _medit->Match("%f", false); input = new Sensor; Ref(input); input->Catch(KeyEvent); Insert(Interior()); SelectMessage(); } void RotateDialog::Handle (Event& e) { _medit->Handle(e); } bool RotateDialog::Accept () { Event e; int v = 0; state->SetValue(0); _medit->Edit(); state->GetValue(v); while (v == 0) { Read(e); Forward(e); state->GetValue(v); } return v == '\r'; } void RotateDialog::SelectMessage () { _medit->Select(0, strlen(_medit->Text())); } Interactor* RotateDialog::Interior () { const int space = iv26_round(.5*cm); VBox* titleblock = new VBox( new HBox(_title, new HGlue), new HBox(_subtitle, new HGlue) ); return new MarginFrame( new VBox( titleblock, new VGlue(space), new Frame(new MarginFrame(_medit, 2)), new VGlue(space), new HBox( new HGlue, new PushButton("Cancel", state, '\007'), new HGlue(space, 0), new PushButton(" OK ", state, '\r') ) ), space, space/2, 0 ); } void RotateDialog::GetValue (float& angle) { char* movement = nil; movement = strnew(_medit->Text()); if (sscanf(movement,"%f",&angle) != 1) { angle = 0.0; } delete movement; } neuron-7.6.3/src/bin/idraw/iddialogs.h000066400000000000000000000041151340731477100176220ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Idraw editor-specific dialog boxes. */ #ifndef iddialogs_h #define iddialogs_h #include class MoveDialog : public BasicDialog { public: MoveDialog(); virtual void GetValues(float& x, float& y); virtual bool Accept(); virtual void Handle(Event&); void SelectMessage(); private: Interactor* Interior(); class MatchEditor* _medit; ButtonState* _units; }; class ScaleDialog : public BasicDialog { public: ScaleDialog(); virtual void GetValues(float& x, float& y); virtual bool Accept(); virtual void Handle(Event&); void SelectMessage(); private: Interactor* Interior(); class MatchEditor* _medit; }; class RotateDialog : public BasicDialog { public: RotateDialog(); virtual void GetValue(float& angle); virtual bool Accept(); virtual void Handle(Event&); void SelectMessage(); private: Interactor* Interior(); class MatchEditor* _medit; }; #endif neuron-7.6.3/src/bin/idraw/ided.cpp000077500000000000000000000642101340731477100171300ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Idraw editor main class implementation. */ #include "idarrow.h" #include "idarrows.h" #include "idclasses.h" #include "idcmds.h" #include "idcomp.h" #include "ided.h" #include "idkybd.h" #include "idvars.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ static const char* brAttrib = "brush"; static const char* fontAttrib = "font"; static const char* patAttrib = "pattern"; static const char* fgAttrib = "fgcolor"; static const char* bgAttrib = "bgcolor"; static const char* initBrAttrib = "initialbrush"; static const char* initFontAttrib = "initialfont"; static const char* initPatAttrib = "initialpattern"; static const char* initFgAttrib = "initialfgcolor"; static const char* initBgAttrib = "initialbgcolor"; static const char* initArrowAttrib = "initialarrow"; static const char* page_width_attrib = "pagewidth"; static const char* page_height_attrib = "pageheight"; static const char* grid_x_incr = "gridxincr"; static const char* grid_y_incr = "gridyincr"; /*****************************************************************************/ inline void InsertSeparator (PulldownMenu* pdm) { pdm->GetScene()->Insert( new VBox( new VGlue(2, 0, 0), new HBorder, new VGlue(2, 0, 0) ) ); } inline PulldownMenu* MakePulldown (const char* name) { return new PulldownMenu( new HBox( new Message(name, Center, iv26_round(.1*cm)), new HGlue(0, 5*strlen(name), 0) ) ); } /*****************************************************************************/ IdrawEditor::IdrawEditor (GraphicComp* comp) { Init(comp); } IdrawEditor::IdrawEditor (const char* file) { if (file == nil) { Init(); } else { Catalog* catalog = unidraw->GetCatalog(); GraphicComp* comp; if (catalog->Retrieve(file, (Component*&) comp)) { Init(comp); } else { Init(); fprintf(stderr, "idraw: couldn't open %s\n", file); } } } void IdrawEditor::Init (GraphicComp* comp) { if (GetWindow() == nil) { ManagedWindow* w = new ApplicationWindow(this); SetWindow(w); Style* s = new Style(Session::instance()->style()); s->alias("IdrawEditor"); w->style(s); } _comp = (comp == nil) ? (new IdrawComp) : comp; _keymap = new KeyMap; _curCtrl = new ControlState; _selection = new Selection; _tray = new Tray; InitStateVars(); InitViewer(); Insert(new Frame(Interior())); GetKeyMap()->Execute(CODE_SELECT); } void IdrawEditor::InitStateVars () { _name = new CompNameVar(_comp); _modifStatus = new ModifStatusVar(_comp); _gravity = new GravityVar; _magnif = new MagnifVar; _font = new FontVar; _brush = new BrushVar; _pattern = new PatternVar; _color = new ColorVar; _arrows = new ArrowVar; Catalog* catalog = unidraw->GetCatalog(); const char* brIndex = catalog->GetAttribute(initBrAttrib); const char* fontIndex = catalog->GetAttribute(initFontAttrib); const char* patIndex = catalog->GetAttribute(initPatAttrib); const char* fgIndex = catalog->GetAttribute(initFgAttrib); const char* bgIndex = catalog->GetAttribute(initBgAttrib); const char* arrowState = catalog->GetAttribute(initArrowAttrib); _brush->SetBrush(catalog->ReadBrush(brAttrib, atoi(brIndex))); _font->SetFont(catalog->ReadFont(fontAttrib, atoi(fontIndex))); _pattern->SetPattern(catalog->ReadPattern(patAttrib, atoi(patIndex))); _color->SetColors( catalog->ReadColor(fgAttrib, atoi(fgIndex)), catalog->ReadColor(bgAttrib, atoi(bgIndex)) ); if (strcmp(arrowState,"both") == 0) { _arrows->SetArrows(true, true); } else if (strcmp(arrowState,"head") == 0) { _arrows->SetArrows(true, false); } else if (strcmp(arrowState,"tail") == 0) { _arrows->SetArrows(false, true); } else { _arrows->SetArrows(false, false); } } IdrawEditor::~IdrawEditor () { delete _keymap; delete _selection; delete _name; delete _modifStatus; delete _gravity; delete _magnif; delete _font; delete _brush; delete _pattern; delete _color; delete _arrows; } Component* IdrawEditor::GetComponent () { return _comp; } Viewer* IdrawEditor::GetViewer (int id) { return (id == 0) ? _viewer : nil; } KeyMap* IdrawEditor::GetKeyMap () { return _keymap; } Selection* IdrawEditor::GetSelection () { return _selection; } StateVar* IdrawEditor::GetState (const char* name) { if (strcmp(name, "CompNameVar") == 0) { return _name; } else if (strcmp(name, "ModifStatusVar") == 0) { return _modifStatus; } else if (strcmp(name, "MagnifVar") == 0) { return _magnif; } else if (strcmp(name, "GravityVar") == 0) { return _gravity; } else if (strcmp(name, "FontVar") == 0) { return _font; } else if (strcmp(name, "BrushVar") == 0) { return _brush; } else if (strcmp(name, "PatternVar") == 0) { return _pattern; } else if (strcmp(name, "ColorVar") == 0) { return _color; } else if (strcmp(name, "ArrowVar") == 0) { return _arrows; } else { return Editor::GetState(name); } } Tool* IdrawEditor::GetCurTool () { UControl* c = (UControl*) _curCtrl->Selection(); return (Tool*) c->GetControlInfo()->GetOwner(); } void IdrawEditor::SetComponent (Component* comp) { if (comp == nil || comp->IsA(GRAPHIC_COMP)) { _comp = (GraphicComp*) comp; } } void IdrawEditor::SetViewer (Viewer* v, int i) { if (i == 0) { _viewer = v; } } void IdrawEditor::SetKeyMap (KeyMap* k) { _keymap = k; } void IdrawEditor::SetSelection (Selection* s) { _selection = s; } Interactor* IdrawEditor::Interior () { Interactor* tools = Tools(); Interactor* commands = new HBox(Commands(), new HGlue); HBorder* hborder = new HBorder; VBorder* vborder = new VBorder; int gap = iv26_round(.1*cm); HBox* indicators = new HBox( new ArrowVarView(_arrows, _brush, _color), new VBorder, new PatternVarView(_pattern, _color) ); VBox* status = new VBox( new HBox( new HGlue(gap, 0, 0), new ModifStatusVarView(_modifStatus), new CompNameVarView(_name, Left), new MagnifVarView(_magnif), new GravityVarView(_gravity, Right), new FontVarView(_font, Right) ), new HBorder ); VBox* panel = new VBox( tools, new VGlue, new HBorder, new Panner(_viewer) ); panel->Propagate(false); _tray->HBox(_tray, status, _tray); _tray->HBox(_tray, indicators, vborder, commands, _tray); _tray->HBox(_tray, hborder, _tray); _tray->HBox(_tray, panel, vborder, _viewer, _tray); _tray->VBox(_tray, status, indicators, hborder, panel, _tray); _tray->VBox(_tray, status, vborder, _tray); _tray->VBox(_tray, status, commands, hborder, _viewer, _tray); return _tray; } Interactor* IdrawEditor::Commands () { MenuBar* commands = new MenuBar; commands->Include(FileMenu()); commands->Include(EditMenu()); commands->Include(StructureMenu()); commands->Include(FontMenu()); commands->Include(BrushMenu()); commands->Include(PatternMenu()); commands->Include(ColorMenu("FgColor", fgAttrib)); commands->Include(ColorMenu("BgColor", bgAttrib)); commands->Include(AlignMenu()); commands->Include(ViewMenu()); return commands; } static const int unit = 15; static Coord xClosed[] = { unit/5, unit, unit, unit*3/5, 0 }; static Coord yClosed[] = { 0, unit/5, unit*3/5, unit, unit*2/5 }; static const int nClosed = 5; static Coord xOpen[] = { 0, unit/2, unit/2, unit }; static Coord yOpen[] = { 0, unit/4, unit*3/4, unit }; static const int nOpen = 4; Interactor* IdrawEditor::Tools () { VBox* tools = new VBox; Include( new SelectTool(new ControlInfo("Select", KLBL_SELECT, CODE_SELECT)), tools ); Include( new MoveTool(new ControlInfo("Move", KLBL_MOVE, CODE_MOVE)), tools ); Include( new ScaleTool(new ControlInfo("Scale", KLBL_SCALE, CODE_SCALE)), tools ); Include( new StretchTool(new ControlInfo("Stretch", KLBL_STRETCH,CODE_STRETCH)), tools ); Include( new RotateTool(new ControlInfo("Rotate", KLBL_ROTATE, CODE_ROTATE)), tools ); Include( new ReshapeTool(new ControlInfo("Alter", KLBL_RESHAPE, CODE_RESHAPE)), tools ); Include( new MagnifyTool(new ControlInfo("Magnify", KLBL_MAGNIFY,CODE_MAGNIFY)), tools ); TextGraphic* text = new TextGraphic("Text", stdgraphic); TextComp* textComp = new TextComp(text); Include( new GraphicCompTool( new ControlInfo("Text", KLBL_TEXT, CODE_TEXT), textComp ), tools ); ArrowLine* line = new ArrowLine( 0, 0, unit, unit, false, false, 1., stdgraphic ); ArrowLineComp* arrowLineComp = new ArrowLineComp(line); Include( new GraphicCompTool( new ControlInfo(arrowLineComp, KLBL_LINE, CODE_LINE), arrowLineComp ), tools ); ArrowMultiLine* ml = new ArrowMultiLine( xOpen, yOpen, nOpen, false, false, 1., stdgraphic ); ml->SetPattern(psnonepat); ArrowMultiLineComp* mlComp = new ArrowMultiLineComp(ml); Include( new GraphicCompTool( new ControlInfo(mlComp, KLBL_MULTILINE, CODE_MULTILINE), mlComp ), tools ); ArrowOpenBSpline* spl = new ArrowOpenBSpline( xOpen, yOpen, nOpen, false, false, 1., stdgraphic ); spl->SetPattern(psnonepat); ArrowSplineComp* splComp = new ArrowSplineComp(spl); Include( new GraphicCompTool( new ControlInfo(splComp, KLBL_SPLINE, CODE_SPLINE), splComp ), tools ); SF_Rect* rect = new SF_Rect(0, 0, unit, unit*4/5, stdgraphic); rect->SetPattern(psnonepat); RectComp* rectComp = new RectComp(rect); Include( new GraphicCompTool( new ControlInfo(rectComp, KLBL_RECT, CODE_RECT), rectComp ), tools ); SF_Ellipse* ellipse = new SF_Ellipse(0, 0, unit*2/3, unit*2/5, stdgraphic); ellipse->SetPattern(psnonepat); EllipseComp* ellipseComp = new EllipseComp(ellipse); Include( new GraphicCompTool( new ControlInfo(ellipseComp, KLBL_ELLIPSE, CODE_ELLIPSE), ellipseComp ), tools ); SF_Polygon* polygon = new SF_Polygon(xClosed, yClosed, nClosed,stdgraphic); polygon->SetPattern(psnonepat); PolygonComp* polygonComp = new PolygonComp(polygon); Include( new GraphicCompTool( new ControlInfo(polygonComp, KLBL_POLY, CODE_POLY), polygonComp ), tools ); SFH_ClosedBSpline* cspline = new SFH_ClosedBSpline( xClosed, yClosed, nClosed, stdgraphic ); cspline->SetPattern(psnonepat); ClosedSplineComp* csplineComp = new ClosedSplineComp(cspline); Include( new GraphicCompTool( new ControlInfo(csplineComp, KLBL_CSPLINE,CODE_CSPLINE),csplineComp ), tools ); return tools; } void IdrawEditor::InitViewer () { Catalog* catalog = unidraw->GetCatalog(); const char* page_w = catalog->GetAttribute(page_width_attrib); const char* page_h = catalog->GetAttribute(page_height_attrib); const char* x_incr = catalog->GetAttribute(grid_x_incr); const char* y_incr = catalog->GetAttribute(grid_y_incr); GraphicView* view = (GraphicView*) _comp->Create(COMPONENT_VIEW); _comp->Attach(view); view->Update(); /* * These statements had to be moved down here to workaround * a strange cfront 3.0 bug. */ const float w = iv26_round(atof(page_w) * inches); const float h = iv26_round(atof(page_h) * inches); UPage* page = new UPage(w, h); Grid* grid = new Grid(w, h, atof(x_incr), atof(y_incr)); grid->Visibility(false); _viewer = new Viewer(this, view, page, grid); } void IdrawEditor::Include (Command* cmd, PulldownMenu* pdm) { ControlInfo* ctrlInfo = cmd->GetControlInfo(); UControl* ctrl = new CommandControl(ctrlInfo); _keymap->Register(ctrl); if (pdm != nil) pdm->Include(ctrl); cmd->SetEditor(this); } void IdrawEditor::Include (Tool* tool, Box* box) { ControlInfo* ctrlInfo = tool->GetControlInfo(); UControl* ctrl = new VPanelControl(ctrlInfo, _curCtrl); _keymap->Register(ctrl); box->Insert(ctrl); } PulldownMenu* IdrawEditor::FileMenu () { PulldownMenu* pdm = MakePulldown("File"); Include( new AboutCmd(new ControlInfo("About idraw", KLBL_ABOUT, CODE_ABOUT)) ); Include( new NewCompCmd( new ControlInfo("New", KLBL_NEWCOMP, CODE_NEWCOMP), new IdrawComp ), pdm ); Include( new RevertCmd(new ControlInfo("Revert", KLBL_REVERT, CODE_REVERT)), pdm ); InsertSeparator(pdm); Include( new OpenCmd( new ControlInfo("Open...", KLBL_VIEWCOMP, CODE_VIEWCOMP) ), pdm ); Include( new SaveCompCmd(new ControlInfo("Save", KLBL_SAVECOMP, CODE_SAVECOMP)), pdm ); Include( new SaveCompAsCmd( new ControlInfo("Save As...", KLBL_SAVECOMPAS, CODE_SAVECOMPAS) ), pdm ); Include( new PrintCmd( new ControlInfo("Print...", KLBL_PRINT, CODE_PRINT) ), pdm ); Include( new ImportCmd( new ControlInfo("Import Graphic...", KLBL_IMPORT, CODE_IMPORT) ), pdm ); InsertSeparator(pdm); Include( new QuitCmd( new ControlInfo("Quit", KLBL_QUIT, CODE_QUIT) ), pdm ); return pdm; } PulldownMenu* IdrawEditor::EditMenu () { PulldownMenu* pdm = MakePulldown("Edit"); Include( new UndoCmd( new ControlInfo("Undo", KLBL_UNDO, CODE_UNDO) ), pdm ); Include( new RedoCmd( new ControlInfo("Redo", KLBL_REDO, CODE_REDO) ), pdm ); InsertSeparator(pdm); Include( new CutCmd( new ControlInfo("Cut", KLBL_CUT, CODE_CUT) ), pdm ); Include( new CopyCmd( new ControlInfo("Copy", KLBL_COPY, CODE_COPY) ), pdm ); Include( new PasteCmd( new ControlInfo("Paste", KLBL_PASTE,CODE_PASTE) ), pdm ); Include( new DupCmd( new ControlInfo("Duplicate", KLBL_DUP, CODE_DUP) ), pdm ); Include( new DeleteCmd( new ControlInfo("Delete", KLBL_DEL, CODE_DEL) ), pdm ); Include( new SlctAllCmd( new ControlInfo("Select All", KLBL_SLCTALL, CODE_SLCTALL) ), pdm ); InsertSeparator(pdm); Include( new ScaleCmd( new ControlInfo("Flip Horizontal", KLBL_HFLIP, CODE_HFLIP), -1.0, 1.0 ), pdm ); Include( new ScaleCmd( new ControlInfo("Flip Vertical", KLBL_VFLIP, CODE_VFLIP), 1.0, -1.0 ), pdm ); Include( new RotateCmd( new ControlInfo("90 Clockwise", KLBL_CW90, CODE_CW90), -90.0 ), pdm ); Include( new RotateCmd( new ControlInfo("90 CounterCW", KLBL_CCW90, CODE_CCW90), 90.0 ), pdm ); InsertSeparator(pdm); Include( new PreciseMoveCmd( new ControlInfo("Precise Move", KLBL_PMOVE, CODE_PMOVE) ), pdm ); Include( new PreciseScaleCmd( new ControlInfo("Precise Scale", KLBL_PSCALE, CODE_PSCALE) ), pdm ); Include( new PreciseRotateCmd( new ControlInfo("Precise Rotate", KLBL_PROTATE, CODE_PROTATE) ), pdm ); return pdm; } PulldownMenu* IdrawEditor::StructureMenu () { PulldownMenu* pdm = MakePulldown("Structure"); Include( new GroupCmd( new ControlInfo("Group", KLBL_GROUP, CODE_GROUP) ), pdm ); Include( new UngroupCmd( new ControlInfo("Ungroup", KLBL_UNGROUP, CODE_UNGROUP) ), pdm ); Include( new FrontCmd( new ControlInfo("Bring to Front", KLBL_FRONT, CODE_FRONT) ), pdm ); Include( new BackCmd( new ControlInfo("Send to Back", KLBL_BACK, CODE_BACK) ), pdm ); return pdm; } PulldownMenu* IdrawEditor::FontMenu () { Catalog* catalog = unidraw->GetCatalog(); PulldownMenu* pdm = MakePulldown("Font"); int i = 1; PSFont* font = catalog->ReadFont(fontAttrib, i); while (font != nil) { TextGraphic* text = new TextGraphic( font->GetPrintFontAndSize(), stdgraphic ); text->SetFont(font); Include( new FontCmd( new ControlInfo(new TextComp(text)), font ), pdm ); font = catalog->ReadFont(fontAttrib, ++i); } return pdm; } static float MENU_WIDTH = 1.3; /* in cm */ static float MENU_HEIGHT = 0.5; PulldownMenu* IdrawEditor::BrushMenu () { ControlInfo* ctrlInfo; ArrowLine* line; Catalog* catalog = unidraw->GetCatalog(); PulldownMenu* pdm = MakePulldown("Brush"); int i = 1; PSBrush* br = catalog->ReadBrush(brAttrib, i); while (br != nil) { if (br->None()) { ctrlInfo = new ControlInfo("None"); } else { line = new ArrowLine( 0, 0, iv26_round(MENU_WIDTH*cm), 0, false, false, 1., stdgraphic ); line->SetBrush(br); ctrlInfo = new ControlInfo(new ArrowLineComp(line)); } Include(new BrushCmd(ctrlInfo, br), pdm); br = catalog->ReadBrush(brAttrib, ++i); } InsertSeparator(pdm); line = new ArrowLine( 0, 0, iv26_round(MENU_WIDTH*cm), 0, false, false, 1., stdgraphic ); ctrlInfo = new ControlInfo(new ArrowLineComp(line)); Include(new ArrowCmd(ctrlInfo, false, false), pdm); line = new ArrowLine( 0, 0, iv26_round(MENU_WIDTH*cm), 0, true, false, 1., stdgraphic ); ctrlInfo = new ControlInfo(new ArrowLineComp(line)); Include(new ArrowCmd(ctrlInfo, true, false), pdm); line = new ArrowLine( 0, 0, iv26_round(MENU_WIDTH*cm), 0, false, true, 1., stdgraphic ); ctrlInfo = new ControlInfo(new ArrowLineComp(line)); Include(new ArrowCmd(ctrlInfo, false, true), pdm); line = new ArrowLine( 0, 0, iv26_round(MENU_WIDTH*cm), 0, true, true, 1., stdgraphic ); ctrlInfo = new ControlInfo(new ArrowLineComp(line)); Include(new ArrowCmd(ctrlInfo, true, true), pdm); return pdm; } PulldownMenu* IdrawEditor::PatternMenu () { Catalog* catalog = unidraw->GetCatalog(); PulldownMenu* pdm = MakePulldown("Pattern"); int i = 1; PSPattern* pat = catalog->ReadPattern(patAttrib, i); while (pat != nil) { ControlInfo* ctrlInfo; if (pat->None()) { ctrlInfo = new ControlInfo("None"); } else { SF_Rect* sfr = new SF_Rect( 0, 0, iv26_round(MENU_WIDTH*cm), iv26_round(MENU_HEIGHT*cm), stdgraphic ); sfr->SetPattern(pat); ctrlInfo = new ControlInfo(new RectComp(sfr)); } Include(new PatternCmd(ctrlInfo, pat), pdm); pat = catalog->ReadPattern(patAttrib, ++i); } return pdm; } PulldownMenu* IdrawEditor::ColorMenu (const char* name, const char* attrib) { Catalog* catalog = unidraw->GetCatalog(); PulldownMenu* pdm = MakePulldown(name); int i = 1; PSColor* color = catalog->ReadColor(attrib, i); while (color != nil) { ControlInfo* ctrlInfo; Coord w = iv26_round(MENU_WIDTH*cm); Coord h = iv26_round(MENU_HEIGHT*cm); SF_Rect* sfr = new SF_Rect(0, 0, w, h, stdgraphic); sfr->SetColors(color, color); ctrlInfo = new ControlInfo(new RectComp(sfr), color->GetName()); if (strcmp(attrib, fgAttrib) == 0) { Include(new ColorCmd(ctrlInfo, color, nil), pdm); } else { Include(new ColorCmd(ctrlInfo, nil, color), pdm); } color = catalog->ReadColor(attrib, ++i); } return pdm; } PulldownMenu* IdrawEditor::AlignMenu () { PulldownMenu* pdm = MakePulldown("Align"); Include( new AlignCmd( new ControlInfo("Left Sides", KLBL_ALGNLEFT, CODE_ALGNLEFT), Left, Left ), pdm ); Include( new AlignCmd( new ControlInfo("Right Sides", KLBL_ALGNRIGHT, CODE_ALGNRIGHT), Right, Right ), pdm ); Include( new AlignCmd( new ControlInfo("Tops", KLBL_ALGNTOP, CODE_ALGNTOP), Top, Top ), pdm ); Include( new AlignCmd( new ControlInfo("Bottoms", KLBL_ALGNBOT, CODE_ALGNBOT), Bottom, Bottom ), pdm ); Include( new AlignCmd( new ControlInfo("Horiz Centers", KLBL_ALGNHCTR, CODE_ALGNHCTR), HorizCenter, HorizCenter ), pdm ); Include( new AlignCmd( new ControlInfo("Vert Centers", KLBL_ALGNVCTR, CODE_ALGNVCTR), VertCenter, VertCenter ), pdm ); Include( new AlignCmd( new ControlInfo("Centers", KLBL_ALGNCTR, CODE_ALGNCTR), Center, Center ), pdm ); Include( new AlignCmd( new ControlInfo("Abut Left", KLBL_ABUTLEFT, CODE_ABUTLEFT), Left, Right ), pdm ); Include( new AlignCmd( new ControlInfo("Abut Right", KLBL_ABUTRIGHT, CODE_ABUTRIGHT), Right, Left ), pdm ); Include( new AlignCmd( new ControlInfo("Abut Up", KLBL_ABUTUP, CODE_ABUTUP), Top, Bottom ), pdm ); Include( new AlignCmd( new ControlInfo("Abut Down", KLBL_ABUTDOWN, CODE_ABUTDOWN), Bottom, Top ), pdm ); InsertSeparator(pdm); Include( new AlignToGridCmd( new ControlInfo("Align to Grid", KLBL_ALGNTOGRID, CODE_ALGNTOGRID) ), pdm ); return pdm; } PulldownMenu* IdrawEditor::ViewMenu () { PulldownMenu* pdm = MakePulldown("View"); Include( new NewViewCmd( new ControlInfo("New View", KLBL_NEWVIEW, CODE_NEWVIEW) ), pdm ); Include( new CloseEditorCmd( new ControlInfo("Close View", KLBL_CLOSEEDITOR, CODE_CLOSEEDITOR) ), pdm ); InsertSeparator(pdm); Include( new NormSizeCmd( new ControlInfo("Normal Size", KLBL_NORMSIZE, CODE_NORMSIZE) ), pdm ); Include( new RedToFitCmd( new ControlInfo("Reduce to Fit", KLBL_REDTOFIT, CODE_REDTOFIT) ), pdm ); Include( new CenterCmd( new ControlInfo("Center Page", KLBL_CENTER, CODE_CENTER) ), pdm ); Include( new OrientationCmd( new ControlInfo("Orientation", KLBL_ORIENTATION, CODE_ORIENTATION) ), pdm ); InsertSeparator(pdm); Include( new GridCmd( new ControlInfo("Grid on/off", KLBL_GRID, CODE_GRID) ), pdm ); Include( new IGridSpacingCmd( new ControlInfo("Grid Spacing...", KLBL_GRIDSPC, CODE_GRIDSPC) ), pdm ); Include( new GravityCmd( new ControlInfo("Gravity on/off", KLBL_GRAVITY, CODE_GRAVITY) ), pdm ); return pdm; } neuron-7.6.3/src/bin/idraw/ided.h000077500000000000000000000062341340731477100165770ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Main class for idraw editor, derived from Editor class. */ #ifndef ided_h #define ided_h #include "idcomp.h" #include class ArrowVar; class Box; class BrushVar; class ColorVar; class Command; class CompNameVar; class ControlState; class FontVar; class GravityVar; class MagnifVar; class ModifStatusVar; class PatternVar; class PulldownMenu; class Tray; class IdrawEditor : public Editor { public: IdrawEditor(GraphicComp* = nil); IdrawEditor(const char* file); virtual ~IdrawEditor(); GraphicComp* GetGraphicComp(); virtual Component* GetComponent(); virtual Viewer* GetViewer(int = 0); virtual KeyMap* GetKeyMap(); virtual Tool* GetCurTool(); virtual Selection* GetSelection(); virtual StateVar* GetState(const char*); virtual void SetComponent(Component*); virtual void SetViewer(Viewer*, int = 0); virtual void SetKeyMap(KeyMap*); virtual void SetSelection(Selection*); private: Interactor* Interior(); void Init(GraphicComp* = nil); void InitEditorInfo(); void InitStateVars(); void InitViewer(); Interactor* Commands(); Interactor* Tools(); void Include(Command*, PulldownMenu* = nil); void Include(Tool*, Box*); PulldownMenu* FileMenu(); PulldownMenu* EditMenu(); PulldownMenu* StructureMenu(); PulldownMenu* FontMenu(); PulldownMenu* BrushMenu(); PulldownMenu* PatternMenu(); PulldownMenu* ColorMenu(const char* name, const char* attrib); PulldownMenu* AlignMenu(); PulldownMenu* ViewMenu(); private: GraphicComp* _comp; KeyMap* _keymap; ControlState* _curCtrl; Viewer* _viewer; Selection* _selection; class Tray* _tray; class CompNameVar* _name; class ModifStatusVar* _modifStatus; class GravityVar* _gravity; class MagnifVar* _magnif; class FontVar* _font; class BrushVar* _brush; class PatternVar* _pattern; class ColorVar* _color; class ArrowVar* _arrows; }; inline GraphicComp* IdrawEditor::GetGraphicComp () { return _comp; } #endif neuron-7.6.3/src/bin/idraw/idkybd.cpp000077500000000000000000000031561340731477100174730ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Idraw keycode values. */ #include "idkybd.h" const char* KLBL_ABOUT = "$", *CODE_ABOUT = "$"; const char* KLBL_NEWVIEW = "V", *CODE_NEWVIEW = "V"; const char* KLBL_PMOVE = "^M", *CODE_PMOVE = "\015"; const char* KLBL_PSCALE = "^J", *CODE_PSCALE = "\012"; const char* KLBL_PROTATE = "^K", *CODE_PROTATE = "\013"; neuron-7.6.3/src/bin/idraw/idkybd.h000077500000000000000000000026711340731477100171410ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Idraw keycode equivalents. */ #ifndef idkybd_h #define idkybd_h extern const char* KLBL_ABOUT, *CODE_ABOUT; extern const char* KLBL_NEWVIEW, *CODE_NEWVIEW; extern const char* KLBL_PMOVE, *CODE_PMOVE; extern const char* KLBL_PSCALE, *CODE_PSCALE; extern const char* KLBL_PROTATE, *CODE_PROTATE; #endif neuron-7.6.3/src/bin/idraw/idvars.cpp000066400000000000000000000174221340731477100175130ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of idraw-specific state variables */ #include "idvars.h" #include "idclasses.h" #include #include #include #include #include #include #include #include #include /*****************************************************************************/ static const int VIEW_WIDTH = 30; static const int VIEW_HEIGHT = 15; static const int HPAD = 2; static const int VPAD = 2; static const int ARROWX = HPAD + 5; static const int ARROWY = HPAD + 3; /*****************************************************************************/ static void CenterText ( const char* text, Painter* output, Coord xmax, Coord ymax ) { const Font* f = output->GetFont(); int width = f->Width(text); int height = f->Height(); output->MoveTo((xmax - width + 1)/2, (ymax - height + 1)/2); } /*****************************************************************************/ ArrowVar::ArrowVar(bool h, bool t) { _head = h; _tail = t; } void ArrowVar::SetArrows(bool h, bool t) { if (h != _head || t != _tail) { _head = h; _tail = t; Notify(); } } StateVar& ArrowVar::operator = (StateVar& var) { if (var.IsA(ARROW_VAR)) { ArrowVar* arrowVar = (ArrowVar*) &var; SetArrows(arrowVar->Head(),arrowVar->Tail()); } return *this; } StateVar* ArrowVar::Copy () { return new ArrowVar(_head, _tail); } ClassId ArrowVar::GetClassId () { return ARROW_VAR; } bool ArrowVar::IsA (ClassId id) {return ARROW_VAR==id || StateVar::IsA(id);} void ArrowVar::Read (istream& in) { StateVar::Read(in); char h, t; in >> h >> t; _head = (bool) h; _tail = (bool) t; } void ArrowVar::Write (ostream& out) { StateVar::Write(out); out << _head << " " << _tail << " "; } /*****************************************************************************/ class ArrowInteractor : public Interactor { public: ArrowInteractor( bool, bool, PSBrush*, PSColor* fg = nil, PSColor* bg = nil ); virtual ~ArrowInteractor(); void SetBrush(PSBrush*); void SetColors(PSColor*, PSColor*); void SetArrows(bool, bool); PSBrush* GetBrush(); PSColor* GetFgColor(); PSColor* GetBgColor(); protected: virtual void Reconfig(); virtual void Redraw(Coord, Coord, Coord, Coord); protected: bool _head, _tail; PSBrush* _brush; PSColor* _fg, *_bg; }; ArrowInteractor::ArrowInteractor ( bool h, bool t, PSBrush* b, PSColor* fg, PSColor* bg ) { _head = h; _tail = t; _brush = b; _fg = fg; _bg = bg; Ref(_brush); Ref(_fg); Ref(_bg); shape->Rect(VIEW_WIDTH, VIEW_HEIGHT); shape->Rigid(VIEW_WIDTH, VIEW_WIDTH, VIEW_HEIGHT, VIEW_HEIGHT); } ArrowInteractor::~ArrowInteractor () { Unref(_brush); Unref(_fg); Unref(_bg); } void ArrowInteractor::SetBrush (PSBrush* b) { Ref(b); Unref(_brush); _brush = b; } PSBrush* ArrowInteractor::GetBrush () { return _brush; } void ArrowInteractor::SetArrows (bool h, bool t) { _head = h; _tail = t; } void ArrowInteractor::SetColors (PSColor* fg, PSColor* bg) { Ref(fg); Ref(bg); Unref(_fg); Unref(_bg); _fg = fg; _bg = bg; } PSColor* ArrowInteractor::GetFgColor () { return _fg; } PSColor* ArrowInteractor::GetBgColor () { return _bg; } void ArrowInteractor::Reconfig () { Painter* p = new Painter(output); Ref(p); Unref(output); output = p; } void ArrowInteractor::Redraw (Coord, Coord, Coord, Coord) { const char* none = "None"; Coord x[3], y[3]; if (canvas != nil) { output->ClearRect(canvas, 0, 0, xmax, ymax); if (_brush->None()) { const Font* f = output->GetFont(); int width = f->Width(none); int height = f->Height(); output->MoveTo((xmax - width + 1)/2, (ymax - height + 1)/2); output->Text(canvas, none); } else { const Color* origfg = output->GetFgColor(); const Color* origbg = output->GetBgColor(); Resource::ref(origfg); Resource::ref(origbg); output->SetBrush(_brush); output->SetColors(_fg, _bg); output->Line(canvas, HPAD, ymax/2, xmax-HPAD, ymax/2); if (_head) { x[2] = x[0] = xmax-ARROWX; y[0] = ymax/2 - ARROWY; x[1] = xmax-HPAD; y[1] = ymax/2; y[2] = ymax/2 + ARROWY; output->MultiLine(canvas, x, y, 3); } if (_tail) { x[2] = x[0] = ARROWX; y[0] = ymax/2 - ARROWY; x[1] = HPAD; y[1] = ymax/2; y[2] = ymax/2 + ARROWY; output->MultiLine(canvas, x, y, 3); } if (_brush->Width() == 0) { CenterText("0", output, xmax, ymax); output->Text(canvas, "0"); } output->SetColors(origfg, origbg); Resource::unref(origfg); Resource::unref(origbg); } } } /*****************************************************************************/ ArrowVarView::ArrowVarView ( ArrowVar* av, BrushVar* bv, ColorVar* cv ) : StateVarView(bv) { PSColor* fg = nil, *bg = nil; _colorSubj = cv; _arrowSubj = av; _arrowSubj->Attach(this); _subject = bv; if (_colorSubj != nil) { _colorSubj->Attach(this); _subject = bv; // Attach changes _subject fg = _colorSubj->GetFgColor(); bg = _colorSubj->GetBgColor(); } ArrowInteractor* ab = new ArrowInteractor( av->Head(), av->Tail(), bv->GetBrush(), fg, bg ); Insert(ab); } ArrowVarView::~ArrowVarView () { StateVar* subject = _subject; // Detach changes _subject _arrowSubj->Detach(this); _subject = subject; if (_colorSubj != nil) { _colorSubj->Detach(this); _subject = subject; } } bool ArrowVarView::Stale () { bool arrowsChanged = ( (_arrowSubj->Head() != _prevHead || _arrowSubj->Tail() != _prevTail) ); bool colorsChanged = ( (_colorSubj != nil) && ( _colorSubj->GetFgColor() != _prevFg || _colorSubj->GetBgColor() != _prevBg ) ); return ((BrushVar*) _subject)->GetBrush() != _prevVal || colorsChanged || arrowsChanged; } void ArrowVarView::Init () { ArrowInteractor* b = (ArrowInteractor*) interior(); _prevVal = ((BrushVar*) _subject)->GetBrush(); b->SetBrush(_prevVal); _prevHead = _arrowSubj->Head(); _prevTail = _arrowSubj->Tail(); b->SetArrows(_prevHead, _prevTail); if (_colorSubj != nil) { _prevFg = _colorSubj->GetFgColor(); _prevBg = _colorSubj->GetBgColor(); b->SetColors(_prevFg, _prevBg); } } neuron-7.6.3/src/bin/idraw/idvars.h000066400000000000000000000041541340731477100171560ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Idraw-specific state variables */ #ifndef idvars_h #define idvars_h #include #include class ArrowVar : public StateVar { public: ArrowVar(bool h = false, bool t = false); bool Head(); bool Tail(); void SetArrows(bool, bool); virtual StateVar& operator = (StateVar&); virtual StateVar* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); private: bool _head, _tail; }; inline bool ArrowVar::Head() { return _head; } inline bool ArrowVar::Tail() { return _tail; } class ArrowVarView : public StateVarView { public: ArrowVarView(ArrowVar*, BrushVar*, ColorVar* = nil); virtual ~ArrowVarView(); protected: virtual void Init(); virtual bool Stale(); protected: ArrowVar* _arrowSubj; bool _prevHead, _prevTail; PSBrush* _prevVal; PSColor* _prevFg, *_prevBg; ColorVar* _colorSubj; }; #endif neuron-7.6.3/src/bin/idraw/idversion.h000077500000000000000000000024101340731477100176640ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Version number information. */ static const char* VERSION = "idraw - Version 2.1. By John Vlissides and Scott Stanton."; neuron-7.6.3/src/bin/idraw/main.cpp000077500000000000000000000120341340731477100171440ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Idraw editor main program. */ #include "idcatalog.h" #include "idcreator.h" #include "ided.h" #include #include #include /*****************************************************************************/ static PropertyData properties[] = { { "*IdrawEditor*name", "InterViews drawing editor" }, { "*IdrawEditor*iconName", "Idraw" }, { "*domain", "drawing" }, { "*initialbrush", "2" }, { "*initialfgcolor","1" }, { "*initialbgcolor","10" }, { "*initialfont", "4" }, { "*initialpattern","1" }, { "*initialarrow", "none" }, { "*pagewidth", "8.5" }, { "*pageheight", "11" }, { "*gridxincr", "8" }, { "*gridyincr", "8" }, { "*font1", "-*-courier-medium-r-normal-*-8-*-*-*-*-*-*-* Courier 8" }, { "*font2", "-*-courier-medium-r-normal-*-10-*-*-*-*-*-*-* Courier 10" }, { "*font3", "-*-courier-bold-r-normal-*-12-*-*-*-*-*-*-* Courier-Bold 12" }, { "*font4", "-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-* Helvetica 12" }, { "*font5", "-*-helvetica-medium-r-normal-*-14-*-*-*-*-*-*-* Helvetica 14" }, { "*font6", "-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-* Helvetica-Bold 14" }, { "*font7", "-*-helvetica-medium-o-normal-*-14-*-*-*-*-*-*-* Helvetica-Oblique 14" }, { "*font8", "-*-times-medium-r-normal-*-12-*-*-*-*-*-*-* Times-Roman 12" }, { "*font9", "-*-times-medium-r-normal-*-14-*-*-*-*-*-*-* Times-Roman 14" } , { "*font10", "-*-times-bold-r-normal-*-14-*-*-*-*-*-*-* Times-Bold 14" }, { "*font11", "-*-Symbol-*-12-*-*-*-*-*-*-* Symbol 12" }, { "*font12", "-*-Symbol-*-14-*-*-*-*-*-*-* Symbol 14" }, { "*brush1", "none" }, { "*brush2", "ffff 0" }, { "*brush3", "ffff 1" }, { "*brush4", "ffff 2" }, { "*brush5", "ffff 3" }, { "*brush6", "fff0 0" }, { "*brush7", "fff0 1" }, { "*brush8", "fff0 2" }, { "*brush9", "fff0 3" }, { "*pattern1", "none" }, { "*pattern2", "0.0" }, { "*pattern3", "1.0" }, { "*pattern4", "0.75" }, { "*pattern5", "0.5" }, { "*pattern6", "0.25" }, { "*pattern7", "1248" }, { "*pattern8", "8421" }, { "*pattern9", "f000" }, { "*pattern10", "8888" }, { "*pattern11", "f888" }, { "*pattern12", "8525" }, { "*pattern13", "cc33" }, { "*pattern14", "7bed" }, { "*fgcolor1", "Black" }, { "*fgcolor2", "Brown 42240 10752 10752" }, { "*fgcolor3", "Red" }, { "*fgcolor4", "Orange" }, { "*fgcolor5", "Yellow" }, { "*fgcolor6", "Green" }, { "*fgcolor7", "Blue" }, { "*fgcolor8", "Indigo 48896 0 65280" }, { "*fgcolor9", "Violet 20224 12032 20224" }, { "*fgcolor10", "White" }, { "*fgcolor11", "LtGray 50000 50000 50000" }, { "*fgcolor12", "DkGray 33000 33000 33000" }, { "*bgcolor1", "Black" }, { "*bgcolor2", "Brown 42240 10752 10752" }, { "*bgcolor3", "Red" }, { "*bgcolor4", "Orange" }, { "*bgcolor5", "Yellow" }, { "*bgcolor6", "Green" }, { "*bgcolor7", "Blue" }, { "*bgcolor8", "Indigo 48896 0 65280" }, { "*bgcolor9", "Violet 20224 12032 20224" }, { "*bgcolor10", "White" }, { "*bgcolor11", "LtGray 50000 50000 50000" }, { "*bgcolor12", "DkGray 33000 33000 33000" }, { "*history", "20" }, { nil } }; static OptionDesc options[] = { { nil } }; /*****************************************************************************/ int main (int argc, char** argv) { int exit_status = 0; IdrawCreator creator; Unidraw* unidraw = new Unidraw( new IdrawCatalog("idraw", &creator), argc, argv, options, properties ); if (argc > 2) { cerr << "Usage: idraw [file]" << "\n"; exit_status = 1; } else { const char* initial_file = (argc == 2) ? argv[1] : nil; IdrawEditor* ed = new IdrawEditor(initial_file); unidraw->Open(ed); unidraw->Run(); } delete unidraw; return exit_status; } neuron-7.6.3/src/include/000077500000000000000000000000001340731477100152565ustar00rootroot00000000000000neuron-7.6.3/src/include/Dispatch/000077500000000000000000000000001340731477100170155ustar00rootroot00000000000000neuron-7.6.3/src/include/Dispatch/_defines.h000077500000000000000000000010661340731477100207500ustar00rootroot00000000000000#define Dispatcher _lib_dp(Dispatcher) #define FdMask _lib_dp(FdMask) #define IOHandler _lib_dp(IOHandler) #define RpcHdr _lib_dp(RpcHdr) #define RpcPeer _lib_dp(RpcPeer) #define RpcReader _lib_dp(RpcReader) #define RpcRegistry _lib_dp(RpcRegistry) #define RpcService _lib_dp(RpcService) #define RpcWriter _lib_dp(RpcWriter) #define TimerQueue _lib_dp(TimerQueue) #define iosb _lib_dp(iosb) #define iostreamb _lib_dp(iostreamb) #define istreamb _lib_dp(istreamb) #define ostreamb _lib_dp(ostreamb) #define rpcbuf _lib_dp(rpcbuf) #define rpcstream _lib_dp(rpcstream) neuron-7.6.3/src/include/Dispatch/_gendefs000077500000000000000000000004231340731477100205140ustar00rootroot00000000000000#! /bin/csh -f set tmp = /tmp/$$ cp /dev/null $tmp grep "^class" *.h | \ sed -e 's/.*class \([^ ;\*]*\).*$/\1/' | \ sort | uniq | fgrep -v "(" >> $tmp sed -e 's/\(.*\)/#define \1 _lib_dp(\1)/' < $tmp > "_defines.h" sed -e 's/^/#undef /' < $tmp > "_undefs.h" rm $tmp neuron-7.6.3/src/include/Dispatch/_undefs.h000077500000000000000000000004031340731477100206110ustar00rootroot00000000000000#undef Dispatcher #undef FdMask #undef IOHandler #undef RpcHdr #undef RpcPeer #undef RpcReader #undef RpcRegistry #undef RpcService #undef RpcWriter #undef TimerQueue #undef iosb #undef iostreamb #undef istreamb #undef ostreamb #undef rpcbuf #undef rpcstream neuron-7.6.3/src/include/Dispatch/dispatcher.h000066400000000000000000000065731340731477100213270ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Wait on multiple file descriptors until a condition occurs. */ #ifndef dp_dispatcher_h #define dp_dispatcher_h #include class FdMask; class IOHandler; class TimerQueue; class ChildQueue; struct timeval; class Dispatcher { public: enum DispatcherMask { ReadMask, WriteMask, ExceptMask }; Dispatcher(); virtual ~Dispatcher(); virtual void link(int fd, DispatcherMask, IOHandler*); virtual IOHandler* handler(int fd, DispatcherMask) const; virtual void unlink(int fd); virtual void startTimer(long sec, long usec, IOHandler*); virtual void stopTimer(IOHandler*); virtual void startChild(int pid, IOHandler*); virtual void stopChild(IOHandler*); virtual bool setReady(int fd, DispatcherMask); virtual void dispatch(); virtual bool dispatch(long& sec, long& usec); static Dispatcher& instance(); static void instance(Dispatcher*); protected: virtual void attach(int fd, DispatcherMask, IOHandler*); virtual void detach(int fd); virtual bool dispatch(timeval*); virtual bool anyReady() const; virtual int fillInReady(FdMask&, FdMask&, FdMask&); virtual int waitFor(FdMask&, FdMask&, FdMask&, timeval*); virtual void notify(int, FdMask&, FdMask&, FdMask&); virtual timeval* calculateTimeout(timeval*) const; virtual bool handleError(); virtual void checkConnections(); protected: int _nfds; FdMask* _rmask; FdMask* _wmask; FdMask* _emask; FdMask* _rmaskready; FdMask* _wmaskready; FdMask* _emaskready; IOHandler** _rtable; IOHandler** _wtable; IOHandler** _etable; TimerQueue* _queue; ChildQueue* _cqueue; #if defined(HAVE_BSD_SIGNALS) || defined(HAVE_POSIX_SIGNALS) static RETSIGTYPE sigCLD(int); #else // When is this used? static RETSIGTYPE sigCLD(...); #endif //#if defined(sgi) // static void sigCLD(...); //#else //#if defined(AIXV4) // static void sigCLD(int); //#else // static void sigCLD(); //#endif //#endif private: static Dispatcher* _instance; private: /* deny access since member-wise won't work */ Dispatcher(const Dispatcher&); Dispatcher& operator =(const Dispatcher&); }; #endif neuron-7.6.3/src/include/Dispatch/dp.h000077500000000000000000000025601340731477100175770ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef dp_h #define dp_h #if 1 || defined(__STDC__) || defined(__ANSI_CPP__) #define _lib_dp(name) dp##name #else #define _lib_dp(name) dp/**/name #endif #endif neuron-7.6.3/src/include/Dispatch/enter-scope.h000077500000000000000000000027121340731477100214170ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef dp__scope_h #define dp__scope_h #include #include #ifndef os__scope_h #include #include #define String _lib_os(String) #define u_char _lib_os(u_char) #endif #endif neuron-7.6.3/src/include/Dispatch/iocallback.h000077500000000000000000000064021340731477100212570ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef dp_iocallback_h #define dp_iocallback_h /* * IOCallback allows a member function to be used as an IO handler * instead of requiring derivation of a subclass. */ #include #if defined(__STDC__) || defined(__ANSI_CPP__) #define __IOCallback(T) T##_IOCallback #define IOCallback(T) __IOCallback(T) #define __IOReady(T) T##_IOReady #define IOReady(T) __IOReady(T) #define __IOTimer(T) T##_IOTimer #define IOTimer(T) __IOTimer(T) #else #define __IOCallback(T) T/**/_IOCallback #define IOCallback(T) __IOCallback(T) #define __IOReady(T) T/**/_IOReady #define IOReady(T) __IOReady(T) #define __IOTimer(T) T/**/_IOTimer #define IOTimer(T) __IOTimer(T) #endif #define declareIOCallback(T) \ typedef int (T::*IOReady(T))(int fd); \ typedef void (T::*IOTimer(T))(long sec, long usec); \ class IOCallback(T) : public IOHandler { \ public: \ IOCallback(T)( \ T*, IOReady(T) in, IOReady(T) out = nil, IOReady(T) ex = nil \ ); \ IOCallback(T)( \ T*, IOTimer(T), \ IOReady(T) in = nil, IOReady(T) out = nil, IOReady(T) ex = nil \ ); \ \ virtual int inputReady(int fd); \ virtual int outputReady(int fd); \ virtual int exceptionRaised(int fd); \ virtual void timerExpired(long sec, long usec); \ private: \ T* _obj; \ IOReady(T) _input; \ IOReady(T) _output; \ IOReady(T) _except; \ IOTimer(T) _timer; \ }; #define implementIOCallback(T) \ IOCallback(T)::IOCallback(T)( \ T* obj, IOReady(T) in, IOReady(T) out, IOReady(T) ex \ ) { \ _obj = obj; _timer = nil; \ _input = in; _output = out; _except = ex; \ } \ \ IOCallback(T)::IOCallback(T)( \ T* obj, IOTimer(T) t, IOReady(T) in, IOReady(T) out, IOReady(T) ex \ ) { \ _obj = obj; _timer = t; \ _input = in; _output = out; _except = ex; \ } \ \ int IOCallback(T)::inputReady(int fd) { return (_obj->*_input)(fd); } \ int IOCallback(T)::outputReady(int fd) { return (_obj->*_output)(fd); } \ int IOCallback(T)::exceptionRaised(int fd) { return (_obj->*_except)(fd); } \ void IOCallback(T)::timerExpired(long s, long u) { (_obj->*_timer)(s, u); } #endif neuron-7.6.3/src/include/Dispatch/iohandler.h000077500000000000000000000035121340731477100211370ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef dp_iohandler_h #define dp_iohandler_h #include #include // Derived classes read input on a file number, write output on a file // number, handle an exception raised on a file number, or handle a // timer's expiration. #if (defined(WIN32) || MAC) && 0 typedef int pid_t; #endif class IOHandler { protected: IOHandler(); public: virtual ~IOHandler(); virtual int inputReady(int fd); virtual int outputReady(int fd); virtual int exceptionRaised(int fd); virtual void timerExpired(long sec, long usec); virtual void childStatus(pid_t pid, int status); }; #endif neuron-7.6.3/src/include/Dispatch/iostreamb.h000066400000000000000000000071611340731477100211600ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef dp_iostreamb_h #define dp_iostreamb_h #include #include // Modify ios to store extra state information for binary I/O. class iosb : public virtual ios { public: iosb(); ~iosb(); bool binary() const; void binary(bool); bool swapped() const; void swapped(bool); protected: bool _binary; // are my peer and I performing binary I/O? bool _swapped; // does my peer have a swapped endian? }; // Modify istream to extract unformatted data where possible for // faster I/O throughput and to discard delimiters automatically. class istreamb : public virtual iosb, public istream { protected: istreamb(); public: istreamb(streambuf*); ~istreamb(); istreamb& operator>>(char&); istreamb& operator>>(unsigned char&); istreamb& operator>>(short&); istreamb& operator>>(unsigned short&); istreamb& operator>>(int&); istreamb& operator>>(unsigned int&); istreamb& operator>>(long&); istreamb& operator>>(unsigned long&); istreamb& operator>>(float&); istreamb& operator>>(double&); istreamb& operator>>(char*); istreamb& operator>>(unsigned char*); istreamb& operator>>(istream& (*)(istream&)); istreamb& operator>>(ios& (*)(ios&)); }; // Modify ostream to insert unformatted data where possible for faster // I/O throughput and to delimit formatted data automatically. class ostreamb : public virtual iosb, public ostream { protected: ostreamb(); public: ostreamb(streambuf*); ~ostreamb(); ostreamb& operator<<(char); ostreamb& operator<<(unsigned char); ostreamb& operator<<(short); ostreamb& operator<<(unsigned short); ostreamb& operator<<(int); ostreamb& operator<<(unsigned int); ostreamb& operator<<(long); ostreamb& operator<<(unsigned long); ostreamb& operator<<(float); ostreamb& operator<<(double); ostreamb& operator<<(const char*); ostreamb& operator<<(const unsigned char*); ostreamb& operator<<(ostream& (*)(ostream&)); ostreamb& operator<<(ios& (*)(ios&)); protected: void fixwidth(); }; // Replace iostream with a stream that inserts and extracts // unformatted data where possible for faster I/O throughput and // delimits formatted data automatically. class iostreamb : public istreamb, public ostreamb { protected: iostreamb(); public: iostreamb(streambuf*); ~iostreamb(); void negotiate(bool binary); }; #endif neuron-7.6.3/src/include/Dispatch/leave-scope.h000077500000000000000000000024451340731477100214010ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifdef dp__scope_h #undef dp__scope_h #include #undef nil #endif neuron-7.6.3/src/include/Dispatch/rpcbuf.h000066400000000000000000000065711340731477100204600ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef dp_rpcbuf_h #define dp_rpcbuf_h #include // Specialize streambuf to sending and receiving RPC requests to and // from remote machines. class rpcbuf : public streambuf { public: rpcbuf(iostreamb* = nil); virtual ~rpcbuf(); const char* host(); int port(); int fd(); bool opened(); bool nonblocking(); enum { anyport = 0 }; rpcbuf* listen(int port); rpcbuf* connect(const char* host, int port); rpcbuf* accept(int& fd); rpcbuf* attach(int fd); rpcbuf* nonblocking(bool); rpcbuf* verbose(bool); rpcbuf* close(); int start_request(); int read_request(); virtual int overflow(int c = EOF); virtual int underflow(); virtual int sync(); #ifdef cplusplus_2_1 virtual streampos seekoff(streamoff, ios::seek_dir, int); #else virtual streampos seekoff(streamoff, seek_dir, int); #endif virtual streambuf* setbuf(char*, int); protected: virtual int doallocate(); void finish_request(); bool expand_g(int); bool expand_p(); void error(const char*); void sys_error(const char*); iostreamb& mystream(); char* rptr(); void setr(char*); void rbump(int); protected: iostreamb* _mystream; // reference to the stream that uses me char* _rptr; // beginning of outgoing RPC request int _actualWidth; // width of outgoing RPC request's length field const char* _host; // name of my peer's host or nil if no peer int _port; // my peer's port or my port if I'm a listener int _fd; // my IPC connection's file descriptor bool _opened; // do I have an open file descriptor? bool _close; // should I close my file descriptor on exit? bool _nonblocking; // can I read or write without blocking? bool _verbose; // should I print system error messages? }; // Get the stream which will format the length field of RPC requests. inline iostreamb& rpcbuf::mystream() { return *_mystream; } // Get and set the pointer to the outgoing RPC request's beginning. inline char* rpcbuf::rptr() { return _rptr; } inline void rpcbuf::setr(char* rptr) { _rptr = rptr; } inline void rpcbuf::rbump(int n) { _rptr += n; } #endif neuron-7.6.3/src/include/Dispatch/rpchdr.h000077500000000000000000000041521340731477100204550ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef dp_rpchdr_h #define dp_rpchdr_h #include class rpcstream; // Insert or extract this header to send or receive a RPC request. class RpcHdr { public: RpcHdr(void* writer, int request); RpcHdr(); unsigned long reader(); int request(); int ndata(); protected: friend rpcstream& operator>>(rpcstream&, RpcHdr&); friend rpcstream& operator<<(rpcstream&, const RpcHdr&); protected: union { void* _writer; // stores writer sending this RPC request unsigned long _reader; // maps to reader for this RPC request }; int _request; // maps to member function to be called int _ndata; // gives size (in bytes) of data to extract }; // Get information about the RPC request. inline unsigned long RpcHdr::reader() { return _reader; } inline int RpcHdr::request() { return _request; } inline int RpcHdr::ndata() { return _ndata; } #endif neuron-7.6.3/src/include/Dispatch/rpcpeer.h000066400000000000000000000045451340731477100206360ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef dp_rpcpeer_h #define dp_rpcpeer_h #include class rpcbuf; // Support bi-directional RPC between two peers. Derived classes // create both a reader and a writer so each peer can send RPC // requests to its opposite over the same connection. class RpcPeer : public IOHandler { public: virtual ~RpcPeer(); void run(); void quitRunning(); protected: RpcPeer( const char* lPath, int lPort = 0 ); void init(const char* rPath); void startListening(); void stopListening(); virtual int inputReady(int); virtual bool createReaderAndWriter(const char* rHost, int rPort) = 0; virtual void createReaderAndWriter(int fd) = 0; protected: const char* _lPath; // my registration's path int _lPort; // my port's address rpcbuf* _service; // my network socket bool _running; // am I running my dispatch loop? bool _remote; // am I connected to a remote RPC service? char* _rHost; // dynamically allocated storage to be freed private: // deny access since unimplemented and member-wise won't work RpcPeer(const RpcPeer&); RpcPeer& operator=(const RpcPeer&); }; #endif neuron-7.6.3/src/include/Dispatch/rpcreader.h000066400000000000000000000047771340731477100211540ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef dp_rpcreader_h #define dp_rpcreader_h #include class RpcHdr; class rpcstream; /* * Read RPC requests from a client. Derived classes initialize the * function array with addresses of static member functions to * unmarshall RPC requests and implement the virtual function called * when the client closes the connection. */ class RpcReader : public IOHandler { public: virtual ~RpcReader(); protected: RpcReader(rpcstream* client, int nfcns); RpcReader(int fd, int nfcns, bool binary); rpcstream& client(); virtual int inputReady(int); virtual RpcReader* map(unsigned long); bool execute(RpcReader*, RpcHdr&); virtual void connectionClosed(int fd) = 0; protected: typedef void (*PF)(RpcReader*, RpcHdr&, rpcstream&); int _nfcns; /* size of function array */ PF* _function; /* function array indexed by request number */ rpcstream* _client; /* source of RPC requests coming from client */ bool _delete; /* should the destructor delete _client? */ int _fd; /* file number of connection with client */ private: /* deny access since unimplemented and member-wise won't work */ RpcReader(const RpcReader&); RpcReader& operator=(const RpcReader&); }; inline rpcstream& RpcReader::client() { return *_client; } #endif neuron-7.6.3/src/include/Dispatch/rpcregistry.h000066400000000000000000000031251340731477100215440ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef dp_rpcregistry_h #define dp_rpcregistry_h #include // Store or retrieve a RPC service's hostname and port number so that // clients can contact the RPC service. class RpcRegistry { public: static bool record(const char* path, int port); static bool erase(const char* path); static bool find(const char* path, char*& host, int& port); }; #endif neuron-7.6.3/src/include/Dispatch/rpcservice.h000066400000000000000000000041751340731477100213420ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef dp_rpcservice_h #define dp_rpcservice_h #include class rpcbuf; // Support communication between a RPC service and its clients. // Derived classes create readers to read RPC requests from // connections with clients. class RpcService : public IOHandler { public: virtual ~RpcService(); void run(); void quitRunning(); protected: RpcService(int port); RpcService(const char* path, int port = 0); void startListening(); void stopListening(); virtual int inputReady(int); virtual void createReader(int fd) = 0; protected: const char* _path; // my registration's path int _port; // my port's address rpcbuf* _service; // my network socket bool _running; // am I running my dispatch loop? private: // deny access since unimplemented and member-wise won't work RpcService(const RpcService&); RpcService& operator=(const RpcService&); }; #endif neuron-7.6.3/src/include/Dispatch/rpcstream.h000066400000000000000000000043621340731477100211730ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef dp_rpcstream_h #define dp_rpcstream_h #include // Modify iostreamb to store a rpcbuf and provide operations on the // rpcbuf, therefore specializing iostreamb to RPC requests. class rpcstream : public virtual iostreamb { public: rpcstream(); ~rpcstream(); void listen(int port); void connect(const char* host, int port); int accept(); void attach(int fd); void close(); void nonblocking(bool); void verbose(bool); rpcbuf* rdbuf(); bool incomplete_request(); void incomplete_request(bool); protected: void verify(int); protected: rpcbuf _buf; // streambuf specialized to RPC requests bool _incomplete_request; // is the incoming request still incomplete? }; // Return or set protected member variables. inline rpcbuf* rpcstream::rdbuf() { return &_buf; } inline bool rpcstream::incomplete_request() { return _incomplete_request; } inline void rpcstream::incomplete_request(bool incomplete_request) { _incomplete_request = incomplete_request; } #endif neuron-7.6.3/src/include/Dispatch/rpcwriter.h000066400000000000000000000045471340731477100212210ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef dp_rpcwriter_h #define dp_rpcwriter_h #include class rpcstream; // Write RPC requests to a server. Derived classes should add member // functions corresponding to the RPC service's protocol. class RpcWriter { public: ~RpcWriter(); rpcstream& server(); protected: RpcWriter(const char* path, bool fatal, bool binary); RpcWriter(const char* host, int port, bool fatal, bool binary); RpcWriter(int fd, bool fatal, bool binary); RpcWriter(rpcstream* server); void open(const char* path, bool fatal, bool binary); rpcstream* _server; // sink of RPC requests going to server bool _delete; // should the destructor delete _server? char* _host; // dynamically allocated storage to be deleted private: // deny access since unimplemented and member-wise won't work RpcWriter(const RpcWriter&); RpcWriter& operator=(const RpcWriter&); }; // Give this function public access so that programs can test this // connection's state or attach a RpcReader to it to read as well // as send RPC requests over the same connection. inline rpcstream& RpcWriter::server() { return *_server; } #endif neuron-7.6.3/src/include/IV-2_6/000077500000000000000000000000001340731477100161605ustar00rootroot00000000000000neuron-7.6.3/src/include/IV-2_6/InterViews/000077500000000000000000000000001340731477100202575ustar00rootroot00000000000000neuron-7.6.3/src/include/IV-2_6/InterViews/adjuster.h000066400000000000000000000076451340731477100222650ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Adjuster - button-like interactors for incremental adjustment of an * interactor's perspective. */ #ifndef ivlook2_6_adjuster_h #define ivlook2_6_adjuster_h #include #include static const int NO_AUTOREPEAT = -1; class Bitmap; class Shape; class Adjuster : public Interactor { public: Adjuster(Interactor*, int = NO_AUTOREPEAT); Adjuster(const char*, Interactor*, int = NO_AUTOREPEAT); virtual ~Adjuster(); void Handle(Event&); virtual void Highlight(bool on); void Redraw(IntCoord, IntCoord, IntCoord, IntCoord); void Reshape(Shape&); protected: Interactor* view; Bitmap* plain; Bitmap* hit; Bitmap* mask; int delay; bool timer; Perspective* shown; bool highlighted; virtual void AdjustView(Event&); void AutoRepeat(); void Flash(); void HandlePress(); void Invert(); virtual void Reconfig(); void TimerOn(); void TimerOff(); private: void Init(Interactor*, int); }; class Zoomer : public Adjuster { public: Zoomer(Interactor*, float factor); Zoomer(const char*, Interactor*, float factor); virtual ~Zoomer(); protected: void AdjustView(Event&); private: float factor; void Init(float); }; class Enlarger : public Zoomer { public: Enlarger(Interactor*); Enlarger(const char*, Interactor*); virtual ~Enlarger(); private: void Init(); }; class Reducer : public Zoomer { public: Reducer(Interactor*); Reducer(const char*, Interactor*); virtual ~Reducer(); private: void Init(); }; class Mover : public Adjuster { public: Mover(Interactor*, int delay, int moveType); Mover(const char*, Interactor*, int delay, int moveType); virtual ~Mover(); protected: int moveType; void AdjustView(Event&); private: void Init(int); }; class LeftMover : public Mover { public: LeftMover(Interactor*, int delay = NO_AUTOREPEAT); LeftMover(const char*, Interactor*, int delay = NO_AUTOREPEAT); virtual ~LeftMover(); private: void Init(); }; class RightMover : public Mover { public: RightMover(Interactor*, int delay = NO_AUTOREPEAT); RightMover(const char*, Interactor*, int delay = NO_AUTOREPEAT); virtual ~RightMover(); private: void Init(); }; class UpMover : public Mover { public: UpMover(Interactor*, int delay = NO_AUTOREPEAT); UpMover(const char*, Interactor*, int delay = NO_AUTOREPEAT); virtual ~UpMover(); private: void Init(); }; class DownMover : public Mover { public: DownMover(Interactor*, int delay = NO_AUTOREPEAT); DownMover(const char*, Interactor*, int delay = NO_AUTOREPEAT); virtual ~DownMover(); private: void Init(); }; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/alignment.h000077500000000000000000000042411340731477100224120ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Common definitions for all of InterViews. */ #ifndef iv2_6_alignment_h #define iv2_6_alignment_h #include #include /* * Alignment needs to be unsigned so that it can be stored * as a bit field. */ typedef unsigned Alignment; /* * Use the concrete type (unsigned) instead of Alignment * to get around cfront 2.1 incorrect warning. */ static const unsigned TopLeft = 0; static const unsigned TopCenter = 1; static const unsigned TopRight = 2; static const unsigned CenterLeft = 3; static const unsigned Center = 4; static const unsigned CenterRight = 5; static const unsigned BottomLeft = 6; static const unsigned BottomCenter = 7; static const unsigned BottomRight = 8; static const unsigned Left = 9; static const unsigned Right = 10; static const unsigned Top = 11; static const unsigned Bottom = 12; static const unsigned HorizCenter = 13; static const unsigned VertCenter = 14; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/banner.h000066400000000000000000000035531340731477100217030ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * A banner is a one line title bar. */ #ifndef ivlook2_6_banner_h #define ivlook2_6_banner_h #include #include class Banner : public Interactor { public: char* left; char* middle; char* right; bool highlight; Banner(char* lt, char* mid, char* rt); Banner(const char*, char* lt, char* mid, char* rt); ~Banner(); void Update(); protected: int lw, mw, rw; IntCoord lx, mx, rx; Painter* inverse; void Init(char*, char*, char*); void Reconfig(); void Redraw(IntCoord, IntCoord, IntCoord, IntCoord); void Resize(); }; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/border.h000077500000000000000000000040621340731477100217120ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * A border is simply a infinitely stretchable line. */ #ifndef ivlook2_6_border_h #define ivlook2_6_border_h #include #include class Border : public Interactor { protected: int thickness; Border(int); Border(const char*, int); virtual ~Border(); void DefaultThickness(int); virtual void Redraw(IntCoord, IntCoord, IntCoord, IntCoord); }; class HBorder : public Border { public: HBorder(int thick = -1); HBorder(const char*, int thick = -1); virtual ~HBorder(); protected: virtual void Reconfig(); private: void Init(); }; class VBorder : public Border { public: VBorder(int thick = -1); VBorder(const char*, int thick = -1); virtual ~VBorder(); protected: virtual void Reconfig(); private: void Init(); }; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/box.h000066400000000000000000000071561340731477100212310ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Boxes are used to compose side-by-side. */ #ifndef iv2_6_box_h #define iv2_6_box_h #include #include class BoxElement; class BoxCanonical; class Box : public Scene { public: virtual ~Box(); void Align(Alignment); void Draw(); void GetComponents(Interactor**, int, Interactor**&, int&); void Resize(); protected: Alignment align; Box(); virtual void ComputeShape(Shape*); virtual void GetActual(int& major_size, int& minor_size); virtual void GetCanonical(Shape*, BoxCanonical&); BoxElement* Head(); virtual void PlaceElement( Interactor*, Coord major_size, int len, int thick, int minor_size ); virtual void Reconfig(); private: int nelements; BoxElement* head; BoxElement* tail; void DoInsert(Interactor*, bool, Coord& x, Coord& y); void DoChange(Interactor*); void DoRemove(Interactor*); }; class HBox : public Box { public: HBox(); HBox(Interactor*); HBox(Interactor*, Interactor*); HBox(Interactor*, Interactor*, Interactor*); HBox(Interactor*, Interactor*, Interactor*, Interactor*); HBox(Interactor*, Interactor*, Interactor*, Interactor*, Interactor*); HBox( Interactor*, Interactor*, Interactor*, Interactor*, Interactor*, Interactor* ); HBox( Interactor*, Interactor*, Interactor*, Interactor*, Interactor*, Interactor*, Interactor* ); virtual ~HBox(); protected: void ComputeShape(Shape*); void GetActual(int& major_size, int& minor_size); void GetCanonical(Shape*, BoxCanonical&); void PlaceElement(Interactor*, Coord, int, int, int); private: void Init(); }; class VBox : public Box { public: VBox(); VBox(Interactor*); VBox(Interactor*, Interactor*); VBox(Interactor*, Interactor*, Interactor*); VBox(Interactor*, Interactor*, Interactor*, Interactor*); VBox(Interactor*, Interactor*, Interactor*, Interactor*, Interactor*); VBox( Interactor*, Interactor*, Interactor*, Interactor*, Interactor*, Interactor* ); VBox( Interactor*, Interactor*, Interactor*, Interactor*, Interactor*, Interactor*, Interactor* ); virtual ~VBox(); protected: void ComputeShape(Shape*); void GetActual(int& major_size, int& minor_size); void GetCanonical(Shape*, BoxCanonical&); void PlaceElement(Interactor*, Coord, int, int, int); private: void Init(); }; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/button.h000066400000000000000000000107611340731477100217500ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * A button is a view of some value that is normally set when * the button is pressed. */ #ifndef ivlook2_6_button_h #define ivlook2_6_button_h #include #include #include class Button; class ButtonList; class Bitmap; class ButtonState : public Subject { public: ButtonState(); ButtonState(int); ButtonState(void*); virtual ~ButtonState(); void operator=(ButtonState&); void SetValue(int); void SetValue(void*); void GetValue (int& v) { v = int(long(value)); } void GetValue (void*& v) { v = value; } protected: void* value; void Modify(void*); }; class Button : public Interactor { public: void Attach(Button*); void Detach(Button*); void Enable(); void Disable(); void Choose(); void UnChoose(); virtual void Press(); virtual void Refresh(); virtual void Handle(Event&); virtual void Update(); protected: Button(ButtonState*, void*); Button(const char*, ButtonState*, void*); ~Button(); void* value; /* value associated with this button */ ButtonState* subject; /* set to this->value when pressed */ ButtonList* associates; /* enable/disable when chosen/unchosen */ bool enabled; /* can be pressed */ bool chosen; /* currently toggled on */ bool hit; /* currently being pushed */ private: void Init(ButtonState*, void*); }; class TextButton : public Button { protected: char* text; Painter* background; Painter* grayout; /* for disabled buttons */ TextButton(const char*, const char*, ButtonState*, void*); TextButton(const char*, ButtonState*, void*); virtual ~TextButton(); virtual void Reconfig(); void MakeBackground(); void MakeShape(); private: void Init(const char*); }; class PushButton : public TextButton { public: PushButton(const char*, ButtonState*, int); PushButton(const char*, ButtonState*, void*); PushButton(const char*, const char*, ButtonState*, int); PushButton(const char*, const char*, ButtonState*, void*); virtual ~PushButton(); virtual void Refresh(); protected: virtual void Reconfig(); virtual void Redraw(IntCoord, IntCoord, IntCoord, IntCoord); private: void Init(); }; class RadioButton : public TextButton { public: RadioButton(const char*, ButtonState*, int); RadioButton(const char*, ButtonState*, void*); RadioButton(const char*, const char*, ButtonState*, int); RadioButton(const char*, const char*, ButtonState*, void*); virtual ~RadioButton(); virtual void Refresh(); protected: virtual void Reconfig(); virtual void Redraw(IntCoord, IntCoord, IntCoord, IntCoord); private: void Init(); }; class CheckBox : public TextButton { public: CheckBox(const char*, ButtonState*, int, int); CheckBox(const char*, ButtonState*, void*, void*); CheckBox(const char*, const char*, ButtonState*, int, int); CheckBox(const char*, const char*, ButtonState*, void*, void*); virtual ~CheckBox(); virtual void Press(); virtual void Refresh(); virtual void Update(); protected: virtual void Reconfig(); virtual void Redraw(IntCoord, IntCoord, IntCoord, IntCoord); private: void* offvalue; void Init(void*); }; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/compeditor.h000066400000000000000000000036601340731477100226020ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * CompletionEditor - StringEditor with completion */ #ifndef ivlook2_6_compeditor_h #define ivlook2_6_compeditor_h #include #include const char CEComplete = ' '; class CompletionEditor : public StringEditor { public: CompletionEditor(ButtonState*, const char* samp, const char* = SEDone); CompletionEditor( const char* name, ButtonState*, const char*, const char* = SEDone ); virtual ~CompletionEditor(); void Completions(const char* list[], int count, char = CEComplete); protected: virtual bool HandleChar(char); private: void Init(); char complete_; const char** completions_; int count_; }; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/control.h000066400000000000000000000076061340731477100221210ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Controls provide an interface to selecting and executing some action. */ #ifndef ivlook2_6_control_h #define ivlook2_6_control_h #include #include #include #include class Control; class ControlState; class Control : public MonoScene { public: Control(Interactor*); Control(const char* name, Interactor*); ~Control(); ControlState* State() { return state_; } void SetState(ControlState*); virtual void Handle(Event&); virtual void Enable(bool); bool Enabled(); virtual void Select(); /* highlight, open, and grab */ virtual void Unselect(); /* close, unhighlight */ virtual void Do(); /* action for selection */ Control* ParentControl(); Control* RootControl(); protected: virtual void Down(); /* activate control */ virtual void Enter(); /* select a control if active */ virtual void Open(); /* open subviews, if any */ virtual void Grab(); /* read input events */ virtual void Skip(); /* ignore until enter active control */ virtual void Leave(); /* unselect if active */ virtual void Close(); /* close subviews, if any */ virtual void Up(); /* deactivate control, do selection */ virtual void Busy(); virtual void Done(); virtual bool IsGrabbing(Interactor*); void Reparent(Control*, Control* parent); private: ControlState* state_; bool enabled_; Control* parent_; void Init(const char*, Interactor*); }; inline bool Control::Enabled() { return enabled_; } inline Control* Control::ParentControl() { return parent_; } /* * ControlState is a subject that several controls share to exchange * common information. */ enum ControlStatus { ControlActive = 0x1 }; class ControlState : virtual public Subject { public: ControlState(unsigned status = 0); ~ControlState(); bool Active() { return Set(ControlActive); } void Activate() { Set(ControlActive, true); } virtual void Deactivate(); Control* Selection() { return selection; } void Selection(Control* c) { selection = c; } virtual void NotifySelection(Control*); Control* Action() { return action; } void Action(Control* c) { action = c; } void Push(ControlState*); void Pop(); ControlState* Next() { return next; } ControlState* Prev() { return prev; } protected: unsigned status; Control* selection; Control* action; ControlState* next; ControlState* prev; bool Set(ControlStatus s) { return (status & s) != 0; } void Set(ControlStatus s, bool b) { status = b ? (status | s) : (status & ~s); } }; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/deck.h000066400000000000000000000040561340731477100213430ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Deck - a Scene for stacking Interactors */ #ifndef iv2_6_deck_h #define iv2_6_deck_h #include #include class Card; class Deck : public Scene { public: Deck(); Deck(const char*); ~Deck(); void Flip(int = 1); void FlipTo(int); void Top () { FlipTo(1); } void Bottom () { FlipTo(-1); } virtual void Adjust(Perspective&); virtual void Draw(); virtual void GetComponents(Interactor**, int, Interactor**&, int&); virtual void Resize(); protected: Card* cards; Interactor* top; virtual void DoInsert(Interactor*, bool, Coord&, Coord&); virtual void DoRemove(Interactor*); virtual void DoChange(Interactor*); virtual void Reconfig(); private: void FixPerspective(); void Init(); void NewTop(); }; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/defs.h000066400000000000000000000027701340731477100213570ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv2_6_defs_h #define iv2_6_defs_h #include #include #include #include #include #include #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/dialog.h000066400000000000000000000035231340731477100216720ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Dialog - a simple dialog box input handler. */ #ifndef ivlook2_6_dialog_h #define ivlook2_6_dialog_h #include #include class ButtonState; class Dialog : public MonoScene { public: Dialog(ButtonState*, Interactor*, Alignment = Center); Dialog(const char*, ButtonState*, Interactor*, Alignment = Center); virtual ~Dialog(); virtual bool Accept(); virtual bool Popup(Event&, bool placed = true); int Status(); protected: ButtonState* state; Alignment align; private: void Init(ButtonState*, Interactor*, Alignment); }; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/filebrowser.h000066400000000000000000000051641340731477100227610ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * FileBrowser - a StringBrowser that displays file names. */ #ifndef ivlook2_6_filebrowser_h #define ivlook2_6_filebrowser_h #include #include class FBDirectory; class Regexp; class FileBrowser : public StringBrowser { public: FileBrowser( ButtonState*, const char* dir = "~", int rows = 10, int cols = 24, bool uniqueSel = true, int highlight = Reversed, const char* done = SBDone ); FileBrowser( const char* name, ButtonState*, const char* = "~", int = 10, int = 24, bool = true, int = Reversed, const char* = SBDone ); virtual ~FileBrowser(); bool IsADirectory(const char*); bool SetDirectory(const char*); const char* GetDirectory(); const char* ValidDirectories(const char*); const char* Normalize(const char*); const char* Path(int index); void RereadDirectory(); void SetTextFilter(const char*); void SetDirectoryTextFilter(const char*); void SetModeFilter(int); void SetDirectoryModeFilter(int); virtual void Update(); protected: void UpdateStrings(); virtual bool Acceptable(const char*); private: void Init(const char*); FBDirectory* dir; char* lastpath; Regexp* regexp; Regexp* directory_regexp; int mode; int directory_mode; }; inline const char* FileBrowser::GetDirectory () { return lastpath; } #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/filechooser.h000066400000000000000000000051521340731477100227350ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * FileChooser - a StringChooser for choosing files from a directory. */ #ifndef ivlook2_6_filechooser_h #define ivlook2_6_filechooser_h #include #include class Button; class FileBrowser; class MarginFrame; class FileChooser : public StringChooser { public: FileChooser( const char* title = "Please select a file:", const char* subtitle = "", const char* dir = "~", int rows = 10, int cols = 24, const char* acceptLabel = " Open ", Alignment = Center ); FileChooser( const char* name, const char* title, const char* subtitle, const char* dir, int, int, const char* acceptLabel, Alignment ); virtual ~FileChooser(); void SetTitle(const char*); void SetSubtitle(const char*); void SelectFile(); virtual bool Accept(); virtual void Update(); protected: FileChooser(ButtonState*, Alignment = Center); FileChooser(ButtonState*, const char* dir, int rows, int cols, Alignment); void Init(const char*, const char*); Interactor* Interior(const char* acptlbl); Interactor* AddScroller(Interactor*); FileBrowser* browser(); virtual void UpdateEditor(); virtual void UpdateBrowser(); protected: MarginFrame* title, *subtitle; }; inline FileBrowser* FileChooser::browser () { return (FileBrowser*) _browser; } #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/frame.h000066400000000000000000000110311340731477100215160ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * A frame surrounds another interactor. */ #ifndef ivlook2_6_frame_h #define ivlook2_6_frame_h #include #include class Frame : public MonoScene { public: Frame(Interactor* = nil, int width = 1); Frame(const char*, Interactor* = nil, int width = 1); virtual ~Frame(); protected: int left:8, bottom:8, right:8, top:8; Frame(Interactor*, int, int, int, int); Frame(const char*, Interactor*, int, int, int, int); virtual void Reconfig(); virtual void Resize(); virtual void Redraw(IntCoord, IntCoord, IntCoord, IntCoord); private: void Init(Interactor*, int, int, int, int); }; class ShowFrame : public Frame { public: ShowFrame(Interactor* i = nil, int width = 1) : Frame(i, width) { Init(); } ShowFrame( const char* name, Interactor* i = nil, int width = 1 ) : Frame(name, i, width) { Init(); } virtual ~ShowFrame(); virtual void Handle(Event&); virtual void HandleInput(Event&); virtual void InsideFrame(bool); protected: ShowFrame( Interactor* i, int l, int b, int r, int h ) : Frame(i, l, b, r, h) { Init(); } ShowFrame( const char* name, Interactor* i, int l, int b, int r, int h ) : Frame(name, i, l, b, r, h) { Init(); } private: void Init(); }; class Banner; class TitleFrame : public ShowFrame { public: TitleFrame(Banner*, Interactor*, int width = 1); TitleFrame(const char*, Banner*, Interactor*, int width = 1); virtual ~TitleFrame(); virtual void InsideFrame(bool); protected: Banner* banner; virtual Interactor* Wrap(Interactor*); private: void Init(Banner*, Interactor*); }; class BorderFrame : public ShowFrame { public: BorderFrame(Interactor* = nil, int width = 1); BorderFrame(const char*, Interactor* = nil, int width = 1); virtual ~BorderFrame(); virtual void InsideFrame(bool); protected: virtual void Redraw(IntCoord, IntCoord, IntCoord, IntCoord); private: bool normal; void Init(); }; class ShadowFrame : public Frame { public: ShadowFrame(Interactor* = nil, int h = 1, int v = 1); ShadowFrame(const char*, Interactor* = nil, int h = 1, int v = 1); virtual ~ShadowFrame(); protected: virtual void Redraw(IntCoord, IntCoord, IntCoord, IntCoord); private: void Init(Interactor*, int h, int v); }; class MarginFrame : public Frame { public: MarginFrame(Interactor* = nil, int margin = 0); MarginFrame(const char*, Interactor* = nil, int margin = 0); MarginFrame(Interactor*, int margin, int shrink, int stretch); MarginFrame(const char*, Interactor*, int margin, int shrink, int stretch); MarginFrame(Interactor*, int hmargin, int vmargin); MarginFrame(const char*, Interactor*, int hmargin, int vmargin); MarginFrame( Interactor*, int hmargin, int hshrink, int hstretch, int vmargin, int vshrink, int vstretch ); MarginFrame( const char*, Interactor*, int hmargin, int hshrink, int hstretch, int vmargin, int vshrink, int vstretch ); virtual ~MarginFrame(); protected: virtual void Reconfig(); virtual void Resize(); virtual void Redraw(IntCoord, IntCoord, IntCoord, IntCoord); protected: int hmargin, hshrink, hstretch; int vmargin, vshrink, vstretch; private: void Init(int, int, int, int, int, int); }; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/glue.h000077500000000000000000000044421340731477100213730ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Glue is useful for variable spacing between interactors. */ #ifndef iv2_6_glue_h #define iv2_6_glue_h #include #include #include class Glue : public Interactor { protected: Glue(); Glue(const char*); virtual ~Glue(); void Redraw(Coord, Coord, Coord, Coord); private: void Init(); }; class HGlue : public Glue { public: HGlue(int natural = 0, int stretch = hfil); HGlue(const char*, int natural = 0, int stretch = hfil); HGlue(int natural, int shrink, int stretch); HGlue(const char*, int natural, int shrink, int stretch); virtual ~HGlue(); private: void Init(int nat, int shrink, int stretch); }; class VGlue : public Glue { public: VGlue(int natural = 0, int stretch = vfil); VGlue(const char*, int natural = 0, int stretch = vfil); VGlue(int natural, int shrink, int stretch); VGlue(const char*, int natural, int shrink, int stretch); virtual ~VGlue(); private: void Init(int nat, int shrink, int stretch); }; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/ihandler.h000066400000000000000000000031451340731477100222210ustar00rootroot00000000000000/* * Copyright (c) 1992 Stanford University * Copyright (c) 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * InteractorHandler - special handler for interactors */ #ifndef iv2_6_ihandler_h #define iv2_6_ihandler_h #include #include class Interactor; class InteractorHandler : public Handler { public: InteractorHandler(Interactor*); virtual ~InteractorHandler(); virtual bool event(Event&); private: Interactor* interactor_; }; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/interactor.h000066400000000000000000000125371340731477100226120ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Base class for interactive objects. */ #ifndef iv2_6_interactor_h #define iv2_6_interactor_h #include #include #include #include #include #include #include #include #include class Bitmap; class Cursor; class Event; class InteractorHandler; class InteractorWindow; class ManagedWindow; class Painter; class Perspective; class Scene; class Sensor; class Shape; class Style; class Window; class World; enum CanvasType { CanvasShapeOnly, CanvasInputOnly, CanvasInputOutput, CanvasSaveUnder, CanvasSaveContents, CanvasSaveBoth }; class Interactor : public Glyph { protected: Interactor(); Interactor(const char*); public: virtual ~Interactor(); /* configuration */ void Align(Alignment, int w, int h, Coord& l, Coord& b) const; void Config(Scene* = nil); void Config(World*); virtual void Reconfig(); const char* GetAttribute(const char*) const; bool AttributeIsSet(const char*) const; virtual void Reshape(Shape&); Shape* GetShape() const; void SetCursor(Cursor*); Cursor* GetCursor() const; const char* GetClassName() const; const char* GetInstance() const; void GetRelative(Coord& x, Coord &y, Interactor* = nil) const; void GetRelative(Coord& x, Coord &y, World*) const; void GetPosition(Coord& left, Coord& bottom) const; /* traversing hierarchy */ virtual void GetComponents(Interactor**, int, Interactor**&, int&); Scene* Parent() const; World* GetWorld() const; /* output */ Canvas* GetCanvas() const; virtual void Draw(); virtual void Highlight(bool on); void Flush(); void Sync(); static bool ValidCanvas(Canvas*); /* input events */ bool Check(); int CheckQueue(); void Listen(Sensor*); void Poll(Event&); void Read(Event&); bool Read(long sec, long usec, Event&); void UnRead(Event&); void Run(); void QuitRunning(Event&); virtual void Handle(Event&); /* subject-view communication */ virtual void Adjust(Perspective&); Perspective* GetPerspective() const; virtual void Update(); /* canvas properties */ void SetCanvasType(CanvasType); CanvasType GetCanvasType() const; /* top-level interactors */ ManagedWindow* GetTopLevelWindow() const; /* glyph */ virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); virtual void undraw(); protected: Shape* shape; /* desired shape characteristics */ Canvas* canvas; /* actual display area */ Perspective* perspective; /* portion displayed */ Coord xmax; /* canvas->Width() - 1 */ Coord ymax; /* canvas->Height() - 1 */ Sensor* input; /* normal input event interest */ Painter* output; /* normal output parameters */ virtual void Redraw(Coord left, Coord bottom, Coord right, Coord top); virtual void RedrawList(int n, Coord[], Coord[], Coord[], Coord[]); virtual void Resize(); virtual void Activate(); virtual void Deactivate(); void SetClassName(const char*); void SetInstance(const char*); private: friend class InteractorHandler; friend class InteractorWindow; friend class Scene; friend class World; Scene* parent; Style* style; const char* classname; const char* instance; Sensor* cursensor; InteractorWindow* window; World* world; Window* insert_window; ManagedWindow* managed_window; Cursor* cursor_; CanvasType canvas_type_; InteractorHandler* handler_; void Init(); void DefaultConfig(bool&); void DoConfig(bool); virtual void Orphan(); }; inline Scene* Interactor::Parent() const { return parent; } inline Perspective* Interactor::GetPerspective() const { return perspective; } inline Shape* Interactor::GetShape() const { return shape; } #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/iwindow.h000066400000000000000000000035241340731477100221140ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * InteractorWindow - special subwindow for interactors */ #ifndef iv2_6_iwindow_h #define iv2_6_iwindow_h #include #include class Interactor; class InteractorWindow : public Window { public: InteractorWindow(Interactor*); InteractorWindow(Interactor*, Window*); virtual ~InteractorWindow(); virtual void bind(); virtual void unbind(); virtual bool receive(const Event&); virtual Handler* target(const Event&) const; protected: virtual void set_attributes(); private: Interactor* interactor_; Window* parent_; }; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/matcheditor.h000066400000000000000000000035651340731477100227440ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * MatchEditor - string editor with pattern matching */ #ifndef ivlook2_6_matcheditor_h #define ivlook2_6_matcheditor_h #include #include class MatchEditor : public StringEditor { public: MatchEditor(ButtonState*, const char* sample, const char* done = SEDone); MatchEditor( const char* name, ButtonState*, const char*, const char* = SEDone ); virtual ~MatchEditor(); virtual void Match(const char* pattern, bool keystoke = true); protected: virtual bool HandleChar(char); char pattern[100]; bool match_on_keystroke; private: void Init(); }; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/menu.h000077500000000000000000000072641340731477100214100ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Common menus built on top of controls */ #ifndef ivlook2_6_menu_h #define ivlook2_6_menu_h #include #include #include class MenuItem : public Control { public: MenuItem(Interactor*); MenuItem(const char* name, Interactor*); MenuItem(const char* str, Alignment = Left); MenuItem(const char* name, const char* str, Alignment = Left); virtual ~MenuItem(); protected: virtual void Busy(); virtual void Done(); private: void Init(); }; class Menu : public Control { public: Menu(Interactor*); Menu(const char* name, Interactor* i); virtual ~Menu(); void SetAlign(Alignment); Alignment GetAlign() { return align_; } void SetDepth(int); int GetDepth() { return depth_; } void SetBodyState(ControlState*); ControlState* GetBodyState() { return state_; } void SetScene(Scene*); Scene* GetScene() { return scene_; } virtual void Include(Control*); virtual void Popup(Event&); IntCoord InsertX() { return ins_x_; } IntCoord InsertY() { return ins_y_; } protected: virtual void Leave(); virtual void Open(); virtual void Close(); virtual void Reconfig(); virtual void Setup(); virtual void InsertBody(IntCoord, IntCoord); private: Interactor* body_; Scene* scene_; ControlState* state_; Interactor* shadow_; unsigned int depth_ : 16; unsigned int align_ : 16; class World* world_; IntCoord ins_x_, ins_y_; IntCoord rel_x_, rel_y_; private: void Init(); }; class MenuBar : public HBox { public: MenuBar(); MenuBar(const char* name); virtual ~MenuBar(); virtual void Include(Control*); protected: ControlState* state_; private: void Init(); }; class PulldownMenu : public Menu { public: PulldownMenu(Interactor* i); PulldownMenu(const char* name, Interactor* i); PulldownMenu(const char* str); PulldownMenu(const char* name, const char* str); virtual ~PulldownMenu(); private: void Init(); }; class PullrightMenu : public Menu { public: PullrightMenu(Interactor* i); PullrightMenu(const char* name, Interactor* i); PullrightMenu(const char* str); PullrightMenu(const char* name, const char* str); virtual ~PullrightMenu(); private: void Init(); }; class PopupMenu : public Menu { public: PopupMenu(); PopupMenu(const char*); virtual ~PopupMenu(); private: void Init(); }; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/message.h000066400000000000000000000040621340731477100220560ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Message - display a string of text */ #ifndef iv2_6_message_h #define iv2_6_message_h #include #include class Message : public Interactor { public: Message( const char* msg, Alignment al = Center, int pad = 0, int hstretch = 0, int vstretch = 0 ); Message( const char* name, const char* msg, Alignment al = Center, int pad = 0, int hstretch = 0, int vstretch = 0 ); virtual ~Message(); virtual void Highlight(bool); virtual void Realign(Alignment); protected: char* text; Alignment alignment : 16; unsigned pad : 15; bool highlighted : 1; virtual void Reconfig(); virtual void Redraw(IntCoord, IntCoord, IntCoord, IntCoord); private: void Init(const char*, Alignment, int pad, int hstretch, int vstretch); }; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/minmax.h000066400000000000000000000040071340731477100217220ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv2_6_minmax_h #define iv2_6_minmax_h #include #define declare_2(T) \ inline T min(T a, T b) { return a < b ? a : b; } \ inline T max(T a, T b) { return a > b ? a : b; } \ declare_2(int) declare_2(unsigned) declare_2(float) declare_2(double) /* * Compiler isn't smart enough to figure out how to do 4-way min inline. */ #define declare_4(T) \ inline T min(T a, T b, T c, T d) { \ T r1 = min(a, b), r2 = min(c, d); \ return min(r1, r2); \ } \ \ inline T max(T a, T b, T c, T d) { \ T r1 = max(a, b), r2 = max(c, d); \ return max(r1, r2); \ } declare_4(int) declare_4(float) declare_4(double) inline int iv26_round(double x) { return x > 0 ? int(x+0.5) : -int(-x+0.5); } inline bool iv26_equal(float x, float y, float e) { return x - y < e && y - x < e; } #endif neuron-7.6.3/src/include/IV-2_6/InterViews/paint.h000077500000000000000000000025721340731477100215540ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv2_6_paint_h #define iv2_6_paint_h #include #include #include #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/painter.h000066400000000000000000000124321340731477100220740ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Graphics interface */ #ifndef iv2_6_painter_h #define iv2_6_painter_h #include #include #include #include #include #include class Canvas; class Color; class PainterRep; class Pattern; class Brush; class Font; class Transformer; class Bitmap; class Raster; class Painter : public Resource { public: Painter(); Painter(Painter*); ~Painter(); void FillBg(bool); bool BgFilled() const; void SetColors(const Color* f, const Color* b); const Color* GetFgColor() const; const Color* GetBgColor() const; void SetPattern(const Pattern*); const Pattern* GetPattern() const; void SetBrush(const Brush*); const Brush* GetBrush() const; void SetFont(const Font*); const Font* GetFont() const; void SetStyle(int); int GetStyle() const; void SetTransformer(Transformer*); Transformer* GetTransformer() const; void MoveTo(int x, int y); void GetPosition(int& x, int& y) const; void SetOrigin(int x0, int y0); void GetOrigin(int& x0, int& y0) const; void Translate(float dx, float dy); void Scale(float x, float y); void Rotate(float angle); virtual void Clip( Canvas*, Coord left, Coord bottom, Coord right, Coord top ); virtual void NoClip(); virtual void SetOverwrite(bool); virtual void SetPlaneMask(int); virtual void Text(Canvas*, const char*); virtual void Text(Canvas*, const char*, int); virtual void Text(Canvas*, const char*, Coord, Coord); virtual void Text(Canvas*, const char*, int, Coord, Coord); virtual void Stencil( Canvas*, Coord x, Coord y, Bitmap* image, Bitmap* mask = nil ); virtual void RasterRect(Canvas*, Coord x, Coord y, Raster*); virtual void Point(Canvas*, Coord x, Coord y); virtual void MultiPoint(Canvas*, Coord x[], Coord y[], int n); virtual void Line(Canvas*, Coord x1, Coord y1, Coord x2, Coord y2); virtual void Rect(Canvas*, Coord x1, Coord y1, Coord x2, Coord y2); virtual void FillRect(Canvas*, Coord x1, Coord y1, Coord x2, Coord y2); virtual void ClearRect(Canvas*, Coord x1, Coord y1, Coord x2, Coord y2); virtual void Circle(Canvas*, Coord x, Coord y, int r); virtual void FillCircle(Canvas*, Coord x, Coord y, int r); virtual void Ellipse(Canvas*, Coord x, Coord y, int r1, int r2); virtual void FillEllipse(Canvas*, Coord x, Coord y, int r1, int r2); virtual void MultiLine(Canvas*, Coord x[], Coord y[], int n); virtual void Polygon(Canvas*, Coord x[], Coord y[], int n); virtual void FillPolygon(Canvas*, Coord x[], Coord y[], int n); virtual void BSpline(Canvas*, Coord x[], Coord y[], int n); virtual void ClosedBSpline(Canvas*, Coord x[], Coord y[], int n); virtual void FillBSpline(Canvas*, Coord x[], Coord y[], int n); virtual void Curve(Canvas*, Coord x0, Coord y0, Coord x1, Coord y1, Coord x2, Coord y2, Coord x3, Coord y3 ); virtual void CurveTo(Canvas*, Coord x0, Coord y0, Coord x1, Coord y1, Coord x2, Coord y2 ); virtual void Copy( Canvas* src, Coord x1, Coord y1, Coord x2, Coord y2, Canvas* dst, Coord x0, Coord y0 ); PainterRep* Rep() const; private: friend class Rubberband; const Font* font; const Color* foreground; const Color* background; const Brush* br; const Pattern* pattern; int style; Coord curx, cury; int xoff, yoff; Transformer* matrix; PainterRep* rep; void Init(); void Copy(Painter*); void Begin_xor(); void End_xor(); void Map(Canvas*, Coord x, Coord y, Coord& mx, Coord& my); void Map(Canvas*, Coord x, Coord y, short& sx, short& sy); void MapList(Canvas*, Coord x[], Coord y[], int n, Coord mx[], Coord my[]); void MapList(Canvas*, float x[], float y[], int n, Coord mx[], Coord my[]); void MultiLineNoMap(Canvas* c, Coord x[], Coord y[], int n); void FillPolygonNoMap(Canvas* c, Coord x[], Coord y[], int n); }; inline PainterRep* Painter::Rep() const { return rep; } #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/panner.h000066400000000000000000000057471340731477100217300ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Panner - an interactor for two-dimensional scrolling and zooming. */ #ifndef ivlook2_6_panner_h #define ivlook2_6_panner_h #include #include class Panner : public MonoScene { public: Panner(Interactor*, int size = 0); Panner(const char*, Interactor*, int size = 0); virtual ~Panner(); protected: int size; virtual void Reconfig(); private: Interactor* adjusters; Interactor* slider; void Init(Interactor*, int); }; class Slider : public Interactor { public: Slider(Interactor*); Slider(const char*, Interactor*); virtual ~Slider(); virtual void Draw(); virtual void Handle(Event&); virtual void Update(); virtual void Reshape(Shape&); virtual void Resize(); protected: virtual void Reconfig(); virtual void Redraw(IntCoord, IntCoord, IntCoord, IntCoord); private: Interactor* interactor; Perspective* view; Perspective* shown; IntCoord left, bottom, right, top; IntCoord prevl, prevb, prevr, prevt; // for smart update IntCoord llim, blim, rlim, tlim; // sliding limits bool constrained, syncScroll; int moveType; IntCoord origx, origy; void Init(Interactor*); IntCoord ViewX(IntCoord); IntCoord ViewY(IntCoord); IntCoord SliderX(IntCoord); IntCoord SliderY(IntCoord); void CalcLimits(Event&); // calculate sliding limits void SizeKnob(); // calculate size of slider knob bool Inside(Event&); // true if inside slider knob void Constrain(Event&); // constrain slider knob motion void Move(IntCoord dx, IntCoord dy);// move view to reflect slider position void Slide(Event&); // rubberband rect while mousing void Jump(Event&); // for click outside knob }; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/perspective.h000066400000000000000000000043641340731477100227700ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * A perspective describes what portion of the total view * an interactor shows. */ #ifndef iv2_6_perspective_h #define iv2_6_perspective_h #include #include #include #include class Interactor; class ViewList; class Perspective : public Resource { public: IntCoord x0, y0; /* origin of view */ int width, height; /* total size of view */ IntCoord curx, cury; /* current position */ int curwidth, curheight; /* current size */ int sx, sy, lx, ly; /* small and large scrolling increments */ Perspective(); Perspective(Perspective&); ~Perspective(); void Init(IntCoord ix0, IntCoord iy0, int iwidth, int iheight); void Attach(Interactor*); void Detach(Interactor*); void Update(); bool operator ==(Perspective&); bool operator !=(Perspective&); Perspective& operator =(Perspective&); protected: ViewList* views; /* interactors that access the perspective */ }; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/rubband.h000066400000000000000000000044171340731477100220530ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Rubber - rubberbanding graphical objects */ #ifndef iv2_6_rubband_h #define iv2_6_rubband_h #include #include #include enum Side { LeftSide, RightSide, BottomSide, TopSide }; class Canvas; class Painter; class Rubberband : public Resource { public: Rubberband(Painter*, Canvas*, IntCoord offx, IntCoord offy); virtual ~Rubberband(); virtual void Draw(); virtual void Redraw(); virtual void Erase(); virtual void Track(IntCoord x, IntCoord y); virtual void SetPainter(Painter*); virtual void SetCanvas(Canvas*); Painter* GetPainter(); Canvas* GetCanvas(); protected: float Angle(IntCoord, IntCoord, IntCoord, IntCoord); float Distance(IntCoord, IntCoord, IntCoord, IntCoord); protected: Painter* output; Canvas* canvas; bool drawn; IntCoord trackx, offx; IntCoord tracky, offy; }; inline Painter* Rubberband::GetPainter () { return output; } inline Canvas* Rubberband::GetCanvas () { return canvas; } #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/rubcurve.h000077500000000000000000000143011340731477100222670ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Rubberbanding for curves. */ #ifndef iv2_6_rubcurve_h #define iv2_6_rubcurve_h #include class RubberEllipse : public Rubberband { public: RubberEllipse( Painter*, Canvas*, IntCoord cx, IntCoord cy, IntCoord rx, IntCoord ry, IntCoord offx = 0, IntCoord offy = 0 ); virtual void GetOriginal( IntCoord& cx, IntCoord& cy, IntCoord& rx, IntCoord& ry ); virtual void GetCurrent( IntCoord& cx, IntCoord& cy, IntCoord& rx, IntCoord& ry ); virtual void OriginalRadii(int& xr, int& yr); virtual void CurrentRadii(int& xr, int& yr); virtual void Draw(); protected: IntCoord centerx, radiusx; IntCoord centery, radiusy; }; class SlidingEllipse : public RubberEllipse { public: SlidingEllipse( Painter*, Canvas*, IntCoord cx, IntCoord cy, IntCoord xr, IntCoord yr, IntCoord rfx, IntCoord rfy, IntCoord offx = 0, IntCoord offy = 0 ); virtual void GetCurrent( IntCoord& cx, IntCoord& cy, IntCoord& xr, IntCoord& yr ); virtual void OriginalRadii(int&, int&); virtual void CurrentRadii(int&, int&); protected: IntCoord refx; IntCoord refy; }; class RubberCircle : public RubberEllipse { public: RubberCircle( Painter*, Canvas*, IntCoord cx, IntCoord cy, IntCoord rx, IntCoord ry, IntCoord offx = 0, IntCoord offy = 0 ); virtual void OriginalRadii(int& xr, int& yr); virtual void CurrentRadii(int& xr, int& yr); virtual void Draw(); }; class RubberPointList : public Rubberband { public: RubberPointList( Painter*, Canvas*, IntCoord px[], IntCoord py[], int n, IntCoord offx = 0, IntCoord offy = 0 ); ~RubberPointList(); protected: void Copy(IntCoord*, IntCoord*, int, IntCoord*&, IntCoord*&); protected: IntCoord *x; IntCoord *y; int count; }; class RubberVertex : public RubberPointList { public: RubberVertex( Painter*, Canvas*, IntCoord px[], IntCoord py[], int n, int pt, IntCoord offx = 0, IntCoord offy = 0 ); virtual void GetOriginal(IntCoord*& px, IntCoord*& py, int& n, int& pt); virtual void GetCurrent(IntCoord*& px, IntCoord*& py, int& n, int& pt); protected: void DrawSplineSection (Painter*, Canvas*, IntCoord x[], IntCoord y[]); protected: int rubberPt; }; class RubberHandles : public RubberVertex { public: RubberHandles( Painter*, Canvas*, IntCoord x[], IntCoord y[], int n, int pt, int size, IntCoord offx = 0, IntCoord offy = 0 ); virtual void Track(IntCoord x, IntCoord y); virtual void Draw(); protected: int d; /* half of handle size */ }; class RubberSpline : public RubberVertex { public: RubberSpline( Painter*, Canvas*, IntCoord px[], IntCoord py[], int n, int pt, IntCoord offx = 0, IntCoord offy = 0 ); virtual void Draw(); }; class RubberClosedSpline : public RubberVertex { public: RubberClosedSpline( Painter*, Canvas*, IntCoord px[], IntCoord py[], int n, int pt, IntCoord offx = 0, IntCoord offy = 0 ); virtual void Draw(); }; class SlidingPointList : public RubberPointList { public: SlidingPointList ( Painter*, Canvas*, IntCoord px[], IntCoord py[], int n, IntCoord rfx, IntCoord rfy, IntCoord offx = 0, IntCoord offy = 0 ); virtual void GetOriginal(IntCoord*& px, IntCoord*& py, int& n); virtual void GetCurrent(IntCoord*& px, IntCoord*& py, int& n); virtual void Draw(); virtual void Track(IntCoord x, IntCoord y); protected: IntCoord refx; IntCoord refy; }; class SlidingLineList : public SlidingPointList { public: SlidingLineList( Painter*, Canvas*, IntCoord x[], IntCoord y[], int n, IntCoord rfx, IntCoord rfy, IntCoord offx = 0, IntCoord offy = 0 ); virtual void Draw(); }; class ScalingLineList : public RubberPointList { public: ScalingLineList ( Painter*, Canvas*, IntCoord px[], IntCoord py[], int n, IntCoord cx, IntCoord cy, IntCoord offx = 0, IntCoord offy = 0 ); virtual ~ScalingLineList(); virtual void GetOriginal(IntCoord*& px, IntCoord*& py, int& n); virtual void GetCurrent(IntCoord*& px, IntCoord*& py, int& n); virtual void Track(IntCoord, IntCoord); virtual void Draw(); float CurrentScaling(); protected: virtual void Update(); protected: IntCoord* newx, *newy; IntCoord centerx, centery; IntCoord width, height; }; class RotatingLineList : public RubberPointList { public: RotatingLineList ( Painter*, Canvas*, IntCoord px[], IntCoord py[], int n, IntCoord cx, IntCoord cy, IntCoord rfx, IntCoord rfy, IntCoord offx = 0, IntCoord offy = 0 ); virtual ~RotatingLineList(); virtual void GetOriginal(IntCoord*& px, IntCoord*& py, int& n); virtual void GetCurrent(IntCoord*& px, IntCoord*& py, int& n); virtual void Track(IntCoord, IntCoord); virtual void Draw(); float OriginalAngle(); float CurrentAngle(); protected: virtual void Update(); protected: IntCoord* newx, *newy; IntCoord centerx, centery; IntCoord refx, refy; }; #endif neuron-7.6.3/src/include/IV-2_6/InterViews/rubgroup.h000066400000000000000000000040521340731477100222760ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * RubberGroup - a group of Rubberbands to track simultaneously. */ #ifndef iv2_6_rubgroup_h #define iv2_6_rubgroup_h #include class RubberList; class RubberGroup : public Rubberband { public: RubberGroup(Painter*, Canvas*); virtual ~RubberGroup(); virtual void Draw(); virtual void Erase(); virtual void Track(IntCoord, IntCoord); virtual void SetPainter(Painter*); virtual void SetCanvas(Canvas*); void Append( Rubberband*, Rubberband* = nil, Rubberband* = nil, Rubberband* = nil ); void Remove(Rubberband*); void RemoveCur(); void SetCurrent(Rubberband*); Rubberband* GetCurrent(); Rubberband* First(); Rubberband* Last(); Rubberband* Next(); Rubberband* Prev(); bool IsEmpty(); bool AtEnd(); private: RubberList* rlist, *cur; }; #endif neuron-7.6.3/src/include/IV-2_6/InterViews/rubline.h000077500000000000000000000066051340731477100221020ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Rubberbanding for simple lines. */ #ifndef iv2_6_rubline_h #define iv2_6_rubline_h #include class RubberLine : public Rubberband { public: RubberLine( Painter*, Canvas*, IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1, IntCoord offx = 0, IntCoord offy = 0 ); virtual void GetOriginal( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ); virtual void GetCurrent( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ); virtual void Draw(); protected: IntCoord fixedx, fixedy; IntCoord movingx, movingy; }; class RubberAxis : public RubberLine { public: RubberAxis( Painter*, Canvas*, IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1, IntCoord offx = 0, IntCoord offy = 0 ); virtual void GetCurrent( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ); }; class SlidingLine : public RubberLine { public: SlidingLine( Painter*, Canvas*, IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1, IntCoord rfx, IntCoord rfy, IntCoord offx = 0, IntCoord offy = 0 ); virtual void GetCurrent( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ); protected: IntCoord refx; IntCoord refy; }; class ScalingLine : public RubberLine { public: ScalingLine( Painter*, Canvas*, IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1, IntCoord cx, IntCoord cy, IntCoord offx = 0, IntCoord offy = 0 ); virtual void GetCurrent( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ); float CurrentScaling(); protected: IntCoord centerx, centery; int width, height; }; class RotatingLine : public RubberLine { public: RotatingLine( Painter*, Canvas*, IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1, IntCoord cx, IntCoord cy, IntCoord rfx, IntCoord rfy, IntCoord offx = 0, IntCoord offy = 0 ); virtual void GetCurrent( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ); float OriginalAngle(); float CurrentAngle(); protected: void Transform ( IntCoord& x, IntCoord& y, double a0, double a1, double b0, double b1, double c0, double c1 ); protected: IntCoord centerx, centery, refx, refy; }; #endif neuron-7.6.3/src/include/IV-2_6/InterViews/rubrect.h000077500000000000000000000077661340731477100221210ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Rubberbanding for rectangles. */ #ifndef iv2_6_rubrect_h #define iv2_6_rubrect_h #include class RubberRect : public Rubberband { public: RubberRect( Painter*, Canvas*, IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1, IntCoord offx = 0, IntCoord offy = 0 ); virtual void GetOriginal( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ); virtual void GetCurrent( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ); virtual void Draw(); protected: IntCoord fixedx, fixedy; IntCoord movingx, movingy; }; class RubberSquare : public RubberRect { public: RubberSquare( Painter*, Canvas*, IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1, IntCoord offx = 0, IntCoord offy = 0 ); virtual void GetCurrent( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ); }; class SlidingRect : public RubberRect { public: SlidingRect( Painter*, Canvas*, IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1, IntCoord rfx, IntCoord rfy, IntCoord offx = 0, IntCoord offy = 0 ); virtual void GetCurrent( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ); protected: IntCoord refx; IntCoord refy; }; class StretchingRect : public RubberRect { public: StretchingRect ( Painter*, Canvas*, IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1, Side s, IntCoord offx = 0, IntCoord offy = 0 ); virtual void GetCurrent( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ); float CurrentStretching(); protected: Side side; }; class ScalingRect : public RubberRect { public: ScalingRect( Painter*, Canvas*, IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1, IntCoord cx, IntCoord cy, IntCoord offx = 0, IntCoord offy = 0 ); virtual void GetCurrent( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ); float CurrentScaling(); protected: IntCoord centerx, centery; int width, height; }; class RotatingRect : public Rubberband { public: RotatingRect( Painter*, Canvas*, IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1, IntCoord cx, IntCoord cy, IntCoord rfx, IntCoord rfy, IntCoord offx = 0, IntCoord offy = 0 ); virtual void Draw(); virtual void GetOriginal( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ); virtual void GetCurrent( IntCoord& leftbotx, IntCoord& leftboty, IntCoord& rightbotx, IntCoord& rightboty, IntCoord& righttopx, IntCoord& righttopy, IntCoord& lefttopx, IntCoord& lefttopy ); float CurrentAngle(); protected: void Transform ( IntCoord& x, IntCoord& y, double a0, double a1, double b0, double b1, double c0, double c1 ); protected: IntCoord left, right, centerx, refx; IntCoord bottom, top, centery, refy; }; #endif neuron-7.6.3/src/include/IV-2_6/InterViews/rubverts.h000077500000000000000000000067311340731477100223160ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * GrowingVertices and subclasses - rubberbands defined by a set of vertices * that can grow dynamically in number. */ #ifndef iv2_6_rubverts_h #define iv2_6_rubverts_h #include class GrowingVertices : public Rubberband { public: virtual ~GrowingVertices(); virtual void AddVertex(IntCoord, IntCoord); virtual void RemoveVertex(); virtual void Draw(); virtual void GetOriginal(IntCoord*& px, IntCoord*& py, int& n, int& pt); virtual void GetCurrent(IntCoord*& px, IntCoord*& py, int& n, int& pt); protected: GrowingVertices( Painter*, Canvas*, IntCoord px[], IntCoord py[], int n, int pt = -1, int handleSize = -1 ); void Init(IntCoord px[], IntCoord py[], int, int, int); void CheckBufs(); void Copy(IntCoord*, IntCoord*, int, IntCoord*&, IntCoord*&); virtual void DrawVertices(IntCoord*, IntCoord*, int); virtual void DrawHandles(); protected: IntCoord* x, *y; int count, bufsize, origbufsize; int curPt, origPt; int handleSize; public: // obsolete calls virtual void AppendVertex(IntCoord, IntCoord); virtual void GetOriginal(IntCoord*& px, IntCoord*& py, int& n); virtual void GetCurrent(IntCoord*& px, IntCoord*& py, int& n); }; class GrowingMultiLine : public GrowingVertices { public: GrowingMultiLine( Painter*, Canvas*, IntCoord px[], IntCoord py[], int n, int pt = -1, int handleSize = -1 ); protected: virtual void DrawVertices(IntCoord*, IntCoord*, int); }; class GrowingPolygon : public GrowingVertices { public: GrowingPolygon( Painter*, Canvas*, IntCoord px[], IntCoord py[], int n, int pt = -1, int handleSize = -1 ); protected: virtual void DrawVertices(IntCoord*, IntCoord*, int); }; class GrowingBSpline : public GrowingVertices { public: GrowingBSpline( Painter*, Canvas*, IntCoord px[], IntCoord py[], int n, int pt = -1, int handleSize = -1 ); protected: virtual void DrawVertices(IntCoord*, IntCoord*, int); }; class GrowingClosedBSpline : public GrowingVertices { public: GrowingClosedBSpline( Painter*, Canvas*, IntCoord px[], IntCoord py[], int n, int pt = -1, int handleSize = -1 ); protected: virtual void DrawVertices(IntCoord*, IntCoord*, int); }; #endif neuron-7.6.3/src/include/IV-2_6/InterViews/scene.h000066400000000000000000000061771340731477100215400ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Basic composite object for interaction. */ #ifndef iv2_6_scene_h #define iv2_6_scene_h #include #include class Scene : public Interactor { protected: Scene(); public: virtual ~Scene(); void Insert(Interactor*); void Insert(Interactor*, Coord x, Coord y, Alignment = BottomLeft); void Change(Interactor* = nil); void Remove(Interactor*); void Move(Interactor*, Coord x, Coord y, Alignment = BottomLeft); void Raise(Interactor*); void Lower(Interactor*); void Propagate(bool); virtual void Highlight(bool); protected: bool propagate; void PrepareToInsert(Interactor*); virtual Interactor* Wrap(Interactor*); virtual void DoInsert(Interactor*, bool, Coord& x, Coord& y); virtual void DoChange(Interactor*); virtual void DoMove(Interactor*, Coord& x, Coord& y); virtual void DoRemove(Interactor*); virtual void DoRaise(Interactor*); virtual void DoLower(Interactor*); void Place(Interactor*, Coord, Coord, Coord, Coord, bool map = true); void Map(Interactor*, bool raised = true); void Unmap(Interactor*); private: void DoAlign(Interactor*, Alignment, Coord& x, Coord& y); virtual void Orphan(); }; /* Scene with a single component */ class MonoScene : public Scene { protected: MonoScene(); public: virtual ~MonoScene(); virtual void Draw(); virtual void GetComponents(Interactor**, int, Interactor**&, int&); virtual void Resize(); protected: Interactor* interior(); void interior(Interactor*); virtual void DoInsert(Interactor*, bool, Coord&, Coord&); virtual void DoChange(Interactor*); virtual void DoRemove(Interactor*); virtual void Reconfig(); private: Interactor* interior_; }; inline Interactor* MonoScene::interior() { return interior_; } inline void MonoScene::interior(Interactor* i) { interior_ = i; } #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/scrollbar.h000077500000000000000000000041251340731477100224200ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * ScrollBar - simple scrolling interface. */ #ifndef ivlook2_6_scrollbar_h #define ivlook2_6_scrollbar_h #include #include class ScrollBar : public MonoScene { protected: Interactor* interactor; int size; ScrollBar(Interactor*, int); ScrollBar(const char*, Interactor*, int); virtual ~ScrollBar(); void Use(Interactor*); }; class HScrollBar : public ScrollBar { public: HScrollBar(Interactor*, int size = 0); HScrollBar(const char*, Interactor*, int size = 0); virtual ~HScrollBar(); virtual void Reconfig(); private: void Init(); }; class VScrollBar : public ScrollBar { public: VScrollBar(Interactor*, int size = 0); VScrollBar(const char*, Interactor*, int size = 0); virtual ~VScrollBar(); virtual void Reconfig(); private: void Init(); }; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/scroller.h000066400000000000000000000056621340731477100222660ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * General scrolling interface. */ #ifndef ivlook2_6_scroller_h #define ivlook2_6_scroller_h #include #include class Scroller : public Interactor { protected: Interactor* interactor; int size; Perspective* view; Perspective* shown; double scale; Sensor* tracking; bool syncScroll; Scroller(Interactor*, int); Scroller(const char*, Interactor*, int); virtual ~Scroller(); void Background(IntCoord, IntCoord, IntCoord, IntCoord); void MakeBackground(); virtual void Resize(); private: void Init(); }; class HScroller : public Scroller { public: HScroller(Interactor*, int size = 0); HScroller(const char*, Interactor*, int size = 0); virtual ~HScroller(); virtual void Handle(Event&); virtual void Update(); private: void Bar(IntCoord, int); void Border(IntCoord); void GetBarInfo(Perspective*, IntCoord&, int&); void Init(); void Outline(IntCoord, int); virtual void Reconfig(); virtual void Redraw(IntCoord, IntCoord, IntCoord, IntCoord); void Sides(IntCoord, IntCoord); IntCoord Slide(Event&); }; class VScroller : public Scroller { public: VScroller(Interactor*, int size = 0); VScroller(const char*, Interactor*, int size = 0); virtual ~VScroller(); virtual void Handle(Event&); virtual void Update(); private: void Bar(IntCoord, int); void Border(IntCoord); void GetBarInfo(Perspective*, IntCoord&, int&); void Init(); void Outline(IntCoord, int); virtual void Reconfig(); virtual void Redraw(IntCoord, IntCoord, IntCoord, IntCoord); void Sides(IntCoord, IntCoord); IntCoord Slide(Event&); }; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/sensor.h000066400000000000000000000054371340731477100217520ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Sensors describe input events of interest. */ #ifndef iv2_6_sensor_h #define iv2_6_sensor_h #include #include #include class Interactor; class InteractorWindow; class Sensor : virtual public Resource { public: Sensor(); Sensor(const Sensor&); Sensor(const Sensor*); virtual ~Sensor(); virtual Sensor& operator =(const Sensor&); void Catch(EventType); void CatchButton(EventType, int); void Ignore(EventType); void IgnoreButton(EventType, int); bool Caught(const Event&) const; static void init(); protected: unsigned long mask; unsigned long down[8]; unsigned long up[8]; int ButtonIndex(unsigned long b) const { return (b >> 5) & 07; } int ButtonFlag(unsigned long b) const{ return 1 << (b & 0x1f); } void SetButton(unsigned long a[], unsigned long b) { a[ButtonIndex(b)] |= ButtonFlag(b); } void ClearButton(unsigned long a[], unsigned long b) { a[ButtonIndex(b)] &= ~ButtonFlag(b); } bool ButtonIsSet(const unsigned long a[], unsigned long b) const { return (a[ButtonIndex(b)] & ButtonFlag(b)) != 0; } void SetMouseButtons(unsigned long a[]) { a[0] |= 0x7; } void ClearMouseButtons(unsigned long a[]) { a[0] &= ~0x7; } bool MouseButtons(const unsigned long a[]) const { return (a[0] & 0x7) != 0; } private: friend class Interactor; friend class InteractorWindow; }; extern Sensor* allEvents; extern Sensor* onoffEvents; extern Sensor* updownEvents; extern Sensor* noEvents; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/shape.h000066400000000000000000000037101340731477100215310ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv2_6_shape_h #define iv2_6_shape_h #include /* * Constants for defining "infinite" stretchability or shrinkability. */ static const int hfil = 1000000; static const int vfil = 1000000; class Shape { public: int width, height; /* natural dimensions */ int hstretch, vstretch; /* stretchability */ int hshrink, vshrink; /* shrinkability */ int aspect; /* desired aspect ratio, 0 means don't care */ int hunits, vunits; /* allocate in multiples */ Shape(); ~Shape(); void Square(int); void Rect(int w, int h); void Rigid(int hshr = 0, int hstr = 0, int vshr = 0, int vstr = 0); void SetUndefined(); bool Defined(); bool Undefined () { return !Defined(); } }; #endif neuron-7.6.3/src/include/IV-2_6/InterViews/strbrowser.h000066400000000000000000000112121340731477100226410ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * StringBrowser - a Mac minifinder-like object for perusing and choosing * from list of strings. */ #ifndef ivlook2_6_strbrowser_h #define ivlook2_6_strbrowser_h #include #include #include static const char* SBDone = "\r\t\007\033"; static const char SBFirstString = 'g'; static const char SBLastString = 'G'; static const char SBSelectAll = 'a'; static const char SBUnselectAll = '\177'; static const char SBUnselectAllAlt = '\010'; static const char SBSelectPreviousString = 'p'; static const char SBSelectNextString = 'n'; static const char SBSelectTopString = '<'; static const char SBSelectBottomString = '>'; static const char SBScrollDown = 'j'; static const char SBScrollUp = 'k'; static const char SBPageDown = ' '; static const char SBPageUp = 'b'; static const char SBHalfPageDown = 'd'; static const char SBHalfPageUp = 'u'; class ButtonState; class TextDisplay; class StringBrowser : public Interactor { public: StringBrowser( ButtonState*, int rows, int cols, bool uniqueSel = true, int highlight = Reversed, const char* done = SBDone ); StringBrowser( const char* name, ButtonState*, int, int, bool = true, int = Reversed, const char* = SBDone ); virtual ~StringBrowser(); void Browse(); void Insert(const char*, int index); void Replace(const char*, int index); void Append(const char*); void Remove(int index); int Index(const char*); char* String(int); int Count(); void Clear(); void Select(int index); void SelectAll(); void Unselect(int index); void UnselectAll(); int Selection(int selindex = 0); int SelectionIndex(int index); int Selections(); bool Selected(int index); virtual void Handle(Event&); virtual void Adjust(Perspective&); protected: void Select(int dot, int mark); void Unselect(int dot, int mark); void ScrollBy(int, int); void ScrollBy(int lines); void ScrollTo(int, int); void ScrollTo(int index); void ScrollToView(IntCoord, IntCoord); void GrabScroll(Event&); void RateScroll(Event&); int Locate(IntCoord, IntCoord); bool DoubleClicked(Event&); virtual bool HandleChar(char); virtual bool LeftButtonDown(Event&); virtual void Reconfig(); virtual void Redraw(IntCoord, IntCoord, IntCoord, IntCoord); virtual void Resize(); protected: int rows; int columns; bool uniqueSel; bool singleClick; int clickDelay; int highlight; ButtonState* subject; const char* done; private: void Init(ButtonState*, int, int, bool, int, const char*); void InitTextDisplay(); void InitPerspective(bool scroll_to_top); void UpdateSelection(int dot, int mark, int style); void UpdateWidth(); void Note(Event&); bool HandleDownEvent(Event&); bool HandleKeyEvent(Event&); private: char** strbuf; int strbufsize; int strcount; char** selbuf; int selbufsize; int selcount; TextDisplay* display; int lineheight; unsigned long lasttime; IntCoord lastx, lasty; int lastdot, lastmark; }; inline void StringBrowser::Append (const char* s) { Insert(s, strcount); } inline int StringBrowser::Count () { return strcount; } inline int StringBrowser::Selections () { return selcount; } inline bool StringBrowser::Selected (int i) {return SelectionIndex(i) >= 0;} #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/strchooser.h000066400000000000000000000046561340731477100226360ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * StringChooser - a dialog box that provides a keyboard and mouse interface * to selecting from a list of strings. */ #ifndef ivlook2_6_strchooser_h #define ivlook2_6_strchooser_h #include #include class StringBrowser; class StringEditor; class StringChooser : public Dialog { public: StringChooser( ButtonState*, int rows, int cols, const char* sample, Alignment =Center ); StringChooser( const char* name, ButtonState*, int, int, const char*, Alignment = Center ); virtual ~StringChooser(); void Select(int = -1); void Select(int left, int right); void SelectMessage(); void Message(const char*); virtual const char* Choice(); virtual bool Accept(); virtual void Handle(Event&); protected: StringChooser(ButtonState*, Alignment = Center); void Init(StringEditor*, StringBrowser*); void Forward(Event&); virtual void SwitchFocus(); virtual bool CanFocus(Interactor*); virtual void HandleFocus(); virtual void UpdateEditor(); virtual void UpdateBrowser(); protected: StringEditor* _sedit; StringBrowser* _browser; Interactor* _focus; }; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/streditor.h000066400000000000000000000056011340731477100224510ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * StringEditor - interactive editor for character strings */ #ifndef ivlook2_6_streditor_h #define ivlook2_6_streditor_h #include #include static const char* SEDone = "\r\t\007\033"; static const char SEBeginningOfLine = '\001'; static const char SEEndOfLine = '\005'; static const char SESelectAll = '\025'; static const char SESelectWord = '\027'; static const char SEPreviousCharacter = '\002'; static const char SENextCharacter = '\006'; static const char SEDeleteNextCharacter = '\004'; static const char SEDeletePreviousCharacter = '\177'; static const char SEDeletePreviousCharacterAlt = '\010'; class ButtonState; class TextDisplay; class TextBuffer; class StringEditor : public Interactor { public: StringEditor(ButtonState*, const char* sample, const char* done = SEDone); StringEditor( const char* name, ButtonState*, const char*, const char* = SEDone ); virtual ~StringEditor(); void Message(const char* text); void Select(int); void Select(int left, int right); void Edit(); void Edit(const char* text, int left, int right); const char* Text(); virtual void Handle(Event&); virtual void Reconfig(); protected: virtual bool HandleChar(char); void InsertText(const char*, int); void DoSelect(int left, int right); virtual void Redraw(IntCoord, IntCoord, IntCoord, IntCoord); virtual void Resize(); TextBuffer* text; int left, right; ButtonState* subject; char* done; char* sample; char* buffer; int size; TextDisplay* display; private: void Init(ButtonState*, const char*, const char*); }; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/subject.h000066400000000000000000000033561340731477100220760ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * A subject is an object that has one or more views * that it wishes to notify when it changes. */ #ifndef iv2_6_subject_h #define iv2_6_subject_h #include #include class Interactor; class SubjectRep; class Subject : virtual public Resource { public: virtual ~Subject(); virtual void Attach(Interactor*); virtual void Detach(Interactor*); virtual void Notify(); virtual bool IsView(Interactor*); protected: Subject(); private: SubjectRep* rep_; }; #endif neuron-7.6.3/src/include/IV-2_6/InterViews/textbuffer.h000066400000000000000000000076251340731477100226200ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TextBuffer - editable text buffer */ #ifndef iv2_6_textbuffer_h #define iv2_6_textbuffer_h #include class Regexp; class TextBuffer { public: TextBuffer(char* buffer, int length, int size); virtual ~TextBuffer(); int Search(Regexp* regexp, int index, int range, int stop); int ForwardSearch(Regexp* regexp, int index); int BackwardSearch(Regexp* regexp, int index); int Match(Regexp* regexp, int index, int stop); bool ForwardMatch(Regexp* regexp, int index); bool BackwardMatch(Regexp* regexp, int index); virtual int Insert(int index, const char* string, int count); virtual int Delete(int index, int count); int Copy(int index, char* buffer, int count); int Height(); int Width(); int Length(); const char* Text(); const char* Text(int index); const char* Text(int index1, int index2); char Char (int index); int LineIndex(int line); int LinesBetween(int index1, int index2); int LineNumber(int index); int LineOffset (int index); int PreviousCharacter(int index); int NextCharacter(int index); bool IsBeginningOfText(int index); int BeginningOfText(); bool IsEndOfText(int index); int EndOfText(); bool IsBeginningOfLine(int index); int BeginningOfLine(int index); int BeginningOfNextLine(int index); bool IsEndOfLine(int index); int EndOfLine(int index); int EndOfPreviousLine(int index); bool IsBeginningOfWord(int index); int BeginningOfWord(int index); int BeginningOfNextWord(int index); bool IsEndOfWord(int index); int EndOfWord(int index); int EndOfPreviousWord(int index); protected: char* text; int length; int size; private: int linecount; int lastline; int lastindex; }; inline char TextBuffer::Char (int i) { return (i<0) ? text[0] : (i>length) ? text[length] : text[i]; } inline const char* TextBuffer::Text () { return text; } inline const char* TextBuffer::Text (int i) { return text + ((i<0) ? 0 : (i>length) ? length : i); } inline const char* TextBuffer::Text (int i, int) { return text + ((i<0) ? 0 : (i>length) ? length : i); } inline int TextBuffer::PreviousCharacter (int i) { return (i<=0) ? 0 : i-1; } inline int TextBuffer::NextCharacter (int i) { return (i>=length) ? length : i+1; } inline bool TextBuffer::IsBeginningOfText (int i) { return i <= 0; } inline int TextBuffer::BeginningOfText () { return 0; } inline bool TextBuffer::IsEndOfText (int i) { return i >= length; } inline int TextBuffer::EndOfText () { return length; } inline int TextBuffer::Height () { return linecount; } inline int TextBuffer::Length () { return length; } #endif neuron-7.6.3/src/include/IV-2_6/InterViews/textdisplay.h000066400000000000000000000071171340731477100230100ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TextDisplay - basic text displaying */ #ifndef iv2_6_textdisplay_h #define iv2_6_textdisplay_h #include #include #include #include #include enum CaretStyleOptions { NoCaret, DefaultCaret, BarCaret, UnderscoreCaret, OutlineCaret }; class Painter; class Canvas; class TextLine; class TextDisplay { public: TextDisplay(bool autosized = false); ~TextDisplay(); void Draw(Painter*, Canvas*); void LineHeight(IntCoord height); void TabWidth(IntCoord width); void Scroll(int line, IntCoord x, IntCoord y); void Resize(IntCoord xmin, IntCoord ymin, IntCoord xmax, IntCoord ymax); void Bounds( IntCoord& xmin, IntCoord& ymin, IntCoord& xmax, IntCoord& ymax ); void Redraw(IntCoord l, IntCoord b, IntCoord r, IntCoord t); void InsertLinesAfter(int line, int count = 1); void InsertLinesBefore(int line, int count = 1); void DeleteLinesAfter(int line, int count = 1); void DeleteLinesBefore(int line, int count = 1); void InsertText(int line, int index, const char*, int count); void DeleteText(int line, int index, int count); void ReplaceText(int line, const char*, int count); void Style(int line1, int index1, int line2, int index2, int style); void AddStyle(int line1, int index1, int line2, int index2, int style); void RemoveStyle(int line1, int index1, int line2, int index2, int style); void Caret(int line, int index); void CaretStyle(int); int LineNumber(IntCoord y); int LineIndex(int line, IntCoord x, bool between = true); IntCoord Width(); IntCoord Height(); IntCoord Base(int line); IntCoord Top(int line); IntCoord Left(int line, int index); IntCoord Right(int line, int index); private: friend class TextLine; void Size(int, int); TextLine* Line(int, bool); int Index(int); void HideCaret(); void ShowCaret(); Painter* painter; Canvas* canvas; bool autosized; IntCoord xmin, xmax; IntCoord ymin, ymax; IntCoord x0, y0; IntCoord width; int lineheight; int tabwidth; TextLine** lines; int maxlines; int firstline; int lastline; int topline; int bottomline; int widestline; int caretline; int caretindex; int caretstyle; }; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/texteditor.h000066400000000000000000000066301340731477100226300ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TextEditor - basic interactive editor for mulit-line text */ #ifndef ivlook2_6_texteditor_h #define ivlook2_6_texteditor_h #include #include class TextDisplay; class TextBuffer; class TextEditor : public Interactor { public: TextEditor(int rows, int cols, int tabsize, int highlight); TextEditor(const char* name, int r, int c, int t, int h); virtual ~TextEditor(); void Edit(TextBuffer*, int index = 0); int Dot(); int Mark(); void InsertText(const char*, int); void DeleteText(int); void DeleteSelection(); void BackwardCharacter(int = 1), ForwardCharacter(int = 1); void BackwardLine(int = 1), ForwardLine(int = 1); void BackwardWord(int = 1), ForwardWord(int = 1); void BackwardPage(int = 1), ForwardPage(int = 1); void BeginningOfLine(), EndOfLine(); void BeginningOfWord(), EndOfWord(); void BeginningOfSelection(), EndOfSelection(); void BeginningOfText(), EndOfText(); void SetScrollAlignment(Alignment); Alignment GetScrollAlignment(); void ScrollToSelection(bool always = false); void ScrollToView(IntCoord x, IntCoord y); void ScrollBy(IntCoord dx, IntCoord dy); void GrabScroll(Event&); void RateScroll(Event&); virtual void Adjust(Perspective&); void Select(int dot); void SelectMore(int mark); void SelectAll(); void Select(int dot, int mark); int Locate(IntCoord x, IntCoord y); protected: virtual void Reconfig(); virtual void Redraw(IntCoord, IntCoord, IntCoord, IntCoord); virtual void Resize(); TextBuffer* text; TextDisplay* display; private: void ScrollTo(int x, int y); void Init(int r, int c, int t, int h); int dot, mark; int tabsize; int lineheight; int highlight; int shaperows; int shapecolumns; Alignment scrollalign; }; inline int TextEditor::Dot () { return dot; } inline int TextEditor::Mark () { return mark; } inline void TextEditor::SetScrollAlignment (Alignment a) { scrollalign = a; } inline Alignment TextEditor::GetScrollAlignment() { return scrollalign; } #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/textstyle.h000077500000000000000000000026441340731477100225060ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv2_6_textstyle_h #define iv2_6_textstyle_h #include enum TextStyle { Plain = 0x0, Boldface = 0x1, Underlined = 0x2, Reversed = 0x4, Outlined = 0x8 }; #endif neuron-7.6.3/src/include/IV-2_6/InterViews/tray.h000066400000000000000000000062531340731477100214150ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Tray - composes interactors into (possibly) overlapping layouts. */ #ifndef iv2_6_tray_h #define iv2_6_tray_h #include #include #include #include class TrayElement; class TSolver; class TGlue : public Resource { public: TGlue(int w = 0, int h = 0, int hstretch = hfil, int vstretch = vfil); TGlue(int w, int h, int hshr, int hstr, int vshr, int vstr); ~TGlue(); Shape* GetShape(); private: Shape* shape; }; class Tray : public Scene { public: Tray(Interactor* background = nil); Tray(const char*, Interactor* background = nil); ~Tray(); virtual void Draw(); virtual void Reshape(Shape&); virtual void GetComponents(Interactor**, int, Interactor**&, int&); void Align(Alignment, Interactor*, TGlue* = nil); void Align(Alignment, Interactor*, Alignment, Interactor*, TGlue* = nil); void Align( Alignment, Interactor*, Interactor*, Interactor* = nil, Interactor* = nil, Interactor* = nil, Interactor* = nil, Interactor* = nil ); void HBox( Interactor*, Interactor*, Interactor* = nil, Interactor* = nil, Interactor* = nil, Interactor* = nil, Interactor* = nil ); void VBox( Interactor*, Interactor*, Interactor* = nil, Interactor* = nil, Interactor* = nil, Interactor* = nil, Interactor* = nil ); protected: virtual void DoInsert(Interactor*, bool, Coord& x, Coord& y); virtual void DoChange(Interactor*); virtual void DoRemove(Interactor*); virtual void Reconfig(); virtual void Resize(); private: int nelements; TrayElement* head; TrayElement* tail; Interactor* bg; TSolver* tsolver; void Init(Interactor*); void ComponentBounds(int&, int&); bool AlreadyInserted(Interactor*); void CalcShape(); void PlaceElement(TrayElement*); bool TrayOrBg(Interactor*); }; inline Shape* TGlue::GetShape () { return shape; } #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/viewport.h000077500000000000000000000054521340731477100223200ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * A viewport contains another interactor. Unlike a MonoScene or Frame, * a viewport always gives the interactor its desired shape. However, * the interactor may not be entirely viewable through the viewport. * The viewport's perspective can be used to adjust what portion is visible. */ #ifndef iv2_6_viewport_h #define iv2_6_viewport_h #include #include class Viewport : public MonoScene { public: Viewport(Interactor* = nil, Alignment = Center); Viewport(const char*, Interactor* = nil, Alignment = Center); ~Viewport(); virtual void Adjust(Perspective&); virtual void Resize(); void AdjustTo(float px, float py, float zx, float zy); void AdjustBy(float dpx, float dpy, float dzx, float dzy); void ScrollTo(float px, float py); void ScrollXTo(float px); void ScrollYTo(float py); void ScrollBy(float dpx, float dpy); void ScrollXBy(float dpx); void ScrollYBy(float dpy); void ZoomTo(float zx, float zy); void ZoomXTo(float zx); void ZoomYTo(float zy); void ZoomBy(float dzx, float dzy); void ZoomXBy(float dzx); void ZoomYBy(float dzy); float XPos(); float YPos(); float XMag(); float YMag(); protected: Alignment align; Painter* background; virtual void Reconfig(); virtual void Redraw(Coord, Coord, Coord, Coord); virtual void DoMove(Interactor*, Coord& x, Coord& y); private: int cwidth; int cheight; void Init(Interactor*, Alignment); void DoAdjust(float px, float py, float zx, float zy); }; #include #endif neuron-7.6.3/src/include/IV-2_6/InterViews/world.h000066400000000000000000000127011340731477100215600ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * World -- object representing a display */ #ifndef iv_world_h #define iv_world_h #include #include class Color; class Event; class Font; class Interactor; class Sensor; class World { protected: World(); public: World( const char*, int& argc, char** argv, const OptionDesc* = nil, const PropertyData* = nil ); virtual ~World(); virtual Session* session() const; virtual Display* display() const; virtual const char* name() const; virtual const char* classname() const; virtual int argc() const; virtual char** argv() const; virtual Style* style() const; virtual const char* property_value(const char*) const; virtual bool property_is_on(const char*) const; virtual const Font* font() const; virtual const Color* foreground() const; virtual const Color* background() const; virtual bool shaped_windows() const; virtual bool double_buffered() const; virtual void flush(); virtual void sync(); virtual Coord width() const; virtual Coord height() const; virtual unsigned int pwidth() const; virtual unsigned int pheight() const; virtual void run(); virtual void quit(); virtual bool done() const; virtual bool pending() const; virtual void read(Event&); virtual bool read(long sec, long usec, Event&); virtual void unread(Event&); virtual void poll(Event&); virtual void RingBell(int); virtual void SetKeyClick(int); virtual void SetAutoRepeat(bool); virtual void SetFeedback(int thresh, int scale); virtual void SetScreen(int); static World* current(); protected: void make_current(); private: friend class Interactor; static World* current_; Session* session_; Display* display_; /* * Old functions for backward compatibility * * We use "unsigned" for Alignment and "6" for BottomLeft to avoid * conflicts with new 3.0 names (like Center). */ public: void InsertApplication(Interactor*); void InsertApplication( Interactor*, _lib_iv2_6(Coord) x, _lib_iv2_6(Coord) y, unsigned = 6 ); void InsertToplevel(Interactor*, Interactor*); void InsertToplevel( Interactor*, Interactor*, _lib_iv2_6(Coord) x, _lib_iv2_6(Coord) y, unsigned = 6 ); void InsertPopup(Interactor*); void InsertPopup( Interactor*, _lib_iv2_6(Coord) x, _lib_iv2_6(Coord) y, unsigned = 6 ); void InsertTransient(Interactor*, Interactor*); void InsertTransient( Interactor*, Interactor*, _lib_iv2_6(Coord) x, _lib_iv2_6(Coord) y, unsigned = 6 ); void InsertIcon(Interactor*); void InsertIcon( Interactor*, _lib_iv2_6(Coord) x, _lib_iv2_6(Coord) y, unsigned = 6 ); void Insert(Interactor*); void Insert( Interactor*, _lib_iv2_6(Coord) x, _lib_iv2_6(Coord) y, unsigned = 6 ); void Change(Interactor*); void Remove(Interactor*); void Move(Interactor*, _lib_iv2_6(Coord) x, _lib_iv2_6(Coord) y); void Raise(Interactor*); void Lower(Interactor*); unsigned int Width() const; unsigned int Height() const; void Run(); void Flush(); void Sync(); /* * ParseGeometry return values contains one or more of these bits set. */ # define GeomNoValue 0x00 # define GeomXValue 0x01 # define GeomYValue 0x02 # define GeomWidthValue 0x04 # define GeomHeightValue 0x08 # define GeomAllValues 0x0F # define GeomXNegative 0x10 # define GeomYNegative 0x20 unsigned int ParseGeometry( const char*, int&, int&, unsigned int&, unsigned int& ) const; const char* GetAttribute(const char*) const; int Fileno() const; }; /* * Old functions for backward compatibilty */ inline void World::Insert(Interactor* i) { InsertToplevel(i, i); } inline void World::Insert( Interactor* i, _lib_iv2_6(Coord) x, _lib_iv2_6(Coord) y, unsigned a ) { InsertToplevel(i, i, x, y, a); } inline unsigned int World::Width() const { return pwidth(); } inline unsigned int World::Height() const { return pheight(); } inline void World::Run() { run(); } inline void World::Flush() { flush(); } inline void World::Sync() { sync(); } inline const char* World::GetAttribute(const char* s) const { return property_value(s); } #include #endif neuron-7.6.3/src/include/IV-2_6/_enter.h000077500000000000000000000025061340731477100176130ustar00rootroot00000000000000/* * Copyright (c) 1990 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Include this to override the current names and use the old 2.6 ones. */ #ifndef iv__2_6_h #define iv__2_6_h #ifdef iv__current_h #undef iv__current_h #endif #include #endif neuron-7.6.3/src/include/IV-2_6/_leave.h000077500000000000000000000023461340731477100175740ustar00rootroot00000000000000/* * Copyright (c) 1990 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifdef iv__2_6_h #ifndef iv2_6_compatible #undef iv__2_6_h #include #endif #endif neuron-7.6.3/src/include/IV-2_6/_names.h000077500000000000000000000053721340731477100176050ustar00rootroot00000000000000/* * Copyright (c) 1990 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Use 2.6 by default for ambiguous names */ #undef Adjuster #undef Border #undef Box #undef Button #undef PushButton #undef RadioButton #undef Center #undef Coord #undef Deck #undef Dialog #undef FileBrowser #undef FileChooser #undef Glue #undef HGlue #undef VGlue #undef Menu #undef MenuBar #undef MenuItem #undef Mover #undef UpMover #undef DownMover #undef LeftMover #undef RightMover #undef Panner #undef Scroller #undef HScroller #undef VScroller #undef ScrollBar #undef HScrollBar #undef VScrollBar #undef Slider #define Adjuster _lib_iv2_6(Adjuster) #define Border _lib_iv2_6(Border) #define Box _lib_iv2_6(Box) #define Button _lib_iv2_6(Button) #define PushButton _lib_iv2_6(PushButton) #define RadioButton _lib_iv2_6(RadioButton) #define Center _lib_iv2_6(Center) #define Coord _lib_iv2_6(Coord) #define Deck _lib_iv2_6(Deck) #define Dialog _lib_iv2_6(Dialog) #define FileBrowser _lib_iv2_6(FileBrowser) #define FileChooser _lib_iv2_6(FileChooser) #define Glue _lib_iv2_6(Glue) #define HGlue _lib_iv2_6(HGlue) #define VGlue _lib_iv2_6(VGlue) #define Menu _lib_iv2_6(Menu) #define MenuBar _lib_iv2_6(MenuBar) #define MenuItem _lib_iv2_6(MenuItem) #define Mover _lib_iv2_6(Mover) #define UpMover _lib_iv2_6(UpMover) #define DownMover _lib_iv2_6(DownMover) #define LeftMover _lib_iv2_6(LeftMover) #define RightMover _lib_iv2_6(RightMover) #define Panner _lib_iv2_6(Panner) #define Scroller _lib_iv2_6(Scroller) #define HScroller _lib_iv2_6(HScroller) #define VScroller _lib_iv2_6(VScroller) #define ScrollBar _lib_iv2_6(ScrollBar) #define HScrollBar _lib_iv2_6(HScrollBar) #define VScrollBar _lib_iv2_6(VScrollBar) #define Slider _lib_iv2_6(Slider) neuron-7.6.3/src/include/IV-Mac/000077500000000000000000000000001340731477100162725ustar00rootroot00000000000000neuron-7.6.3/src/include/IV-Mac/bitmap.h000077500000000000000000000037071340731477100177310ustar00rootroot00000000000000// =========================================================================== // // // // MS-Windows implementation of the InterViews bitmap class. // // The windows data structure BITMAP is used until the bitmap is needed // for actual rendering in the canvas, at which time a temporary GDI object // is created. Operations on this bitmap are therefore very light-weight. // // // 1.1 // 1997/03/28 17:35:39 // // Windows 3.1/NT Port // Copyright (c) 1993 Tim Prinzing // // This media contains programs and data which are proprietary // to Tim Prinzing. // // These contents are provided under a Tim Prinzing software source // license, which prohibits their unauthorized resale or distribution // outside of the buyer's organization. // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL Tim Prinzing BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // // ============================================================================ #ifndef iv_mac_bitmap_h #define iv_mac_bitmap_h // ---- InterViews includes ---- #include #include // ---- windows includes ---- #if !carbon #include #endif class BitmapRep { public: friend class CursorRep; enum { copy, fliph, flipv, rot90, rot180, rot270, inv }; BitmapRep(); ~BitmapRep(); // 2/22/97 don't know what I'm doing. Just experimenting to get a checkbox const void* data_; unsigned width_; unsigned height_; int xhot_; int yhot_; }; #endif neuron-7.6.3/src/include/IV-Mac/brush.h000077500000000000000000000032231340731477100175710ustar00rootroot00000000000000// ========================================================================== // // // // // MS-Windows implementation of the InterViews Brush class // // If a programmer that needs full access to the windows capabilities and // can afford portability problems, this class can be manipulated directly // to control the pen and brush used in the canvas. The way to do this is: // // a) create the Brush instance. // b) fill in the BrushRep values desired. // c) use the Brush. // // // 1.2 // 1999/08/13 16:36:21 // // InterViews port to the Windows 3.1/NT operating systems // Copyright (c) 1993 Tim Prinzing // // This media contains programs and data which are proprietary // to Tim Prinzing. // // These contents are provided under a Tim Prinzing software source // license, which prohibits their unauthorized resale or distribution // outside of the buyer's organization. // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL Tim Prinzing BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // // ======================================================================= #ifndef iv_mac_brush_h #define iv_mac_brush_h class BrushRep { public: Coord width_; }; #endif neuron-7.6.3/src/include/IV-Mac/canvas.h000066400000000000000000000151111340731477100177150ustar00rootroot00000000000000// ========================================================================= // // // Machintosh dependent Canvas representation. This canvas type renders // into an Machintosh window. // // 1.5 // $Date: 4 Aug 1996 // // ========================================================================= #ifndef ivmac_canvas_h #define ivmac_canvas_h // ---- InterViews includes ---- #include #include class BitmapRep; class WindowRep; class Canvas; class Display; class MACtransformPtrList; // PtrList class MACclipList; // List class PathRenderInfo { public: Coord curx_; Coord cury_; Point* point_; Point* cur_point_; Point* end_point_; }; class MACcanvas : public Canvas { public: MACcanvas(); virtual ~MACcanvas(); void bind(WindowRep* w) // bind canvas to a window { win_ = w; } void setWinToUpdate(void); virtual void initClip(); // just initializes clipping so no bug on resize virtual void beginPaint(); virtual void endPaint(); // These two functions determine when the canvas can be rendered // upon, and when it can't. The canvas is not valid for drawing // outside of a begin/end pair. inline int toPixelX(Coord x) const; inline int toPixelY(Coord y) const; inline Coord fromPixelX(int x) const; inline Coord fromPixelY(int x) const; inline void setDamage(Rect * rectangle); inline void addToDamage(Rect * rectangle); inline Rect * getDamage(); inline void clearDamage(); void begin_item(PixelCoord x, PixelCoord y, PixelCoord w); // ---------------- InterViews interface --------------------- virtual Window* window() const; virtual void size(Coord width, Coord height); virtual void psize(PixelCoord width, PixelCoord height); virtual Coord width() const; virtual Coord height() const; virtual PixelCoord pwidth() const; virtual PixelCoord pheight() const; virtual PixelCoord to_pixels(Coord, DimensionName) const; virtual Coord to_coord(PixelCoord, DimensionName) const; virtual void push_transform(); virtual void transform(const Transformer&); virtual void pop_transform(); virtual void transformer(const Transformer&); virtual const Transformer& transformer() const; virtual void push_clipping(bool all = false); virtual void pop_clipping(); virtual void clip(); virtual void front_buffer(); virtual void back_buffer(); virtual void damage(const Extension&); virtual void damage(Coord left, Coord bottom, Coord right, Coord top); virtual bool damaged(const Extension&) const; virtual bool damaged( Coord left, Coord bottom, Coord right, Coord top) const; virtual void damage_area(Extension&); virtual void damage_all(); virtual bool any_damage() const; virtual void restrict_damage(const Extension&); virtual void restrict_damage(Coord left, Coord bottom, Coord right, Coord top); virtual void redraw(Coord left, Coord bottom, Coord right, Coord top); virtual void repair(); Transformer& matrix() const; // current transformation matrix in effect for the rendering // surface. void stencilFill(const Bitmap*, const Color*); // This function fills the current path with a stenciled pattern // in the given color. This function is basically used to simulate // the alpha blending of color which is not directly supported by // the GDI interface (ie PatBlt doesn't allow raster operations that // specify source as part of the operation... so no stencil). Since // the regions stenciled are typically not that large, this shouldn't // be too big of a shortcoming... it's too bad though because some // smart framebuffers can do this in hardware wicked-fast :-) // virtual void new_path(); virtual void move_to(Coord x, Coord y); virtual void line_to(Coord x, Coord y); virtual void curve_to(Coord x, Coord y, Coord x1, Coord y1, Coord x2, Coord y2); virtual void close_path(); virtual void stroke(const Color*, const Brush*); virtual void fill(const Color*); virtual void character(const Font*, long ch, Coord width, const Color*, Coord x, Coord y); virtual void stencil(const Bitmap*, const Color*, Coord x, Coord y); virtual void image(const Raster*, Coord x, Coord y); protected: virtual void flush(); // flush any buffered operations int transformAngle() const; // determines the current transformation angle in terms of tenths // of a degree. Returns a number between 0 and 3600. // ---- attribute setting functions ---- void color(const Color*); void brush(const Brush*); void font(const Font*); WindowRep* win_; // associated window Display* dpy; // display bool transformed_; MACtransformPtrList* transformers_; Rect* clipping_; MACclipList* clippers_; //private: protected: // for MacPrinterCanvas Rect damageArea; // area of canvas currently damaged. This is maintained in terms of // world coordinates since it is used primarily by clients of the // canvas. //PixelCoord canvas_width; //PixelCoord canvas_height; #if 0 // size of canvas in pixels. HPEN pen_; // current pen to render with HBRUSH brush_; // current brush to render with LOGPEN pen_stats_; // what the pen was constructed from LOGBRUSH brush_stats_; // what the brush was constructed from HPEN old_pen_; // pen before our pen was selected into the DC HBRUSH old_brush_; // brush before our brush was selected into the DC #endif // ---- logical attributes ----- const Color* lg_color_; // last IV color set const Brush* lg_brush_; // last IV brush set const Font* lg_font_; // last IV font set static PathRenderInfo path_; // path info (filled by Canvas members) // ---- text support ---- struct TextItem { int count; PixelCoord x, y; enum { size = 256 }; char buffer[size]; //PixelCoord next_x; }; TextItem text_item_; }; inline int MACcanvas::toPixelX(Coord x) const {return to_pixels(x, Dimension_X);} inline int MACcanvas::toPixelY(Coord y) const {return pheight() - to_pixels(y, Dimension_Y);} inline Coord MACcanvas::fromPixelX(int x) const {return to_coord(x, Dimension_X);} inline Coord MACcanvas::fromPixelY(int y) const {return to_coord((pheight() - y), Dimension_Y);} inline void MACcanvas::setDamage(Rect * rectangle) { damageArea = *rectangle; } inline void MACcanvas::addToDamage(Rect * rectangle) { UnionRect(&damageArea, rectangle, &damageArea); } inline Rect * MACcanvas::getDamage() { return &damageArea; } inline void MACcanvas::clearDamage(void) { SetRect(&damageArea, 0, 0, 0, 0); } #endif /* ivmac_canvas_h */ neuron-7.6.3/src/include/IV-Mac/color.h000077500000000000000000000022031340731477100175610ustar00rootroot00000000000000// =========================================================================== // // // // Machintosh implementation of the InterViews Color classes. // // // 1.1 // $Date: 4 Aug 1996 // // =========================================================================== #ifndef iv_mac_color_h #define iv_mac_color_h #include class Bitmap; class ColorRep { public: ColorRep(int r, int g, int b); ~ColorRep(); RGBColor* MACcolor(); // mac color representation float alpha; ColorOp op; Bitmap* stipple; // stipple pattern static const char* nameToRGB(const char* colormap, const char* name); // translates a color name to the X11 string format of an rgb // specification (ie #??????). The colormap name is basically a // section in the colormap.ini file. static const Color* rgbToColor(const char* name); // translates an rgb string (#?????? format) to a color instance, // or returns null if there is a problem. This is for support of // X11 style color names. private: RGBColor color_; }; inline RGBColor* ColorRep::MACcolor() { return &color_; } #endif neuron-7.6.3/src/include/IV-Mac/cursor.h000077500000000000000000000013221340731477100177610ustar00rootroot00000000000000// ======================================================================= // // // // MS-Windows implementation of the InterViews cursor class. // // The CursorRep class is basically a small wrapper around a Machintosh // CursHandle. // // 1.1 // 1997/03/28 17:35:41 // // ======================================================================= #ifndef iv_mac_cursor_h #define iv_mac_cursor_h class Color; class Display; class WindowVisual; class CursorRep { public: CursorRep(int); CursorRep(const char *); CursorRep(BitmapRep& data, BitmapRep& mask); CursorRep(short, short, const int* data, const int* mask); ~CursorRep(); CursHandle theCursor; }; #endif neuron-7.6.3/src/include/IV-Mac/event.h000077500000000000000000000072211340731477100175710ustar00rootroot00000000000000// ======================================================================= // // // // Machintosh implementation of the InterViews Event classes. // // Machintosh implementation of the InterViews Event classes. The // flow of control is significantly different from MS-Windows. Events // are held on a que, and are read in by Session::read. The event handler // then parses the event. Machintosh native calls are performed on most // events. Mouse motion, key down events, and mouse down events in the // content area of a window, however, are given to the function // MACwindow::MACinput. This function calls EventRep::handleCallBack // which essentially allows Inteviews to handle the event. // // The EventRep stores the type and button information directly as the // values used by the Event class. All information is stashed directly // in the EventRep with no translation unless the information is asked // for through the Event class. MS-Windows Note -- This is to facilitate // rapid creation since a large number of these will be created (especially // mouse motion events). // // // 1.1 // 1997/03/28 17:35:42 // // ======================================================================= #ifndef iv_mac_event_h #define iv_mac_event_h // ---- InterViews includes ---- #include #include #include class EventRep { public: EventRep(); ~EventRep(); #if carbon EventRef getEventRef(); static Point mouse_loc(EventRef); void handle(); void set(int type, int button, int x, int y); #else EventRecord * getEventRecord(); #endif Window* windowOf(); void setWindow(WindowPtr aMacWindow); int typeOf(); // event type int buttonOf(); // mouse button void mouseDownEventHook(void); void mouseUpEventHook(void); void mouseMotionEventHook(void); void keyDownEventHook(void); void appleEventHook(void); void nullEventHook(void); void osEventHook(void); void diskEventHook(void); void activateEventHook(void); void updateEventHook(void); void appleMenuHook(short menuItem); #if carbon void setEventRef(EventRef theEventRef); #else void setEventRecord(EventRecord * theEventRecord); #endif static void handleCallback(Event&); // This function is called by WindowRep as a result an earlier call // to Event::handle(). int ivlocalMouse_x(void); int ivlocalMouse_y(void); int ivglobalMouse_x(void); int ivglobalMouse_y(void); void setMouseLocationToCurrent(void); private: friend class WindowRep; // this class fills in the event info #if carbon EventRef theEvent_; #else EventRecord * theEvent_; #endif Window* win_; int type_; // Event::type enum int button_; // Event::button enum Point localMouseLocation_; }; // --- inline functions --- #if carbon inline EventRef EventRep::getEventRef(void) {return theEvent_;} #else inline EventRecord * EventRep::getEventRecord(void) {return theEvent_;} #endif inline Window* EventRep::windowOf(void) {return win_;} inline int EventRep::typeOf() { return type_; } inline int EventRep::buttonOf() { return button_; } #if carbon inline void EventRep::setEventRef(EventRef theEventRef) {theEvent_ = theEventRef;} #else inline void EventRep::setEventRecord(EventRecord * theEventRecord) {*theEvent_ = *theEventRecord;} #endif inline int EventRep::ivlocalMouse_x(void) {return localMouseLocation_.h;} inline int EventRep::ivlocalMouse_y(void) {Canvas* c = win_->canvas(); return (c->pheight() - localMouseLocation_.v);} inline void EventRep::setMouseLocationToCurrent(void) {GetMouse(&localMouseLocation_);} #endif neuron-7.6.3/src/include/IV-Mac/font.h000077500000000000000000000050271340731477100174200ustar00rootroot00000000000000// ========================================================================= // // // // MS-Windows implementation of the InterViews Font class. // // The font information is stored in a LOGFONT structure until the font is // needed, at which time it can be created with CreateFontIndirect(). Some // functions require a device context to get information (such as metrics), // so the desktop window is used for such requests. // // The user is given a constructor with a LOGFONT structure to use as a // reference. This is primarily for flexibility where one doesn't care // about portability (one really shouldn't use the FontRep directly). The // user is cautioned however that there is no guarantee the fields won't // be overwritten (lfEscapement and lfOrientation may change for example). // // // 1.1 // 1997/03/28 17:35:43 // // Windows 3.1/NT InterViews Port // Copyright (c) 1993 Tim Prinzing // // This media contains programs and data which are proprietary // to Tim Prinzing. // // These contents are provided under a Tim Prinzing software source // license, which prohibits their unauthorized resale or distribution // outside of the buyer's organization. // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL Tim Prinzing BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // // ========================================================================= #ifndef iv_win_font_h #define iv_win_font_h // ---- InterViews includes ---- #include class FontRep { public: FontRep(const char* face_name, int height, int style_flags); ~FontRep(); void defaultFontRep(const char* nm); // ---- recognized style flags ---- enum { normal = 0, bold = 1, italic = 2, underline = 4, strikeout = 8 }; short font_; //font id int face_; //extra typing ... bold, underline, ect. short size_; //size for text Fixed sp_extra_; //expanding the standard space short char_extra_; //expanding space between characters short mode_; //printing mode int* widths_; FontInfo info_; Str255 name_; }; class FontFamilyRep { }; #endif // iv_win_font_h neuron-7.6.3/src/include/IV-Mac/mprinter.h000066400000000000000000000046071340731477100203120ustar00rootroot00000000000000/* * Printer - generate output for a printer */ #ifndef iv_mcprinter_h #define iv_mcprinter_h #include #include #include class MacPrinterCanvas : public MACcanvas { public: MacPrinterCanvas(); virtual ~MacPrinterCanvas(); bool start(); bool finish(); bool setup(bool s = true); virtual Window* window() const; virtual void size(Coord width, Coord height); virtual void psize(Coord width, Coord height); virtual void resize(Coord, Coord, Coord, Coord); virtual Coord width() const; virtual Coord height() const; virtual PixelCoord pwidth() const; virtual PixelCoord pheight() const; virtual PixelCoord to_pixels(Coord x, DimensionName)const; virtual Coord to_coord(PixelCoord x, DimensionName)const; virtual void flush(); private: GrafPtr oldPort; #if carbon PMPrintSession pmses; PMPageFormat pmform; PMRect pmrect; #else THPrint prRecHdl; TPPrPort gPrinterPort; #endif }; class MacPrinter : public Printer { public: MacPrinter(ostream* o = nil); virtual ~MacPrinter(); void setup(); virtual Window* window() const; virtual Coord width() const; virtual Coord height() const; virtual PixelCoord pwidth() const; virtual PixelCoord pheight() const; virtual void transformer(const Transformer&); virtual const Transformer& transformer() const; virtual void resize(Coord left, Coord bottom, Coord right, Coord top); virtual void prolog(const char* creator = "InterViews"); virtual void epilog(); virtual void comment(const char*); virtual void page(const char*); virtual void push_transform(); virtual void transform(const Transformer&); virtual void pop_transform(); virtual void push_clipping(bool all = false); virtual void clip(); virtual void pop_clipping(); virtual void new_path(); virtual void move_to(Coord x, Coord y); virtual void line_to(Coord x, Coord y); virtual void curve_to( Coord x, Coord y, Coord x1, Coord y1, Coord x2, Coord y2 ); virtual void close_path(); virtual void stroke(const Color*, const Brush*); virtual void fill(const Color*); virtual void character( const Font*, long c, Coord width, const Color*, Coord x, Coord y ); virtual void stencil(const Bitmap*, const Color*, Coord x, Coord y); virtual void image(const Raster*, Coord x, Coord y); private: MacPrinterCanvas* c; }; #endif neuron-7.6.3/src/include/IV-Mac/raster.h000077500000000000000000000030501340731477100177440ustar00rootroot00000000000000// ========================================================================= // // // // MS-Windows implementation of the InterViews Raster class. // // A memory device context is used to store the raster. The peek and poke // operations simply get translated to calls that get and set pixel values // the the memory device context. // // 1.2 // 1999/01/11 12:05:05 // // Windows 3.1/NT Port // Copyright (c) 1993 Tim Prinzing // // This media contains programs and data which are proprietary // to Tim Prinzing. // // These contents are provided under a Tim Prinzing software source // license, which prohibits their unauthorized resale or distribution // outside of the buyer's organization. // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL Tim Prinzing BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // // ========================================================================= #ifndef ivmac_raster_h #define ivmac_raster_h class RasterRep { public: RasterRep(); ~RasterRep(); CGrafPtr cg_; int width_, height_; private: }; #endif /* ivwin_raster_h */ neuron-7.6.3/src/include/IV-Mac/session.h000066400000000000000000000074271340731477100201400ustar00rootroot00000000000000// ======================================================================= // // // // The Machintosh implementation of the InterViews Session class. // // // 1.1 // $Date: 4 Aug 1996 1 // ======================================================================= /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef ivmac_Session_h #define ivmac_Session_h #include class SessionRep { public: SessionRep(); ~SessionRep(); int run(); void load_app_defaults(Style*, const char* nm, int priority); // Load a file in the application defaults area with the name // "nm". The method of locating the application defaults directory // is platform dependent. void makeChecks(void); //make sure system appropriate for our assumptions void initToolboxFunctions(); //Load the different Machintosh managers public: const char* classname_; // The following are expected to be moved to the platform-independant // part (ie the Session class). public: void init( const char*, int& argc, char** argv, const OptionDesc*, const PropertyData* ); void parse_args(int& argc, char** argv, const OptionDesc*); bool match( const String& arg, const OptionDesc& o, int& i, int argc, char** argv ); void extract( const String& arg, const OptionDesc& o, int& i, int argc, char** argv, String& name, String& value ); void bad_arg(const char* fmt, const String& arg); String next_arg( int& i, int argc, char** argv, const char* message, const String& ); bool find_arg(const String& name, String& value); void init_style(const char*, const PropertyData*); String* find_name(); void load_props(Style*, const PropertyData*, int priority); void load_environment(Style*, int priority); void load_path(Style*, const char*, const char*, int priority); const char* home(); void load_file(Style*, const char* filename, int priority); void load_list(Style*, const String&, int priority); void load_property(Style*, const String&, int priority); String strip(const String&); void missing_colon(const String&); void bad_property_name(const String&); void bad_property_value(const String&); void init_display(); void connect(Display*); void set_style(Display*); bool srcheck(Event&); // "check" screws up carbon private: friend class Session; String* name_; Style* style_; const PropertyData* props_; static Session* instance_; int argc_; char** argv_; Display* display_; bool done_; }; // ---- window classes registered ---- #define IV_WINDOW "ivWindow" #endif // iv_win_Session_h neuron-7.6.3/src/include/IV-Mac/window.h000066400000000000000000000130721340731477100177550ustar00rootroot00000000000000// ======================================================================= // // // // Machintosh implimentation of the InterViews Window classes. // // THE MANAGED WINDOW AND OTHER SUB-WINDOW CLASSES HAVE NOT BEEN IMPLEMENTED // // The ManagedWindowRep is associated with the ManagedWindow class, which // is a class of window that interacts with the window manager. Although // there is no seperate "Window Manager" in MS-Windows, the functionality // present in that class has equivalents in MS-Windows. // // // 1.1 // $Date: 4 AUG 1996 // // ======================================================================= #ifndef iv_mac_window_h #define iv_mac_window_h #define WindowPtr WindowRef #include #include #include #include #if !carbon #include #endif class Window; class Bitmap; class Handler; class ManagedWindow; class Style; class Glyph; class Cursor; class Event; #if carbon #define USE_SIOUX_WINDOW 0 #else #define USE_SIOUX_WINDOW 1 //Enables one to remove SIOUX specific support #endif declarePtrList(MACWindowRepList, WindowRep); class MACcursorPtrList; class MACcreateParams; class MACwindow { public: MACwindow(); virtual ~MACwindow(); Boolean hasGrow; /* true if has grow box */ ControlHandle horizScroll; /* horizontal scroll bar */ ControlHandle vertScroll; /* vertical scroll bar */ enum { MODAL = 1, MODELESS, MOVABLE_MODAL}; bool update_; //whether window currently in list //Points defining the maximum and minimus sizes of window Point shrink_; Point stretch_; // ---- typical window operations ---- void bind(); // bind to an MS-Windows window void unbind(); // unbind from MS-Windows window bool bound(); // bound to MS-Windows window? bool map(); // map the window to the display void unmap(); // unmap window from display bool isMapped(); // is window visible? //functions to determine new window placement int next_window_x(void); int next_window_y(void); bool placed_; int left_; int bottom_; // MAC specific calls void contentRect (void *data); void drawGrowIcon(void); void activate(bool activ); void repair(void); void update(void); #if carbon void doDrag(EventRef theEvent); void doGrow(EventRef theEvent); void doBackgroundClick(EventRef theEvent); #else void doDrag(EventRecord * theEvent); void doGrow(EventRecord* theEvent); void doBackgroundClick(EventRecord * theEvent); #endif void adjustScrollBar (ControlHandle theControl); void doZoom (void *data); long MACpaint(void); void doubleBuffer(bool b); Window* getIvWindow() const; #if carbon void setport() {SetPort(GetWindowPort(theMacWindow_));} #else void setport() {SetPort(theMacWindow_);} #endif // ----- window class parameters ---- WindowPtr macWindow(); // ----- static functions ----- #if USE_SIOUX_WINDOW static bool noInterviewsWindows(void); static void setNoInterviewsWindows(bool windows); #endif static bool isOurWindow(WindowPtr theWin); static short isDialog(WindowPtr macWindow); MACcreateParams * params_; // creation parameters private: WindowPtr theMacWindow_; // the actual window associated with this GWorldPtr buffer_bitmap_; bool doubleBuffered_; // is window double-buffered? }; // The following are the window/class creation parameters. class MACcreateParams { public: MACcreateParams(); ~MACcreateParams(); void titleOf(const char*); // set window title const char* titleOf(); // fetch window title Rect* bounds_; //size of window int id_; //type of window bool away_; //whether a window can be closed long refCon_input_; //what goes into refcon field Point where_; #if carbon WindowClass wclass_; #endif private: char* title_; //string title }; // ---- inline functions of MACwindow ---- inline bool MACwindow::bound() { return (theMacWindow_) ? 1 : 0; } inline WindowPtr MACwindow::macWindow() { return theMacWindow_; } inline void MACwindow::doubleBuffer(bool b) { doubleBuffered_ = b; } class WindowRep : public MACwindow { public: WindowRep(Window*); ~WindowRep(); Window* ivWindowOf() // associated IV window { return win; } #if carbon long MACinput(EventRef theEvent, int type, int button); void doGrow(EventRef theEvent); #else long MACinput(EventRecord* theEvent, int type, int button); void doGrow(EventRecord* theEvent); #endif void bind(); const Allocation& getAllocation(void); static MACWindowRepList update_list; MACcursorPtrList* cursor_stack_; Cursor* cursor_; Handler* close_callback_; static WindowRep* rc(WindowPtr wp) { #if carbon return (WindowRep*)GetWRefCon(wp); #else return (WindowRep*)((CWindowPeek)wp)->refCon; #endif } bool request_on_resize_; private: Window* win; // associated InterViews window }; inline const Allocation& WindowRep::getAllocation(void) { return win->allocation_;} // ####################################################################### // ################## ManagedWindowRep // ####################################################################### class ManagedWindowRep { public: ManagedWindowRep(ManagedWindow*); ~ManagedWindowRep(); void errorMessage(const char* msg); // ---- Windows messages recognized ---- private: ManagedWindow* win; // associated window public: Handler* wm_delete_; ManagedWindow* icon_; Bitmap* icon_bitmap_; Bitmap* icon_mask_; Window* group_leader_; Window* transient_for_; //void do_set(Window*, HintFunction); }; #endif neuron-7.6.3/src/include/IV-Win/000077500000000000000000000000001340731477100163275ustar00rootroot00000000000000neuron-7.6.3/src/include/IV-Win/MWapp.h000077500000000000000000000034171340731477100175340ustar00rootroot00000000000000/* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ============================================================================ // // // // Application class for the Microsoft-Windows layer. // // 1.1 // 1997/03/28 17:35:55 // // ======================================================================== #ifndef MWapp_h #define MWapp_h #include class MWapp { public: MWapp(); ~MWapp(); int run(); void quit(int ret = 0); void setModule(HINSTANCE, HINSTANCE, const char*, int); const char* appName(); void appName(const char* nm); public: HINSTANCE hinst; // application module handle char scratch[1024]; // static heap for general use private: HINSTANCE pinst; const char* cmdLine; // command line text int cmdShow; }; // ---- inline functions ---- inline void MWapp::quit(int ret) { PostQuitMessage(ret); } extern MWapp theApp; #endif /* MWapp_h */ neuron-7.6.3/src/include/IV-Win/MWlib.h000077500000000000000000000052021340731477100175140ustar00rootroot00000000000000/* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ======================================================================= // // // // General definitions for the MW library, a library implementing an // object oriented structure on top of MS-Windows. // // 1.1 // 1997/03/28 17:35:55 // // ======================================================================== #ifndef MWlib_h #define MWlib_h // ---- MS-Windows includes ---- // since cpp will still read the file even if ifdef'd out, and the windows // file is quite large, a check for previous inclusion is done outside the // include directive! #ifdef WIN32 #ifndef _WINDOWS_ #include #endif #else #ifndef __WINDOWS_H #include #endif #endif #include void MWinitialize(); void MWcleanup(); // ---- error handling support ---- void mwAssertion(const char* msg, const char* file, unsigned int line); #ifdef NDEBUG #define MWassert(test) ((void) 0) #else #define MWassert(test) ((void)((test) || (mwAssertion(#test,__FILE__,__LINE__),1))) #endif // global new and delete operators //extern void* operator new(size_t size); //extern void operator delete(void* ptr); #define EXPORT #include class Style; void dumpStyle(Style*, const char* p = ""); // dumps the given style to the given file in the form that it is // normally read. If the file is null, the style hierarchy is // written out to the appropriate debug stream for the given platform. // This function is recursive, and the last argument is the current // path built up so far. If a fixed path is desired to be prepended // to each line that is not present in the style, it can be supplied // as the path argument to the dumpStyle() call to the root style. #include #endif /* MWlib_h */ neuron-7.6.3/src/include/IV-Win/MWpoint.h000066400000000000000000000157001340731477100201000ustar00rootroot00000000000000/* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // =========================================================================== // // // // Defines the class for a point. This class used to use templates and has // been converted for use of the Microsoft compiler which is behind the times. // // // 1.1 // 1997/03/28 17:35:56 // // ======================================================================== #ifndef Point_h #define Point_h #include #include #include // ################################################################# // ############## class MWcoordPoint // ################################################################# class MWcoordPoint { public: MWcoordPoint() { xpos = ypos = 0; } MWcoordPoint(Coord newx, Coord newy) { xpos=newx; ypos=newy; } Coord x() const { return xpos; } Coord x(Coord newx) { return xpos = newx; } Coord y() const { return ypos; } Coord y(Coord newy) { return ypos = newy; } // ---- arithmetic operations ---- MWcoordPoint operator+(const MWcoordPoint& p) const { return MWcoordPoint(xpos+p.xpos, ypos+p.ypos); } MWcoordPoint operator-() const { return MWcoordPoint(-xpos,-ypos); } MWcoordPoint operator-(const MWcoordPoint& p) const { return MWcoordPoint(xpos-p.xpos, ypos-p.ypos); } friend MWcoordPoint operator*(const MWcoordPoint& p, int i) { return MWcoordPoint(i*p.xpos, i*p.ypos); } friend MWcoordPoint operator*(int i, const MWcoordPoint& p) { return MWcoordPoint(i*p.xpos, i*p.ypos); } int operator*(const MWcoordPoint& p) const { return (int) (xpos*p.xpos + ypos*p.ypos); } // ---- logical operations ---- bool operator==(const MWcoordPoint& p) const { return (xpos==p.xpos && ypos==p.ypos); } bool operator!=(const MWcoordPoint& p) const { return (xpos!=p.xpos || ypos!=p.ypos); } bool operator<(const MWcoordPoint& p) const { return (ypos(const MWcoordPoint& p) const { return (ypos>p.ypos && xpos>p.xpos); } bool operator>=(const MWcoordPoint& p) const { return (ypos>=p.ypos && xpos>=p.xpos); } // ---- assignment operators ---- void operator+=(const MWcoordPoint& p) { xpos += p.xpos; ypos += p.ypos; } void operator-=(const MWcoordPoint& p) { xpos -= p.xpos; ypos -= p.ypos; } void operator*=(float s) { xpos *= s; ypos *= s; } // ---- relationship ---- MWcoordPoint max(const MWcoordPoint&) const; MWcoordPoint min(const MWcoordPoint&) const; MWcoordPoint transpose() const { return MWcoordPoint(ypos,xpos); } bool isBelow(const MWcoordPoint& p) const { return ypos < p.ypos; } bool isAbove(const MWcoordPoint& p) const { return ypos > p.ypos; } bool isLeft(const MWcoordPoint& p) const { return xpos < p.xpos; } bool isRight(const MWcoordPoint& p) const { return xpos > p.xpos; } private: Coord xpos; // x coordinate Coord ypos; // y coordinate }; inline MWcoordPoint MWcoordPoint::max(const MWcoordPoint& p) const { return MWcoordPoint(Math::max(xpos,p.xpos),Math::max(ypos,p.ypos)); } inline MWcoordPoint MWcoordPoint::min(const MWcoordPoint& p) const { return MWcoordPoint(Math::min(xpos,p.xpos),Math::min(ypos,p.ypos)); } // ################################################################# // ############## class MWpixelPoint // ################################################################# class MWpixelPoint { public: MWpixelPoint() { xpos = ypos = 0; } MWpixelPoint(PixelCoord newx, PixelCoord newy) { xpos=newx; ypos=newy; } PixelCoord x() const { return xpos; } PixelCoord x(PixelCoord newx) { return xpos = newx; } PixelCoord y() const { return ypos; } PixelCoord y(PixelCoord newy) { return ypos = newy; } // ---- arithmetic operations ---- MWpixelPoint operator+(const MWpixelPoint& p) const { return MWpixelPoint(xpos+p.xpos, ypos+p.ypos); } MWpixelPoint operator-() const { return MWpixelPoint(-xpos,-ypos); } MWpixelPoint operator-(const MWpixelPoint& p) const { return MWpixelPoint(xpos-p.xpos, ypos-p.ypos); } friend MWpixelPoint operator*(const MWpixelPoint& p, int i) { return MWpixelPoint(i*p.xpos, i*p.ypos); } friend MWpixelPoint operator*(int i, const MWpixelPoint& p) { return MWpixelPoint(i*p.xpos, i*p.ypos); } int operator*(const MWpixelPoint& p) const { return xpos*p.xpos + ypos*p.ypos; } // ---- logical operations ---- bool operator==(const MWpixelPoint& p) const { return (xpos==p.xpos && ypos==p.ypos); } bool operator!=(const MWpixelPoint& p) const { return (xpos!=p.xpos || ypos!=p.ypos); } bool operator<(const MWpixelPoint& p) const { return (ypos(const MWpixelPoint& p) const { return (ypos>p.ypos && xpos>p.xpos); } bool operator>=(const MWpixelPoint& p) const { return (ypos>=p.ypos && xpos>=p.xpos); } // ---- assignment operators ---- void operator+=(const MWpixelPoint& p) { xpos += p.xpos; ypos += p.ypos; } void operator-=(const MWpixelPoint& p) { xpos -= p.xpos; ypos -= p.ypos; } void operator*=(float s) { xpos = PixelCoord(xpos * s); ypos = PixelCoord(ypos * s); } // ---- relationship ---- MWpixelPoint max(const MWpixelPoint&) const; MWpixelPoint min(const MWpixelPoint&) const; MWpixelPoint transpose() const { return MWpixelPoint(ypos,xpos); } bool isBelow(const MWpixelPoint& p) const { return ypos < p.ypos; } bool isAbove(const MWpixelPoint& p) const { return ypos > p.ypos; } bool isLeft(const MWpixelPoint& p) const { return xpos < p.xpos; } bool isRight(const MWpixelPoint& p) const { return xpos > p.xpos; } private: PixelCoord xpos; // x coordinate PixelCoord ypos; // y coordinate }; inline MWpixelPoint MWpixelPoint::max(const MWpixelPoint& p) const { return MWpixelPoint(Math::max(xpos,p.xpos),Math::max(ypos,p.ypos)); } inline MWpixelPoint MWpixelPoint::min(const MWpixelPoint& p) const { return MWpixelPoint(Math::min(xpos,p.xpos),Math::min(ypos,p.ypos)); } #endif /* Point_h */ neuron-7.6.3/src/include/IV-Win/MWrect.h000066400000000000000000000212771340731477100177120ustar00rootroot00000000000000/* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // =========================================================================== // // // // Defines the class for a rectangle. The coordinate system used is the // right hand coordinate system typically found when dealing with world // coordinates (ie the coordinate system used in InterViews). The x value // increases to the right, and the y value increases to the top. The origin // is at the bottom left corner. Note this is not the same as the coordinate // system found in X-Windows and MS-Windows. // // This class used to use templates and has been converted for use of the // Microsoft compiler which is behind the times. // // Positions are maintained as Point, and coordinate values and // length are maintained as Coord or PixelCoord (Since no longer // parameterized). // // // 1.1 // 1997/03/28 17:35:57 // // ======================================================================== #ifndef Rect_h #define Rect_h // ---- local includes ---- #include // ################################################################ // ################## class MWcoordRect // ################################################################ class MWcoordRect { public: MWcoordRect(Coord x0 = 0, Coord y0 = 0, Coord x1 = 0, Coord y1 = 0) : bl(x0,y0), tr(x1,y1) {} MWcoordRect(const MWcoordPoint& p0, const MWcoordPoint& p1) : bl(p0), tr(p1) {} MWcoordRect(const MWcoordRect& r) : bl(r.origin()), tr(r.corner()) {} // ---- positions ---- MWcoordPoint origin() const { return bl; } MWcoordPoint origin(const MWcoordPoint& p) { return bl = p; } MWcoordPoint corner() const { return tr; } MWcoordPoint corner(const MWcoordPoint& p) { return tr = p; } MWcoordPoint topLeft() const { return MWcoordPoint(bl.x(),tr.y()); } MWcoordPoint topCenter() const { return MWcoordPoint((tr.x()+bl.x())/2,tr.y()); } MWcoordPoint topRight() const { return tr; } MWcoordPoint rightCenter() const { return MWcoordPoint(tr.x(),(tr.y()+bl.y())/2); } MWcoordPoint bottomRight() const { return MWcoordPoint(tr.x(),bl.y()); } MWcoordPoint bottomCenter() const { return MWcoordPoint((tr.x()+bl.x())/2,bl.y()); } MWcoordPoint bottomLeft() const { return bl; } MWcoordPoint leftCenter() const { return MWcoordPoint(bl.x(),(tr.y()+bl.y())/2); } MWcoordPoint center() const { return MWcoordPoint((tr.x()+bl.x())/2,(tr.y()+bl.y())/2); } Coord left() const { return bl.x(); } Coord right() const { return tr.x(); } Coord top() const { return tr.y(); } Coord bottom() const { return bl.y(); } // ---- measurements ---- MWcoordPoint extent() const { return MWcoordPoint(tr.x()-bl.x(),tr.y()-bl.y()); } Coord area() const { return (tr.x()-bl.x())*(tr.y()-bl.y()); } Coord width() const { return tr.x()-bl.x(); } Coord height() const { return tr.y()-bl.y(); } // ---- operations ---- bool operator==(const MWcoordRect&) const; bool operator!=(const MWcoordRect& r) const { return !(*this==r); } MWcoordRect operator&&(const MWcoordRect&) const; // intersection MWcoordRect operator||(const MWcoordRect&) const; // union void operator+=(const MWcoordPoint&); // translate void operator-=(const MWcoordPoint&); bool contains(const MWcoordPoint&) const; bool contains(const MWcoordRect&) const; bool intersects(const MWcoordRect&) const; void moveTo(const MWcoordPoint&); private: MWcoordPoint bl; // bottom left corner (origin) MWcoordPoint tr; // top right corner (corner) }; inline bool MWcoordRect::operator==(const MWcoordRect& r) const { return (bl==r.bl && tr==r.tr); } inline MWcoordRect MWcoordRect::operator&&(const MWcoordRect& r) const { return MWcoordRect(bl.max(r.bl), tr.min(r.tr)); } inline MWcoordRect MWcoordRect::operator||(const MWcoordRect& r) const { return MWcoordRect(bl.min(r.bl), tr.max(r.tr)); } inline void MWcoordRect::operator+=(const MWcoordPoint& p) { bl += p; tr += p; } inline void MWcoordRect::operator-=(const MWcoordPoint& p) { bl -= p; tr -= p; } inline bool MWcoordRect::contains(const MWcoordPoint& p) const { return (bl <= p) && (p <= tr); } inline bool MWcoordRect::contains(const MWcoordRect& r) const { return (contains(r.bl) && contains(r.tr)); } inline bool MWcoordRect::intersects(const MWcoordRect& r) const { if (bl.max(r.bl) <= tr.min(r.tr)) return true; return false; } inline void MWcoordRect::moveTo(const MWcoordPoint& p) { tr += p-bl; bl = p; } // ################################################################ // ################## class MWpixelRect // ################################################################ class MWpixelRect { public: MWpixelRect(PixelCoord x0 = 0, PixelCoord y0 = 0, PixelCoord x1 = 0, PixelCoord y1 = 0) : bl(x0,y0), tr(x1,y1) {} MWpixelRect(const MWpixelPoint& p0, const MWpixelPoint& p1) : bl(p0), tr(p1) {} MWpixelRect(const MWpixelRect& r) : bl(r.origin()), tr(r.corner()) {} // ---- positions ---- MWpixelPoint origin() const { return bl; } MWpixelPoint origin(const MWpixelPoint& p) { return bl = p; } MWpixelPoint corner() const { return tr; } MWpixelPoint corner(const MWpixelPoint& p) { return tr = p; } MWpixelPoint topLeft() const { return MWpixelPoint(bl.x(),tr.y()); } MWpixelPoint topCenter() const { return MWpixelPoint((tr.x()+bl.x())/2,tr.y()); } MWpixelPoint topRight() const { return tr; } MWpixelPoint rightCenter() const { return MWpixelPoint(tr.x(),(tr.y()+bl.y())/2); } MWpixelPoint bottomRight() const { return MWpixelPoint(tr.x(),bl.y()); } MWpixelPoint bottomCenter() const { return MWpixelPoint((tr.x()+bl.x())/2,bl.y()); } MWpixelPoint bottomLeft() const { return bl; } MWpixelPoint leftCenter() const { return MWpixelPoint(bl.x(),(tr.y()+bl.y())/2); } MWpixelPoint center() const { return MWpixelPoint((tr.x()+bl.x())/2,(tr.y()+bl.y())/2); } PixelCoord left() const { return bl.x(); } PixelCoord right() const { return tr.x(); } PixelCoord top() const { return tr.y(); } PixelCoord bottom() const { return bl.y(); } // ---- measurements ---- MWpixelPoint extent() const { return MWpixelPoint(tr.x()-bl.x(),tr.y()-bl.y()); } PixelCoord area() const { return (tr.x()-bl.x())*(tr.y()-bl.y()); } PixelCoord width() const { return tr.x()-bl.x(); } PixelCoord height() const { return tr.y()-bl.y(); } // ---- operations ---- bool operator==(const MWpixelRect&) const; bool operator!=(const MWpixelRect& r) const { return !(*this==r); } MWpixelRect operator&&(const MWpixelRect&) const; // intersection MWpixelRect operator||(const MWpixelRect&) const; // union void operator+=(const MWpixelPoint&); // translate void operator-=(const MWpixelPoint&); bool contains(const MWpixelPoint&) const; bool contains(const MWpixelRect&) const; bool intersects(const MWpixelRect&) const; void moveTo(const MWpixelPoint&); private: MWpixelPoint bl; // bottom left corner (origin) MWpixelPoint tr; // top right corner (corner) }; inline bool MWpixelRect::operator==(const MWpixelRect& r) const { return (bl==r.bl && tr==r.tr); } inline MWpixelRect MWpixelRect::operator&&(const MWpixelRect& r) const { return MWpixelRect(bl.max(r.bl), tr.min(r.tr)); } inline MWpixelRect MWpixelRect::operator||(const MWpixelRect& r) const { return MWpixelRect(bl.min(r.bl), tr.max(r.tr)); } inline void MWpixelRect::operator+=(const MWpixelPoint& p) { bl += p; tr += p; } inline void MWpixelRect::operator-=(const MWpixelPoint& p) { bl -= p; tr -= p; } inline bool MWpixelRect::contains(const MWpixelPoint& p) const { return (bl <= p) && (p <= tr); } inline bool MWpixelRect::contains(const MWpixelRect& r) const { return (contains(r.bl) && contains(r.tr)); } inline bool MWpixelRect::intersects(const MWpixelRect& r) const { if (bl.max(r.bl) < tr.min(r.tr)) return true; return false; } inline void MWpixelRect::moveTo(const MWpixelPoint& p) { tr += p-bl; bl = p; } #endif /* Rect_h */ neuron-7.6.3/src/include/IV-Win/bitmap.h000066400000000000000000000053221340731477100177560ustar00rootroot00000000000000/* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // =========================================================================== // // // // MS-Windows implementation of the InterViews bitmap class. // // The windows data structure BITMAP is used until the bitmap is needed // for actual rendering in the canvas, at which time a temporary GDI object // is created. Operations on this bitmap are therefore very light-weight. // // // 1.1 // 1997/03/28 17:35:58 // // ======================================================================== #ifndef iv_win_bitmap_h #define iv_win_bitmap_h // ---- InterViews includes ---- #include #include // ---- windows includes ---- #include class BitmapRep { public: friend class MWcanvas32; friend class MWcanvas16; friend class CursorRep; enum { copy, fliph, flipv, rot90, rot180, rot270, inv }; BitmapRep(); BitmapRep(const void*, unsigned int, unsigned int, int, int); BitmapRep(const BitmapRep&); ~BitmapRep(); // ---- load from a resource ---- bool Load(const char* name); // ---- should phase this stuff out ------ Coord left_; Coord bottom_; Coord right_; Coord top_; Coord width_; Coord height_; // ---- data access functions ---- virtual void poke(bool set, int x, int y); // set or clear a bit virtual bool peek(int x, int y) const; // test a bit unsigned int pwidth() // width in pixels { return bm_.bmWidth; } unsigned int pheight() // height in pixels { return bm_.bmHeight; } protected: void SyncSize(); // sync size fields to bitmap size protected: // ---- windows bitmap representation ---- BITMAP bm_; // logical bitmap representation int hot_x_; // x-coordinate of hot spot (for cursors) int hot_y_; // y-coordinate of hot spot (for cursors) }; #endif neuron-7.6.3/src/include/IV-Win/brush.h000077500000000000000000000032501340731477100176260ustar00rootroot00000000000000/* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ========================================================================== // // // // // MS-Windows implementation of the InterViews Brush class // // If a programmer that needs full access to the windows capabilities and // can afford portability problems, this class can be manipulated directly // to control the pen and brush used in the canvas. The way to do this is: // // a) create the Brush instance. // b) fill in the BrushRep values desired. // c) use the Brush. // // // 1.1 // 1997/03/28 17:35:58 // // ======================================================================== #ifndef iv_win_brush_h #define iv_win_brush_h #include class BrushRep { public: DWORD* dashList; int dashCount; Coord penWidth; }; #endif neuron-7.6.3/src/include/IV-Win/canvas.h000066400000000000000000000251711340731477100177610ustar00rootroot00000000000000/* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ========================================================================= // // // // MS-Windows implementation of the InterView Canvas class. // // This canvas type renders into an MS-Windows window. Because it is // largely GDI based, most of the CanvasRep can be reused for printing // which also uses the GDI interface. // // True-Type fonts are used to provide scaling and rotation capabilies, // which greatly simplifies (and increases performance of) the font scale // and rotate capabilies of InterViews. This class is therefore dependant // upon MS-Windows 3.1 or later since that is the version that introduced // True-Type fonts. // // THIS FILE USED TO USE TEMPLATES, BUT WAS CONVERTED TO BE COMPATIBLE WITH // THE MICROSOFT COMPILER WHICH IS BEHIND THE TIMES!! // // 1.4 // 1999/07/05 15:34:37 // // ======================================================================== #ifndef ivwin_canvas_h #define ivwin_canvas_h // ---- InterViews includes ---- #include #include #include #include class BitmapRep; class WindowRep; class Canvas; class Display; class MWtransformPtrList; // PtrList class MWclipList; // List class MWcanvas : public Canvas { public: MWcanvas(); virtual ~MWcanvas(); void bind(WindowRep* w) // bind canvas to a window { win_ = w; } HDC hdcOf() const; // Returns the current device context of the canvas, or NULL if the // canvas is not currently drawable. virtual void beginPaint(HDC, const RECT&); virtual void endPaint(); // These two functions determine when the canvas can be rendered // upon, and when it can't. The canvas is not valid for drawing // outside of a begin/end pair. public: // ---------------- InterViews interface --------------------- virtual Window* window() const; virtual void size(Coord width, Coord height); virtual void psize(PixelCoord width, PixelCoord height); virtual Coord width() const; virtual Coord height() const; virtual PixelCoord pwidth() const; virtual PixelCoord pheight() const; virtual PixelCoord to_pixels(Coord, DimensionName) const; virtual Coord to_coord(PixelCoord, DimensionName) const; virtual void push_transform(); virtual void transform(const Transformer&); virtual void pop_transform(); virtual void transformer(const Transformer&); virtual const Transformer& transformer() const; virtual void push_clipping(bool all = false); virtual void pop_clipping(); virtual void front_buffer(); virtual void back_buffer(); virtual void damage(const Extension&); virtual void damage(Coord left, Coord bottom, Coord right, Coord top); virtual bool damaged(const Extension&) const; virtual bool damaged( Coord left, Coord bottom, Coord right, Coord top) const; virtual void damage_area(Extension&); virtual void damage_all(); virtual bool any_damage() const; virtual void restrict_damage(const Extension&); virtual void restrict_damage(Coord left, Coord bottom, Coord right, Coord top); virtual void redraw(Coord left, Coord bottom, Coord right, Coord top); virtual void repair(); Transformer& matrix() const; // current transformation matrix in effect for the rendering // surface. protected: void stencilFill(const Bitmap*, const Color*); // This function fills the current path with a stenciled pattern // in the given color. This function is basically used to simulate // the alpha blending of color which is not directly supported by // the GDI interface (ie PatBlt doesn't allow raster operations that // specify source as part of the operation... so no stencil). Since // the regions stenciled are typically not that large, this shouldn't // be too big of a shortcoming... it's too bad though because some // smart framebuffers can do this in hardware wicked-fast :-) // virtual void setmapmode(HDC); // the map mode generally uses cached information with // regard to the display. But for a MacPrinterCanvas // we use different info. protected: WindowRep* win_; // associated window Display* dpy; // display HDC drawable_; // display context to use for drawing bool transformed_; MWtransformPtrList* transformers_; // Transformation matrix. The transformed variable allows a fast // test to see if we have any transformations in effect. HRGN clipping_; MWclipList* clippers_; // ---- clipping support ---- // The region held in clipping_ is the current clipping region, and // can be changed by a new clip request via the clip function. The // region may be replaced, but the old region should be destroyed. // The clippers_ holds previous clip regions and should be adjusted // only by push and pop of the stack. private: MWcoordRect damageArea; // area of canvas currently damaged. This is maintained in terms of // world coordinates since it is used primarily by clients of the // canvas. MWpixelPoint pixelSize; // size of canvas in pixels. }; // ######################################################################### // ############# // ############# MWcanvas32 - Win32 specific canvas // ############# // ############# The following class is an implementation of the Win32 // ############# varient of functionality that differs between the versions // ############# of MS-Windows. The Win32 functionality uses the device- // ############# context in it's advanced mode using the path and world // ############# world coordinate transform support. // ############# // ######################################################################### #if 1//0 && (!defined(WIN32S)) && (!defined(WIN16)) class MWcanvas32 : public MWcanvas { public: MWcanvas32(); virtual ~MWcanvas32(); virtual void beginPaint(HDC hdc, const RECT& r); virtual void new_path(); virtual void move_to(Coord x, Coord y); virtual void line_to(Coord x, Coord y); virtual void curve_to(Coord x, Coord y, Coord x1, Coord y1, Coord x2, Coord y2); virtual void close_path(); virtual void stroke(const Color*, const Brush*); virtual void fill(const Color*); virtual void clip(); virtual void character(const Font*, long ch, Coord width, const Color*, Coord x, Coord y); virtual void stencil(const Bitmap*, const Color*, Coord x, Coord y); virtual void image(const Raster*, Coord x, Coord y); virtual void pop_transform(); virtual void transform(const Transformer& t); virtual void transformer(const Transformer& t); private: bool pathBracketStarted; }; #endif // ######################################################################### // ############# // ############# MWcanvas16 - Win16/Win32s // ############# // ############# The following class is an implementation of the Win16 // ############# varient of functionality. It provides extra code to // ############# implement transformations and paths in MS-Windows. // ############# // ######################################################################### class PathRenderInfo { public: Coord curx_; Coord cury_; POINT* point_; POINT* cur_point_; POINT* end_point_; }; class MWcanvas16 : public MWcanvas { public: MWcanvas16(); virtual ~MWcanvas16(); virtual void beginPaint(HDC, const RECT&); virtual void endPaint(); // These two functions determine when the canvas can be rendered // upon, and when it can't. The canvas is not valid for drawing // outside of a begin/end pair. virtual void new_path(); virtual void move_to(Coord x, Coord y); virtual void line_to(Coord x, Coord y); virtual void curve_to(Coord x, Coord y, Coord x1, Coord y1, Coord x2, Coord y2); virtual void close_path(); virtual void push_clipping(bool all = false); virtual void pop_clipping(); virtual void clip(); virtual void stroke(const Color*, const Brush*); virtual void fill(const Color*); virtual void character(const Font*, long ch, Coord width, const Color*, Coord x, Coord y); virtual void stencil(const Bitmap*, const Color*, Coord x, Coord y); virtual void image(const Raster*, Coord x, Coord y); virtual void push_transform(); virtual void pop_transform(); virtual void transform(const Transformer& t); virtual void transformer(const Transformer& t); virtual const Transformer& transformer() const; protected: void flush(); // flush any buffered operations int transformAngle() const; // determines the current transformation angle in terms of tenths // of a degree. Returns a number between 0 and 3600. // ---- attribute setting functions ---- void color(const Color*); void brush(const Brush*); void font(const Font*); private: HPEN pen_; // current pen to render with HBRUSH brush_; // current brush to render with LOGPEN pen_stats_; // what the pen was constructed from LOGBRUSH brush_stats_; // what the brush was constructed from HPEN old_pen_; // pen before our pen was selected into the DC HBRUSH old_brush_; // brush before our brush was selected into the DC // ---- logical attributes ----- const Color* lg_color_; // last IV color set const Brush* lg_brush_; // last IV brush set const Font* lg_font_; // last IV font set static PathRenderInfo path_; // path info (filled by Canvas members) // ---- text support ---- char* text_buff_; // text buffer char* text_ptr_; // pointer to current position in buffer int text_x0_; // x-coordinate of text start int text_y0_; // y-coordinate of text start int text_width_; // width of text string int text_x_ptr_; // x-coordinate of next insert position int text_y_ptr_; // y-coordinate of next insert position }; // ---- inline functions for MWcanvas ---- inline HDC MWcanvas::hdcOf() const { return drawable_; } #endif /* ivwin_canvas_h */ neuron-7.6.3/src/include/IV-Win/color.h000066400000000000000000000056611340731477100176260ustar00rootroot00000000000000/* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // =========================================================================== // // // // MS-Windows implementation of the InterViews Color classes. // // // 1.1 // 1997/03/28 17:36:00 // // ======================================================================== #ifndef iv_win_color_h #define iv_win_color_h #include #include class MWpalette; class Bitmap; class ColorRep { public: ColorRep(int r, int g, int b); ~ColorRep(); COLORREF msColor(); // mswin color representation static MWpalette* defaultPalette(); // default palette to use float alpha; ColorOp op; Bitmap* stipple; // stipple pattern static const char* nameToRGB(const char* colormap, const char* name); // translates a color name to the X11 string format of an rgb // specification (ie #??????). The colormap name is basically a // section in the colormap.ini file. static const Color* rgbToColor(const char* name); // translates an rgb string (#?????? format) to a color instance, // or returns null if there is a problem. This is for support of // X11 style color names. private: COLORREF color; }; inline COLORREF ColorRep::msColor() { return color; } class MWpalette { public: MWpalette(); // construct an empty palette MWpalette(LOGPALETTE*); // construct from logical palette ~MWpalette(); COLORREF addEntry(int r, int g, int b); // Add an entry into the palette for the given color rgb specification. // If the color already exists, nothing is done, otherwise it is added // and a reference is returned. bool findEntry(int r, int g, int b, COLORREF& value); // Looks for the given rgb color specification in the palette. If // found, true is returned and the value set to the corresponding // reference. int realizeInto(HDC, BOOL); private: class MWcolorTable* table; // color lookup table HPALETTE palette; // the MS-Windows palette int numEntries; // number of palette entries int palSize; // size of the palette }; #endif neuron-7.6.3/src/include/IV-Win/cursor.h000077500000000000000000000035701340731477100200250ustar00rootroot00000000000000/* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ======================================================================= // // // // MS-Windows implementation of the InterViews cursor class. // // The CursorRep class is basically a small wrapper around an MS-Widows // HCURSOR. Cursors have a lot of limitations in MS-Windows, so some // differences from the X11 counterpart are unavoidable. The biggest // difference is the lack of color (or lack documentation to make them color)! // // // 1.1 // 1997/03/28 17:36:01 // // ======================================================================== #ifndef iv_win_cursor_h #define iv_win_cursor_h #include class Color; class Display; class WindowVisual; class CursorRep { public: CursorRep(int); CursorRep(const char*); CursorRep(BitmapRep& data, BitmapRep& mask); CursorRep(short, short, const int* data, const int* mask); ~CursorRep(); HCURSOR cursorOf() { return cursor; } private: HCURSOR cursor; }; #endif neuron-7.6.3/src/include/IV-Win/event.h000066400000000000000000000147311340731477100176270ustar00rootroot00000000000000/* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ======================================================================= // // // // MS-Windows implementation of the InterViews Event classes. // // The flow of control is significantly different from X11 in MS-Windows. // Messages come from a callback rather than read from a socket, and the // messages are distributed to a WindowRep object. Therefore, the events // are actually created by a WindowRep-based object which then turns // around and calls EventRep::handleCallback(), which occurs as a result // of calling Event::handle() (which is what Session::run() does). This // should support modified event loops that programmers wrote rather // than using Session::run(). // // WARNING - Any assumption that the event is valid after a Session::read() // is guaranteed to be incorrect since the event is actually // filled out in the callback. The only safe thing to do after // a read is eventually call Event::handle()!! // // // The EventRep stores the type and button information directly as the // values used by the Event class. The modifier_ field contains keycode // information... MK_? if mouse event and VK_? if keyboard event. All // information is stashed directly in the EventRep with no translation // unless the information is asked for through the Event class. This is // to facilitate rapid creation since a large number of these will be // created (especially mouse motion events). // // // 1.1 // 1997/03/28 17:36:01 // // ======================================================================== #ifndef iv_win_event_h #define iv_win_event_h // ---- InterViews includes ---- #include #include #include // ---- MS-Windows includes ---- #include class EventRep { public: int typeOf(); // event type int buttonOf(); // mouse button bool isShift(); // is shift key pressed bool isControl(); // is control key pressed unsigned char keycode(); // key pressed Window* windowOf() const; // window associated with this event (message). void windowSet(Window* w); // set the window pointer: need this if you're faking an event // and the Event::window(Window*) call is apparently bad and therefore unsupported PixelCoord windowXpos() const; PixelCoord windowYpos() const; // fetch window-relative mouse pointer coordinates. These are // in terms of the InterViews coordinate system (not MS-Windows). // The pointer position is saved, and can be queried at any time, // independently of the message type of the event. PixelCoord displayXpos() const; PixelCoord displayYpos() const; // fetch display-relative mouse pointer coordinates. These are // in terms of the InterViews coordinate system (not MS-Windows). // The pointer position is saved, and can be queried at any time, // independently of the message type of the event. void setMessage(Window*, UINT, WPARAM, LPARAM); // establish the current message and parameters for this event // record. UINT messageOf() const; WPARAM wparamOf() const; LPARAM lparamOf() const; // fetch the raw message data. If an alternative form of the data // is available, it should be used to maximize portibility between // win16 and win32. static void handleCallback(Event&); // This function is called by WindowRep as a result an earlier call // to Event::handle(). public: LRESULT result; // message processing return value. This is the return value for // the WndProc() function that was registered as the callback function // for the MS-Window messages. This will be initialized to zero with // each message placed into this record for processing. If a return // other than zero is desired, it is up to the function processing // the message to place a different value in this field. MSG msg; // Current MS-Windows message being processed. This is basically // to support alternative event loops... ie via read() and handle() // calls. private: friend class WindowRep; // this class fills in the event info int type_; // Event::type enum int button_; // Event::button enum Window* window_; UINT message_; WPARAM wparam_; LPARAM lparam_; // These values are the message and it's parameters passed to the // WndProc() function that was registered as the callback function // for the MS-Window messages. The meaning of these is defined by // Microsoft as part of their API. WORD ptrX_; WORD ptrY_; // window relative pointer position. This is the value of the // pointer position in the last WM_MOUSEMOVE message. This is needed // to keep the pick requests working when a handler is being searched // for. }; // ---- inline functions for EventRep ---- inline int EventRep::typeOf() { return type_; } inline int EventRep::buttonOf() { return button_; } inline bool EventRep::isShift() { return (wparam_ & MK_SHIFT) ? 1 : 0; } inline bool EventRep::isControl() { return (wparam_ & MK_CONTROL) ? 1 : 0; } inline UINT EventRep::messageOf() const { return message_; } inline WPARAM EventRep::wparamOf() const { return wparam_; } inline LPARAM EventRep::lparamOf() const { return lparam_; } inline Window* EventRep::windowOf() const { return window_; } inline void EventRep::windowSet(Window* w) { window_ = w; } inline PixelCoord EventRep::windowXpos() const { return ptrX_ > 32768 ? ptrX_ - 0x10000 : ptrX_; } inline PixelCoord EventRep::windowYpos() const { Canvas* c = window_->canvas(); return (c->pheight() - ((ptrY_ > 32768)? ptrY_ - 0x10000 : ptrY_)); } #endif neuron-7.6.3/src/include/IV-Win/font.h000066400000000000000000000102641340731477100174510ustar00rootroot00000000000000/* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ========================================================================= // // // // MS-Windows implementation of the InterViews Font class. // // The font information is stored in a LOGFONT structure until the font is // needed, at which time it can be created with CreateFontIndirect(). Some // functions require a device context to get information (such as metrics), // so the desktop window is used for such requests. // // The user is given a constructor with a LOGFONT structure to use as a // reference. This is primarily for flexibility where one doesn't care // about portability (one really shouldn't use the FontRep directly). The // user is cautioned however that there is no guarantee the fields won't // be overwritten (lfEscapement and lfOrientation may change for example). // // // 1.1 // 1997/03/28 17:36:02 // // ======================================================================== #ifndef iv_win_font_h #define iv_win_font_h // ---- InterViews includes ---- #include // ---- MS-Windows includes ---- #include class FontRep { public: // ---- recognized style flags ---- enum { normal = 0, bold = 1, italic = 2, underline = 4, strikeout = 8 }; FontRep(const char* face_name, int height, int sytle_flags = normal); FontRep(LOGFONT&); ~FontRep(); // now storing with the font (hfont_) // HFONT Create(); // create for drawing... client responsible HFONT HFont(); // return the hfont_ void Scale(float); // scale the font int Height(); // return font height TEXTMETRIC& Metrics(); // return font metric information float CharWidth(int ch); // return width of a character bool AssociateWith(HDC); // associate with a device for metrics const char* TypefaceName(); // name of typeface void orientation(int); // Establish the orientation angle to render the font. The font // must be true-type for this function to affect the rendering. // The angle given is in tenths of a degree, 0 to 3600. This function // can be called repeatedly since the actual font is created when // needed and then destroyed. protected: bool CheckAssociation(); // makes sure metric data is available HWND fontWindow(); // window to get font information protected: LOGFONT font_; // font creation template HFONT hfont_; // the actual font TEXTMETRIC metrics; // metric info for the font float* char_widths_; // character width information }; // ---- FontRep inline functions ---- // now storing the HFONT representation with the font itself /* inline HFONT FontRep::Create() */ /* { */ /* return CreateFontIndirect(&font_); */ /* } */ inline int FontRep::Height() { return font_.lfHeight; } inline TEXTMETRIC& FontRep::Metrics() { CheckAssociation(); return metrics; } inline HFONT FontRep::HFont() { CheckAssociation(); return hfont_; } inline const char* FontRep::TypefaceName() { return font_.lfFaceName; } inline void FontRep::orientation(int angle) { font_.lfOrientation = angle; } class MWfamilyPtrList; class FontFamilyRep { public: FontFamilyRep(const char* family); ~FontFamilyRep(); bool font(int size, const char* style, // translate to font name const char*& name, float& scale); protected: static MWfamilyPtrList name_list_; char* family_name_; }; #endif // iv_win_font_h neuron-7.6.3/src/include/IV-Win/mprinter.h000066400000000000000000000047531340731477100203510ustar00rootroot00000000000000/* Copyright (C) 2002 Michael Hines This file contains programs and data originally developed by Michael Hines This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * MacPrinter - generate output for a mswindows printer. Derived from the * Mac version. */ #ifndef iv_mcprinter_h #define iv_mcprinter_h #include class MacPrinterCanvas; #include class MacPrinter : public Printer { public: MacPrinter(ostream* o = nil); virtual ~MacPrinter(); virtual Window* window() const; virtual Coord width() const; virtual Coord height() const; virtual PixelCoord pwidth() const; virtual PixelCoord pheight() const; virtual void transformer(const Transformer&); virtual const Transformer& transformer() const; virtual void resize(Coord left, Coord bottom, Coord right, Coord top); virtual bool get(); virtual void prolog(const char* creator = "InterViews"); void prolog(float scale); virtual void epilog(); virtual void setup(bool b = true); virtual void comment(const char*); virtual void page(const char*); virtual void push_transform(); virtual void transform(const Transformer&); virtual void pop_transform(); virtual void push_clipping(bool all = false); virtual void clip(); virtual void pop_clipping(); virtual void new_path(); virtual void move_to(Coord x, Coord y); virtual void line_to(Coord x, Coord y); virtual void curve_to( Coord x, Coord y, Coord x1, Coord y1, Coord x2, Coord y2 ); virtual void close_path(); virtual void stroke(const Color*, const Brush*); virtual void fill(const Color*); virtual void character( const Font*, long c, Coord width, const Color*, Coord x, Coord y ); virtual void stencil(const Bitmap*, const Color*, Coord x, Coord y); virtual void image(const Raster*, Coord x, Coord y); private: MacPrinterCanvas* c; }; #endif neuron-7.6.3/src/include/IV-Win/raster.h000077500000000000000000000034721340731477100200110ustar00rootroot00000000000000/* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ========================================================================= // // // // MS-Windows implementation of the InterViews Raster class. // // A memory device context is used to store the raster. The peek and poke // operations simply get translated to calls that get and set pixel values // the the memory device context. // // 1.1 // 1997/03/28 17:36:03 // // ======================================================================== #ifndef ivwin_raster_h #define ivwin_raster_h #include class RasterRep { public: RasterRep(HDC hdc); ~RasterRep(); HDC deviceContext() const; unsigned long width_; unsigned long height_; // dimensions of the display surface... a query with GetDeviceCaps // returns the incorrect numbers for a memory-based display context. private: HDC hdcMem; }; inline HDC RasterRep::deviceContext() const { return hdcMem; } #endif /* ivwin_raster_h */ neuron-7.6.3/src/include/IV-Win/session.h000066400000000000000000000107411340731477100201660ustar00rootroot00000000000000/* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ======================================================================= // // // // The MS-Windows implementation of the InterViews Session class. // // // 1.1 // 1997/03/28 17:36:04 // // ======================================================================== /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef ivwin_Session_h #define ivwin_Session_h #include class SessionRep { public: SessionRep(); ~SessionRep(); int run(); void load_app_defaults(Style*, const char* nm, int priority); // Load a file in the application defaults area with the name // "nm". The method of locating the application defaults directory // is platform dependent. public: const char* classname_; // The following are expected to be moved to the platform-independant // part (ie the Session class). public: void init( const char*, int& argc, char** argv, const OptionDesc*, const PropertyData* ); void parse_args(int& argc, char** argv, const OptionDesc*); bool match( const String& arg, const OptionDesc& o, int& i, int argc, char** argv ); void extract( const String& arg, const OptionDesc& o, int& i, int argc, char** argv, String& name, String& value ); void bad_arg(const char* fmt, const String& arg); String next_arg( int& i, int argc, char** argv, const char* message, const String& ); bool find_arg(const String& name, String& value); void init_style(const char*, const PropertyData*); String* find_name(); void load_props(Style*, const PropertyData*, int priority); void load_environment(Style*, int priority); void load_path(Style*, const char*, const char*, int priority); const char* home(); void load_file(Style*, const char* filename, int priority); void load_list(Style*, const String&, int priority); void load_property(Style*, const String&, int priority); String strip(const String&); void missing_colon(const String&); void bad_property_name(const String&); void bad_property_value(const String&); void init_display(); void connect(Display*); void set_style(Display*); bool check(Event&); private: friend class Session; String* name_; Style* style_; const PropertyData* props_; static Session* instance_; int argc_; char** argv_; Display* display_; bool done_; }; // ---- window classes registered ---- #define IV_WINDOW "ivWindow" #endif // iv_win_Session_h neuron-7.6.3/src/include/IV-Win/window.h000066400000000000000000000231641340731477100200150ustar00rootroot00000000000000/* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ======================================================================= // // // // MS-Windows implimentation of the InterViews Window classes. // // The WndProc callback procedure is used to dispatch the received messages // to their associated WindowRep instance. The common messages have a // corresponding function in the WindowRep class. Those messages not // directly turned into function calls have the opportunity to be trapped // by the Window::receive function... which gets an event with all of // the MS-Windows message data embedded into it. // // The ManagedWindowRep is associated with the ManagedWindow class, which // is a class of window that interacts with the window manager. Although // there is no seperate "Window Manager" in MS-Windows, the functionality // present in that class has equivalents in MS-Windows. // // // 1.1 // 1997/03/28 17:36:05 // // ======================================================================== #ifndef iv_win_window_h #define iv_win_window_h #include #include #include class Window; class Bitmap; class Handler; class ManagedWindow; class Style; class Glyph; class Cursor; class Event; class MWpalette; class MWcontrol; class MWcontrolTable; class MWcontrolHWND; class MWcreateParams; class MWcursorPtrList; class MWwindow { public: MWwindow(); virtual ~MWwindow(); // ---- typical window operations ---- void bind(); // bind to an MS-Windows window void unbind(); // unbind from MS-Windows window bool bound(); // bound to MS-Windows window? bool map(); // map the window to the display void unmap(); // unmap window from display bool isMapped(); // is window visible? // ---- window creation parameters ---- void windowTitle(const char*); void widthOf(int); void heightOf(int); void xposOf(int); void yposOf(int); void parentOf(HWND); void styleOf(DWORD); void styleOfEx(DWORD); void idOf(int); // ----- window class parameters ---- void windowClass(const char*); void classStyle(UINT); // The following function is the entry point from message callbacks. It // redistributes the messages into other member functions. This function // can be overriden as long as the base class is called to // translate any untrapped messages. virtual long WndProc(UINT message, WPARAM wParam, LPARAM lParam); void registerClass(HINSTANCE); // register Windows class // (if needed). HWND msWindow(); // associated MS-Windows window protected: HWND hwnd; // associated MS-Windows window private: MWcreateParams* params; // creation parameters protected: void resize(unsigned int w, unsigned int h); }; // The following are the window/class creation parameters. They are only // available until the window gets mapped (which is the time that they are // actually used). Since the window doesn't get mapped until after // construction, derived classes are free to change the window parameters // in their constructor and guarantee their effect. A constructor and // destructor are provided even though used as a structure, since this // guarantees creation defaults and freeing of sub-allocated storage. class MWcreateParams { public: MWcreateParams(); ~MWcreateParams(); // ---- window creation parameters ---- void titleOf(const char*); // set window title const char* titleOf(); // fetch window title UINT width; // width of the window UINT height; // height of the window UINT x; // x-coordinate screen position UINT y; // y-coordinate screen position HWND parent; // window parent (if any) DWORD style; // window style attributes DWORD styleEx; // extended window style attributes int id; // control/menu id // ---- class registration parameters ---- void classnameOf(const char*); // set window classname const char* classnameOf(); // fetch window classname UINT classStyle; // style of the class private: char* title; // title of window char* classname; // classname to register }; // ---- inline functions of MWwindow ---- inline bool MWwindow::bound() { return (hwnd) ? 1 : 0; } inline HWND MWwindow::msWindow() { return hwnd; } inline void MWwindow::windowTitle(const char* t) { MWassert(params); params->titleOf(t); } inline void MWwindow::widthOf(int w) { MWassert(params); params->width = w; } inline void MWwindow::heightOf(int h) { MWassert(params); params->height = h; } inline void MWwindow::parentOf(HWND p) { MWassert(params); params->parent = p; } inline void MWwindow::windowClass(const char* c) { MWassert(params); params->classnameOf(c); } inline void MWwindow::styleOf(DWORD s) { MWassert(params); params->style = s; } inline void MWwindow::styleOfEx(DWORD s) { MWassert(params); params->styleEx = s; } inline void MWwindow::xposOf(int xpos) { MWassert(params); params->x = xpos; } inline void MWwindow::yposOf(int ypos) { MWassert(params); params->y = ypos; } inline void MWwindow::classStyle(UINT sty) { MWassert(params); params->classStyle = sty; } inline void MWwindow::idOf(int id) { MWassert(params); params->id = id; } class MWchild { public: virtual void receive(Event&) = 0; // Child controls/menus receive events through this function. }; class EXPORT WindowRep : public MWwindow { public: WindowRep(Window*); ~WindowRep(); // The following function is the entry point from message callbacks. It // redistributes the messages into other member functions. This function // can be overriden as long as the base class is called to // translate any untrapped messages. virtual long WndProc(UINT message, WPARAM wParam, LPARAM lParam); // ---- Windows messages recognized ---- virtual long WMpaint(WPARAM wParam, LPARAM lParam); virtual long WMinput(WPARAM wParam, LPARAM lParam, int type, int button); virtual long WMsize(WPARAM wParam, LPARAM lParam); long childEvent(long id, Event& e); long childEventHWND(HWND h, Event& e); // distribute command/other messages to the C++ object that correponds // to the child-window control/menu item that is trying to tell us // something. The id is the identification of the control, and the // event contains the message information. void registerControl(long id, MWchild*); void registerControlHWND(HWND, MWchild*); // Register a predefined control, or custom control (really any // child window) with this window. This allows the window to route // child window callbacks to their C++ control object which handles // it as appropriate. static HWND mainWindow(); // handle of main (first) window static void errorMessage(const char*); // preliminary error handler Window* ivWindowOf() // associated IV window { return win; } void bind(); // bind to MS-Window & canvas void doubleBuffer(bool); // Turn double-buffering on if true, off if false. void frontBuffer(); // Set the window to be rendered upon in immediate mode. The // double buffered setting will have no effect when the front // buffer is set active. void backBuffer(); // Set the window to be rendered only upon receipt of WMpaint // messages. If double-buffered, that will take effect when // the back buffer is set active. public: MWcursorPtrList* cursor_stack_; Cursor* cursor_; UINT left_; UINT bottom_; bool request_on_resize_; protected: void rebuffer(); // rebuilds the memory-based image buffer used for double-buffering // the canvas display. private: Window* win; // associated InterViews window MWpalette* palette; // palette associated with window MWcontrolTable* controls; // hash table of registered controls MWcontrolHWND* cntrlHWND; // hash table of registered control handles bool doubleBuffered; // is window double-buffered? HBITMAP back_bitmap_; // bitmap associated with back buffer HDC frontBuff; // front buffer device context bool offscreen_; // WM_MOVE needs to redraw if portion // was off screen }; inline void WindowRep::doubleBuffer(bool b) { doubleBuffered = b; } // ####################################################################### // ################## ManagedWindowRep // ####################################################################### class ManagedWindowRep { public: ManagedWindowRep(ManagedWindow*); ~ManagedWindowRep(); // ---- Windows messages recognized ---- long WMminmax(WPARAM wParam, LPARAM lParam); long WMclose(WPARAM wParam, LPARAM lParam); private: ManagedWindow* win; // associated window public: Handler* wm_delete_; ManagedWindow* icon_; Bitmap* icon_bitmap_; Bitmap* icon_mask_; Window* group_leader_; Window* transient_for_; //void do_set(Window*, HintFunction); }; #endif neuron-7.6.3/src/include/IV-X11/000077500000000000000000000000001340731477100161435ustar00rootroot00000000000000neuron-7.6.3/src/include/IV-X11/Xdefs.h000077500000000000000000000004621340731477100173720ustar00rootroot00000000000000#undef Bitmap #undef Colormap #undef Cursor #undef Display #undef Drawable #undef Font #undef Screen #undef Window #define Bitmap XBitmap #define Colormap XColormap #define Cursor XCursor #define Display XDisplay #define Drawable XDrawable #define Font XFont #define Screen XScreen #define Window XWindow neuron-7.6.3/src/include/IV-X11/Xext.h000077500000000000000000000060171340731477100172530ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef IV_X11_Xext_h #define IV_X11_Xext_h extern "C" { #include #define XShapeQueryExtension cc_XShapeQueryExtension #define XShapeQueryVersion cc_XShapeQueryVersion #define XShapeCombineRegion cc_XShapeCombineRegion #define XShapeCombineRectangles cc_XShapeCombineRectangles #define XShapeCombineMask cc_XShapeCombineMask #define XShapeCombineShape cc_XShapeCombineShape #define XShapeOffsetShape cc_XShapeOffsetShape #define XShapeQueryExtents cc_XShapeQueryExtents #define XShapeSelectInput cc_XShapeSelectInput #define XShapeInputSelected cc_XShapeInputSelected #define XShapeGetRectangles cc_XShapeGetRectangles #include #include #undef XShapeQueryExtension #undef XShapeQueryVersion #undef XShapeCombineRegion #undef XShapeCombineRectangles #undef XShapeCombineMask #undef XShapeCombineShape #undef XShapeOffsetShape #undef XShapeQueryExtents #undef XShapeSelectInput #undef XShapeInputSelected #undef XShapeGetRectangles Bool XShapeQueryExtension (Display*, int*, int*); Status XShapeQueryVersion (Display*, int*, int*); void XShapeCombineRegion (Display*, XWindow, int, int, int, Region, int); void XShapeCombineRectangles ( Display*, XWindow, int, int, int, XRectangle*, int, int, int ); void XShapeCombineMask (Display*, XWindow, int, int, int, Pixmap, int); void XShapeCombineShape (Display*, XWindow, int, int, int, XWindow, int, int); void XShapeOffsetShape (Display*, XWindow, int, int, int); Status XShapeQueryExtents ( Display*, XWindow, Bool*, int*, int*, unsigned int*, unsigned int*, Bool*, int*, int*, unsigned int*, unsigned int* ); void XShapeSelectInput (Display*, XWindow, Bool); unsigned long XShapeInputSelected (Display*, XWindow); XRectangle *XShapeGetRectangles (Display*, XWindow, int, int*, int*); #include } #endif neuron-7.6.3/src/include/IV-X11/Xlib.h000077500000000000000000000032611340731477100172170ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * C++ interface to standard Xlib.h. */ #ifndef InterViews_Xlib_h #define InterViews_Xlib_h extern "C" { #ifdef AIXV3 struct _XDisplay; struct _XFreeFuncs; struct _XSQEvent; struct _XExten; struct _XKeytrans; struct _XDisplayAtoms; struct _XContextDB; struct _XIMFilter; struct _XrmHashBucketRec; #endif #ifdef __DECCXX struct _XDisplay; struct _XPrivate; struct _XrmHashBucketRec; #endif #include #include #include } #endif neuron-7.6.3/src/include/IV-X11/Xundefs.h000077500000000000000000000006461340731477100177410ustar00rootroot00000000000000#undef Bitmap #undef Colormap #undef Cursor #undef Display #undef Drawable #undef Font #undef Screen #undef Window #define Bitmap _lib_iv(Bitmap) #define Colormap _lib_iv(Colormap) #define Cursor _lib_iv(Cursor) #define Display _lib_iv(Display) #define Drawable _lib_iv(Drawable) #define Font _lib_iv(Font) #define Screen _lib_iv(Screen) #define Window _lib_iv(Window) #ifdef iv__2_6_h #include #endif neuron-7.6.3/src/include/IV-X11/Xutil.h000077500000000000000000000045411340731477100174300ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef IV_X11_Xutil_h #define IV_X11_Xutil_h #include extern "C" { #include #include #include } /* * These are macros that make use of untype-checking pointers to functions. */ #undef XDestroyImage #undef XGetPixel #undef XPutPixel #undef XSubImage #undef XAddPixel inline int XDestroyImage(XImage* i) { typedef int (*PF)(XImage*); return (*((PF)i->f.destroy_image))(i); } inline unsigned long XGetPixel(XImage* i, int x, int y) { typedef unsigned long (*PF)(XImage*, int, int); return (*((PF)i->f.get_pixel))(i, x, y); } inline int XPutPixel(XImage* i, int x, int y, unsigned long pixel) { typedef int (*PF)(XImage*, int, int, unsigned long); return (*((PF)i->f.put_pixel))(i, x, y, pixel); } inline XImage* XSubImage( XImage* i, int x, int y, unsigned int width, unsigned int height ) { typedef XImage* (*PF)(XImage*, int, int, unsigned int, unsigned int); return (*((PF)i->f.sub_image))(i, x, y, width, height); } inline int XAddPixel(XImage* i, long value) { typedef int (*PF)(XImage*, long); return (*((PF)i->f.add_pixel))(i, value); } #endif neuron-7.6.3/src/include/IV-X11/xbitmap.h000066400000000000000000000034661340731477100177710ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv_xbitmap_h #define iv_xbitmap_h #include #include #include class BitmapRep { public: enum { copy, fliph, flipv, rot90, rot180, rot270, inv }; BitmapRep(); BitmapRep(BitmapRep*, unsigned int); ~BitmapRep(); void fill(); void flush(); Display* display_; XImage* image_; Pixmap pixmap_; Coord left_; Coord bottom_; Coord right_; Coord top_; Coord width_; Coord height_; unsigned int pwidth_; unsigned int pheight_; bool modified_; }; #include #endif neuron-7.6.3/src/include/IV-X11/xbrush.h000077500000000000000000000026621340731477100176400ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv_xbrush_h #define iv_xbrush_h class Display; class BrushRep { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif Display* display_; char* dash_list_; int dash_count_; int width_; }; #endif neuron-7.6.3/src/include/IV-X11/xcanvas.h000066400000000000000000000067301340731477100177650ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv_xcanvas_h #define iv_xcanvas_h #include #include #include #include class ClippingStack; class Display; class TransformerStack; class CanvasDamage { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif Coord left; Coord bottom; Coord right; Coord top; }; class TextRenderInfo { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif CanvasRep* canvas_; GC drawgc_; int x0_; int y0_; Coord width_; Coord curx_; Coord cury_; char* text_; char* cur_text_; int spaces_; XTextItem* items_; }; class PathRenderInfo { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif Coord curx_; Coord cury_; XPoint* point_; XPoint* cur_point_; XPoint* end_point_; }; class CanvasRep { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif Display* display_; Window* window_; XDrawable xdrawable_; Coord width_; Coord height_; PixelCoord pwidth_; PixelCoord pheight_; bool damaged_ : 1; bool on_damage_list_ : 1; bool repairing_ : 1; CanvasDamage damage_; XDrawable drawbuffer_; XDrawable copybuffer_; XRectangle clip_; const Brush* brush_; const Color* color_; const Font* font_; Region clipping_; Region empty_; GC drawgc_; GC copygc_; int op_; Pixmap stipple_; unsigned long pixel_; int brush_width_; char* dash_list_; int dash_count_; XFontStruct* xfont_; bool text_twobyte_; bool text_reencode_; bool font_is_scaled_; bool transformed_; TransformerStack* transformers_; ClippingStack* clippers_; static TextRenderInfo text_; static PathRenderInfo path_; enum { unbound = 0 }; XDisplay* dpy() const; Transformer& matrix() const; void flush(); void swapbuffers(); void brush(const Brush*); void color(const Color*); void font(const Font*); void new_damage(); void clear_damage(); bool start_repair(); void finish_repair(); void bind(bool double_buffered); void unbind(); /* for backward compability */ public: CanvasLocation status_; void wait_for_copy(); }; #include #endif neuron-7.6.3/src/include/IV-X11/xcolor.h000066400000000000000000000032341340731477100176240ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * X11-dependent Color representation. */ #ifndef iv_colorrep_h #define iv_colorrep_h #include #include #include #include class WindowVisual; class ColorRep { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif WindowVisual* visual_; ColorOp op_; bool masking_; XColor xcolor_; Pixmap stipple_; }; #include #endif neuron-7.6.3/src/include/IV-X11/xcursor.h000077500000000000000000000064121340731477100200270ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv_xcursor_h #define iv_xcursor_h #include #include class Color; class Display; class Style; class WindowVisual; class CursorRep { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif const Color* fg_; const Color* bg_; Display* display_; XCursor xcursor_; CursorRep(const Color* fg, const Color* bg); virtual ~CursorRep(); XCursor xid(Display*, WindowVisual*); virtual void make_xcursor(Display*, WindowVisual*) = 0; const Color* make_color( Display*, Style*, const char* str1, const char* str2, const char* str3, const char* default_value ); }; class CursorRepData : public CursorRep { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif short x_, y_; const int* pat_; const int* mask_; CursorRepData( short x_hot, short y_hot, const int* pat, const int* mask, const Color* fg, const Color* bg ); virtual ~CursorRepData(); virtual void make_xcursor(Display*, WindowVisual*); Pixmap make_cursor_pixmap(XDisplay*, XWindow, const int* scanline); }; class CursorRepBitmap : public CursorRep { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif const Bitmap* pat_; const Bitmap* mask_; CursorRepBitmap( const Bitmap* pat, const Bitmap* mask, const Color* fg, const Color* bg ); virtual ~CursorRepBitmap(); virtual void make_xcursor(Display*, WindowVisual*); }; class CursorRepFont : public CursorRep { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif const Font* font_; int pat_; int mask_; CursorRepFont( const Font*, int pat, int mask, const Color* fg, const Color* bg ); virtual ~CursorRepFont(); virtual void make_xcursor(Display*, WindowVisual*); }; class CursorRepXFont : public CursorRep { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif int code_; CursorRepXFont(int code, const Color* fg, const Color* bg); virtual ~CursorRepXFont(); virtual void make_xcursor(Display*, WindowVisual*); }; #include #endif neuron-7.6.3/src/include/IV-X11/xdisplay.h000077500000000000000000000041601340731477100201550ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * X11-dependent Display representation. */ #ifndef iv_xdisplay_h #define iv_xdisplay_h #include #include #include #include #include #include class ColorTable; class DamageList; class GrabList; class RGBTable; class SelectionList; class String; class Transformer; class Window; class WindowTable; class DisplayRep { public: XDisplay* display_; unsigned int screen_; XWindow root_; WindowVisualList visuals_; WindowVisual* default_visual_; Coord width_; Coord height_; unsigned int pwidth_; unsigned int pheight_; Style* style_; GrabList* grabbers_; DamageList* damaged_; SelectionList* selections_; WindowTable* wtable_; void set_dpi(Coord&); void needs_repair(Window*); void remove(Window*); }; #include #endif neuron-7.6.3/src/include/IV-X11/xdrag.h000066400000000000000000000026561340731477100174320ustar00rootroot00000000000000/* * Copyright (c) 1992 Redwood Design Automation * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the name of * Redwood Design Automation may not be used in any advertising or publicity * relating to the software without the specific, prior written permission of * Redwood Design Automation. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL REDWOOD DESIGN AUTOMATION BE LIABLE FOR ANY SPECIAL, * INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT * ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ #ifndef iv_xdrag_h #define iv_xdrag_h #include class XDrag { public: // these are used by xevent to detect and interpret a drag client message. static bool isDrag(const XEvent&); static void locate(const XEvent&, int& x, int& y); }; #include #endif neuron-7.6.3/src/include/IV-X11/xevent.h000066400000000000000000000035151340731477100176310ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * X11-dependent Event representation. */ #ifndef iv_xevent_h #define iv_xevent_h #include #include #include #include class Display; class Window; class EventRep { public: XEvent xevent_; Display* display_; Window* window_; Coord pointer_x_; Coord pointer_y_; Coord pointer_root_x_; Coord pointer_root_y_; void clear(); void locate(); bool has_pointer_location(); void acknowledge_motion(); private: bool location_valid_; bool has_pointer_location_; }; #include #endif neuron-7.6.3/src/include/IV-X11/xfont.h000066400000000000000000000042031340731477100174510ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * X11-dependent Font representation. */ #ifndef iv_xfont_h #define iv_xfont_h #include #include #include #include class Display; class KnownFonts; class String; class FontRep : public Resource { public: FontRep(Display*, XFontStruct*, float); ~FontRep(); Display* display_; XFontStruct* font_; float scale_; bool unscaled_; String* name_; String* encoding_; float size_; KnownFonts* entry_; }; class FontFamilyRep { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif Display* display_; int count_; int min_weight_; int max_weight_; int min_width_; int max_width_; int min_slant_; int max_slant_; int min_size_; int max_size_; char** names_; int* weights_; int* slants_; int* widths_; int* sizes_; }; #include #endif neuron-7.6.3/src/include/IV-X11/xpainter.h000066400000000000000000000036201340731477100201470ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * X11-dependent painter interface. */ #ifndef iv_xpainter_h #define iv_xpainter_h #include class Brush; class Pattern; class Transformer; class PainterRep { public: PainterRep(); ~PainterRep(); void PrepareFill(const Pattern*); void PrepareDash(const Brush*); GC fillgc; GC dashgc; bool fillbg; bool overwrite; bool iv_xor; bool clipped; Display* display; XRectangle xclip[1]; }; void DrawTransformedImage( XImage* src, int sx0, int sy0, XImage* mask, int mx0, int my0, XDrawable d, unsigned int height, int dx0, int dy0, bool stencil, unsigned long fg, unsigned long bg, GC gc, const Transformer& matrix ); #endif neuron-7.6.3/src/include/IV-X11/xpattern.h000077500000000000000000000027531340731477100201730ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv_xpattern_h #define iv_xpattern_h #include #include class Display; class PatternRep { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif Display* display_; Pixmap pixmap_; }; #include #endif neuron-7.6.3/src/include/IV-X11/xraster.h000066400000000000000000000034121340731477100200040ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * X11-dependent Raster representation. */ #ifndef iv_xraster_h #define iv_xraster_h #include #include #include class Display; class RasterRep { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif Display* display_; bool modified_; Coord left_; Coord bottom_; Coord right_; Coord top_; Coord width_; Coord height_; unsigned int pwidth_; unsigned int pheight_; XImage* image_; Pixmap pixmap_; GC gc_; }; #include #endif neuron-7.6.3/src/include/IV-X11/xselection.h000077500000000000000000000035451340731477100205030ustar00rootroot00000000000000/* * Copyright (c) 1992 Stanford University * Copyright (c) 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv_xselection_h #define iv_xselection_h #include #include class PopupWindow; class SelectionManagerRep { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif XDisplay* xdisplay_; String* name_; XSelectionRequestEvent x_req_; PopupWindow* owner_; SelectionHandler* convert_; SelectionHandler* lose_; SelectionHandler* done_; SelectionHandler* ok_; SelectionHandler* fail_; SelectionManagerRep(Display*, const String&); ~SelectionManagerRep(); void request(SelectionManager*, const XSelectionRequestEvent&); void notify(SelectionManager*, const XSelectionEvent&); }; #endif neuron-7.6.3/src/include/IV-X11/xwindow.h000066400000000000000000000157441340731477100200260ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv_xwindow_h #define iv_xwindow_h #include #include #include #include #include #include class Bitmap; class ColorTable; class Cursor; class Display; class Glyph; class Handler; class ManagedWindow; class ManagedWindowRep; class RGBTable; class String; class Style; class WindowCursorStack; class WindowTable; struct WindowOverlayInfo { VisualID id_; long type_; long transparent_; long layer_; }; struct WindowVisualInfo { XDisplay* display_; int screen_; int depth_; Visual* visual_; XColormap cmap_; WindowOverlayInfo overlay_; }; class WindowVisual { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif WindowVisual(const WindowVisualInfo&); ~WindowVisual(); static WindowVisual* find_visual(Display*, Style*); void init_color_tables(); void find_color(unsigned long, XColor&); void find_color( unsigned short r, unsigned short g, unsigned short b, XColor& ); unsigned long iv_xor(const Style&) const; XDisplay* display() const; int screen() const; int depth() const; Visual* visual() const; XColormap colormap() const; private: WindowVisualInfo info_; ColorTable* ctable_; RGBTable* rgbtable_; XColor* localmap_; unsigned int localmapsize_; unsigned long red_; unsigned long red_shift_; unsigned long green_; unsigned long green_shift_; unsigned long blue_; unsigned long blue_shift_; unsigned long white_; unsigned long xor_; static void find_visual_by_class_name(const String&, WindowVisualInfo&); static bool find_layer(const String&, int& layer); static void find_overlay(int layer, WindowVisualInfo&); static void find_visual_by_info( XVisualInfo&, long mask, WindowVisualInfo& ); void set_shift(unsigned long mask, unsigned long& v, unsigned long& shift); static unsigned int MSB(unsigned long); static double distance( unsigned short r, unsigned short g, unsigned short b, const XColor& ); static unsigned long rescale( unsigned long value, unsigned long in_scale, unsigned long out_scale ); }; inline XDisplay* WindowVisual::display() const { return info_.display_; } inline int WindowVisual::screen() const { return info_.screen_; } inline int WindowVisual::depth() const { return info_.depth_; } inline Visual* WindowVisual::visual() const { return info_.visual_; } inline XColormap WindowVisual::colormap() const { return info_.cmap_; } declarePtrList(WindowVisualList,WindowVisual) class WindowRep { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif Glyph* glyph_; Style* style_; Display* display_; WindowVisual* visual_; Canvas* canvas_; Requisition shape_; Allocation allocation_; Cursor* cursor_; WindowCursorStack* cursor_stack_; Coord left_; Coord bottom_; float xalign_; float yalign_; Handler* focus_in_; Handler* focus_out_; Handler* wm_delete_; XWindow xwindow_; XSetWindowAttributes xattrs_; unsigned long xattrmask_; unsigned int xclass_; int xpos_; int ypos_; Window* toplevel_; XWindow xtoplevel_; bool placed_ : 1; bool aligned_ : 1; bool needs_resize_ : 1; bool resized_ : 1; bool moved_ : 1; bool unmapped_ : 1; bool wm_mapped_ : 1; bool map_pending_ : 1; static Atom wm_delete_atom_; static Atom wm_protocols_atom_; enum { unbound = 0 }; XDisplay* dpy(); Atom wm_delete_atom(); Atom wm_protocols_atom(); void clear_mapping_info(); void map_notify(Window*, XMapEvent&); void unmap_notify(Window*, XUnmapEvent&); void expose(Window*, XExposeEvent&); void configure_notify(Window*, XConfigureEvent&); void move(Window*, int x, int y); void resize(Window*, unsigned int w, unsigned int h); void check_position(const Window*); void check_binding(Window*); void do_bind(Window*, XWindow parent, int left, int top); void init_renderer(Window*); // some complicated windows need a full request on a resize. Otherwise // sliders and graph views do not fit in their box. Note that // a full request necessitates the invalidation of any box in the window. // and that is accomplished by a temporary setting of // a static flag for Box which is checked when the Box::request is called. bool request_on_resize_; static Window* find(XWindow, WindowTable*); }; class ManagedWindowHintInfo { private: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif friend class ManagedWindowRep; Style* style_; XWMHints* hints_; XDisplay* dpy_; XWindow xwindow_; unsigned int pwidth_; unsigned int pheight_; Display* display_; }; typedef bool (ManagedWindowRep::*HintFunction)(ManagedWindowHintInfo&); class ManagedWindowRep { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif ManagedWindow* icon_; Bitmap* icon_bitmap_; Bitmap* icon_mask_; Window* group_leader_; Window* transient_for_; void do_set(Window*, HintFunction); bool set_name(ManagedWindowHintInfo&); bool set_geometry(ManagedWindowHintInfo&); bool set_group_leader(ManagedWindowHintInfo&); bool set_transient_for(ManagedWindowHintInfo&); bool set_icon_name(ManagedWindowHintInfo&); bool set_icon_geometry(ManagedWindowHintInfo&); bool set_icon(ManagedWindowHintInfo&); bool set_icon_bitmap(ManagedWindowHintInfo&); bool set_icon_mask(ManagedWindowHintInfo&); bool set_all(ManagedWindowHintInfo&); void wm_normal_hints(Window*); void wm_name(Window*); void wm_class(Window*); void wm_protocols(Window*); void wm_colormap_windows(Window*); void wm_hints(Window*); }; #include #endif neuron-7.6.3/src/include/IV-look/000077500000000000000000000000001340731477100165365ustar00rootroot00000000000000neuron-7.6.3/src/include/IV-look/bevel.h000066400000000000000000000074521340731477100200140ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Bevel - beveled framing of a glyph */ #ifndef ivlook_bevel_h #define ivlook_bevel_h #include class BevelFrame : public MonoGlyph { public: BevelFrame( Glyph*, Coord, float xalign = 0.0, float yalign = 0.0, bool hmargin = true, bool vmargin = true ); virtual ~BevelFrame(); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void print(Printer*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); virtual void draw_frame(Canvas*, const Allocation&, Coord thickness) const; private: Coord thickness_; float xalign_; float yalign_; bool hmargin_ : 1; bool vmargin_ : 1; Coord thickness(Canvas*) const; void allocate_body(Glyph*, Coord, Allocation&) const; }; class Color; typedef void (*Beveler)( Canvas*, const Color* light, const Color* medium, const Color* dark, Coord thickness, Coord left, Coord bottom, Coord right, Coord top ); class Bevel : public BevelFrame { public: Bevel( Glyph*, Beveler, const Color* light, const Color* medium, const Color* dark, Coord thickness, float xalign = 0.0, float yalign = 0.0, bool hmargin = true, bool vmargin = true ); virtual ~Bevel(); virtual void draw_frame(Canvas*, const Allocation&, Coord thickness) const; static void rect( Canvas*, const Color* light, const Color* medium, const Color* dark, Coord thickness, Coord left, Coord bottom, Coord right, Coord top ); static void left_arrow( Canvas*, const Color* light, const Color* medium, const Color* dark, Coord thickness, Coord left, Coord bottom, Coord right, Coord top ); static void right_arrow( Canvas*, const Color* light, const Color* medium, const Color* dark, Coord thickness, Coord left, Coord bottom, Coord right, Coord top ); static void up_arrow( Canvas*, const Color* light, const Color* medium, const Color* dark, Coord thickness, Coord left, Coord bottom, Coord right, Coord top ); static void down_arrow( Canvas*, const Color* light, const Color* medium, const Color* dark, Coord thickness, Coord left, Coord bottom, Coord right, Coord top ); static void diamond( Canvas*, const Color* light, const Color* medium, const Color* dark, Coord thickness, Coord left, Coord bottom, Coord right, Coord top ); private: Beveler beveler_; const Color* light_; const Color* medium_; const Color* dark_; Coord thickness(Canvas*) const; void allocate_body(Glyph*, Coord, Allocation&) const; }; #endif neuron-7.6.3/src/include/IV-look/browser.h000066400000000000000000000043421340731477100203750ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Browser -- select an item */ #ifndef ivlook_browser_h #define ivlook_browser_h #include #include class Action; class BrowserList; class TelltaleState; class Browser : public InputHandler, public Observer { public: Browser(Glyph*, Style*, Action* accept, Action* cancel); virtual ~Browser(); virtual void append_selectable(TelltaleState*); virtual void replace_selectable(GlyphIndex, TelltaleState*); virtual void remove_selectable(GlyphIndex); virtual TelltaleState* state(GlyphIndex) const; virtual void select(GlyphIndex); virtual GlyphIndex selected() const; virtual void choose(GlyphIndex) const; virtual void cancel(); virtual void press(const Event&); virtual void drag(const Event&); virtual void release(const Event&); virtual void double_click(const Event&); virtual void update(Observable*); private: Action* accept_; Action* cancel_; BrowserList* items_; GlyphIndex item_; void active(GlyphIndex i, bool); }; #endif neuron-7.6.3/src/include/IV-look/button.h000077500000000000000000000037301340731477100202300ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Button - clickable Action */ #ifndef ivlook_button_h #define ivlook_button_h #include #include #include class Action; class TelltaleState; class Button : public ActiveHandler, public Observer { public: Button(Glyph*, Style*, TelltaleState*, Action*); virtual ~Button(); virtual void state(TelltaleState*); virtual TelltaleState* state() const; virtual void action(Action*); virtual Action* action() const; virtual void enter(); virtual void leave(); virtual void press(const Event&); virtual void release(const Event&); virtual void update(Observable*); private: TelltaleState* state_; Action* action_; }; #include #endif neuron-7.6.3/src/include/IV-look/choice.h000077500000000000000000000040601340731477100201440ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef ivlook_choice_h #define ivlook_choice_h /* * ChoiceItem - telltale with different look for each state */ #include class Deck; class ChoiceItem : public Telltale { public: ChoiceItem(TelltaleState*); ChoiceItem(TelltaleState*, Glyph* normal, Glyph* pressed); ChoiceItem( TelltaleState*, Glyph* disabled, Glyph* enabled, Glyph* visible, Glyph* visible_active, Glyph* active, Glyph* chosen, Glyph* visible_chosen, Glyph* active_chosen, Glyph* visible_active_chosen, Glyph* disabled_chosen ); virtual ~ChoiceItem(); virtual void look( const TelltaleFlags include, const TelltaleFlags exclude, Glyph* ); virtual Glyph* look(const TelltaleFlags) const; virtual void update(Observable*); private: Deck* deck_; GlyphIndex index_[TelltaleState::max_flags]; void init(); }; #endif neuron-7.6.3/src/include/IV-look/dialogs.h000077500000000000000000000045151340731477100203410ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * DialogKit -- object for creating common dialog boxes */ #ifndef ivlook_dialogs_h #define ivlook_dialogs_h #include #include #include class DialogKitImpl; class String; class Style; class WidgetKit; class DialogKit { protected: DialogKit(); public: static DialogKit* instance(); virtual ~DialogKit(); virtual WidgetKit* widget_kit() const; virtual FieldEditor* field_editor( const char* sample, Style*, FieldEditorAction* = nil ) const; virtual FieldEditor* field_editor( const String& sample, Style*, FieldEditorAction* = nil ) const; virtual FileChooser* file_chooser( const char* dir, Style*, FileChooserAction* = nil ) const; virtual FileChooser* file_chooser( const String& dir, Style*, FileChooserAction* = nil ) const; virtual FieldEditor* make_field_editor( const String& sample, WidgetKit*, Style*, FieldEditorAction* = nil ) const; virtual FileChooser* make_file_chooser( const String& dir, WidgetKit*, Style*, FileChooserAction* = nil ) const; private: DialogKitImpl* impl_; }; #include #endif neuron-7.6.3/src/include/IV-look/fbrowser.h000077500000000000000000000035661340731477100205550ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * FileBrowser -- browse a directory */ #ifndef ivlook_fbrowser_h #define ivlook_fbrowser_h #include class Adjustable; class FileBrowserImpl; class WidgetKit; class FileBrowser : public Browser { public: FileBrowser(WidgetKit*, Action* accept, Action* cancel); virtual ~FileBrowser(); virtual void press(const Event&); virtual void drag(const Event&); virtual void release(const Event&); virtual void keystroke(const Event&); virtual InputHandler* focus_in(); virtual void focus_out(); virtual void select(GlyphIndex); virtual Adjustable* adjustable() const; virtual void refresh(); private: FileBrowserImpl* impl_; }; #endif neuron-7.6.3/src/include/IV-look/fchooser.h000066400000000000000000000061261340731477100205240ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * FileChooser -- select a file */ #ifndef ivlook_fchooser_h #define ivlook_fchooser_h #include #include #include class FileChooser; class FileChooserImpl; class String; class WidgetKit; class FileChooserAction : public Resource { protected: FileChooserAction(); virtual ~FileChooserAction(); public: virtual void execute(FileChooser*, bool accept); }; #if 1 || defined(__STDC__) || defined(__ANSI_CPP__) #define FileChooserCallback(T) T##_FileChooserCallback #define FileChooserMemberFunction(T) T##_FileChooserMemberFunction #else #define FileChooserCallback(T) T/**/_FileChooserCallback #define FileChooserMemberFunction(T) T/**/_FileChooserMemberFunction #endif #define declareFileChooserCallback(T) \ typedef void (T::*FileChooserMemberFunction(T))(FileChooser*, bool); \ class FileChooserCallback(T) : public FileChooserAction { \ public: \ FileChooserCallback(T)(T*, FileChooserMemberFunction(T)); \ virtual ~FileChooserCallback(T)(); \ \ virtual void execute(FileChooser*, bool accept); \ private: \ T* obj_; \ FileChooserMemberFunction(T) func_; \ }; #define implementFileChooserCallback(T) \ FileChooserCallback(T)::FileChooserCallback(T)( \ T* obj, FileChooserMemberFunction(T) func \ ) { \ obj_ = obj; \ func_ = func; \ } \ \ FileChooserCallback(T)::~FileChooserCallback(T)() { } \ \ void FileChooserCallback(T)::execute(FileChooser* f, bool accept) { \ FileChooserMemberFunction(T) pf = func_; \ (obj_->*pf)(f, accept); \ } class FileChooser : public Dialog { public: FileChooser( const String& dir, WidgetKit*, Style*, FileChooserAction* = nil ); virtual ~FileChooser(); virtual const String* selected() const; virtual const String* dir() const; virtual void reread(); virtual void dismiss(bool); private: FileChooserImpl* impl_; }; #include #endif neuron-7.6.3/src/include/IV-look/field.h000077500000000000000000000077371340731477100200130ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * FieldEditor -- simple editor for text fields */ #ifndef ivlook_field_h #define ivlook_field_h #include #include class FieldEditor; class FieldEditorImpl; class String; class Style; class WidgetKit; class FieldEditorAction : public Resource { protected: FieldEditorAction(); virtual ~FieldEditorAction(); public: virtual void accept(FieldEditor*); virtual void cancel(FieldEditor*); }; #if 1 || defined(__STDC__) || defined(__ANSI_CPP__) #define __FieldEditorCallback(T) T##_FieldEditorCallback #define FieldEditorCallback(T) __FieldEditorCallback(T) #define __FieldEditorMemberFunction(T) T##_FieldEditorMemberFunction #define FieldEditorMemberFunction(T) __FieldEditorMemberFunction(T) #else #define __FieldEditorCallback(T) T/**/_FieldEditorCallback #define FieldEditorCallback(T) __FieldEditorCallback(T) #define __FieldEditorMemberFunction(T) T/**/_FieldEditorMemberFunction #define FieldEditorMemberFunction(T) __FieldEditorMemberFunction(T) #endif #define declareFieldEditorCallback(T) \ typedef void (T::*FieldEditorMemberFunction(T))(FieldEditor*); \ class FieldEditorCallback(T) : public FieldEditorAction { \ public: \ FieldEditorCallback(T)( \ T*, FieldEditorMemberFunction(T) accept, \ FieldEditorMemberFunction(T) cancel \ ); \ virtual ~FieldEditorCallback(T)(); \ \ virtual void accept(FieldEditor*); \ virtual void cancel(FieldEditor*); \ private: \ T* obj_; \ FieldEditorMemberFunction(T) accept_; \ FieldEditorMemberFunction(T) cancel_; \ }; #define implementFieldEditorCallback(T) \ FieldEditorCallback(T)::FieldEditorCallback(T)( \ T* obj, FieldEditorMemberFunction(T) accept, \ FieldEditorMemberFunction(T) cancel \ ) { \ obj_ = obj; \ accept_ = accept; \ cancel_ = cancel; \ } \ \ FieldEditorCallback(T)::~FieldEditorCallback(T)() { } \ \ void FieldEditorCallback(T)::accept(FieldEditor* f) { (obj_->*accept_)(f); } \ void FieldEditorCallback(T)::cancel(FieldEditor* f) { (obj_->*cancel_)(f); } class FieldEditor : public InputHandler { public: FieldEditor( const String& sample, WidgetKit*, Style*, FieldEditorAction* = nil ); virtual ~FieldEditor(); virtual void undraw(); virtual void press(const Event&); virtual void drag(const Event&); virtual void release(const Event&); virtual void keystroke(const Event&); virtual InputHandler* focus_in(); virtual void focus_out(); virtual void field(const char*); virtual void field(const String&); virtual void select(int pos); virtual void select(int left, int right); virtual void edit(); virtual void edit(const char*, int left, int right); virtual void edit(const String&, int left, int right); virtual const String* text() const; private: FieldEditorImpl* impl_; }; #endif neuron-7.6.3/src/include/IV-look/kit.h000077500000000000000000000165701340731477100175120ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * WidgetKit -- object for creating common UI components */ #ifndef ivlook_kit_h #define ivlook_kit_h #include #include #include #include #include #include class Adjustable; class Color; class Cursor; class Font; class String; class Style; class WidgetKitImpl; class WidgetKit { protected: WidgetKit(); public: static WidgetKit* instance(); virtual ~WidgetKit(); virtual const char* gui() const; /* style management */ virtual void style(Style*); virtual Style* style() const; virtual const Font* font() const; virtual const Color* foreground() const; virtual const Color* background() const; virtual void begin_style(const String&); virtual void begin_style(const char*); virtual void begin_style(const String& name, const String& alias); virtual void begin_style(const char* name, const char* alias); virtual void alias(const String&); virtual void alias(const char*); virtual void end_style(); virtual void push_style(); virtual void push_style(Style*); virtual void pop_style(); virtual void style_changed(Style*); /* shared objects */ virtual Cursor* hand_cursor() const; virtual Cursor* lfast_cursor() const; virtual Cursor* lufast_cursor() const; virtual Cursor* ufast_cursor() const; virtual Cursor* rufast_cursor() const; virtual Cursor* rfast_cursor() const; virtual Cursor* rdfast_cursor() const; virtual Cursor* dfast_cursor() const; virtual Cursor* ldfast_cursor() const; /* shading */ virtual MonoGlyph* outset_frame(Glyph*) const = 0; virtual MonoGlyph* inset_frame(Glyph*) const = 0; virtual MonoGlyph* bright_inset_frame(Glyph*) const = 0; /* styled low-level glyphs */ virtual Glyph* label(const char*) const; virtual Glyph* label(const String&) const; virtual Glyph* chiseled_label(const char*) const; virtual Glyph* chiseled_label(const String&) const; virtual Glyph* raised_label(const char*) const; virtual Glyph* raised_label(const String&) const; virtual Glyph* fancy_label(const char*) const; virtual Glyph* fancy_label(const String&) const; /* menus */ virtual Menu* menubar() const; virtual Menu* pulldown() const; virtual Menu* pullright() const; virtual MenuItem* menubar_item(const char*) const; virtual MenuItem* menubar_item(const String&) const; virtual MenuItem* menubar_item(Glyph*) const; virtual MenuItem* menu_item(const char*) const; virtual MenuItem* menu_item(const String&) const; virtual MenuItem* menu_item(Glyph*) const; virtual MenuItem* check_menu_item(const char*) const; virtual MenuItem* check_menu_item(const String&) const; virtual MenuItem* check_menu_item(Glyph*) const; virtual MenuItem* radio_menu_item(TelltaleGroup*, const char*) const; virtual MenuItem* radio_menu_item(TelltaleGroup*, const String&) const; virtual MenuItem* radio_menu_item(TelltaleGroup*, Glyph*) const; virtual MenuItem* menu_item_separator() const; /* buttons */ virtual Button* push_button(const char*, Action*) const; virtual Button* push_button(const String&, Action*) const; virtual Button* push_button(Glyph*, Action*) const; virtual Button* default_button(const char*, Action*) const; virtual Button* default_button(const String&, Action*) const; virtual Button* default_button(Glyph*, Action*) const; virtual Button* check_box(const char*, Action*) const; virtual Button* check_box(const String&, Action*) const; virtual Button* check_box(Glyph*, Action*) const; virtual Button* palette_button(const char*, Action*) const; virtual Button* palette_button(const String&, Action*) const; virtual Button* palette_button(Glyph*, Action*) const; virtual Button* radio_button(TelltaleGroup*, const char*, Action*) const; virtual Button* radio_button(TelltaleGroup*, const String&, Action*) const; virtual Button* radio_button(TelltaleGroup*, Glyph*, Action*) const; virtual Action* quit() const; /* adjusters */ virtual Glyph* hslider(Adjustable*) const; virtual Glyph* hscroll_bar(Adjustable*) const; virtual Glyph* vslider(Adjustable*) const; virtual Glyph* vscroll_bar(Adjustable*) const; virtual Glyph* panner(Adjustable*, Adjustable*) const; virtual Stepper* enlarger(Adjustable*) const; virtual Stepper* reducer(Adjustable*) const; virtual Stepper* up_mover(Adjustable*) const; virtual Stepper* down_mover(Adjustable*) const; virtual Stepper* left_mover(Adjustable*) const; virtual Stepper* right_mover(Adjustable*) const; /* looks implemented by subclass, usually not called directly */ virtual Glyph* menubar_look() const = 0; virtual Glyph* pulldown_look() const = 0; virtual Glyph* pullright_look() const; virtual Glyph* menubar_item_look(Glyph*, TelltaleState*) const = 0; virtual Glyph* menu_item_look(Glyph*, TelltaleState*) const = 0; virtual Glyph* check_menu_item_look(Glyph*, TelltaleState*) const = 0; virtual Glyph* radio_menu_item_look(Glyph*, TelltaleState*) const = 0; virtual Glyph* menu_item_separator_look() const = 0; virtual Glyph* push_button_look(Glyph*, TelltaleState*) const = 0; virtual Glyph* default_button_look(Glyph*, TelltaleState*) const = 0; virtual Glyph* check_box_look(Glyph*, TelltaleState*) const = 0; virtual Glyph* palette_button_look(Glyph*, TelltaleState*) const = 0; virtual Glyph* radio_button_look(Glyph*, TelltaleState*) const = 0; virtual Glyph* slider_look(DimensionName, Adjustable*) const = 0; virtual Glyph* scroll_bar_look(DimensionName, Adjustable*) const = 0; virtual Glyph* panner_look(Adjustable*, Adjustable*) const = 0; virtual Glyph* enlarger_look(TelltaleState*) const = 0; virtual Glyph* reducer_look(TelltaleState*) const = 0; virtual Glyph* up_mover_look(TelltaleState*) const = 0; virtual Glyph* down_mover_look(TelltaleState*) const = 0; virtual Glyph* left_mover_look(TelltaleState*) const = 0; virtual Glyph* right_mover_look(TelltaleState*) const = 0; private: WidgetKitImpl* impl_; }; #include #endif neuron-7.6.3/src/include/IV-look/menu.h000077500000000000000000000062521340731477100176630ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Menu -- visible list of actions */ #ifndef ivlook_menu_h #define ivlook_menu_h #include #include #include class Action; class Menu; class MenuImpl; class Patch; class TelltaleState; class Window; class MenuItem : public Resource, public Observer { public: MenuItem(Glyph*, TelltaleState*); MenuItem(Glyph*, TelltaleState*, Action*); MenuItem(Glyph*, TelltaleState*, Menu*, Window* = nil); virtual ~MenuItem(); Glyph* body() const; TelltaleState* state() const; virtual void action(Action*); Action* action() const; virtual void menu(Menu*, Window* = nil); Menu* menu() const; Window* window() const; virtual void update(Observable*); private: friend class Menu; friend class MenuImpl; Patch* patch_; TelltaleState* state_; Action* action_; Menu* menu_; Window* window_; void init(Glyph*, TelltaleState*); }; inline TelltaleState* MenuItem::state() const { return state_; } inline Action* MenuItem::action() const { return action_; } inline Menu* MenuItem::menu() const { return menu_; } inline Window* MenuItem::window() const { return window_; } class Menu : public InputHandler { public: Menu(Glyph*, Style*, float x1, float y1, float x2, float y2); virtual ~Menu(); virtual void append_item(MenuItem*); virtual void prepend_item(MenuItem*); virtual void insert_item(GlyphIndex, MenuItem*); virtual void remove_item(GlyphIndex); virtual void replace_item(GlyphIndex, MenuItem*); virtual GlyphIndex item_count() const; virtual MenuItem* item(GlyphIndex) const; virtual void select(GlyphIndex); virtual GlyphIndex selected() const; virtual void unselect(); virtual void press(const Event&); virtual void drag(const Event&); virtual void release(const Event&); virtual void open(); virtual void close(); private: MenuImpl* impl_; }; #include #endif neuron-7.6.3/src/include/IV-look/mf_dialogs.h000077500000000000000000000033031340731477100210150ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * MFDialogKit -- object for creating common Motif dialog boxes */ #ifndef ivlook_mf_dialogs_h #define ivlook_mf_dialogs_h #include class String; class MFDialogKit : public DialogKit { public: MFDialogKit(); virtual ~MFDialogKit(); virtual FieldEditor* make_field_editor( const String& sample, WidgetKit*, Style*, FieldEditorAction* = nil ) const; virtual FileChooser* make_file_chooser( const String& dir, WidgetKit*, Style*, FileChooserAction* = nil ) const; }; #endif neuron-7.6.3/src/include/IV-look/mf_kit.h000077500000000000000000000057131340731477100201710ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * MFKit -- object for creating common UI Motif-ish components */ #ifndef ivlook_mfkit_h #define ivlook_mfkit_h #include class MFKitImpl; class MFKit : public WidgetKit { public: MFKit(); virtual ~MFKit(); virtual const char* gui() const; virtual void style_changed(Style*); virtual MonoGlyph* outset_frame(Glyph*) const; virtual MonoGlyph* inset_frame(Glyph*) const; virtual MonoGlyph* bright_inset_frame(Glyph*) const; virtual Glyph* menubar_look() const; virtual Glyph* pulldown_look() const; virtual Glyph* menubar_item_look(Glyph*, TelltaleState*) const; virtual Glyph* menu_item_look(Glyph*, TelltaleState*) const; virtual Glyph* check_menu_item_look(Glyph*, TelltaleState*) const; virtual Glyph* radio_menu_item_look(Glyph*, TelltaleState*) const; virtual Glyph* menu_item_separator_look() const; virtual Glyph* push_button_look(Glyph*, TelltaleState*) const; virtual Glyph* default_button_look(Glyph*, TelltaleState*) const; virtual Glyph* check_box_look(Glyph*, TelltaleState*) const; virtual Glyph* palette_button_look(Glyph*, TelltaleState*) const; virtual Glyph* radio_button_look(Glyph*, TelltaleState*) const; virtual Glyph* slider_look(DimensionName, Adjustable*) const; virtual Glyph* scroll_bar_look(DimensionName, Adjustable*) const; virtual Glyph* panner_look(Adjustable*, Adjustable*) const; virtual Glyph* enlarger_look(TelltaleState*) const; virtual Glyph* reducer_look(TelltaleState*) const; virtual Glyph* up_mover_look(TelltaleState*) const; virtual Glyph* down_mover_look(TelltaleState*) const; virtual Glyph* left_mover_look(TelltaleState*) const; virtual Glyph* right_mover_look(TelltaleState*) const; private: MFKitImpl* impl_; }; #endif neuron-7.6.3/src/include/IV-look/mono_kit.h000077500000000000000000000061641340731477100205400ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * MonoKit -- object for creating common UI monochrome Motif-ish components */ #ifndef ivlook_mono_mf_kit_h #define ivlook_mono_mf_kit_h #include class MonoKitImpl; class MonoKit : public WidgetKit { public: MonoKit(); virtual ~MonoKit(); virtual const char* gui() const; virtual void style_changed(Style*); virtual MonoGlyph* outset_frame(Glyph*) const; virtual MonoGlyph* inset_frame(Glyph*) const; virtual MonoGlyph* bright_inset_frame(Glyph*) const; virtual Glyph* menubar_look() const; virtual Glyph* pulldown_look() const; virtual Glyph* menubar_item_look(Glyph*, TelltaleState*) const; virtual Glyph* menu_item_look(Glyph*, TelltaleState*) const; virtual Glyph* check_menu_item_look(Glyph*, TelltaleState*) const; virtual Glyph* radio_menu_item_look(Glyph*, TelltaleState*) const; virtual Glyph* menu_item_separator_look() const; virtual Glyph* push_button_look(Glyph*, TelltaleState*) const; virtual Glyph* default_button_look(Glyph*, TelltaleState*) const; virtual Glyph* check_box_look(Glyph*, TelltaleState*) const; virtual Glyph* palette_button_look(Glyph*, TelltaleState*) const; virtual Glyph* radio_button_look(Glyph*, TelltaleState*) const; virtual Glyph* slider_look(DimensionName, Adjustable*) const; virtual Glyph* scroll_bar_look(DimensionName, Adjustable*) const; virtual Glyph* panner_look(Adjustable*, Adjustable*) const; virtual Glyph* enlarger_look(TelltaleState*) const; virtual Glyph* reducer_look(TelltaleState*) const; virtual Glyph* up_mover_look(TelltaleState*) const; virtual Glyph* down_mover_look(TelltaleState*) const; virtual Glyph* left_mover_look(TelltaleState*) const; virtual Glyph* right_mover_look(TelltaleState*) const; /* hack for reverse video labels */ virtual Glyph* label(const char *) const; virtual Glyph* label(const String&) const; private: MonoKitImpl* impl_; }; #endif neuron-7.6.3/src/include/IV-look/mw_kit.h000077500000000000000000000113161340731477100202060ustar00rootroot00000000000000// ======================================================================= // // MWkit -- object for creating common UI MS-Windows components // // 1.1 // 1997/03/28 22:03:50 // // InterViews Port to the Windows 3.1/NT operating systems // Copyright (c) 1993 Tim Prinzing // // Permission to use, copy, modify, distribute, and sell this software and // its documentation for any purpose is hereby granted without fee, provided // that (i) the above copyright notice and this permission notice appear in // all copies of the software and related documentation, and (ii) the name of // Tim Prinzing may not be used in any advertising or publicity relating to // the software without the specific, prior written permission of Tim Prinzing. // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL Tim Prinzing BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // // ======================================================================= #ifndef ivlook_mwkit_h #define ivlook_mwkit_h #include class MWkitImpl; class MWkit : public WidgetKit { public: MWkit(); virtual ~MWkit(); virtual const char* gui() const; public: // --------------- buttons ------------------------ virtual Button* push_button(const char*, Action*) const; virtual Button* push_button(const String&, Action*) const; virtual Button* radio_button(TelltaleGroup*, const char*, Action*) const; virtual Button* radio_button(TelltaleGroup*, const String&, Action*) const; virtual Button* check_box(const char*, Action*) const; virtual Button* check_box(const String&, Action*) const; public: // -------------- menus ---------------------------- virtual Menu* menubar() const; virtual Menu* pulldown() const; virtual Menu* pullright() const; virtual MenuItem* menubar_item(const char*) const; virtual MenuItem* menubar_item(const String&) const; virtual MenuItem* menubar_item(Glyph*) const; virtual MenuItem* menu_item(const char*) const; virtual MenuItem* menu_item(const String&) const; virtual MenuItem* menu_item(Glyph*) const; virtual MenuItem* check_menu_item(const char*) const; virtual MenuItem* check_menu_item(const String&) const; virtual MenuItem* check_menu_item(Glyph*) const; virtual MenuItem* radio_menu_item(TelltaleGroup*, const char*) const; virtual MenuItem* radio_menu_item(TelltaleGroup*, const String&) const; virtual MenuItem* radio_menu_item(TelltaleGroup*, Glyph*) const; virtual MenuItem* menu_item_separator() const; public: // -------------- scrolling ---------------------------- virtual Glyph* hscroll_bar(Adjustable*) const; virtual Glyph* vscroll_bar(Adjustable*) const; public: // // items currently without mswin-specific implementation // virtual void style_changed(Style*); virtual MonoGlyph* outset_frame(Glyph*) const; virtual MonoGlyph* inset_frame(Glyph*) const; virtual MonoGlyph* bright_inset_frame(Glyph*) const; virtual Glyph* menubar_look() const; virtual Glyph* pulldown_look() const; virtual Glyph* menubar_item_look(Glyph*, TelltaleState*) const; virtual Glyph* menu_item_look(Glyph*, TelltaleState*) const; virtual Glyph* check_menu_item_look(Glyph*, TelltaleState*) const; virtual Glyph* radio_menu_item_look(Glyph*, TelltaleState*) const; virtual Glyph* menu_item_separator_look() const; virtual Glyph* push_button_look(Glyph*, TelltaleState*) const; virtual Glyph* default_button_look(Glyph*, TelltaleState*) const; virtual Glyph* check_box_look(Glyph*, TelltaleState*) const; virtual Glyph* palette_button_look(Glyph*, TelltaleState*) const; virtual Glyph* radio_button_look(Glyph*, TelltaleState*) const; virtual Glyph* slider_look(DimensionName, Adjustable*) const; virtual Glyph* scroll_bar_look(DimensionName, Adjustable*) const; virtual Glyph* panner_look(Adjustable*, Adjustable*) const; virtual Glyph* enlarger_look(TelltaleState*) const; virtual Glyph* reducer_look(TelltaleState*) const; virtual Glyph* up_mover_look(TelltaleState*) const; virtual Glyph* down_mover_look(TelltaleState*) const; virtual Glyph* left_mover_look(TelltaleState*) const; virtual Glyph* right_mover_look(TelltaleState*) const; private: MWkitImpl* impl_; }; #endif /* ivlook_mwkit_h */ neuron-7.6.3/src/include/IV-look/ol_dialogs.h000077500000000000000000000033061340731477100210300ustar00rootroot00000000000000/* * Copyright (c) 1992 Stanford University * Copyright (c) 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * OLDialogKit -- object for creating common OpenLook dialog boxes */ #ifndef ivlook_ol_dialogs_h #define ivlook_ol_dialogs_h #include class String; class OLDialogKit : public DialogKit { public: OLDialogKit(); virtual ~OLDialogKit(); virtual FieldEditor* make_field_editor( const String& sample, WidgetKit*, Style*, FieldEditorAction* = nil ) const; virtual FileChooser* make_file_chooser( const String& dir, WidgetKit*, Style*, FileChooserAction* = nil ) const; }; #endif neuron-7.6.3/src/include/IV-look/ol_kit.h000077500000000000000000000111011340731477100201650ustar00rootroot00000000000000/* * Copyright (c) 1991, 1992 Stanford University * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef ivlook_olkit_h #define ivlook_olkit_h #include class OLKitImpl; class Window; class OLKit : public WidgetKit { /* * OpenLook ==> WidgetKit mappings: * * exclusive setting ==> radio_button * non-exclusive setting ==> pallette_button * exclusive menu setting ==> radio_menu_item * non-exclusive setting ==> radio_menu_item(*) * scrolling button ==> {up,down,left,down}_mover * text field ==> DialogKit::make_field_editor * * * Remove the telltale state of each exclusive menu item * from the radio_menu_item's telltale group. * * Use -xrm "olglyph:size" to specify the font size used for the OpenLook * font, where size is one of (10, 12, 14, 19). Default size is 12. */ public: OLKit(); virtual ~OLKit(); virtual const char* gui() const; /* shading */ virtual MonoGlyph* outset_frame(Glyph*) const; virtual MonoGlyph* inset_frame(Glyph*) const; virtual MonoGlyph* bright_inset_frame(Glyph*) const; /* menus */ virtual Menu* menubar() const; /* looks implemented by subclass, usually not called directly */ virtual Glyph* menubar_look() const; virtual Glyph* pulldown_look() const; virtual Glyph* pullright_look() const; virtual Glyph* menubar_item_look(Glyph*, TelltaleState*) const; virtual Glyph* menu_item_look(Glyph*, TelltaleState*) const; virtual Glyph* check_menu_item_look(Glyph*, TelltaleState*) const; virtual Glyph* radio_menu_item_look(Glyph*, TelltaleState*) const; virtual Glyph* menu_item_separator_look() const; virtual Glyph* push_button_look(Glyph*, TelltaleState*) const; virtual Glyph* default_button_look(Glyph*, TelltaleState*) const; virtual Glyph* check_box_look(Glyph*, TelltaleState*) const; virtual Glyph* palette_button_look(Glyph*, TelltaleState*) const; virtual Glyph* radio_button_look(Glyph*, TelltaleState*) const; virtual Glyph* slider_look(DimensionName, Adjustable*) const; virtual Glyph* scroll_bar_look(DimensionName, Adjustable*) const; virtual Glyph* panner_look(Adjustable*, Adjustable*) const; virtual Glyph* enlarger_look(TelltaleState*) const; virtual Glyph* reducer_look(TelltaleState*) const; virtual Glyph* up_mover_look(TelltaleState*) const; virtual Glyph* down_mover_look(TelltaleState*) const; virtual Glyph* left_mover_look(TelltaleState*) const; virtual Glyph* right_mover_look(TelltaleState*) const; /* OLKit-specific */ virtual const Color* white() const; virtual const Color* bg1() const; virtual const Color* bg2() const; virtual const Color* bg3() const; virtual const Color* black() const; virtual const Color* inactive() const; virtual const Color* busy() const; virtual Button* pushpin(const Window* unpinned, Window* pinned) const; virtual void pinnable(Menu*, const Window* unpinned) const; virtual MenuItem* habbrev_menu_button() const; virtual MenuItem* vabbrev_menu_button() const; virtual Glyph* hgauge(Adjustable*) const; virtual Glyph* vgauge(Adjustable*) const; virtual Glyph* htick() const; virtual Glyph* vtick() const; virtual Glyph* top_end_box(Adjustable*) const; virtual Glyph* bottom_end_box(Adjustable*) const; virtual Glyph* left_end_box(Adjustable*) const; virtual Glyph* right_end_box(Adjustable*) const; private: OLKitImpl* impl_; }; #endif neuron-7.6.3/src/include/IV-look/slider.h000077500000000000000000000100101340731477100201640ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Slider - common slider behavior */ #ifndef ivlook_slider_h #define ivlook_slider_h #include #include #include class SliderImpl; class Stepper; class Style; typedef void (Adjustable::*SliderAdjustment)(DimensionName); class Slider : public ActiveHandler, public Observer { public: Slider(Style*); virtual ~Slider(); virtual void normal_thumb(Glyph*); virtual void visible_thumb(Glyph*); virtual void old_thumb(Glyph*); virtual Coord minimum_thumb_size() const; virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void undraw(); virtual void move(const Event&); virtual void press(const Event&); virtual void drag(const Event&); virtual void release(const Event&); virtual void allocation_changed(Canvas*, const Allocation&); virtual void update(Observable*); virtual void forward_stepper(Stepper*); virtual void backward_stepper(Stepper*); virtual void move_to(Coord x, Coord y); virtual void allocate_thumb(const Allocation&); virtual void allot_thumb_major_axis( const Allocation&, DimensionName, Adjustable*, Coord min_thumb_size, float& scale, Allotment& ); virtual void allot_thumb_minor_axis(const Allotment&, Allotment&); virtual void redraw_thumb(); virtual void reallocate_thumb(const Allocation&); virtual void apply_adjustment(SliderAdjustment); virtual void do_adjustment(Adjustable*, SliderAdjustment, DimensionName); private: SliderImpl* impl_; }; class XSlider : public Slider { public: XSlider(Style*, Adjustable*); virtual ~XSlider(); virtual void move_to(Coord x, Coord y); virtual void allocate_thumb(const Allocation&); virtual void disconnect(Observable*); virtual void apply_adjustment(SliderAdjustment); private: Adjustable* adjustable_; float xscale_; Stepper* forward_; Stepper* backward_; }; class YSlider : public Slider { public: YSlider(Style*, Adjustable*); virtual ~YSlider(); virtual void move_to(Coord x, Coord y); virtual void allocate_thumb(const Allocation&); virtual void disconnect(Observable*); virtual void apply_adjustment(SliderAdjustment); private: Adjustable* adjustable_; float yscale_; Stepper* forward_; Stepper* backward_; }; class XYSlider : public Slider { public: XYSlider(Style*, Adjustable* x, Adjustable* y); virtual ~XYSlider(); virtual void move_to(Coord x, Coord y); virtual void allocate_thumb(const Allocation&); virtual void disconnect(Observable*); virtual void apply_adjustment(SliderAdjustment); private: Adjustable* x_adjustable_; Adjustable* y_adjustable_; float xscale_; float yscale_; }; #endif neuron-7.6.3/src/include/IV-look/smf_kit.h000077500000000000000000000057671340731477100203650ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * SMFKit -- object for creating SGI Motif components */ #ifndef ivlook_smfkit_h #define ivlook_smfkit_h #include class SMFKitImpl; class SMFKit : public WidgetKit { public: SMFKit(); virtual ~SMFKit(); virtual const char* gui() const; virtual void style_changed(Style*); virtual MonoGlyph* outset_frame(Glyph*) const; virtual MonoGlyph* inset_frame(Glyph*) const; virtual MonoGlyph* bright_inset_frame(Glyph*) const; virtual Glyph* menubar_look() const; virtual Glyph* pulldown_look() const; virtual Glyph* pullright_look() const; virtual Glyph* menubar_item_look(Glyph*, TelltaleState*) const; virtual Glyph* menu_item_look(Glyph*, TelltaleState*) const; virtual Glyph* check_menu_item_look(Glyph*, TelltaleState*) const; virtual Glyph* radio_menu_item_look(Glyph*, TelltaleState*) const; virtual Glyph* menu_item_separator_look() const; virtual Glyph* push_button_look(Glyph*, TelltaleState*) const; virtual Glyph* default_button_look(Glyph*, TelltaleState*) const; virtual Glyph* check_box_look(Glyph*, TelltaleState*) const; virtual Glyph* palette_button_look(Glyph*, TelltaleState*) const; virtual Glyph* radio_button_look(Glyph*, TelltaleState*) const; virtual Glyph* slider_look(DimensionName, Adjustable*) const; virtual Glyph* scroll_bar_look(DimensionName, Adjustable*) const; virtual Glyph* panner_look(Adjustable*, Adjustable*) const; virtual Glyph* enlarger_look(TelltaleState*) const; virtual Glyph* reducer_look(TelltaleState*) const; virtual Glyph* up_mover_look(TelltaleState*) const; virtual Glyph* down_mover_look(TelltaleState*) const; virtual Glyph* left_mover_look(TelltaleState*) const; virtual Glyph* right_mover_look(TelltaleState*) const; private: SMFKitImpl* impl_; }; #endif neuron-7.6.3/src/include/IV-look/stepper.h000077500000000000000000000054141340731477100204000ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Stepper -- button with autorepeat */ #ifndef ivlook_stepper_h #define ivlook_stepper_h #include #include #include class Color; class IOHandler; class TelltaleState; class Stepper : public Button { public: Stepper(Glyph*, Style*, TelltaleState*, Action* = nil); virtual ~Stepper(); virtual void press(const Event&); virtual void release(const Event&); virtual void start_stepping(); virtual void stop_stepping(); protected: virtual void adjust() = 0; private: long start_delay_; long next_delay_; IOHandler* timer_; void tick(long, long); }; #define declareAdjustStepper(StepperSubclassName) \ class StepperSubclassName : public Stepper { \ public: \ StepperSubclassName( \ Glyph*, Style*, TelltaleState*, Adjustable*, DimensionName \ ); \ virtual ~StepperSubclassName(); \ \ virtual void adjust(); \ private: \ Adjustable* adjustable_; \ DimensionName dimension_; \ }; declareAdjustStepper(ForwardScroller) declareAdjustStepper(BackwardScroller) declareAdjustStepper(ForwardPager) declareAdjustStepper(BackwardPager) #define declareArrowGlyph(ArrowSubclassName) \ class ArrowSubclassName : public Glyph { \ public: \ ArrowSubclassName(const Color*); \ virtual ~ArrowSubclassName(); \ \ virtual void draw(Canvas*, const Allocation&) const; \ private: \ const Color* color_; \ }; declareArrowGlyph(UpArrow) declareArrowGlyph(DownArrow) declareArrowGlyph(LeftArrow) declareArrowGlyph(RightArrow) #include #endif neuron-7.6.3/src/include/IV-look/telltale.h000077500000000000000000000000761340731477100205230ustar00rootroot00000000000000/* backward compatibility */ #include neuron-7.6.3/src/include/InterViews/000077500000000000000000000000001340731477100173555ustar00rootroot00000000000000neuron-7.6.3/src/include/InterViews/Bitmaps/000077500000000000000000000000001340731477100207545ustar00rootroot00000000000000neuron-7.6.3/src/include/InterViews/Bitmaps/big_checkmark.bm000066400000000000000000000004531340731477100240470ustar00rootroot00000000000000#define checkmark_width 16 #define checkmark_height 16 static unsigned char checkmark_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x20, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x06, 0x18, 0x03, 0xbe, 0x01, 0xfc, 0x01, 0xf8, 0x00, 0xf0, 0x00, 0x60, 0x00, 0x40, 0x00, 0x00, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/checkmark.bm000066400000000000000000000003401340731477100232210ustar00rootroot00000000000000#define checkmark_width 8 #define checkmark_height 12 #define checkmark_x_hot 0 #define checkmark_y_hot 9 static unsigned char checkmark_bits[] = { 0x00, 0x80, 0x80, 0x40, 0x40, 0x20, 0x32, 0x1f, 0x1f, 0x1e, 0x0c, 0x08}; neuron-7.6.3/src/include/InterViews/Bitmaps/chkbox.bm000066400000000000000000000005711340731477100225550ustar00rootroot00000000000000#define checkbox_plain_width 16 #define checkbox_plain_height 16 #define checkbox_plain_x_hot 0 #define checkbox_plain_y_hot 11 static unsigned char checkbox_plain_bits[] = { 0x00, 0x00, 0xfe, 0x7f, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0xfe, 0x7f, 0x00, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/chkboxBoth.bm000066400000000000000000000005641340731477100233740ustar00rootroot00000000000000#define checkbox_both_width 16 #define checkbox_both_height 16 #define checkbox_both_x_hot 0 #define checkbox_both_y_hot 11 static unsigned char checkbox_both_bits[] = { 0x00, 0x00, 0xfe, 0x7f, 0xfe, 0x7f, 0x06, 0x60, 0x36, 0x6c, 0x76, 0x6e, 0xe6, 0x67, 0xc6, 0x63, 0xc6, 0x63, 0xe6, 0x67, 0x76, 0x6e, 0x36, 0x6c, 0x06, 0x60, 0xfe, 0x7f, 0xfe, 0x7f, 0x00, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/chkboxChosen.bm000066400000000000000000000005761340731477100237220ustar00rootroot00000000000000#define checkbox_chosen_width 16 #define checkbox_chosen_height 16 #define checkbox_chosen_x_hot 0 #define checkbox_chosen_y_hot 11 static unsigned char checkbox_chosen_bits[] = { 0x00, 0x00, 0xfe, 0x7f, 0x02, 0x40, 0x02, 0x40, 0x32, 0x4c, 0x72, 0x4e, 0xe2, 0x47, 0xc2, 0x43, 0xc2, 0x43, 0xe2, 0x47, 0x72, 0x4e, 0x32, 0x4c, 0x02, 0x40, 0x02, 0x40, 0xfe, 0x7f, 0x00, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/chkboxHit.bm000066400000000000000000000005571340731477100232260ustar00rootroot00000000000000#define checkbox_hit_width 16 #define checkbox_hit_height 16 #define checkbox_hit_x_hot 0 #define checkbox_hit_y_hot 11 static unsigned char checkbox_hit_bits[] = { 0x00, 0x00, 0xfe, 0x7f, 0xfe, 0x7f, 0x06, 0x60, 0x06, 0x60, 0x06, 0x60, 0x06, 0x60, 0x06, 0x60, 0x06, 0x60, 0x06, 0x60, 0x06, 0x60, 0x06, 0x60, 0x06, 0x60, 0xfe, 0x7f, 0xfe, 0x7f, 0x00, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/dfast.bm000066400000000000000000000005131340731477100223740ustar00rootroot00000000000000#define dfast_width 16 #define dfast_height 16 #define dfast_x_hot 8 #define dfast_y_hot 7 static unsigned char dfast_bits[] = { 0x00, 0x00, 0xfc, 0x7f, 0x08, 0x20, 0x10, 0x10, 0x20, 0x08, 0x40, 0x04, 0x80, 0x02, 0x00, 0x01, 0xfc, 0x7f, 0x08, 0x20, 0x10, 0x10, 0x20, 0x08, 0x40, 0x04, 0x80, 0x02, 0x00, 0x01, 0x00, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/dfastMask.bm000066400000000000000000000005441340731477100232140ustar00rootroot00000000000000#define dfast_mask_width 16 #define dfast_mask_height 16 #define dfast_mask_x_hot 8 #define dfast_mask_y_hot 7 static unsigned char dfast_mask_bits[] = { 0xfe, 0xff, 0xfe, 0xff, 0xfc, 0x7f, 0xf8, 0x3f, 0xf0, 0x1f, 0xe0, 0x0f, 0xc0, 0x07, 0xfe, 0xff, 0xfe, 0xff, 0xfc, 0x7f, 0xf8, 0x3f, 0xf0, 0x1f, 0xe0, 0x0f, 0xc0, 0x07, 0x80, 0x03, 0x00, 0x01}; neuron-7.6.3/src/include/InterViews/Bitmaps/dmover.bm000066400000000000000000000004571340731477100225760ustar00rootroot00000000000000#define dmover_plain_width 11 #define dmover_plain_height 11 #define dmover_plain_x_hot 5 #define dmover_plain_y_hot 5 static unsigned char dmover_plain_bits[] = { 0x00, 0x00, 0xf8, 0x00, 0x88, 0x01, 0x88, 0x01, 0x8e, 0x03, 0x02, 0x06, 0x04, 0x07, 0x88, 0x03, 0xd0, 0x01, 0xe0, 0x00, 0x40, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/dmoverHit.bm000066400000000000000000000004451340731477100232400ustar00rootroot00000000000000#define dmover_hit_width 11 #define dmover_hit_height 11 #define dmover_hit_x_hot 6 #define dmover_hit_y_hot 6 static unsigned char dmover_hit_bits[] = { 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x10, 0x01, 0x10, 0x01, 0x1c, 0x07, 0x04, 0x04, 0x08, 0x02, 0x10, 0x01, 0xa0, 0x00, 0x40, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/dmoverMask.bm000066400000000000000000000004521340731477100234050ustar00rootroot00000000000000#define dmover_mask_width 11 #define dmover_mask_height 11 #define dmover_mask_x_hot 6 #define dmover_mask_y_hot 6 static unsigned char dmover_mask_bits[] = { 0x00, 0x00, 0xf8, 0x00, 0xf8, 0x01, 0xf8, 0x01, 0xfe, 0x03, 0xfe, 0x07, 0xfc, 0x07, 0xf8, 0x03, 0xf0, 0x01, 0xe0, 0x00, 0x40, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/enlarge.bm000066400000000000000000000010471340731477100227130ustar00rootroot00000000000000#define enlarger_plain_width 25 #define enlarger_plain_height 15 #define enlarger_plain_x_hot 12 #define enlarger_plain_y_hot 6 static unsigned char enlarger_plain_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x80, 0x01, 0x03, 0x00, 0x60, 0x00, 0x0c, 0x00, 0x18, 0x00, 0x30, 0x00, 0xf8, 0x01, 0x3f, 0x00, 0x88, 0x00, 0x22, 0x00, 0x78, 0x00, 0x3c, 0x00, 0xc0, 0xff, 0x07, 0x00, 0x40, 0x00, 0x04, 0x00, 0x40, 0x00, 0x04, 0x00, 0xc0, 0xff, 0x07, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/enlargeHit.bm000066400000000000000000000010351340731477100233550ustar00rootroot00000000000000#define enlarger_hit_width 25 #define enlarger_hit_height 15 #define enlarger_hit_x_hot 12 #define enlarger_hit_y_hot 5 static unsigned char enlarger_hit_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xee, 0x00, 0x00, 0xc0, 0x01, 0x07, 0x00, 0x30, 0x00, 0x18, 0x00, 0xf0, 0x83, 0x1f, 0x00, 0x10, 0x01, 0x11, 0x00, 0xf0, 0xff, 0x1f, 0x00, 0x80, 0x00, 0x02, 0x00, 0x80, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/enlargeMask.bm000066400000000000000000000010421340731477100235220ustar00rootroot00000000000000#define enlarger_mask_width 25 #define enlarger_mask_height 15 #define enlarger_mask_x_hot 12 #define enlarger_mask_y_hot 6 static unsigned char enlarger_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xc0, 0xff, 0x07, 0x00, 0xf0, 0xff, 0x1f, 0x00, 0xf0, 0xff, 0x1f, 0x00, 0xf8, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0x07, 0x00, 0xc0, 0xff, 0x07, 0x00, 0xc0, 0xff, 0x07, 0x00, 0xc0, 0xff, 0x07, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/hand.bm000066400000000000000000000005061340731477100222070ustar00rootroot00000000000000#define hand_width 16 #define hand_height 16 #define hand_x_hot 8 #define hand_y_hot 8 static unsigned char hand_bits[] = { 0x80, 0x00, 0x40, 0x09, 0x48, 0x16, 0x54, 0x12, 0x54, 0x12, 0x64, 0x52, 0x64, 0xb2, 0x68, 0xb2, 0x48, 0x92, 0x4a, 0x92, 0x15, 0x80, 0x19, 0x40, 0x12, 0x40, 0x04, 0x40, 0x08, 0x20, 0x10, 0x20}; neuron-7.6.3/src/include/InterViews/Bitmaps/handMask.bm000066400000000000000000000005371340731477100230270ustar00rootroot00000000000000#define hand_mask_width 16 #define hand_mask_height 16 #define hand_mask_x_hot 8 #define hand_mask_y_hot 8 static unsigned char hand_mask_bits[] = { 0x80, 0x00, 0xc0, 0x09, 0xc8, 0x1f, 0xdc, 0x1f, 0xdc, 0x1f, 0xfc, 0x5f, 0xfc, 0xff, 0xf8, 0xff, 0xf8, 0xff, 0xfa, 0xff, 0xf7, 0xff, 0xff, 0x7f, 0xfe, 0x7f, 0xfc, 0x7f, 0xf8, 0x3f, 0xf0, 0x3f}; neuron-7.6.3/src/include/InterViews/Bitmaps/ldfast.bm000066400000000000000000000005201340731477100225460ustar00rootroot00000000000000#define ldfast_width 16 #define ldfast_height 16 #define ldfast_x_hot 6 #define ldfast_y_hot 9 static unsigned char ldfast_bits[] = { 0x00, 0x00, 0x40, 0x00, 0xc0, 0x00, 0x40, 0x01, 0x40, 0x02, 0x40, 0x04, 0x42, 0x08, 0x46, 0x10, 0x4a, 0x20, 0xd2, 0x7f, 0x22, 0x00, 0x42, 0x00, 0x82, 0x00, 0x02, 0x01, 0xfe, 0x03, 0x00, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/ldfastMask.bm000066400000000000000000000005511340731477100233660ustar00rootroot00000000000000#define ldfast_mask_width 16 #define ldfast_mask_height 16 #define ldfast_mask_x_hot 6 #define ldfast_mask_y_hot 9 static unsigned char ldfast_mask_bits[] = { 0x60, 0x00, 0xe0, 0x00, 0xe0, 0x01, 0xe0, 0x03, 0xe0, 0x07, 0xe3, 0x0f, 0xe7, 0x1f, 0xef, 0x3f, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0x01, 0xff, 0x03, 0xff, 0x07, 0xff, 0x07}; neuron-7.6.3/src/include/InterViews/Bitmaps/lfast.bm000066400000000000000000000005131340731477100224040ustar00rootroot00000000000000#define lfast_width 16 #define lfast_height 16 #define lfast_x_hot 8 #define lfast_y_hot 7 static unsigned char lfast_bits[] = { 0x00, 0x00, 0x80, 0x40, 0xc0, 0x60, 0xa0, 0x50, 0x90, 0x48, 0x88, 0x44, 0x84, 0x42, 0x82, 0x41, 0x84, 0x42, 0x88, 0x44, 0x90, 0x48, 0xa0, 0x50, 0xc0, 0x60, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/lfastMask.bm000066400000000000000000000005441340731477100232240ustar00rootroot00000000000000#define lfast_mask_width 16 #define lfast_mask_height 16 #define lfast_mask_x_hot 8 #define lfast_mask_y_hot 7 static unsigned char lfast_mask_bits[] = { 0x80, 0xc1, 0xc0, 0xe1, 0xe0, 0xf1, 0xf0, 0xf9, 0xf8, 0xfd, 0xfc, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xfc, 0xff, 0xf8, 0xfd, 0xf0, 0xf9, 0xe0, 0xf1, 0xc0, 0xe1, 0x80, 0xc1, 0x00, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/lmover.bm000066400000000000000000000004571340731477100226060ustar00rootroot00000000000000#define lmover_plain_width 11 #define lmover_plain_height 11 #define lmover_plain_x_hot 5 #define lmover_plain_y_hot 5 static unsigned char lmover_plain_bits[] = { 0x00, 0x00, 0x60, 0x00, 0x50, 0x00, 0xc8, 0x03, 0x04, 0x06, 0x02, 0x06, 0x04, 0x06, 0xc8, 0x07, 0xd0, 0x07, 0xe0, 0x00, 0xc0, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/lmoverHit.bm000066400000000000000000000004451340731477100232500ustar00rootroot00000000000000#define lmover_hit_width 11 #define lmover_hit_height 11 #define lmover_hit_x_hot 6 #define lmover_hit_y_hot 6 static unsigned char lmover_hit_bits[] = { 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0xa0, 0x00, 0x90, 0x07, 0x08, 0x04, 0x04, 0x04, 0x08, 0x04, 0x90, 0x07, 0xa0, 0x00, 0xc0, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/lmoverMask.bm000066400000000000000000000004521340731477100234150ustar00rootroot00000000000000#define lmover_mask_width 11 #define lmover_mask_height 11 #define lmover_mask_x_hot 6 #define lmover_mask_y_hot 5 static unsigned char lmover_mask_bits[] = { 0x00, 0x00, 0x60, 0x00, 0x70, 0x00, 0xf8, 0x03, 0xfc, 0x07, 0xfe, 0x07, 0xfc, 0x07, 0xf8, 0x07, 0xf0, 0x07, 0xe0, 0x00, 0xc0, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/lufast.bm000066400000000000000000000005201340731477100225670ustar00rootroot00000000000000#define lufast_width 16 #define lufast_height 16 #define lufast_x_hot 6 #define lufast_y_hot 6 static unsigned char lufast_bits[] = { 0x00, 0x00, 0xfe, 0x03, 0x02, 0x01, 0x82, 0x00, 0x42, 0x00, 0x22, 0x00, 0xd2, 0x7f, 0x4a, 0x20, 0x46, 0x10, 0x42, 0x08, 0x40, 0x04, 0x40, 0x02, 0x40, 0x01, 0xc0, 0x00, 0x40, 0x00, 0x00, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/lufastMask.bm000066400000000000000000000005511340731477100234070ustar00rootroot00000000000000#define lufast_mask_width 16 #define lufast_mask_height 16 #define lufast_mask_x_hot 6 #define lufast_mask_y_hot 6 static unsigned char lufast_mask_bits[] = { 0xff, 0x07, 0xff, 0x07, 0xff, 0x03, 0xff, 0x01, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xef, 0x3f, 0xe7, 0x1f, 0xe3, 0x0f, 0xe0, 0x07, 0xe0, 0x03, 0xe0, 0x01, 0xe0, 0x00, 0x60, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/page.bm000066400000000000000000000013211340731477100222050ustar00rootroot00000000000000#define page_plain_width 20 #define page_plain_height 30 #define page_plain_x_hot 10 #define page_plain_y_hot 21 static unsigned char page_plain_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x04, 0x18, 0x00, 0x04, 0x28, 0x00, 0x04, 0x48, 0x00, 0x04, 0x88, 0x00, 0x04, 0x08, 0x01, 0x04, 0x08, 0x02, 0x04, 0xf8, 0x07, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0xfc, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/pageBoth.bm000066400000000000000000000013141340731477100230240ustar00rootroot00000000000000#define page_both_width 20 #define page_both_height 30 #define page_both_x_hot 10 #define page_both_y_hot 21 static unsigned char page_both_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x1f, 0x00, 0xfc, 0x3f, 0x00, 0x0c, 0x7c, 0x00, 0x0c, 0xfc, 0x00, 0x0c, 0xfc, 0x01, 0x0c, 0xfc, 0x03, 0x0c, 0xfc, 0x07, 0x0c, 0xfc, 0x07, 0x0c, 0xfc, 0x07, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0xfc, 0xff, 0x07, 0xfc, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/pageChosen.bm000066400000000000000000000013261340731477100233520ustar00rootroot00000000000000#define page_chosen_width 20 #define page_chosen_height 30 #define page_chosen_x_hot 10 #define page_chosen_y_hot 21 static unsigned char page_chosen_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x1f, 0x00, 0xfc, 0x3f, 0x00, 0x0c, 0x6c, 0x00, 0x0c, 0xcc, 0x00, 0x0c, 0x8c, 0x01, 0x0c, 0x0c, 0x03, 0x0c, 0x0c, 0x06, 0x0c, 0xfc, 0x07, 0x0c, 0xfc, 0x07, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0x0c, 0x00, 0x06, 0xfc, 0xff, 0x07, 0xfc, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/pageHit.bm000066400000000000000000000013071340731477100226560ustar00rootroot00000000000000#define page_hit_width 20 #define page_hit_height 30 #define page_hit_x_hot 10 #define page_hit_y_hot 21 static unsigned char page_hit_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x04, 0x18, 0x00, 0x04, 0x38, 0x00, 0x04, 0x78, 0x00, 0x04, 0xf8, 0x00, 0x04, 0xf8, 0x01, 0x04, 0xf8, 0x03, 0x04, 0xf8, 0x07, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0xfc, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/radio.bm000066400000000000000000000004521340731477100223730ustar00rootroot00000000000000#define radio_plain_width 11 #define radio_plain_height 11 #define radio_plain_x_hot 5 #define radio_plain_y_hot 5 static unsigned char radio_plain_bits[] = { 0x70, 0x00, 0x8c, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04, 0x02, 0x02, 0x02, 0x02, 0x8c, 0x01, 0x70, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/radioBoth.bm000066400000000000000000000004451340731477100232120ustar00rootroot00000000000000#define radio_both_width 11 #define radio_both_height 11 #define radio_both_x_hot 5 #define radio_both_y_hot 5 static unsigned char radio_both_bits[] = { 0x70, 0x00, 0xfc, 0x01, 0x8e, 0x03, 0x76, 0x03, 0xfb, 0x06, 0xfb, 0x06, 0xfb, 0x06, 0x76, 0x03, 0x8e, 0x03, 0xfc, 0x01, 0x70, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/radioChosen.bm000066400000000000000000000004571340731477100235400ustar00rootroot00000000000000#define radio_chosen_width 11 #define radio_chosen_height 11 #define radio_chosen_x_hot 5 #define radio_chosen_y_hot 5 static unsigned char radio_chosen_bits[] = { 0x70, 0x00, 0x8c, 0x01, 0x02, 0x02, 0x72, 0x02, 0xf9, 0x04, 0xf9, 0x04, 0xf9, 0x04, 0x72, 0x02, 0x02, 0x02, 0x8c, 0x01, 0x70, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/radioHit.bm000066400000000000000000000004401340731477100230350ustar00rootroot00000000000000#define radio_hit_width 11 #define radio_hit_height 11 #define radio_hit_x_hot 5 #define radio_hit_y_hot 5 static unsigned char radio_hit_bits[] = { 0x70, 0x00, 0xfc, 0x01, 0x8e, 0x03, 0x06, 0x03, 0x03, 0x06, 0x03, 0x06, 0x03, 0x06, 0x06, 0x03, 0x8e, 0x03, 0xfc, 0x01, 0x70, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/radioMask.bm000066400000000000000000000004451340731477100232110ustar00rootroot00000000000000#define radio_mask_width 11 #define radio_mask_height 11 #define radio_mask_x_hot 5 #define radio_mask_y_hot 5 static unsigned char radio_mask_bits[] = { 0x70, 0x00, 0xfc, 0x01, 0xfe, 0x03, 0xfe, 0x03, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xfe, 0x03, 0xfe, 0x03, 0xfc, 0x01, 0x70, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/rdfast.bm000066400000000000000000000005201340731477100225540ustar00rootroot00000000000000#define rdfast_width 16 #define rdfast_height 16 #define rdfast_x_hot 9 #define rdfast_y_hot 9 static unsigned char rdfast_bits[] = { 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x80, 0x02, 0x40, 0x02, 0x20, 0x02, 0x10, 0x42, 0x08, 0x62, 0x04, 0x52, 0xfe, 0x4b, 0x00, 0x44, 0x00, 0x42, 0x00, 0x41, 0x80, 0x40, 0xc0, 0x7f, 0x00, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/rdfastMask.bm000066400000000000000000000005511340731477100233740ustar00rootroot00000000000000#define rdfast_mask_width 16 #define rdfast_mask_height 16 #define rdfast_mask_x_hot 9 #define rdfast_mask_y_hot 9 static unsigned char rdfast_mask_bits[] = { 0x00, 0x06, 0x00, 0x07, 0x80, 0x07, 0xc0, 0x07, 0xe0, 0x07, 0xf0, 0xc7, 0xf8, 0xe7, 0xfc, 0xf7, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0x80, 0xff, 0xc0, 0xff, 0xe0, 0xff, 0xe0, 0xff}; neuron-7.6.3/src/include/InterViews/Bitmaps/reducer.bm000066400000000000000000000010421340731477100227220ustar00rootroot00000000000000#define reducer_plain_width 25 #define reducer_plain_height 15 #define reducer_plain_x_hot 12 #define reducer_plain_y_hot 5 static unsigned char reducer_plain_bits[] = { 0x00, 0x7c, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0xf8, 0x00, 0x3e, 0x00, 0x38, 0x00, 0x38, 0x00, 0xc8, 0x00, 0x26, 0x00, 0x08, 0x83, 0x21, 0x00, 0x30, 0x6c, 0x18, 0x00, 0xc0, 0x10, 0x06, 0x00, 0x00, 0x93, 0x01, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/reducerHit.bm000066400000000000000000000010301340731477100233640ustar00rootroot00000000000000#define reducer_hit_width 25 #define reducer_hit_height 15 #define reducer_hit_x_hot 12 #define reducer_hit_y_hot 7 static unsigned char reducer_hit_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x80, 0x00, 0x02, 0x00, 0x40, 0x00, 0x04, 0x00, 0x3f, 0x00, 0xf8, 0x01, 0x07, 0x00, 0xc0, 0x01, 0x19, 0x00, 0x30, 0x01, 0x61, 0x00, 0x0c, 0x01, 0x86, 0x01, 0xc3, 0x00, 0x18, 0xc6, 0x30, 0x00, 0x60, 0x38, 0x0c, 0x00, 0x80, 0x11, 0x03, 0x00, 0x00, 0xd6, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/reducerMask.bm000066400000000000000000000010351340731477100235400ustar00rootroot00000000000000#define reducer_mask_width 25 #define reducer_mask_height 15 #define reducer_mask_x_hot 12 #define reducer_mask_y_hot 8 static unsigned char reducer_mask_bits[] = { 0x00, 0x7c, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0xf8, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0x3f, 0x00, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0x01, 0xfe, 0xff, 0xff, 0x00, 0xf8, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0x0f, 0x00, 0x80, 0xff, 0x03, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/rfast.bm000066400000000000000000000005131340731477100224120ustar00rootroot00000000000000#define rfast_width 16 #define rfast_height 16 #define rfast_x_hot 7 #define rfast_y_hot 7 static unsigned char rfast_bits[] = { 0x00, 0x00, 0x02, 0x01, 0x06, 0x03, 0x0a, 0x05, 0x12, 0x09, 0x22, 0x11, 0x42, 0x21, 0x82, 0x41, 0x42, 0x21, 0x22, 0x11, 0x12, 0x09, 0x0a, 0x05, 0x06, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/rfastMask.bm000066400000000000000000000005441340731477100232320ustar00rootroot00000000000000#define rfast_mask_width 16 #define rfast_mask_height 16 #define rfast_mask_x_hot 7 #define rfast_mask_y_hot 7 static unsigned char rfast_mask_bits[] = { 0x83, 0x01, 0x87, 0x03, 0x8f, 0x07, 0x9f, 0x0f, 0xbf, 0x1f, 0xff, 0x3f, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0x3f, 0xbf, 0x1f, 0x9f, 0x0f, 0x8f, 0x07, 0x87, 0x03, 0x83, 0x01, 0x00, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/rmover.bm000066400000000000000000000004571340731477100226140ustar00rootroot00000000000000#define rmover_plain_width 11 #define rmover_plain_height 11 #define rmover_plain_x_hot 5 #define rmover_plain_y_hot 5 static unsigned char rmover_plain_bits[] = { 0x00, 0x00, 0x30, 0x00, 0x50, 0x00, 0x9e, 0x00, 0x02, 0x01, 0x02, 0x02, 0x02, 0x07, 0x9e, 0x03, 0xdc, 0x01, 0xf0, 0x00, 0x60, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/rmoverHit.bm000066400000000000000000000004451340731477100232560ustar00rootroot00000000000000#define rmover_hit_width 11 #define rmover_hit_height 11 #define rmover_hit_x_hot 6 #define rmover_hit_y_hot 6 static unsigned char rmover_hit_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0xa0, 0x00, 0x3c, 0x01, 0x04, 0x02, 0x04, 0x04, 0x04, 0x02, 0x3c, 0x01, 0xa0, 0x00, 0x60, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/rmoverMask.bm000066400000000000000000000004521340731477100234230ustar00rootroot00000000000000#define rmover_mask_width 11 #define rmover_mask_height 11 #define rmover_mask_x_hot 5 #define rmover_mask_y_hot 5 static unsigned char rmover_mask_bits[] = { 0x00, 0x00, 0x30, 0x00, 0x70, 0x00, 0xfe, 0x00, 0xfe, 0x01, 0xfe, 0x03, 0xfe, 0x07, 0xfe, 0x03, 0xfc, 0x01, 0xf0, 0x00, 0x60, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/rufast.bm000066400000000000000000000005201340731477100225750ustar00rootroot00000000000000#define rufast_width 16 #define rufast_height 16 #define rufast_x_hot 9 #define rufast_y_hot 6 static unsigned char rufast_bits[] = { 0x00, 0x00, 0xc0, 0x7f, 0x80, 0x40, 0x00, 0x41, 0x00, 0x42, 0x00, 0x44, 0xfe, 0x4b, 0x04, 0x52, 0x08, 0x62, 0x10, 0x42, 0x20, 0x02, 0x40, 0x02, 0x80, 0x02, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/rufastMask.bm000066400000000000000000000005511340731477100234150ustar00rootroot00000000000000#define rufast_mask_width 16 #define rufast_mask_height 16 #define rufast_mask_x_hot 9 #define rufast_mask_y_hot 6 static unsigned char rufast_mask_bits[] = { 0xe0, 0xff, 0xe0, 0xff, 0xc0, 0xff, 0x80, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xfc, 0xf7, 0xf8, 0xe7, 0xf0, 0xc7, 0xe0, 0x07, 0xc0, 0x07, 0x80, 0x07, 0x00, 0x07, 0x00, 0x06}; neuron-7.6.3/src/include/InterViews/Bitmaps/ufast.bm000066400000000000000000000005131340731477100224150ustar00rootroot00000000000000#define ufast_width 16 #define ufast_height 16 #define ufast_x_hot 8 #define ufast_y_hot 8 static unsigned char ufast_bits[] = { 0x00, 0x00, 0x00, 0x01, 0x80, 0x02, 0x40, 0x04, 0x20, 0x08, 0x10, 0x10, 0x08, 0x20, 0xfc, 0x7f, 0x00, 0x01, 0x80, 0x02, 0x40, 0x04, 0x20, 0x08, 0x10, 0x10, 0x08, 0x20, 0xfc, 0x7f, 0x00, 0x00}; neuron-7.6.3/src/include/InterViews/Bitmaps/ufastMask.bm000066400000000000000000000005441340731477100232350ustar00rootroot00000000000000#define ufast_mask_width 16 #define ufast_mask_height 16 #define ufast_mask_x_hot 8 #define ufast_mask_y_hot 8 static unsigned char ufast_mask_bits[] = { 0x00, 0x01, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0xf8, 0x3f, 0xfc, 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0xf8, 0x3f, 0xfc, 0x7f, 0xfe, 0xff, 0xfe, 0xff}; neuron-7.6.3/src/include/InterViews/Bitmaps/umover.bm000066400000000000000000000004571340731477100226170ustar00rootroot00000000000000#define umover_plain_width 11 #define umover_plain_height 11 #define umover_plain_x_hot 5 #define umover_plain_y_hot 5 static unsigned char umover_plain_bits[] = { 0x00, 0x00, 0x20, 0x00, 0x50, 0x00, 0x88, 0x00, 0x04, 0x01, 0x02, 0x02, 0x8e, 0x07, 0x88, 0x07, 0x88, 0x01, 0xf8, 0x01, 0xf0, 0x01}; neuron-7.6.3/src/include/InterViews/Bitmaps/umoverHit.bm000066400000000000000000000004451340731477100232610ustar00rootroot00000000000000#define umover_hit_width 11 #define umover_hit_height 11 #define umover_hit_x_hot 6 #define umover_hit_y_hot 6 static unsigned char umover_hit_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0xa0, 0x00, 0x10, 0x01, 0x08, 0x02, 0x04, 0x04, 0x1c, 0x07, 0x10, 0x01, 0x10, 0x01, 0xf0, 0x01}; neuron-7.6.3/src/include/InterViews/Bitmaps/umoverMask.bm000066400000000000000000000004521340731477100234260ustar00rootroot00000000000000#define umover_mask_width 11 #define umover_mask_height 11 #define umover_mask_x_hot 5 #define umover_mask_y_hot 5 static unsigned char umover_mask_bits[] = { 0x00, 0x00, 0x20, 0x00, 0x70, 0x00, 0xf8, 0x00, 0xfc, 0x01, 0xfe, 0x03, 0xfe, 0x07, 0xf8, 0x07, 0xf8, 0x01, 0xf8, 0x01, 0xf0, 0x01}; neuron-7.6.3/src/include/InterViews/_defines.h000077500000000000000000000317701340731477100213150ustar00rootroot00000000000000#define inch _lib_iv(inch) #define inches _lib_iv(inches) #define cm _lib_iv(cm) #define mm _lib_iv(mm) #define point _lib_iv(point) #define points _lib_iv(points) #define RasterRect _lib_iv(RasterRect) #if !MAC #define Point _lib_iv(Point) #endif #define Line _lib_iv(Line) #define Ellipse _lib_iv(Ellipse) #define MultiLine _lib_iv(MultiLine) #define Polygon _lib_iv(Polygon) #define ClosedBSpline _lib_iv(ClosedBSpline) #define Alignment _lib_iv(Alignment) #define ColorIntensity _lib_iv(ColorIntensity) #define ColorOp _lib_iv(ColorOp) #define Coord _lib_iv(Coord) #define EventType _lib_iv(EventType) #define EventButton _lib_iv(EventButton) #define GlyphBreakType _lib_iv(GlyphBreakType) #define GlyphIndex _lib_iv(GlyphIndex) #define IntCoord _lib_iv(IntCoord) #define PixelCoord _lib_iv(PixelCoord) #define Selection _lib_iv(Selection) #define Action _lib_iv(Action) #define ActiveHandler _lib_iv(ActiveHandler) #define Adjustable _lib_iv(Adjustable) #define Adjuster _lib_iv(Adjuster) #define Aggregate _lib_iv(Aggregate) #define AggregateInfo_List _lib_iv(AggregateInfo_List) #define Align _lib_iv(Align) #define Allocation _lib_iv(Allocation) #define AllocationInfo _lib_iv(AllocationInfo) #define AllocationTable _lib_iv(AllocationTable) #define AllocationTableImpl _lib_iv(AllocationTableImpl) #define Allotment _lib_iv(Allotment) #define ApplicationWindow _lib_iv(ApplicationWindow) #define ArrayCompositor _lib_iv(ArrayCompositor) #define ArrowSubclassName _lib_iv(ArrowSubclassName) #define BMPRaster _lib_iv(BMPRaster) #define Background _lib_iv(Background) #define Banner _lib_iv(Banner) #define Bevel _lib_iv(Bevel) #define BevelFrame _lib_iv(BevelFrame) #define Bitmap _lib_iv(Bitmap) #define BitmapRep _lib_iv(BitmapRep) #define Border _lib_iv(Border) #define BorderFrame _lib_iv(BorderFrame) #define Box _lib_iv(Box) #define BoxCanonical _lib_iv(BoxCanonical) #define BoxElement _lib_iv(BoxElement) #define BoxImpl _lib_iv(BoxImpl) #define Break _lib_iv(Break) #define Break_List _lib_iv(Break_List) #define Browser _lib_iv(Browser) #define BrowserList _lib_iv(BrowserList) #define Brush _lib_iv(Brush) #define BrushImpl _lib_iv(BrushImpl) #define BrushRep _lib_iv(BrushRep) #define Button _lib_iv(Button) #define ButtonList _lib_iv(ButtonList) #define ButtonState _lib_iv(ButtonState) #define Canvas _lib_iv(Canvas) #define CanvasDamage _lib_iv(CanvasDamage) #define CanvasRep _lib_iv(CanvasRep) #define Card _lib_iv(Card) #define CenterLayout _lib_iv(CenterLayout) #define Character _lib_iv(Character) #define CheckBox _lib_iv(CheckBox) #define ChoiceItem _lib_iv(ChoiceItem) #define ClippingStack _lib_iv(ClippingStack) #define Color _lib_iv(Color) #define ColorImpl _lib_iv(ColorImpl) #define ColorRep _lib_iv(ColorRep) #define ColorTable _lib_iv(ColorTable) #define CompletionEditor _lib_iv(CompletionEditor) #define Composition _lib_iv(Composition) #define CompositionComponent_List _lib_iv(CompositionComponent_List) #define Compositor _lib_iv(Compositor) #define Control _lib_iv(Control) #define ControlState _lib_iv(ControlState) #define CoordinateSpace _lib_iv(CoordinateSpace) #define Cursor _lib_iv(Cursor) #define CursorRep _lib_iv(CursorRep) #define CursorRepBitmap _lib_iv(CursorRepBitmap) #define CursorRepData _lib_iv(CursorRepData) #define CursorRepFont _lib_iv(CursorRepFont) #define CursorRepXFont _lib_iv(CursorRepXFont) #define DamageList _lib_iv(DamageList) #define DebugGlyph _lib_iv(DebugGlyph) #define Deck _lib_iv(Deck) #define Dialog _lib_iv(Dialog) #define DialogKit _lib_iv(DialogKit) #define DialogKitImpl _lib_iv(DialogKitImpl) #define Display _lib_iv(Display) #define DisplayRep _lib_iv(DisplayRep) #define DownMover _lib_iv(DownMover) #define Drag _lib_iv(Drag) #define DragRep _lib_iv(DragRep) #define DragZone _lib_iv(DragZone) #define DragZoneRep _lib_iv(DragZoneRep) #define DragZoneSink _lib_iv(DragZoneSink) #define DragZoneSinkHandler _lib_iv(DragZoneSinkHandler) #define Enlarger _lib_iv(Enlarger) #define Event _lib_iv(Event) #define EventRep _lib_iv(EventRep) #define Extension _lib_iv(Extension) #define FBDirectory _lib_iv(FBDirectory) #define FieldEditor _lib_iv(FieldEditor) #define FieldEditorAction _lib_iv(FieldEditorAction) #define FieldEditorImpl _lib_iv(FieldEditorImpl) #define FileBrowser _lib_iv(FileBrowser) #define FileBrowserImpl _lib_iv(FileBrowserImpl) #define FileChooser _lib_iv(FileChooser) #define FileChooserAction _lib_iv(FileChooserAction) #define FileChooserImpl _lib_iv(FileChooserImpl) #define FixedLayout _lib_iv(FixedLayout) #define Font _lib_iv(Font) #define FontBoundingBox _lib_iv(FontBoundingBox) #define FontFamily _lib_iv(FontFamily) #define FontFamilyImpl _lib_iv(FontFamilyImpl) #define FontFamilyRep _lib_iv(FontFamilyRep) #define FontImpl _lib_iv(FontImpl) #define FontRep _lib_iv(FontRep) #define Frame _lib_iv(Frame) #define GLContext _lib_iv(GLContext) #define GLContextImpl _lib_iv(GLContextImpl) #define GLWindow _lib_iv(GLWindow) #define Glue _lib_iv(Glue) #define Glyph _lib_iv(Glyph) #define GrabList _lib_iv(GrabList) #define Group _lib_iv(Group) #define GrowingBSpline _lib_iv(GrowingBSpline) #define GrowingClosedBSpline _lib_iv(GrowingClosedBSpline) #define GrowingMultiLine _lib_iv(GrowingMultiLine) #define GrowingPolygon _lib_iv(GrowingPolygon) #define GrowingVertices _lib_iv(GrowingVertices) #define HBorder _lib_iv(HBorder) #define HBox _lib_iv(HBox) #define HGlue _lib_iv(HGlue) #define HRule _lib_iv(HRule) #define HScrollBar _lib_iv(HScrollBar) #define HScroller _lib_iv(HScroller) #define Handler _lib_iv(Handler) #define Hit _lib_iv(Hit) #define HitImpl _lib_iv(HitImpl) #define IconWindow _lib_iv(IconWindow) #define Image _lib_iv(Image) #define InputHandler _lib_iv(InputHandler) #define InputHandlerImpl _lib_iv(InputHandlerImpl) #define Interactor _lib_iv(Interactor) #define InteractorHandler _lib_iv(InteractorHandler) #define InteractorWindow _lib_iv(InteractorWindow) #define KnownFonts _lib_iv(KnownFonts) #define LRComposition _lib_iv(LRComposition) #define LRMarker _lib_iv(LRMarker) #define Label _lib_iv(Label) #define Layout _lib_iv(Layout) #define LayoutKit _lib_iv(LayoutKit) #define LeftMover _lib_iv(LeftMover) #define MFDialogKit _lib_iv(MFDialogKit) #define MFKit _lib_iv(MFKit) #define MFKitImpl _lib_iv(MFKitImpl) #define MWkit _lib_iv(MWkit) #define MWkitImpl _lib_iv(MWkitImpl) #define Macro _lib_iv(Macro) #define MacroActionList _lib_iv(MacroActionList) #define ManagedWindow _lib_iv(ManagedWindow) #define ManagedWindowHintInfo _lib_iv(ManagedWindowHintInfo) #define ManagedWindowRep _lib_iv(ManagedWindowRep) #define MarginFrame _lib_iv(MarginFrame) #define MarginLayout _lib_iv(MarginLayout) #define MatchEditor _lib_iv(MatchEditor) #define Menu _lib_iv(Menu) #define MenuBar _lib_iv(MenuBar) #define MenuImpl _lib_iv(MenuImpl) #define MenuItem _lib_iv(MenuItem) #define Message _lib_iv(Message) #define MonoGlyph _lib_iv(MonoGlyph) #define MonoKit _lib_iv(MonoKit) #define MonoKitImpl _lib_iv(MonoKitImpl) #define MonoScene _lib_iv(MonoScene) #define Mover _lib_iv(Mover) #define NaturalLayout _lib_iv(NaturalLayout) #define OLDialogKit _lib_iv(OLDialogKit) #define OLKit _lib_iv(OLKit) #define OLKitImpl _lib_iv(OLKitImpl) #define Observable _lib_iv(Observable) #define Observer _lib_iv(Observer) #define ObserverList _lib_iv(ObserverList) #define OptionDesc _lib_iv(OptionDesc) #define PSFont _lib_iv(PSFont) #define PSFontImpl _lib_iv(PSFontImpl) #define Page _lib_iv(Page) #define PageInfo_List _lib_iv(PageInfo_List) #define Painter _lib_iv(Painter) #define PainterRep _lib_iv(PainterRep) #define Panner _lib_iv(Panner) #define Patch _lib_iv(Patch) #define PathRenderInfo _lib_iv(PathRenderInfo) #define Pattern _lib_iv(Pattern) #define PatternRep _lib_iv(PatternRep) #define Perspective _lib_iv(Perspective) #define Placement _lib_iv(Placement) #define PolyGlyph _lib_iv(PolyGlyph) #define PolyGlyphImpl _lib_iv(PolyGlyphImpl) #define PopupMenu _lib_iv(PopupMenu) #define PopupWindow _lib_iv(PopupWindow) #define Printer _lib_iv(Printer) #define PrinterRep _lib_iv(PrinterRep) #define PropertyData _lib_iv(PropertyData) #define PulldownMenu _lib_iv(PulldownMenu) #define PullrightMenu _lib_iv(PullrightMenu) #define PushButton _lib_iv(PushButton) #define RGBTable _lib_iv(RGBTable) #define RadioButton _lib_iv(RadioButton) #define Raster _lib_iv(Raster) #define RasterRep _lib_iv(RasterRep) #define Reducer _lib_iv(Reducer) #define Regexp _lib_iv(Regexp) #define ReqErr _lib_iv(ReqErr) #define Requirement _lib_iv(Requirement) #define Requisition _lib_iv(Requisition) #define Resource _lib_iv(Resource) #define RightMover _lib_iv(RightMover) #define RotatingLine _lib_iv(RotatingLine) #define RotatingLineList _lib_iv(RotatingLineList) #define RotatingRect _lib_iv(RotatingRect) #define RubberAxis _lib_iv(RubberAxis) #define RubberCircle _lib_iv(RubberCircle) #define RubberClosedSpline _lib_iv(RubberClosedSpline) #define RubberEllipse _lib_iv(RubberEllipse) #define RubberGroup _lib_iv(RubberGroup) #define RubberHandles _lib_iv(RubberHandles) #define RubberLine _lib_iv(RubberLine) #define RubberList _lib_iv(RubberList) #define RubberPointList _lib_iv(RubberPointList) #define RubberRect _lib_iv(RubberRect) #define RubberSpline _lib_iv(RubberSpline) #define RubberSquare _lib_iv(RubberSquare) #define RubberVertex _lib_iv(RubberVertex) #define Rubberband _lib_iv(Rubberband) #define Rule _lib_iv(Rule) #define SMFKit _lib_iv(SMFKit) #define SMFKitImpl _lib_iv(SMFKitImpl) #define ScalingLine _lib_iv(ScalingLine) #define ScalingLineList _lib_iv(ScalingLineList) #define ScalingRect _lib_iv(ScalingRect) #define Scene _lib_iv(Scene) #define ScrollBar _lib_iv(ScrollBar) #define ScrollBox _lib_iv(ScrollBox) #define Scroller _lib_iv(Scroller) #define SelectionHandler _lib_iv(SelectionHandler) #define SelectionList _lib_iv(SelectionList) #define SelectionManager _lib_iv(SelectionManager) #define SelectionManagerRep _lib_iv(SelectionManagerRep) #define Sensor _lib_iv(Sensor) #define Session _lib_iv(Session) #define SessionRep _lib_iv(SessionRep) #define Shadow _lib_iv(Shadow) #define ShadowFrame _lib_iv(ShadowFrame) #define Shape _lib_iv(Shape) #define ShowFrame _lib_iv(ShowFrame) #define SimpleCompositor _lib_iv(SimpleCompositor) #define Slider _lib_iv(Slider) #define SliderImpl _lib_iv(SliderImpl) #define SlidingEllipse _lib_iv(SlidingEllipse) #define SlidingLine _lib_iv(SlidingLine) #define SlidingLineList _lib_iv(SlidingLineList) #define SlidingPointList _lib_iv(SlidingPointList) #define SlidingRect _lib_iv(SlidingRect) #define Stencil _lib_iv(Stencil) #define Stepper _lib_iv(Stepper) #define StepperSubclassName _lib_iv(StepperSubclassName) #define StretchingRect _lib_iv(StretchingRect) #define StringBrowser _lib_iv(StringBrowser) #define StringChooser _lib_iv(StringChooser) #define StringEditor _lib_iv(StringEditor) #define Style _lib_iv(Style) #define StyleRep _lib_iv(StyleRep) #define Subject _lib_iv(Subject) #define SubjectRep _lib_iv(SubjectRep) #define Superpose _lib_iv(Superpose) #define TBComposition _lib_iv(TBComposition) #define TBScrollBox _lib_iv(TBScrollBox) #define TBScrollBoxImpl _lib_iv(TBScrollBoxImpl) #define TGlue _lib_iv(TGlue) #define TIFFRaster _lib_iv(TIFFRaster) #define TSolver _lib_iv(TSolver) #define Target _lib_iv(Target) #define TeXCompositor _lib_iv(TeXCompositor) #define Telltale _lib_iv(Telltale) #define TelltaleGroup _lib_iv(TelltaleGroup) #define TelltaleState _lib_iv(TelltaleState) #define Text _lib_iv(Text) #define TextAnnotation _lib_iv(TextAnnotation) #define TextBuffer _lib_iv(TextBuffer) #define TextButton _lib_iv(TextButton) #define TextDisplay _lib_iv(TextDisplay) #define TextEditor _lib_iv(TextEditor) #define TextLine _lib_iv(TextLine) #define TextLineAdjuster _lib_iv(TextLineAdjuster) #define TextLocation _lib_iv(TextLocation) #define TextRegion _lib_iv(TextRegion) #define TextRenderInfo _lib_iv(TextRenderInfo) #define Tile _lib_iv(Tile) #define TileFirstAligned _lib_iv(TileFirstAligned) #define TileReversed _lib_iv(TileReversed) #define TileReversedFirstAligned _lib_iv(TileReversedFirstAligned) #define TitleFrame _lib_iv(TitleFrame) #define TopLevelWindow _lib_iv(TopLevelWindow) #define TransformFitter _lib_iv(TransformFitter) #define TransformSetter _lib_iv(TransformSetter) #define Transformer _lib_iv(Transformer) #define TransformerStack _lib_iv(TransformerStack) #define TransientWindow _lib_iv(TransientWindow) #define Tray _lib_iv(Tray) #define TrayElement _lib_iv(TrayElement) #define UpMover _lib_iv(UpMover) #define VBorder _lib_iv(VBorder) #define VBox _lib_iv(VBox) #define VGlue _lib_iv(VGlue) #define VRule _lib_iv(VRule) #define VScrollBar _lib_iv(VScrollBar) #define VScroller _lib_iv(VScroller) #define VariableLayout _lib_iv(VariableLayout) #define ViewList _lib_iv(ViewList) #define Viewport _lib_iv(Viewport) #define WidgetKit _lib_iv(WidgetKit) #define WidgetKitImpl _lib_iv(WidgetKitImpl) #define Window _lib_iv(Window) #define WindowCursorStack _lib_iv(WindowCursorStack) #define WindowRep _lib_iv(WindowRep) #define WindowTable _lib_iv(WindowTable) #define WindowVisual _lib_iv(WindowVisual) #define World _lib_iv(World) #define XDrag _lib_iv(XDrag) #define XSlider _lib_iv(XSlider) #define XYMarker _lib_iv(XYMarker) #define XYSlider _lib_iv(XYSlider) #define YSlider _lib_iv(YSlider) #define Zoomer _lib_iv(Zoomer) neuron-7.6.3/src/include/InterViews/_enter.h000077500000000000000000000025431340731477100210110ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv__current_h #define iv__current_h #ifdef iv__2_6_h #undef iv__2_6_h #ifndef MAKEDEPEND #include #endif #endif #endif neuron-7.6.3/src/include/InterViews/_gendefs000077500000000000000000000020051340731477100210520ustar00rootroot00000000000000#! /bin/csh -f set tmp = /tmp/$$ cp /dev/null $tmp echo "inch" >> $tmp echo "inches" >> $tmp echo "cm" >> $tmp echo "mm" >> $tmp echo "point" >> $tmp echo "points" >> $tmp echo "RasterRect" >> $tmp echo "Point" >> $tmp echo "Line" >> $tmp echo "Ellipse" >> $tmp echo "MultiLine" >> $tmp echo "Polygon" >> $tmp echo "ClosedBSpline" >> $tmp echo "Alignment" >> $tmp echo "ColorIntensity" >> $tmp echo "ColorOp" >> $tmp echo "Coord" >> $tmp echo "EventType" >> $tmp echo "EventButton" >> $tmp echo "GlyphBreakType" >> $tmp echo "GlyphIndex" >> $tmp echo "IntCoord" >> $tmp echo "PixelCoord" >> $tmp echo "Selection" >> $tmp grep "^class" {.,../IV-X11,../IV-look,../IV-2_6/InterViews}/*.h | \ sed -e 's/.*class \([^ ;\*]*\).*$/\1/' | \ sort | uniq | \ fgrep -v "(" | \ grep -v '^String$' | \ grep -v '^IOHandler$' | \ grep -v '^istream$' | \ grep -v '^iostream$' | \ grep -v '^ostream$' \ >> $tmp sed -e 's/\(.*\)/#define \1 _lib_iv(\1)/' < $tmp > "_defines.h" sed -e 's/^/#undef /' < $tmp > "_undefs.h" rm $tmp neuron-7.6.3/src/include/InterViews/_leave.h000077500000000000000000000025451340731477100207720ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifdef iv__current_h #ifdef iv2_6_compatible #undef iv__current_h #define iv__2_6_h #ifndef MAKEDEPEND #include #endif #endif #endif neuron-7.6.3/src/include/InterViews/_names.h000077500000000000000000000053621340731477100210010ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Use current by default for ambiguous names. */ #undef Adjuster #undef Border #undef Box #undef Button #undef PushButton #undef RadioButton #undef Center #undef Coord #undef Deck #undef Dialog #undef FileBrowser #undef FileChooser #undef Glue #undef HGlue #undef VGlue #undef Menu #undef MenuBar #undef MenuItem #undef Mover #undef UpMover #undef DownMover #undef LeftMover #undef RightMover #undef Panner #undef Scroller #undef HScroller #undef VScroller #undef ScrollBar #undef HScrollBar #undef VScrollBar #undef Slider #define Adjuster _lib_iv(Adjuster) #define Border _lib_iv(Border) #define Box _lib_iv(Box) #define Button _lib_iv(Button) #define PushButton _lib_iv(PushButton) #define RadioButton _lib_iv(RadioButton) #define Center _lib_iv(Center) #define Coord _lib_iv(Coord) #define Deck _lib_iv(Deck) #define Dialog _lib_iv(Dialog) #define FileBrowser _lib_iv(FileBrowser) #define FileChooser _lib_iv(FileChooser) #define Glue _lib_iv(Glue) #define HGlue _lib_iv(HGlue) #define VGlue _lib_iv(VGlue) #define Menu _lib_iv(Menu) #define MenuBar _lib_iv(MenuBar) #define MenuItem _lib_iv(MenuItem) #define Mover _lib_iv(Mover) #define UpMover _lib_iv(UpMover) #define DownMover _lib_iv(DownMover) #define LeftMover _lib_iv(LeftMover) #define RightMover _lib_iv(RightMover) #define Panner _lib_iv(Panner) #define Scroller _lib_iv(Scroller) #define HScroller _lib_iv(HScroller) #define VScroller _lib_iv(VScroller) #define ScrollBar _lib_iv(ScrollBar) #define HScrollBar _lib_iv(HScrollBar) #define VScrollBar _lib_iv(VScrollBar) #define Slider _lib_iv(Slider) neuron-7.6.3/src/include/InterViews/_undefs.h000077500000000000000000000140031340731477100211520ustar00rootroot00000000000000#undef inch #undef inches #undef cm #undef mm #undef point #undef points #undef RasterRect #if !MAC #undef Point #endif #undef Line #undef Ellipse #undef MultiLine #undef Polygon #undef ClosedBSpline #undef Alignment #undef ColorIntensity #undef ColorOp #undef Coord #undef EventType #undef EventButton #undef GlyphBreakType #undef GlyphIndex #undef IntCoord #undef PixelCoord #undef Selection #undef Action #undef ActiveHandler #undef Adjustable #undef Adjuster #undef Aggregate #undef AggregateInfo_List #undef Align #undef Allocation #undef AllocationInfo #undef AllocationTable #undef AllocationTableImpl #undef Allotment #undef ApplicationWindow #undef ArrayCompositor #undef ArrowSubclassName #undef BMPRaster #undef Background #undef Banner #undef Bevel #undef BevelFrame #undef Bitmap #undef BitmapRep #undef Border #undef BorderFrame #undef Box #undef BoxCanonical #undef BoxElement #undef BoxImpl #undef Break #undef Break_List #undef Browser #undef BrowserList #undef Brush #undef BrushImpl #undef BrushRep #undef Button #undef ButtonList #undef ButtonState #undef Canvas #undef CanvasDamage #undef CanvasRep #undef Card #undef CenterLayout #undef Character #undef CheckBox #undef ChoiceItem #undef ClippingStack #undef Color #undef ColorImpl #undef ColorRep #undef ColorTable #undef CompletionEditor #undef Composition #undef CompositionComponent_List #undef Compositor #undef Control #undef ControlState #undef CoordinateSpace #undef Cursor #undef CursorRep #undef CursorRepBitmap #undef CursorRepData #undef CursorRepFont #undef CursorRepXFont #undef DamageList #undef DebugGlyph #undef Deck #undef Dialog #undef DialogKit #undef DialogKitImpl #undef Display #undef DisplayRep #undef DownMover #undef Drag #undef DragRep #undef DragZone #undef DragZoneRep #undef DragZoneSink #undef DragZoneSinkHandler #undef Enlarger #undef Event #undef EventRep #undef Extension #undef FBDirectory #undef FieldEditor #undef FieldEditorAction #undef FieldEditorImpl #undef FileBrowser #undef FileBrowserImpl #undef FileChooser #undef FileChooserAction #undef FileChooserImpl #undef FixedLayout #undef Font #undef FontBoundingBox #undef FontFamily #undef FontFamilyImpl #undef FontFamilyRep #undef FontImpl #undef FontRep #undef Frame #undef GLContext #undef GLContextImpl #undef GLWindow #undef Glue #undef Glyph #undef GrabList #undef Group #undef GrowingBSpline #undef GrowingClosedBSpline #undef GrowingMultiLine #undef GrowingPolygon #undef GrowingVertices #undef HBorder #undef HBox #undef HGlue #undef HRule #undef HScrollBar #undef HScroller #undef Handler #undef Hit #undef HitImpl #undef IconWindow #undef Image #undef InputHandler #undef InputHandlerImpl #undef Interactor #undef InteractorHandler #undef InteractorWindow #undef KnownFonts #undef LRComposition #undef LRMarker #undef Label #undef Layout #undef LayoutKit #undef LeftMover #undef MFDialogKit #undef MFKit #undef MFKitImpl #undef MWkit #undef MWkitImpl #undef Macro #undef MacroActionList #undef ManagedWindow #undef ManagedWindowHintInfo #undef ManagedWindowRep #undef MarginFrame #undef MarginLayout #undef MatchEditor #undef Menu #undef MenuBar #undef MenuImpl #undef MenuItem #undef Message #undef MonoGlyph #undef MonoKit #undef MonoKitImpl #undef MonoScene #undef Mover #undef NaturalLayout #undef OLDialogKit #undef OLKit #undef OLKitImpl #undef Observable #undef Observer #undef ObserverList #undef OptionDesc #undef PSFont #undef PSFontImpl #undef Page #undef PageInfo_List #undef Painter #undef PainterRep #undef Panner #undef Patch #undef PathRenderInfo #undef Pattern #undef PatternRep #undef Perspective #undef Placement #undef PolyGlyph #undef PolyGlyphImpl #undef PopupMenu #undef PopupWindow #undef Printer #undef PrinterRep #undef PropertyData #undef PulldownMenu #undef PullrightMenu #undef PushButton #undef RGBTable #undef RadioButton #undef Raster #undef RasterRep #undef Reducer #undef Regexp #undef ReqErr #undef Requirement #undef Requisition #undef Resource #undef RightMover #undef RotatingLine #undef RotatingLineList #undef RotatingRect #undef RubberAxis #undef RubberCircle #undef RubberClosedSpline #undef RubberEllipse #undef RubberGroup #undef RubberHandles #undef RubberLine #undef RubberList #undef RubberPointList #undef RubberRect #undef RubberSpline #undef RubberSquare #undef RubberVertex #undef Rubberband #undef Rule #undef SMFKit #undef SMFKitImpl #undef ScalingLine #undef ScalingLineList #undef ScalingRect #undef Scene #undef ScrollBar #undef ScrollBox #undef Scroller #undef SelectionHandler #undef SelectionList #undef SelectionManager #undef SelectionManagerRep #undef Sensor #undef Session #undef SessionRep #undef Shadow #undef ShadowFrame #undef Shape #undef ShowFrame #undef SimpleCompositor #undef Slider #undef SliderImpl #undef SlidingEllipse #undef SlidingLine #undef SlidingLineList #undef SlidingPointList #undef SlidingRect #undef Stencil #undef Stepper #undef StepperSubclassName #undef StretchingRect #undef StringBrowser #undef StringChooser #undef StringEditor #undef Style #undef StyleRep #undef Subject #undef SubjectRep #undef Superpose #undef TBComposition #undef TBScrollBox #undef TBScrollBoxImpl #undef TGlue #undef TIFFRaster #undef TSolver #undef Target #undef TeXCompositor #undef Telltale #undef TelltaleGroup #undef TelltaleState #undef Text #undef TextAnnotation #undef TextBuffer #undef TextButton #undef TextDisplay #undef TextEditor #undef TextLine #undef TextLineAdjuster #undef TextLocation #undef TextRegion #undef TextRenderInfo #undef Tile #undef TileFirstAligned #undef TileReversed #undef TileReversedFirstAligned #undef TitleFrame #undef TopLevelWindow #undef TransformFitter #undef TransformSetter #undef Transformer #undef TransformerStack #undef TransientWindow #undef Tray #undef TrayElement #undef UpMover #undef VBorder #undef VBox #undef VGlue #undef VRule #undef VScrollBar #undef VScroller #undef VariableLayout #undef ViewList #undef Viewport #undef WidgetKit #undef WidgetKitImpl #undef Window #undef WindowCursorStack #undef WindowRep #undef WindowTable #undef WindowVisual #undef World #undef XDrag #undef XSlider #undef XYMarker #undef XYSlider #undef YSlider #undef Zoomer neuron-7.6.3/src/include/InterViews/action.h000077500000000000000000000061021340731477100210050ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Action - something to do */ #ifndef iv_action_h #define iv_action_h #include #include class Action : public Resource { protected: Action(); virtual ~Action(); public: virtual void execute() = 0; }; /* * Macro - list of actions */ typedef long MacroIndex; class MacroActionList; class Macro : public Action { public: Macro(Action* = nil, Action* = nil, Action* = nil, Action* = nil); virtual ~Macro(); virtual void prepend(Action*); virtual void append(Action*); virtual void insert(MacroIndex, Action*); virtual void remove(MacroIndex); virtual MacroIndex count() const; virtual Action* action(MacroIndex) const; virtual void execute(); private: MacroActionList* list_; }; /* * Action denoted by an object and member function to call on the object. */ #if 1 || defined(__STDC__) || defined(__ANSI_CPP__) #define __ActionCallback(T) T##_ActionCallback #define ActionCallback(T) __ActionCallback(T) #define __ActionMemberFunction(T) T##_ActionMemberFunction #define ActionMemberFunction(T) __ActionMemberFunction(T) #else #define __ActionCallback(T) T/**/_ActionCallback #define ActionCallback(T) __ActionCallback(T) #define __ActionMemberFunction(T) T/**/_ActionMemberFunction #define ActionMemberFunction(T) __ActionMemberFunction(T) #endif #define declareActionCallback(T) \ typedef void (T::*ActionMemberFunction(T))(); \ class ActionCallback(T) : public Action { \ public: \ ActionCallback(T)(T*, ActionMemberFunction(T)); \ \ virtual void execute(); \ private: \ T* obj_; \ ActionMemberFunction(T) func_; \ }; #define implementActionCallback(T) \ ActionCallback(T)::ActionCallback(T)(T* obj, ActionMemberFunction(T) func) { \ obj_ = obj; \ func_ = func; \ } \ \ void ActionCallback(T)::execute() { (obj_->*func_)(); } #include #endif neuron-7.6.3/src/include/InterViews/adjust.h000077500000000000000000000055231340731477100210300ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Adjustable - object to scroll and/or zoom */ #ifndef iv_adjust_h #define iv_adjust_h #include #include class Observable; class Observer; struct AdjustableImpl; class Adjustable { public: Adjustable(); virtual ~Adjustable(); virtual Observable* observable(DimensionName) const; virtual void attach(DimensionName, Observer*); virtual void detach(DimensionName, Observer*); virtual Coord lower(DimensionName) const; virtual Coord upper(DimensionName) const; virtual Coord length(DimensionName) const; virtual Coord cur_lower(DimensionName) const; virtual Coord cur_upper(DimensionName) const; virtual Coord cur_length(DimensionName) const; virtual void small_scroll(DimensionName, Coord); virtual Coord small_scroll(DimensionName) const; virtual void large_scroll(DimensionName, Coord); virtual Coord large_scroll(DimensionName) const; virtual void begin_adjustment(DimensionName); virtual void commit_adjustment(DimensionName); virtual void abort_adjustment(DimensionName); virtual void scroll_forward(DimensionName); virtual void scroll_backward(DimensionName); virtual void page_forward(DimensionName); virtual void page_backward(DimensionName); virtual void scroll_to(DimensionName, Coord lower); virtual void scale_to(DimensionName, float fraction_visible); virtual void zoom_to(float magnification); virtual void constrain(DimensionName, Coord& lower) const; virtual void notify(DimensionName) const; virtual void notify_all() const; private: AdjustableImpl* impl_; }; #include #endif neuron-7.6.3/src/include/InterViews/aggr.h000077500000000000000000000043661340731477100204620ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Aggregate - composite glyph */ #ifndef iv_aggr_h #define iv_aggr_h #include #include class AggregateInfo_List; class Aggregate : public Glyph { public: Aggregate(GlyphIndex size = 4); virtual ~Aggregate(); virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void print(Printer*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); virtual void append(Glyph*); virtual void prepend(Glyph*); virtual void insert(GlyphIndex, Glyph*); virtual void remove(GlyphIndex); virtual void replace(GlyphIndex, Glyph*); virtual void change(GlyphIndex); virtual GlyphIndex count() const; virtual Glyph* component(GlyphIndex) const; virtual void allot(GlyphIndex, DimensionName, const Allotment&); virtual void allotment(GlyphIndex, DimensionName, Allotment&) const; private: AggregateInfo_List* info_; }; #include #endif neuron-7.6.3/src/include/InterViews/align.h000077500000000000000000000033271340731477100206300ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Align - aligned layout */ #ifndef iv_align_h #define iv_align_h #include #include class Align : public Layout { public: Align(DimensionName); virtual ~Align(); virtual void request( GlyphIndex count, const Requisition*, Requisition& result ); virtual void allocate( const Allocation& given, GlyphIndex count, const Requisition*, Allocation* result ); private: DimensionName dimension_; }; #include #endif neuron-7.6.3/src/include/InterViews/alloctbl.h000077500000000000000000000060331340731477100213270ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * AllocationTable - common information for pairs */ #ifndef iv_alloctbl_h #define iv_alloctbl_h #include #include class AllocationTable; class AllocationTableImpl; class AllocationInfo { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif Canvas* canvas() const; const Allocation& allocation() const; const Transformer& transformer() const; void extension(const Extension&); Extension& extension(); const Extension& extension() const; Allocation* component_allocations(); private: friend class AllocationTable; Canvas* canvas_; Transformer* transformer_; Allocation allocation_; Extension extension_; long num_components_; Allocation* component_allocation_; }; inline Canvas* AllocationInfo::canvas() const { return canvas_; } inline const Allocation& AllocationInfo::allocation() const { return allocation_; } inline const Transformer& AllocationInfo::transformer() const { return *transformer_; } inline void AllocationInfo::extension(const Extension& e) { extension_ = e; } inline Extension& AllocationInfo::extension() { return extension_; } inline const Extension& AllocationInfo::extension() const { return extension_; } inline Allocation* AllocationInfo::component_allocations() { return component_allocation_; } class AllocationTable { public: AllocationTable(GlyphIndex count = 1, long maximum_allocations = 5); virtual ~AllocationTable(); virtual AllocationInfo* find(Canvas*, const Allocation&) const; virtual AllocationInfo* find_same_size( Canvas*, const Allocation&, Coord& dx, Coord& dy ) const; virtual AllocationInfo* allocate(Canvas*, const Allocation&); virtual AllocationInfo* most_recent() const; virtual void flush(); private: AllocationTableImpl* impl_; }; #endif neuron-7.6.3/src/include/InterViews/arraycomp.h000077500000000000000000000034661340731477100215370ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * ArrayCompositor */ #ifndef iv_arraycomp_h #define iv_arraycomp_h #include #include class ArrayCompositor : public Compositor { public: ArrayCompositor(CompositorIndex count); virtual ~ArrayCompositor(); virtual CompositorIndex compose( Coord* natural, Coord* stretch, Coord* shrink, int* penalites, CompositorIndex component_count, Coord* spans, CompositorIndex span_count, CompositorIndex* breaks, CompositorIndex break_count ); private: CompositorIndex count_; }; #include #endif neuron-7.6.3/src/include/InterViews/background.h000077500000000000000000000033541340731477100216550ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Background - opaque glyph */ #ifndef iv_background_h #define iv_background_h #include #include class Color; class Background : public MonoGlyph { public: Background(Glyph* body, const Color*); virtual ~Background(); virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void print(Printer*, const Allocation&) const; private: const Color* color_; }; #include #endif neuron-7.6.3/src/include/InterViews/bitmap.h000066400000000000000000000061051340731477100210040ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Bitmap - a two-dimensional bool mask */ #ifndef iv_bitmap_h #define iv_bitmap_h #include #include #include class BitmapRep; class Font; class Transformer; class Bitmap : public Resource { public: Bitmap( const void*, unsigned int width, unsigned int height, int x0 = -1, int y0 = -1 ); Bitmap(const Font*, long character, float scale = 1.0); Bitmap(const Bitmap&); virtual ~Bitmap(); static Bitmap* open(const char* filename); virtual void poke(bool set, int x, int y); virtual bool peek(int x, int y) const; virtual Coord width() const; virtual Coord height() const; virtual unsigned int pwidth() const; virtual unsigned int pheight() const; virtual Coord left_bearing() const; virtual Coord right_bearing() const; virtual Coord ascent() const; virtual Coord descent() const; virtual void flush() const; BitmapRep* rep() const; protected: Bitmap(); private: BitmapRep* rep_; public: /* anachronisms */ int Left() const; int Right() const; int Top() const; int Bottom() const; unsigned int Width() const; unsigned int Height() const; void Transform(const Transformer*); void Scale(float sx, float sy); void Rotate(float angle); void FlipHorizontal(); void FlipVertical(); void Rotate90(); void Rotate180(); void Rotate270(); void Invert(); bool Peek(int x, int y) const; void Poke(bool, int x, int y); }; inline BitmapRep* Bitmap::rep() const { return rep_; } inline unsigned int Bitmap::Width() const { return pwidth(); } inline unsigned int Bitmap::Height() const { return pheight(); } inline bool Bitmap::Peek(int x, int y) const { return peek(x, y); } inline void Bitmap::Poke(bool bit, int x, int y) { poke(bit, x, y); } #include #endif neuron-7.6.3/src/include/InterViews/border.h000077500000000000000000000033611340731477100210110ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Border - a glyph for framing */ #ifndef ivlook_border_h #define ivlook_border_h #include class Color; class Border : public MonoGlyph { public: Border(Glyph* body, const Color*); Border(Glyph* body, const Color*, Coord thickness); virtual ~Border(); virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void print(Printer*, const Allocation&) const; private: const Color* color_; Coord thickness_; }; #endif neuron-7.6.3/src/include/InterViews/box.h000066400000000000000000000050571340731477100203250ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Box - tiling glyph */ #ifndef iv_box_h #define iv_box_h #include #include class BoxImpl; class Layout; class Box : public PolyGlyph { public: Box(Layout* layout, GlyphIndex size); Box( Layout* layout, Glyph* =nil, Glyph* =nil, Glyph* =nil, Glyph* =nil, Glyph* =nil, Glyph* =nil, Glyph* =nil, Glyph* =nil, Glyph* =nil, Glyph* =nil ); virtual ~Box(); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void print(Printer*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); virtual void undraw(); virtual void modified(GlyphIndex); virtual void allotment(GlyphIndex, DimensionName, Allotment&) const; // complicated boxes with sliders, graphs, and/or box adjusters require // an effective modified() call on resize or adjustment. M. Hines could // not fix this problem except with this sledgehammer approach. // The WindowRep::resize will temporarily set the flag and call Glyph::request // when its request_on_resize_ flag is true. static void full_request(bool); private: BoxImpl* impl_; static bool full_request_; }; #include #endif neuron-7.6.3/src/include/InterViews/brush.h000077500000000000000000000040751340731477100206620ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * A brush specifies how lines should be drawn. */ #ifndef iv_brush_h #define iv_brush_h #include #include #include class BrushRep; class BrushImpl; class Display; class Brush : public Resource { public: Brush(Coord width); Brush(int pattern, Coord width); Brush(const int* pattern, int count, Coord width); virtual ~Brush(); virtual Coord width() const; #if !MAC virtual int dash_count() const; virtual int dash_list(int index) const; #endif BrushRep* rep(Display*) const; protected: void calc_dashes(int pat, int* dash, int& count); private: void init(const int*, int, Coord); #if defined(WIN32) || MAC BrushRep* rep_; #else BrushImpl* impl_; /* anachronisms */ public: unsigned int Width() const; #endif }; #include #endif neuron-7.6.3/src/include/InterViews/canvas.h000066400000000000000000000300101340731477100207730ustar00rootroot00000000000000/* * Canvas - an area for drawing */ /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ // ============================================================================ // // 1.5 // 1999/01/19 14:25:06 // // Changes for InterViews Port to the Windows 3.1/NT operating systems // Copyright (c) 1993 Tim Prinzing // // Permission to use, copy, modify, distribute, and sell this software and // its documentation for any purpose is hereby granted without fee, provided // that (i) the above copyright notice and this permission notice appear in // all copies of the software and related documentation, and (ii) the name of // Tim Prinzing may not be used in any advertising or publicity relating to // the software without the specific, prior written permission of Tim Prinzing. // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL Tim Prinzing BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // // ============================================================================ #ifndef iv_canvas_h #define iv_canvas_h #include #include class Bitmap; class Brush; class CanvasRep; class Color; class Extension; class Font; class Raster; class Transformer; class Window; #if !defined(WIN32) && !MAC /* anachronism */ typedef unsigned int CanvasLocation; class Canvas { public: Canvas(); virtual ~Canvas(); virtual Window* window() const; // Returns the window associated with this canvas, if this canvas // is bound to a window. A null pointer will be returned if this // canvas is not bound to a window. virtual void size(Coord width, Coord height); virtual void psize(PixelCoord width, PixelCoord height); virtual Coord width() const; virtual Coord height() const; virtual PixelCoord pwidth() const; virtual PixelCoord pheight() const; // width() and height() return the size of the canvas in terms of // printer points. The pwidth() and pheight() functions return the // size of the canvas in terms of pixels. virtual PixelCoord to_pixels(Coord, DimensionName d=Dimension_X) const; virtual Coord to_coord(PixelCoord, DimensionName d=Dimension_X) const; virtual Coord to_pixels_coord(Coord, DimensionName d=Dimension_X) const; // device/world coordinate system conversions. The to_pixels() // function converts printer points to pixels, and the to_coord() // function converts pixels to printer points. The dimension argument // is an extension of the InterViews 3.1 distribution which doesn't // distinguish between the X and Y dimensions. The dimension defaults // to the x dimension to provide backward compatibility (although // potentially incorrect behavior). virtual void new_path(); virtual void move_to(Coord x, Coord y); virtual void line_to(Coord x, Coord y); virtual void curve_to( Coord x, Coord y, Coord x1, Coord y1, Coord x2, Coord y2 ); virtual void close_path(); virtual void stroke(const Color*, const Brush*); virtual void line( Coord x1, Coord y1, Coord x2, Coord y2, const Color*, const Brush* ); virtual void rect( Coord l, Coord b, Coord r, Coord t, const Color*, const Brush* ); virtual void fill(const Color*); virtual void fill_rect(Coord l, Coord b, Coord r, Coord t, const Color*); virtual void character( const Font*, long ch, Coord width, const Color*, Coord x, Coord y ); virtual void stencil(const Bitmap*, const Color*, Coord x, Coord y); virtual void image(const Raster*, Coord x, Coord y); // stencil() stencils the bitmap foreground bits (those set to 1) // on the rendering surface in the given color at the given location. // The bitmap acts as a mask for the operation, as well as the source // of data. // // image() transfers a Raster (color bitmap) to the canvas surface // at the given location. // virtual void push_transform(); virtual void transform(const Transformer&); virtual void pop_transform(); virtual void transformer(const Transformer&); virtual const Transformer& transformer() const; virtual void push_clipping(); virtual void clip(); virtual void clip_rect(Coord l, Coord b, Coord r, Coord t); virtual void pop_clipping(); virtual void damage(const Extension&); virtual void damage(Coord left, Coord bottom, Coord right, Coord top); virtual bool damaged(const Extension&) const; virtual bool damaged( Coord left, Coord bottom, Coord right, Coord top ) const; virtual void damage_area(Extension&); virtual void damage_all(); virtual bool any_damage() const; virtual void restrict_damage(const Extension&); virtual void restrict_damage( Coord left, Coord bottom, Coord right, Coord top ); virtual void front_buffer(); virtual void back_buffer(); // These functions are for canvases that are bound to a window. If // the canvas is not bound to a window, these functions will have // no effect. The front_buffer() function switches the window into // immediate-mode rendering and will render directly to the window // without double-buffering (and allows rendering outside of the // Glyph::draw() function. This is typically used for things like // rubber-banding. The back_buffer() function switchs out of // immediate-mode and back to being double-buffered if double // buffering is being done. virtual void redraw(Coord left, Coord bottom, Coord right, Coord top); virtual void repair(); CanvasRep* rep() const; private: CanvasRep* rep_; /* anachronisms */ public: enum { mapped, unmapped, offscreen }; virtual CanvasLocation status() const; unsigned int Width() const; unsigned int Height() const; virtual void SetBackground(const Color*); }; inline CanvasRep* Canvas::rep() const { return rep_; } #else // for mswindows and mac this is pure virtual base class class Canvas { public: Canvas(); virtual ~Canvas(); virtual Window* window() const; // Returns the window associated with this canvas, if this canvas // is bound to a window. A null pointer will be returned if this // canvas is not bound to a window. virtual void size(Coord width, Coord height) = 0; virtual void psize(PixelCoord width, PixelCoord height) = 0; virtual Coord width() const = 0; virtual Coord height() const = 0; virtual PixelCoord pwidth() const = 0; virtual PixelCoord pheight() const = 0; // width() and height() return the size of the canvas in terms of // printer points. The pwidth() and pheight() functions return the // size of the canvas in terms of pixels. virtual PixelCoord to_pixels(Coord, DimensionName d=Dimension_X) const = 0; virtual Coord to_coord(PixelCoord, DimensionName d=Dimension_X) const = 0; virtual Coord to_pixels_coord(Coord, DimensionName d=Dimension_X) const; // device/world coordinate system conversions. The to_pixels() // function converts printer points to pixels, and the to_coord() // function converts pixels to printer points. The dimension argument // is an extension of the InterViews 3.1 distribution which doesn't // distinguish between the X and Y dimensions. The dimension defaults // to the x dimension to provide backward compatibility (although // potentially incorrect behavior). virtual void new_path() = 0; virtual void move_to(Coord x, Coord y) = 0; virtual void line_to(Coord x, Coord y) = 0; virtual void curve_to( Coord x, Coord y, Coord x1, Coord y1, Coord x2, Coord y2 ) = 0; virtual void close_path() = 0; virtual void ellipse_path(Coord x, Coord y, Coord rx, Coord ry); // This function creates a new path that represents an ellipse // shape that can be used to stroke, fill, clip, etc. The x and // y coordinates are the center. The coordinates rx and ry are // the radius in the x and y dimensions respectively. virtual void stroke(const Color*, const Brush*) = 0; virtual void line( Coord x1, Coord y1, Coord x2, Coord y2, const Color*, const Brush* ); virtual void rect( Coord l, Coord b, Coord r, Coord t, const Color*, const Brush* ); virtual void fill(const Color*) = 0; virtual void fill_rect(Coord l, Coord b, Coord r, Coord t, const Color*); virtual void character( const Font*, long ch, Coord width, const Color*, Coord x, Coord y ) = 0; virtual void stencil(const Bitmap*, const Color*, Coord x, Coord y) = 0; virtual void image(const Raster*, Coord x, Coord y) = 0; // stencil() stencils the bitmap foreground bits (those set to 1) // on the rendering surface in the given color at the given location. // The bitmap acts as a mask for the operation, as well as the source // of data. // // image() transfers a Raster (color bitmap) to the canvas surface // at the given location. // virtual void push_transform() = 0; virtual void transform(const Transformer&) = 0; virtual void pop_transform() = 0; virtual void transformer(const Transformer&) = 0; virtual const Transformer& transformer() const = 0; virtual void push_clipping(bool all = false) = 0; virtual void clip() = 0; virtual void clip_rect(Coord l, Coord b, Coord r, Coord t); virtual void pop_clipping() = 0; virtual void damage(const Extension&) = 0; virtual void damage(Coord left, Coord bottom, Coord right, Coord top) = 0; virtual bool damaged(const Extension&) const = 0; virtual bool damaged( Coord left, Coord bottom, Coord right, Coord top ) const = 0; virtual void damage_area(Extension&) = 0; virtual void damage_all() = 0; virtual bool any_damage() const = 0; virtual void restrict_damage(const Extension&) = 0; virtual void restrict_damage( Coord left, Coord bottom, Coord right, Coord top ) = 0; virtual void front_buffer(); virtual void back_buffer(); // These functions are for canvases that are bound to a window. If // the canvas is not bound to a window, these functions will have // no effect. The front_buffer() function switches the window into // immediate-mode rendering and will render directly to the window // without double-buffering (and allows rendering outside of the // Glyph::draw() function. This is typically used for things like // rubber-banding. The back_buffer() function switchs out of // immediate-mode and back to being double-buffered if double // buffering is being done. virtual void redraw(Coord left, Coord bottom, Coord right, Coord top) = 0; virtual void repair() = 0; }; #endif #include #endif neuron-7.6.3/src/include/InterViews/character.h000077500000000000000000000037211340731477100214700ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Character - a character glyph with font */ #ifndef iv_character_h #define iv_character_h #include class Color; class Font; class Character : public Glyph { public: Character(long c, const Font*, const Color*); virtual ~Character(); virtual long code() const; virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); private: long c_; const Font* font_; const Color* color_; Coord left_bearing_; Coord right_bearing_; Coord ascent_; Coord descent_; Coord width_; Coord height_; float alignment_; }; #endif neuron-7.6.3/src/include/InterViews/color.h000066400000000000000000000070141340731477100206460ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #if defined(WIN32) // ========================================================================= // // MS-Windows version. The InterViews distribution contains some // X11-specific things in the interface, so this version is slightly // different. // // ========================================================================= #endif #if !defined(WIN32) && !defined(MAC) #define UNIX 1 #endif #ifndef iv_color_h #define iv_color_h #include #include class ColorImpl; class ColorRep; class Display; class String; #if UNIX class WindowVisual; #endif typedef float ColorIntensity; typedef unsigned int ColorOp; class Color : public Resource { public: enum { Copy, Xor, Invisible }; Color( ColorIntensity r, ColorIntensity g, ColorIntensity b, float alpha = 1.0, ColorOp = Copy ); Color(const Color&, float alpha = 1.0, ColorOp = Copy); virtual ~Color(); static bool find( const Display*, const String&, ColorIntensity& r, ColorIntensity& g, ColorIntensity& b ); static bool find( const Display*, const char* name, ColorIntensity& r, ColorIntensity& g, ColorIntensity& b ); static const Color* lookup(Display*, const String& name); static const Color* lookup(Display*, const char* name); virtual bool distinguished(Display*, const Color*) const; virtual void intensities( Display*, ColorIntensity& r, ColorIntensity& g, ColorIntensity& b ) const; virtual float alpha() const; #if UNIX virtual ColorOp op() const; #endif virtual const Color* brightness(float adjust) const; /* use default display */ bool distinguished(const Color*) const; void intensities( ColorIntensity& r, ColorIntensity& g, ColorIntensity& b ) const; #if UNIX ColorRep* rep(WindowVisual*) const; private: ColorImpl* impl_; void remove(WindowVisual*) const; ColorRep* create( WindowVisual*, ColorIntensity, ColorIntensity, ColorIntensity, float, ColorOp ) const; void destroy(ColorRep*); /* anachronisms */ public: Color(int r, int g, int b); void Intensities(int& r, int& g, int& b) const; int PixelValue() const; #else ColorRep* rep() const; private: ColorRep* impl_; #endif }; #if !UNIX inline ColorRep* Color::rep() const { return impl_; } #endif #include #endif neuron-7.6.3/src/include/InterViews/composition.h000066400000000000000000000072371340731477100221020ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv_composition_h #define iv_composition_h #include class CompositionComponent_List; class Break_List; class Compositor; class Break; class Composition : public MonoGlyph { protected: Composition( Glyph* context, Compositor*, Glyph* separator, DimensionName, Coord span, Coord stretch, Coord shrink, GlyphIndex size ); public: virtual ~Composition(); virtual void allocate(Canvas*, const Allocation&, Extension&); virtual bool repair(); virtual GlyphIndex item(GlyphIndex index) const; virtual GlyphIndex beginning_of(GlyphIndex item) const; virtual GlyphIndex end_of(GlyphIndex item) const; virtual void margin(GlyphIndex item, Coord begin, Coord end); virtual void view(GlyphIndex first, GlyphIndex last); virtual void pick(Canvas*, const Allocation&, int depth, Hit&); virtual void append(Glyph*); virtual void prepend(Glyph*); virtual void insert(GlyphIndex, Glyph*); virtual void remove(GlyphIndex); virtual void replace(GlyphIndex, Glyph*); virtual void change(GlyphIndex); virtual GlyphIndex count() const; virtual Glyph* component(GlyphIndex) const; virtual void allotment(GlyphIndex, DimensionName, Allotment&) const; protected: virtual void do_repair( GlyphIndex first_component, GlyphIndex first_break, GlyphIndex* breaks, GlyphIndex break_count ); virtual void damage(GlyphIndex first, GlyphIndex last); virtual Glyph* separator(Break&); virtual Glyph* make_item(Break&, bool created); virtual Glyph* make(Break&); private: Compositor* compositor_; CompositionComponent_List* component_; Break_List* breaks_; Glyph* separator_; bool view_all_; bool damaged_; GlyphIndex first_damage_; GlyphIndex last_damage_; GlyphIndex item_; DimensionName dimension_; Coord span_; bool resizable_; }; class LRComposition : public Composition { public: LRComposition( Glyph* context, Compositor*, Glyph* separator, Coord width, Coord stretch = fil, Coord shrink = fil, GlyphIndex size = 10 ); virtual ~LRComposition(); protected: virtual Glyph* make(Break&); }; class TBComposition : public Composition { public: TBComposition( Glyph* context, Compositor*, Glyph* separator, Coord height, Coord stretch = fil, Coord shrink = fil, GlyphIndex size = 10 ); virtual ~TBComposition(); protected: virtual Glyph* make(Break&); }; #endif neuron-7.6.3/src/include/InterViews/compositor.h000077500000000000000000000035571340731477100217410ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Compositor - find breaks */ #ifndef iv_compositor_h #define iv_compositor_h #include #include #include static const int PenaltyBad = 10000; static const int PenaltyGood = -10000; typedef long CompositorIndex; class Compositor { public: Compositor(); virtual ~Compositor(); virtual CompositorIndex compose( Coord* natural, Coord* stretch, Coord* shrink, int* penalites, CompositorIndex component_count, Coord* spans, CompositorIndex span_count, CompositorIndex* breaks, CompositorIndex break_count ); }; #include #endif neuron-7.6.3/src/include/InterViews/comption.h000066400000000000000000000072371340731477100213670ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv_composition_h #define iv_composition_h #include class CompositionComponent_List; class Break_List; class Compositor; class Break; class Composition : public MonoGlyph { protected: Composition( Glyph* context, Compositor*, Glyph* separator, DimensionName, Coord span, Coord stretch, Coord shrink, GlyphIndex size ); public: virtual ~Composition(); virtual void allocate(Canvas*, const Allocation&, Extension&); virtual bool repair(); virtual GlyphIndex item(GlyphIndex index) const; virtual GlyphIndex beginning_of(GlyphIndex item) const; virtual GlyphIndex end_of(GlyphIndex item) const; virtual void margin(GlyphIndex item, Coord begin, Coord end); virtual void view(GlyphIndex first, GlyphIndex last); virtual void pick(Canvas*, const Allocation&, int depth, Hit&); virtual void append(Glyph*); virtual void prepend(Glyph*); virtual void insert(GlyphIndex, Glyph*); virtual void remove(GlyphIndex); virtual void replace(GlyphIndex, Glyph*); virtual void change(GlyphIndex); virtual GlyphIndex count() const; virtual Glyph* component(GlyphIndex) const; virtual void allotment(GlyphIndex, DimensionName, Allotment&) const; protected: virtual void do_repair( GlyphIndex first_component, GlyphIndex first_break, GlyphIndex* breaks, GlyphIndex break_count ); virtual void damage(GlyphIndex first, GlyphIndex last); virtual Glyph* separator(Break&); virtual Glyph* make_item(Break&, bool created); virtual Glyph* make(Break&); private: Compositor* compositor_; CompositionComponent_List* component_; Break_List* breaks_; Glyph* separator_; bool view_all_; bool damaged_; GlyphIndex first_damage_; GlyphIndex last_damage_; GlyphIndex item_; DimensionName dimension_; Coord span_; bool resizable_; }; class LRComposition : public Composition { public: LRComposition( Glyph* context, Compositor*, Glyph* separator, Coord width, Coord stretch = fil, Coord shrink = fil, GlyphIndex size = 10 ); virtual ~LRComposition(); protected: virtual Glyph* make(Break&); }; class TBComposition : public Composition { public: TBComposition( Glyph* context, Compositor*, Glyph* separator, Coord height, Coord stretch = fil, Coord shrink = fil, GlyphIndex size = 10 ); virtual ~TBComposition(); protected: virtual Glyph* make(Break&); }; #endif neuron-7.6.3/src/include/InterViews/coord.h000077500000000000000000000032731340731477100206440ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Coordinates for graphics allocation and rendering. */ #ifndef iv_coord_h #define iv_coord_h #include typedef float _lib_iv(Coord); typedef int _lib_iv(IntCoord); typedef int _lib_iv(PixelCoord); /* * Should be a static const float, but some compilers don't * do a very good job on that. */ #define fil 10e6 /* * Old definitions */ typedef int _lib_iv2_6(Coord); extern double inch, inches, cm, mm, point, points; static const int pixels = 1; #endif neuron-7.6.3/src/include/InterViews/cursor.h000077500000000000000000000063511340731477100210530ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * An input cursor is defined by two 16x16 bitmaps, one that * specifies which pixels are to be drawn and one that specifies * which pixels are in foreground color and which in background color. * If a device does not support a mask the background pixels are not drawn. */ #if defined(WIN32) || MAC // ====================================================================== // // This file contains a super-set of the InterViews 3.1 distribution. // // 1.2 // 1997/03/28 22:04:01 // // ====================================================================== #endif #ifndef iv_cursor_h #define iv_cursor_h #include static const int cursorHeight = 16; static const int cursorWidth = 16; typedef int CursorPattern[cursorHeight]; class Color; class CursorRep; class Bitmap; class Font; class Cursor { public: Cursor( short xoff, short yoff, /* hot spot */ const int* pat, const int* mask, const Color* fg = nil, const Color* bg = nil ); Cursor( const Bitmap* pat, const Bitmap* mask, const Color* fg = nil, const Color* bg = nil ); Cursor( const Font*, int pat, int mask, const Color* fg = nil, const Color* bg = nil ); Cursor(int, const Color* fg = nil, const Color* bg = nil); ~Cursor(); #if defined(WIN32) || MAC Cursor(const char*); // This constructor takes a resource name and constructs a // cursor from that. Although this functionality isn't native // under X11, it is possible to produce this behavior fairly // easily. It is quite useful under MS-Windows, which makes // extensive use of resources. #endif static void init(); CursorRep* rep(); private: CursorRep* rep_; }; inline CursorRep* Cursor::rep() { return rep_; } /* * Predefined cursors. */ extern Cursor* defaultCursor; extern Cursor* arrow; extern Cursor* crosshairs; extern Cursor* ltextCursor; extern Cursor* rtextCursor; extern Cursor* hourglass; extern Cursor* upperleft; extern Cursor* upperright; extern Cursor* lowerleft; extern Cursor* lowerright; extern Cursor* noCursor; #endif neuron-7.6.3/src/include/InterViews/debug.h000077500000000000000000000060261340731477100206230ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * DebugGlyph -- trace glyph calls */ #ifndef iv_debug_h #define iv_debug_h #include #include class DebugGlyph : public MonoGlyph { public: enum { trace_none = 0x0, trace_request = 0x1, trace_allocate = 0x2, trace_draw = 0x4, trace_print = 0x8, trace_pick = 0x10, trace_undraw = 0x20, /* convenient shorthand */ trace_request_allocate = 0x3, trace_request_draw = 0x5, trace_allocate_draw = 0x6, trace_request_allocate_draw = 0x7, trace_request_pick = 0x11, trace_allocate_pick = 0x12, trace_request_allocate_pick = 0x13, trace_draw_pick = 0x14, trace_request_draw_pick = 0x15, trace_request_undraw = 0x21, trace_allocate_undraw = 0x22, trace_request_allocate_undraw = 0x23, trace_draw_undraw = 0x24, trace_request_draw_undraw = 0x25, trace_allocate_draw_undraw = 0x26, trace_request_allocate_draw_undraw = 0x27, trace_pick_undraw = 0x30, trace_request_pick_undraw = 0x31, trace_allocate_pick_undraw = 0x32, trace_request_allocate_pick_undraw = 0x33, trace_draw_pick_undraw = 0x34, trace_request_draw_pick_undraw = 0x35, trace_allocate_draw_pick_undraw = 0x36, trace_request_allocate_draw_pick_undraw = 0x37, trace_all = 0x3f }; DebugGlyph(Glyph* g, const char* msg, unsigned int trace_flags); virtual ~DebugGlyph(); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void print(Printer*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); virtual void undraw(); static void print_requirement(const Requirement&); static void print_allotment(const Allotment&); private: const char* msg_; unsigned int flags_; void heading(const char*) const; }; #include #endif neuron-7.6.3/src/include/InterViews/deck.h000066400000000000000000000040311340731477100204320ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv_deck_h #define iv_deck_h #include #include class Deck : public PolyGlyph { public: Deck(GlyphIndex size = 0); virtual ~Deck(); GlyphIndex card() const; void flip_to(GlyphIndex); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void print(Printer*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); virtual void undraw(); virtual void modified(GlyphIndex); virtual void allotment(GlyphIndex, DimensionName, Allotment&) const; private: GlyphIndex card_; bool changed_; Requisition requisition_; Allocation allocation_; }; #include #endif neuron-7.6.3/src/include/InterViews/dialog.h000066400000000000000000000041051340731477100207650ustar00rootroot00000000000000/* * Copyright (c) 1992 Stanford University * Copyright (c) 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Dialog -- dialog box */ #ifndef iv_dialog_h #define iv_dialog_h #include #include class Window; /* * The post*_aligned operations replaced default parameters * due to an apparent bug in cfront 3.0. */ class Dialog : public InputHandler { public: Dialog(Glyph*, Style*); virtual ~Dialog(); bool post_for(Window*); virtual bool post_for_aligned(Window*, float xalign, float yalign); bool post_at(Coord x, Coord y); virtual bool post_at_aligned( Coord x, Coord y, float xalign, float yalign ); virtual bool run(); virtual void dismiss(bool accept); private: bool done_; bool accepted_; }; inline bool Dialog::post_for(Window* w) { return post_for_aligned(w, 0.5, 0.5); } inline bool Dialog::post_at(Coord x, Coord y) { return post_at_aligned(x, y, 0.5, 0.5); } #include #endif neuron-7.6.3/src/include/InterViews/display.h000066400000000000000000000101451340731477100211740ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Display -- workstation screen(s) and input devices */ #ifndef iv_display_h #define iv_display_h #include #include class Event; class DisplayRep; class Handler; class SelectionManager; class String; class Style; class Window; class Display { protected: Display(DisplayRep*); public: #ifdef WIN32 virtual void rescale(); #endif static Display* open(const String&); static Display* open(const char*); static Display* open(); virtual void close(); virtual ~Display(); virtual int fd() const; virtual Coord width() const; virtual Coord height() const; virtual PixelCoord pwidth() const; virtual PixelCoord pheight() const; virtual Coord a_width() const; virtual Coord a_height() const; PixelCoord to_pixels(Coord, DimensionName d = Dimension_X) const; Coord to_coord(PixelCoord, DimensionName d = Dimension_X) const; // device/world coordinate system conversions. The to_pixels() // function converts printer points to pixels, and the to_coord() // function converts pixels to printer points. The dimension argument // is an extension of the InterViews 3.1 distribution which doesnt // distinguish between the X and Y dimensions. The dimension defaults // to the x dimension to provide backward compatibility (although // potentially incorrect behavior). virtual bool defaults(String&) const; virtual void style(Style*); virtual Style* style() const; virtual void set_screen(int); virtual void repair(); virtual void flush(); virtual void sync(); virtual bool get(Event&); virtual void put(const Event&); virtual bool closed(); virtual void grab(Window*, Handler*); virtual void ungrab(Handler*, bool all = false); virtual Handler* grabber() const; virtual bool is_grabbing(Handler*) const; virtual void ring_bell(int); virtual void set_key_click(int); virtual void set_auto_repeat(bool); virtual void set_pointer_feedback(int thresh, int scale); virtual void move_pointer(Coord x, Coord y); virtual SelectionManager* primary_selection(); virtual SelectionManager* secondary_selection(); virtual SelectionManager* clipboard_selection(); virtual SelectionManager* find_selection(const char*); virtual SelectionManager* find_selection(const String&); DisplayRep* rep() const; private: DisplayRep* rep_; Coord x_pixel_; Coord y_pixel_; Coord x_point_; Coord y_point_; }; inline PixelCoord Display::to_pixels(Coord c, DimensionName d) const { return PixelCoord( c * ((d == Dimension_X) ? x_point_ : y_point_ ) + ((c > 0) ? 0.5 : -0.5) ); } inline Coord Display::to_coord(PixelCoord p, DimensionName d) const { return Coord(p) * ((d == Dimension_X) ? x_pixel_ : y_pixel_); } inline DisplayRep* Display::rep() const { return rep_; } #include #endif neuron-7.6.3/src/include/InterViews/drag.h000066400000000000000000000107461340731477100204530ustar00rootroot00000000000000/* * Copyright (c) 1992 Redwood Design Automation * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the name of * Redwood Design Automation may not be used in any advertising or publicity * relating to the software without the specific, prior written permission of * Redwood Design Automation. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL REDWOOD DESIGN AUTOMATION BE LIABLE FOR ANY SPECIAL, * INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT * ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ #ifndef iv_drag_h #define iv_drag_h #include #include class Allocation; class Canvas; class Cursor; class DragRep; class DragZoneRep; class DragZoneSinkHandler; class Event; class Hit; /* * To create a dragable glyph: * 1) create a derived class of Drag * 2) implement the member functions dragGlyph and/or dragCursor. dragGlyph * should return a glyph that will be dragged across the screen in a window. * dragCursor should return a cursor that will be dragged across the screen. * 3) implement the member function dragData. dragData should produce a * string to be sent to a drag zone * 4) the dragType member function can be implemented to provide a string * that is sent to a drag zone when the drag zone is entered * 5) caught, commit, and abort can be implemented to change the default * behavior. the default behavior is that a middle button press starts a * drag, a chorded button press aborts, and a button release commits a drag. * 6) dragOffset can be implemented to calculate a transformed offset from * the left-top corner of the dragGlyph. */ class Drag : public MonoGlyph { public: Drag(Glyph* glyph); virtual ~Drag(); virtual void dragable(bool); virtual bool dragable() const; virtual Glyph* dragGlyph() = 0; virtual Cursor* dragCursor() = 0; virtual void dragData(char*& value, int& length) = 0; virtual void dragType(char*& value, int& length); virtual void dragOffset(Event& event, int& dx, int& dy); virtual bool caught(const Event&) const; virtual bool commit(const Event&) const; virtual bool abort(const Event&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void pick(Canvas*, const Allocation&, int depth, Hit&); protected: DragRep* rep() const; private: DragRep* rep_; }; /* * To create a drag zone glyph: * 1) create a derived class of DragZone * 2) implement the member function drop. drop will be called when a drag * glyph is dropped in a DragZone glyph. * 3) enter, motion, and leave can be implemented to indicate when a drop * would be sent to a drag zone. */ class DragZone : public MonoGlyph { public: DragZone(Glyph*); virtual ~DragZone(); virtual void sensitive(bool); virtual bool sensitive() const; virtual void enter(Event&, const char* type, int length); virtual void motion(Event&); virtual void leave(Event&); virtual void drop(Event&, const char* data, int length) = 0; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void pick(Canvas*, const Allocation&, int depth, Hit&); protected: DragZoneRep* rep() const; private: DragZoneRep* rep_; }; /* * A drag zone sink publishes that a window can accept drag messages. It * also consumes any drag messages that do not fall in a drag zone. This * class could be eliminated and the code moved to xwindow.c. */ class DragZoneSink : public DragZone { public: DragZoneSink(Glyph*); virtual ~DragZoneSink(); virtual void drop(Event&, const char* data, int length); virtual void draw(Canvas*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); virtual bool event(Event& event); private: bool dragPublished_; DragZoneSinkHandler* target_; }; #include #endif neuron-7.6.3/src/include/InterViews/enter-scope.h000066400000000000000000000031701340731477100217530ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv__scope_h #define iv__scope_h #include #ifndef MAKEDEPEND #include #include #ifdef iv2_6_compatible #include #endif #ifndef iv_os__scope_h /* * Use OS bool and String definitions. */ #include #include #define String _lib_os(String) #define u_char _lib_os(u_char) #endif #endif #endif neuron-7.6.3/src/include/InterViews/event.h000066400000000000000000000114571340731477100206570ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Input events. */ #ifndef iv_event_h #define iv_event_h #if !defined(WIN32) && !MAC #define UNIX 1 #endif #include #include class Display; class EventRep; class Interactor; class Handler; class Window; class World; typedef unsigned int EventType; typedef unsigned int EventButton; #if UNIX /* anachronism */ enum { MotionEvent, /* mouse moved */ DownEvent, /* button pressed */ UpEvent, /* button released */ KeyEvent, /* key pressed, intepreted as ascii */ EnterEvent, /* mouse enters canvas */ LeaveEvent, /* mouse leaves canvas */ FocusInEvent, /* focus for keyboard events */ FocusOutEvent /* lose keyboard focus */ }; /* mouse button anachronisms */ static const int LEFTMOUSE = 0; static const int MIDDLEMOUSE = 1; static const int RIGHTMOUSE = 2; #endif class Event { public: enum { undefined, motion, down, up, key, other_event }; enum { none, any, left, middle, right, other_button }; Event(); Event(const Event&); virtual ~Event(); virtual Event& operator =(const Event&); virtual void display(Display*); virtual Display* display() const; virtual void window(Window*); virtual Window* window() const; virtual bool pending() const; virtual void read(); virtual bool read(long sec, long usec); virtual void unread(); virtual void poll(); virtual Handler* handler() const; virtual void handle(); virtual void grab(Handler*) const; virtual void ungrab(Handler*) const; virtual Handler* grabber() const; virtual bool is_grabbing(Handler*) const; virtual EventType type() const; virtual unsigned long time() const; virtual Coord pointer_x() const; virtual Coord pointer_y() const; virtual Coord pointer_root_x() const; virtual Coord pointer_root_y() const; virtual EventButton pointer_button() const; virtual unsigned int keymask() const; virtual bool control_is_down() const; virtual bool meta_is_down() const; virtual bool shift_is_down() const; virtual bool capslock_is_down() const; virtual bool left_is_down() const; virtual bool middle_is_down() const; virtual bool right_is_down() const; virtual unsigned char keycode() const; virtual unsigned long keysym() const; virtual unsigned int mapkey(char*, unsigned int len) const; EventRep* rep() const; private: EventRep* rep_; char free_store_[200]; void copy_rep(const Event&); #if UNIX /* * Old members for backward compatibility */ public: Interactor* target; unsigned long timestamp; EventType eventType; IntCoord x, y; /* mouse position relative to target */ bool control : 1; /* true if down */ bool meta : 1; bool shift : 1; bool shiftlock : 1; bool leftmouse : 1; bool middlemouse : 1; bool rightmouse : 1; unsigned char button; /* button pressed or released, if any */ unsigned short len; /* length of ASCII string */ char* keystring; /* ASCII interpretation of event, if any */ void GetAbsolute(IntCoord&, IntCoord&); void GetAbsolute(World*&, IntCoord&, IntCoord&); EventRep* Rep() const; private: World* w; _lib_iv2_6(Coord) wx, wy; char keydata[sizeof(int)]; friend class Interactor; void GetInfo(); void GetMotionInfo(); void GetButtonInfo(EventType); void GetKeyInfo(); void GetKeyState(unsigned); void GetCrossingInfo(EventType); #endif }; inline EventRep* Event::rep() const { return rep_; } #if UNIX inline EventRep* Event::Rep() const { return rep(); } #endif #include #endif neuron-7.6.3/src/include/InterViews/font.h000066400000000000000000000104231340731477100204740ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * A font is essentially an array of similar stencils that can be * indexed by a code corresponding to a character in an alphabet. */ #ifndef iv_font_h #define iv_font_h #include #include #include class Display; class FontFamilyImpl; class FontFamilyRep; class FontImpl; class FontRep; class String; /* * FontFamily - manages related fonts */ class FontFamily { public: FontFamily(const char* familyname); virtual ~FontFamily(); virtual bool font(int size, const char*& name, float& scale) const; virtual bool font( int size, const char* style, const char*& name, float& scale ) const; FontFamilyRep* rep(Display*) const; private: FontFamilyImpl* impl_; FontFamilyRep* create(Display*) const; void destroy(FontFamilyRep*); }; class FontBoundingBox { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif Coord left_bearing() const; Coord right_bearing() const; Coord width() const; Coord ascent() const; Coord descent() const; Coord font_ascent() const; Coord font_descent() const; private: friend class Font; Coord left_bearing_; Coord right_bearing_; Coord width_; Coord ascent_; Coord descent_; Coord font_ascent_; Coord font_descent_; }; inline Coord FontBoundingBox::left_bearing() const { return left_bearing_; } inline Coord FontBoundingBox::right_bearing() const { return right_bearing_; } inline Coord FontBoundingBox::width() const { return width_; } inline Coord FontBoundingBox::ascent() const { return ascent_; } inline Coord FontBoundingBox::descent() const { return descent_; } inline Coord FontBoundingBox::font_ascent() const { return font_ascent_; } inline Coord FontBoundingBox::font_descent() const { return font_descent_; } class Font : public Resource { public: Font(const String&, float scale = 1.0); Font(const char*, float scale = 1.0); virtual ~Font(); virtual void cleanup(); static const Font* lookup(const String&); static const Font* lookup(const char*); static bool exists(Display*, const String&); static bool exists(Display*, const char*); virtual const char* name() const; virtual const char* encoding() const; virtual Coord size() const; virtual void font_bbox(FontBoundingBox&) const; virtual void char_bbox(long, FontBoundingBox&) const; virtual void string_bbox(const char*, int, FontBoundingBox&) const; virtual Coord width(long) const; virtual Coord width(const char*, int) const; virtual int index(const char*, int, float offset, bool between) const; FontRep* rep(Display*) const; protected: Font(FontImpl*); private: friend class FontImpl; FontImpl* impl_; /* anachronisms */ public: int Baseline() const; bool FixedWidth() const; int Height() const; int Index(const char*, int offset, bool between) const; int Index(const char*, int, int offset, bool between) const; int Width(const char*) const; int Width(const char*, int) const; }; #include #endif neuron-7.6.3/src/include/InterViews/geometry.h000066400000000000000000000207511340731477100213660ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv_geometry_h #define iv_geometry_h #if MAC #undef require #endif #include #include /* * Can't make DimensionName an enum because we want to be able * to iterate from 0 to number_of_dimensions. Alas, * C++ does not allow arithmetic on enums. */ typedef unsigned int DimensionName; enum { Dimension_X = 0, Dimension_Y, Dimension_Z, Dimension_Undefined }; class CoordinateSpace { public: enum { x = 0, y, z, dimensions }; #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif }; class Requirement { public: Requirement(); Requirement(Coord natural); Requirement(Coord natural, Coord stretch, Coord shrink, float alignment); Requirement( Coord natural_lead, Coord max_lead, Coord min_lead, Coord natural_trail, Coord max_trail, Coord min_trail ); bool equals(const Requirement&, float epsilon) const; bool defined() const; void natural(Coord); Coord natural() const; void stretch(Coord); Coord stretch() const; void shrink(Coord); Coord shrink() const; void alignment(float); float alignment() const; private: Coord natural_; Coord stretch_; Coord shrink_; float alignment_; #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif }; class Requisition { public: Requisition(); Requisition(const Requisition&); void penalty(int); int penalty() const; bool equals(const Requisition&, float epsilon) const; void require(DimensionName, const Requirement&); void require_x(const Requirement&); void require_y(const Requirement&); const Requirement& requirement(DimensionName) const; const Requirement& x_requirement() const; const Requirement& y_requirement() const; Requirement& requirement(DimensionName); Requirement& x_requirement(); Requirement& y_requirement(); private: int penalty_; Requirement x_; Requirement y_; #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif }; class Allotment { public: Allotment(); Allotment(Coord origin, Coord span, float alignment); bool equals(const Allotment&, float epsilon) const; void origin(Coord); void offset(Coord); Coord origin() const; void span(Coord); Coord span() const; void alignment(float); float alignment() const; Coord begin() const; Coord end() const; private: Coord origin_; Coord span_; float alignment_; #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif }; class Allocation { public: Allocation(); Allocation(const Allocation&); bool equals(const Allocation&, float epsilon) const; void allot(DimensionName, const Allotment&); void allot_x(const Allotment&); void allot_y(const Allotment&); Allotment& allotment(DimensionName); const Allotment& allotment(DimensionName) const; Allotment& x_allotment(); Allotment& y_allotment(); const Allotment& x_allotment() const; const Allotment& y_allotment() const; Coord x() const; Coord y() const; Coord left() const; Coord right() const; Coord bottom() const; Coord top() const; private: Allotment x_; Allotment y_; #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif }; class Canvas; class Extension { public: Extension(); Extension(const Extension&); void operator =(const Extension&); static void transform_xy( Canvas*, Coord& left, Coord& bottom, Coord& right, Coord& top ); void set(Canvas*, const Allocation&); void set_xy(Canvas*, Coord left, Coord bottom, Coord right, Coord top); void clear(); void merge(const Extension&); void merge(Canvas*, const Allocation&); void merge_xy(Canvas*, Coord left, Coord bottom, Coord right, Coord top); Coord left() const; Coord bottom() const; Coord right() const; Coord top() const; private: Coord x_begin_; Coord x_end_; Coord y_begin_; Coord y_end_; #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif }; inline Requirement::Requirement() { natural_ = -fil; stretch_ = 0; shrink_ = 0; alignment_ = 0; } inline Requirement::Requirement(Coord natural) { natural_ = natural; stretch_ = 0; shrink_ = 0; alignment_ = 0; } inline Requirement::Requirement( Coord natural, Coord stretch, Coord shrink, float alignment ) { natural_ = natural; stretch_ = stretch; shrink_ = shrink; alignment_ = alignment; } inline bool Requirement::defined() const { return natural_ != -fil; } inline void Requirement::natural(Coord c) { natural_ = c; } inline Coord Requirement::natural() const { return natural_; } inline void Requirement::stretch(Coord c) { stretch_ = c; } inline Coord Requirement::stretch() const { return stretch_; } inline void Requirement::shrink(Coord c) { shrink_ = c; } inline Coord Requirement::shrink() const { return shrink_; } inline void Requirement::alignment(float a) { alignment_ = a; } inline float Requirement::alignment() const { return alignment_; } inline int Requisition::penalty() const { return penalty_; } inline void Requisition::penalty(int penalty) { penalty_ = penalty; } inline void Requisition::require_x(const Requirement& r) { x_ = r; } inline void Requisition::require_y(const Requirement& r) { y_ = r; } inline const Requirement& Requisition::x_requirement() const { return x_; } inline const Requirement& Requisition::y_requirement() const { return y_; } inline Requirement& Requisition::x_requirement() { return x_; } inline Requirement& Requisition::y_requirement() { return y_; } inline Allotment::Allotment() { origin_ = 0; span_ = 0; alignment_ = 0; } inline Allotment::Allotment(Coord origin, Coord span, float alignment) { origin_ = origin; span_ = span; alignment_ = alignment; } inline void Allotment::origin(Coord o) { origin_ = o; } inline void Allotment::offset(Coord o) { origin_ += o; } inline Coord Allotment::origin() const { return origin_; } inline void Allotment::span(Coord c) { span_ = c; } inline Coord Allotment::span() const { return span_; } inline void Allotment::alignment(float a) { alignment_ = a; } inline float Allotment::alignment() const { return alignment_; } inline Coord Allotment::begin() const { return origin_ - Coord(alignment_ * span_); } inline Coord Allotment::end() const { return origin_ - Coord(alignment_ * span_) + span_; } inline void Allocation::allot_x(const Allotment& a) { x_ = a; } inline void Allocation::allot_y(const Allotment& a) { y_ = a; } inline Allotment& Allocation::x_allotment() { return x_; } inline Allotment& Allocation::y_allotment() { return y_; } inline const Allotment& Allocation::x_allotment() const { return x_; } inline const Allotment& Allocation::y_allotment() const { return y_; } inline Coord Allocation::x() const { return x_.origin(); } inline Coord Allocation::y() const { return y_.origin(); } inline Coord Allocation::left() const { return x_.begin(); } inline Coord Allocation::right() const { return x_.end(); } inline Coord Allocation::bottom() const { return y_.begin(); } inline Coord Allocation::top() const { return y_.end(); } inline Coord Extension::left() const { return x_begin_; } inline Coord Extension::bottom() const { return y_begin_; } inline Coord Extension::right() const { return x_end_; } inline Coord Extension::top() const { return y_end_; } #include #endif neuron-7.6.3/src/include/InterViews/glcontext.h000077500000000000000000000030771340731477100215470ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * GLContext -- glyph for 3D drawing */ #ifndef iv_glcontext_h #define iv_glcontext_h #include #include class GLContextImpl; class GLWindow; class GLContext : public MonoGlyph { public: GLContext(Glyph*); virtual ~GLContext(); virtual void draw(Canvas*, const Allocation&) const; private: GLContextImpl* impl_; }; #endif neuron-7.6.3/src/include/InterViews/glue.h000077500000000000000000000033261340731477100204710ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Glue - filler glyph */ #ifndef iv_glue_h #define iv_glue_h #include #include class Glue : public Glyph { public: Glue( DimensionName, Coord natural, Coord stretch, Coord shrink, float alignment ); Glue(const Requisition&); virtual ~Glue(); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); private: Requisition requisition_; }; #include #endif neuron-7.6.3/src/include/InterViews/glyph.h000077500000000000000000000047311340731477100206610ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Glyph - visible data */ #ifndef iv_glyph_h #define iv_glyph_h #include #include #include #include class Canvas; class Hit; class Printer; typedef long GlyphIndex; typedef unsigned int GlyphBreakType; class Glyph : public Resource { public: enum { no_break, pre_break, in_break, post_break }; virtual ~Glyph(); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void print(Printer*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); virtual void undraw(); virtual Glyph* clone() const; virtual Glyph* compose(GlyphBreakType); virtual void append(Glyph*); virtual void prepend(Glyph*); virtual void insert(GlyphIndex, Glyph*); virtual void remove(GlyphIndex); virtual void replace(GlyphIndex, Glyph*); virtual void change(GlyphIndex); virtual GlyphIndex count() const; virtual Glyph* component(GlyphIndex) const; virtual void allotment(GlyphIndex index, DimensionName, Allotment&) const; protected: Glyph(); }; #include #endif neuron-7.6.3/src/include/InterViews/group.h000077500000000000000000000035161340731477100206720ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv_group_h #define iv_group_h #include class Aggregate; class Layout; // GlyphIndex list added by Chad Dawson to 3/4/94 to fix memory leak // in map_. #include declareList(GlyphIndexList,GlyphIndex); class Group : public Glyph { public: Group(Aggregate* aggregate, DimensionName dimension); virtual ~Group(); void map(GlyphIndex); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); private: Aggregate* aggregate_; DimensionName dimension_; Layout* layout_; GlyphIndexList map_; int count_; }; #endif neuron-7.6.3/src/include/InterViews/handler.h000066400000000000000000000027621340731477100211520ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv_handler_h #define iv_handler_h #include #include class Event; class Handler : public Resource { protected: Handler(); virtual ~Handler(); public: virtual bool event(Event&) = 0; }; #include #endif neuron-7.6.3/src/include/InterViews/hit.h000066400000000000000000000051321340731477100203130ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Hit detection */ #ifndef iv_hit_h #define iv_hit_h #include #include #include class Event; class Handler; class HitImpl; class Transformer; class Hit { protected: Hit(HitImpl*); public: Hit(const Event*); Hit(Coord x, Coord y); Hit(Coord left, Coord bottom, Coord right, Coord top); virtual ~Hit(); virtual const Event* event() const; virtual Coord left() const; virtual Coord bottom() const; virtual Coord right() const; virtual Coord top() const; virtual void push_transform(); virtual void transform(const Transformer&); virtual void pop_transform(); virtual void begin(int depth, Glyph*, GlyphIndex, Handler* = nil); virtual void target(int depth, Glyph*, GlyphIndex, Handler* = nil); virtual void end(); virtual void remove(int depth, GlyphIndex target = 0); virtual void retarget( int depth, Glyph*, GlyphIndex, Handler* = nil, GlyphIndex target = 0 ); virtual bool any() const; virtual int count() const; virtual int depth(GlyphIndex target = 0) const; virtual Glyph* target(int depth, GlyphIndex target = 0) const; virtual GlyphIndex index(int depth, GlyphIndex target = 0) const; virtual Handler* handler() const; private: HitImpl* impl_; char free_store_[4000]; void init(); }; #include #endif neuron-7.6.3/src/include/InterViews/image.h000077500000000000000000000031741340731477100206200ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Image - displays a Raster */ #ifndef iv_image_h #define iv_image_h #include class Raster; class Image : public Glyph { public: Image(const Raster* raster); virtual ~Image(); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; private: const Raster* raster_; }; #endif neuron-7.6.3/src/include/InterViews/input.h000066400000000000000000000062651340731477100206760ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * InputHandler - glyph that handles input */ #ifndef iv_input_h #define iv_input_h #include class Event; class Handler; class InputHandlerImpl; class Style; class Transformer; class InputHandler : public MonoGlyph { public: InputHandler(Glyph*, Style*); virtual ~InputHandler(); virtual Handler* handler() const; virtual InputHandler* parent() const; virtual Style* style() const; virtual void append_input_handler(InputHandler*); virtual void remove_input_handler(GlyphIndex); virtual void remove_all_input_handlers(); virtual GlyphIndex input_handler_count() const; virtual InputHandler* input_handler(GlyphIndex) const; virtual void focus(InputHandler*); virtual void next_focus(); virtual void prev_focus(); virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); virtual void undraw(); virtual void move(const Event&); virtual void press(const Event&); virtual void drag(const Event&); virtual void release(const Event&); virtual void keystroke(const Event&); virtual void double_click(const Event&); virtual InputHandler* focus_in(); virtual void focus_out(); virtual void allocation_changed(Canvas*, const Allocation&); virtual bool inside(const Event&); virtual Canvas* canvas() const; virtual const Transformer& transformer() const; virtual const Allocation& allocation() const; virtual void redraw() const; virtual void repick(int depth, Hit&); private: friend class InputHandlerImpl; InputHandlerImpl* impl_; }; class ActiveHandler : public InputHandler { protected: ActiveHandler(Glyph*, Style*); public: virtual ~ActiveHandler(); virtual void undraw(); virtual void move(const Event&); virtual void drag(const Event&); virtual void enter(); virtual void leave(); private: bool inside_; }; #endif neuron-7.6.3/src/include/InterViews/iv.h000077500000000000000000000027101340731477100201470ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _lib_iv_h #define _lib_iv_h #if 1 || defined(__STDC__) || defined(__ANSI_CPP__) #define _lib_iv(name) iv##name #define _lib_iv2_6(name) iv2_6_##name #else #define _lib_iv(name) iv/**/name #define _lib_iv2_6(name) iv2_6_/**/name #endif #endif neuron-7.6.3/src/include/InterViews/iv3text.h000066400000000000000000000220671340731477100211430ustar00rootroot00000000000000/* * Copyright (c) 1991 Redwood Design Automation * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the name of * Redwood Design Automation may not be used in any advertising or publicity * relating to the software without the specific, prior written permission of * Redwood Design Automation. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL REDWOOD DESIGN AUTOMATION BE LIABLE FOR ANY SPECIAL, * INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT * ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ // ======================================================================= // // Reworked to remove use of the Redwood utility classes, and use the // InterViews classes instead. // // 1.1 // 1997/03/28 17:36:08 // // InterViews Port to the Windows 3.1/NT operating systems // Copyright (c) 1993 Tim Prinzing // // Permission to use, copy, modify, distribute, and sell this software and // its documentation for any purpose is hereby granted without fee, provided // that (i) the above copyright notice and this permission notice appear in // all copies of the software and related documentation, and (ii) the name of // Tim Prinzing may not be used in any advertising or publicity relating to // the software without the specific, prior written permission of Tim Prinzing. // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL Tim Prinzing BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // // ======================================================================= #ifndef iv3Text_h #define iv3Text_h #include #include #include #include #include #include #undef TextLine #undef TextRegion #undef TextAnnotation #undef TextLocation #undef Text #undef TextLineAdjuster #define TextLine iv3_TextLine #define TextRegion iv3_TextRegion #define TextAnnotation iv3_TextAnnotation #define TextLocation iv3_TextLocation #define Text iv3_Text #define TextLineAdjuster iv3_TextLineAdjuster class Requisition; class Canvas; class Allocation; class Extension; class Event; class Font; class Color; class PolyGlyph; class Handler; class Hit; class String; class TextRegion { public: TextRegion(); TextRegion(const TextRegion& region); virtual ~TextRegion(); virtual TextRegion& operator=(const TextRegion& region); virtual void line1(unsigned line1); virtual unsigned line1() const; virtual void column1(unsigned column1); virtual unsigned column1() const; virtual void line2(unsigned line2); virtual unsigned line2() const; virtual void column2(unsigned column2); virtual unsigned column2() const; virtual void color(const Color* color); virtual const Color* color() const; protected: unsigned line1_; unsigned column1_; unsigned line2_; unsigned column2_; Color* color_; }; class TextAnnotation : public TextRegion, public Action { public: TextAnnotation(); virtual ~TextAnnotation(); virtual void execute(); }; declarePtrList(TextAnnotationArray,TextAnnotation) class TextLocation { public: unsigned line_; unsigned column_; Color* color_; unsigned width_; }; declarePtrList(TextActionArray,Action) class Text : public MonoGlyph, public Adjustable { public: Text(unsigned rows = 24, unsigned cols = 80, TextBuffer* buf = nil); ~Text(); void editBuffer(TextBuffer*); // Installs a new text buffer underneath the text glyph. The text // buffer is used for all textual interface. The buffer can be // treated as an abstract class, with more sophisticated // implementations than the base class TextBuffer; TextBuffer* editBuffer() const; // Fetches the current edit buffer being used. public: // --------------- glyph interface -------------------- void request(Requisition& requisition) const; void allocate(Canvas* canvas, const Allocation& allocation, Extension&); void draw(Canvas* canvas, const Allocation& allocation) const; void undraw(); void pick(Canvas* c, const Allocation& a, int depth, Hit& h); void press(const Event& event); void drag(const Event& event); virtual Handler* handler(); virtual void keystroke(const Event& event); public: // ---------------- adjustable interface ---------------- Coord lower(DimensionName dimension) const; Coord upper(DimensionName dimension) const; Coord length(DimensionName dimension) const; Coord cur_lower(DimensionName dimension) const; Coord cur_upper(DimensionName dimension) const; Coord cur_length(DimensionName dimension) const; void scroll_forward(DimensionName dimension); void scroll_backward(DimensionName dimension); void page_forward(DimensionName dimension); void page_backward(DimensionName dimension); void scroll_to(DimensionName dimension, Coord position); void reset(); void copy(); void cut(); void paste(); void paste(const char* buffer, unsigned count); TextBuffer* buffer() const; void region(unsigned line1, unsigned column1, unsigned line2, unsigned column2); void getRegion(unsigned& line1, unsigned& column1, unsigned& line2, unsigned& column2); void location(unsigned line, unsigned column); void getLocation(unsigned& line, unsigned& column); void annotate(TextAnnotation* annotation); void deannotate(TextAnnotation* annotation); void deannotate(); void readOnly(bool readOnly); bool readOnly() const; void font(const Font*); const Font* font() const; bool dirty(); bool delete_selection(); //true if nonempty selection virtual void modified(); void insertDirtyAction(Action* action); void removeDirtyAction(Action* action); protected: void drawRegion(const TextRegion& region, unsigned i, Coord x, Coord y, const String& line) const; void drawLocation(const TextLocation& location, unsigned i, Coord x, Coord y, const String& line) const; void drawLine(unsigned i, Coord x, Coord y, const String& line) const; Coord columnCoord(const String& line, unsigned column) const; bool snap(const Event& event, unsigned& line, unsigned& column) const; Coord width(char ch) const; Coord width(const String& line) const; Coord width() const; Coord height() const; void cur_lower(DimensionName dimension, Coord position); void cur_upper(DimensionName dimension, Coord position); void repair(); void damage(const TextLocation& location); void damage(const TextRegion& region); void damage(); bool damaged(unsigned line) const; void eraseLine(); void backspace(); void insertChars(const char* buffer, unsigned count); void expose(unsigned line, unsigned column); void expose(unsigned line1, unsigned column1, unsigned line2, unsigned column2); void dirty(bool dirty); void context_key(char key); TextBuffer* text_; bool readOnly_; Handler* handler_; TextRegion selection_; TextLocation insertion_; TextAnnotationArray annotation_; TextBuffer* textBuffer_; unsigned initialLines_; unsigned initialColumns_; const Font* font_; const Color* textColor_; Canvas* canvas_; Allocation* allocation_; Coord curLowerX_; Coord curUpperX_; Coord curLowerY_; Coord curUpperY_; bool dirty_; Coord width_; bool needWidth_; TextActionArray dirtyActions_; int ctl_pn_col_; // if >= 0 then in a sequence of up/down keystrokes. int escape_; // chars since last escape }; declareActionCallback(Text); class TextLine : public Text { public: TextLine(unsigned initialColumns = 10); TextLine(const String& line, unsigned initialColumns = 10); ~TextLine(); // Glyph void request(Requisition& requisition) const; // other handler stuff... void keystroke(const Event& event); String value(); }; class TextLineAdjuster : public Patch, public Observer { public: TextLineAdjuster(TextLine* textLine); ~TextLineAdjuster(); void update(Observable*); protected: bool needButtons(); void addButtons(); void removeButtons(); TextLine* adjustable_; bool have_:1; bool updating_:1; PolyGlyph* box_; }; inline void Text::editBuffer(TextBuffer* b) { text_ = b; } inline TextBuffer* Text::editBuffer() const { return text_; } #endif neuron-7.6.3/src/include/InterViews/iv3textbuffer.h000066400000000000000000000157111340731477100223330ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TextBuffer - editable text buffer */ // ======================================================================= // // Moved out of the 2.6 compatibility area and made a bunch of functions // const. // // 1.1 // 1997/03/28 17:36:09 // // Windows 3.1/NT InterViews Port // Copyright (c) 1993 Tim Prinzing // // Permission to use, copy, modify, distribute, and sell this software and // its documentation for any purpose is hereby granted without fee, provided // that (i) the above copyright notice and this permission notice appear in // all copies of the software and related documentation, and (ii) the name of // Tim Prinzing may not be used in any advertising or publicity relating to // the software without the specific, prior written permission of Tim Prinzing. // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL Tim Prinzing BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // // ======================================================================= //The name of the class has been changed so as to be able to coexist without // conflicting with the IV-2_6/InterViews version // They are almost identical but this creates and maintain it own copy // of the buffer whereas the IV-2_6 version holds a pointer to the buffer which // is allocated and freed elsewhere (and, e.g, idraw code explicitly changes // the outiside buffer and expects the inside buffer to mirror it) #ifndef iv3TextBuffer_h #define iv3TextBuffer_h #include #include #undef TextBuffer #undef Text #define TextBuffer iv3_TextBuffer #define Text iv3_Text class Regexp; class TextBuffer { public: TextBuffer(const char* buffer, int length, int size); virtual ~TextBuffer(); int Search(Regexp* regexp, int index, int range, int stop); int ForwardSearch(Regexp* regexp, int index); int BackwardSearch(Regexp* regexp, int index); int Match(Regexp* regexp, int index, int stop); bool ForwardMatch(Regexp* regexp, int index); bool BackwardMatch(Regexp* regexp, int index); virtual int Insert(int index, const char* string, int count); virtual int Delete(int index, int count); int Copy(int index, char* buffer, int count); int Height() const; int Width() const; #if MAC #undef Length #endif int Length() const; const char* Text() const; const char* Text(int index) const; const char* Text(int index1, int index2) const; char Char (int index) const; String getNth(int line) const; // Returns a string containing the text of the given line index. // This is primarily a convenience function. The returned string // should be considered temporary... the contents of which will // become invalid with the next edit operation. int LineIndex(int line) const; int LinesBetween(int index1, int index2) const; int LineNumber(int index) const; int LineOffset (int index) const; // Map between text indices and line and offset positions. lineIndex() // returns the index of the beginning of the line. lineNumber() // returns the number of the line that contains the given index. // lineOffset() returns the offset of index from the beginning of it's // containing line. linesBetween() returns the difference between // the line numbers containing two indices. A return value of zero // indicates the same line. A positive number index2 is after // index1. A negative number indicates index2 is before index1. // Lines are numbered starting from zero. int PreviousCharacter(int index) const; int NextCharacter(int index) const; bool IsBeginningOfText(int index) const; int BeginningOfText() const; bool IsEndOfText(int index) const; int EndOfText() const; bool IsBeginningOfLine(int index) const; int BeginningOfLine(int index) const; int BeginningOfNextLine(int index) const; bool IsEndOfLine(int index) const; int EndOfLine(int index) const; int EndOfPreviousLine(int index) const; bool IsBeginningOfWord(int index) const; int BeginningOfWord(int index) const; int BeginningOfNextWord(int index) const; bool IsEndOfWord(int index) const; int EndOfWord(int index) const; int EndOfPreviousWord(int index) const; protected: char* text; int length; int size; private: int linecount; int lastline; int lastindex; }; inline char TextBuffer::Char (int i) const { return (i<0) ? text[0] : (i>length) ? text[length] : text[i]; } inline const char* TextBuffer::Text () const { return text; } inline const char* TextBuffer::Text (int i) const { return text + ((i<0) ? 0 : (i>length) ? length : i); } inline const char* TextBuffer::Text (int i, int) const { return text + ((i<0) ? 0 : (i>length) ? length : i); } inline int TextBuffer::PreviousCharacter (int i) const { return (i<=0) ? 0 : i-1; } inline int TextBuffer::NextCharacter (int i) const { return (i>=length) ? length : i+1; } inline bool TextBuffer::IsBeginningOfText (int i) const { return i <= 0; } inline int TextBuffer::BeginningOfText () const { return 0; } inline bool TextBuffer::IsEndOfText (int i) const { return i >= length; } inline int TextBuffer::EndOfText () const { return length; } inline int TextBuffer::Height () const { return linecount; } inline int TextBuffer::Length () const { return length; } #endif /* iv3TextBuffer_h */ neuron-7.6.3/src/include/InterViews/label.h000077500000000000000000000041371340731477100206150ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Label - ASCII text glyph with font */ #ifndef iv_label_h #define iv_label_h #include #include class Color; class Font; class String; class Label : public Glyph { public: Label(const String&, const Font*, const Color*); Label(const char*, const Font*, const Color*); Label(const char*, int len, const Font*, const Color*); virtual ~Label(); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); private: String* text_; const Font* font_; const Color* color_; Coord left_; Coord right_; Coord ascent_; Coord descent_; Coord width_; Coord* char_widths_; void compute_metrics(); }; #include #endif neuron-7.6.3/src/include/InterViews/layout.h000077500000000000000000000322231340731477100210500ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Layout - structured layout */ #ifndef iv_layout_h #define iv_layout_h #include #include #include #include class Layout { protected: Layout(); public: virtual ~Layout(); virtual void request( GlyphIndex count, const Requisition*, Requisition& result ); virtual void allocate( const Allocation& given, GlyphIndex count, const Requisition*, Allocation* result ); }; class Color; class Font; class PolyGlyph; class LayoutKit { protected: LayoutKit(); public: virtual ~LayoutKit(); static LayoutKit* instance(); protected: static void instance(LayoutKit*); public: virtual PolyGlyph* box(Layout*, GlyphIndex size = 10) const; virtual PolyGlyph* hbox(GlyphIndex size) const; virtual PolyGlyph* hbox( Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil ) const; virtual PolyGlyph* vbox(GlyphIndex size) const; virtual PolyGlyph* vbox( Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil ) const; virtual PolyGlyph* hbox_first_aligned(GlyphIndex size) const; virtual PolyGlyph* hbox_first_aligned( Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil ) const; virtual PolyGlyph* vbox_first_aligned(GlyphIndex size) const; virtual PolyGlyph* vbox_first_aligned( Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil ) const; virtual ScrollBox* vscrollbox(GlyphIndex size = 10) const; virtual PolyGlyph* overlay( Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil ) const; virtual Deck* deck(GlyphIndex size) const; virtual Deck* deck( Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil, Glyph* = nil ) const; virtual MonoGlyph* back(Glyph*, Glyph* under) const; virtual MonoGlyph* front(Glyph*, Glyph* over) const; virtual MonoGlyph* between(Glyph*, Glyph* under, Glyph* over) const; virtual Glyph* glue( DimensionName, Coord natural, Coord stretch, Coord shrink, float alignment ) const; virtual Glyph* glue(const Requisition&) const; virtual Glyph* hglue() const; virtual Glyph* hglue(Coord natural) const; virtual Glyph* hglue(Coord natural, Coord stretch, Coord shrink) const; virtual Glyph* hglue( Coord natural, Coord stretch, Coord shrink, float alignment ) const; virtual Glyph* hspace(Coord natural) const; virtual Glyph* vglue() const; virtual Glyph* vglue(Coord natural) const; virtual Glyph* vglue(Coord natural, Coord stretch, Coord shrink) const; virtual Glyph* vglue( Coord natural, Coord stretch, Coord shrink, float alignment ) const; virtual Glyph* vspace(Coord natural) const; virtual Glyph* shape_of(Glyph*) const; virtual Glyph* shape_of_xy(Glyph*, Glyph*) const; virtual Glyph* discretionary(int penalty, Glyph*) const; virtual Glyph* discretionary( int penalty, Glyph* no, Glyph* before, Glyph* in, Glyph* after ) const; virtual Glyph* strut( const Font*, Coord natural = 0, Coord stretch = 0, Coord shrink = 0 ) const; virtual Glyph* hstrut( Coord right_bearing, Coord left_bearing = 0, Coord natural = 0, Coord stretch = 0, Coord shrink = 0 ) const; virtual Glyph* vstrut( Coord ascent, Coord descent = 0, Coord natural = 0, Coord stretch = 0, Coord shrink = 0 ) const; virtual Glyph* spaces( int count, Coord each, const Font*, const Color* ) const; virtual MonoGlyph* center(Glyph*, float x = 0.5, float y = 0.5) const; virtual MonoGlyph* center_dimension( Glyph*, DimensionName, float align ) const; virtual MonoGlyph* hcenter(Glyph*, float x = 0.5) const; virtual MonoGlyph* vcenter(Glyph*, float y = 0.5) const; virtual MonoGlyph* fixed(Glyph*, Coord x, Coord y) const; virtual MonoGlyph* fixed_dimension( Glyph*, DimensionName, Coord ) const; virtual MonoGlyph* hfixed(Glyph*, Coord x) const; virtual MonoGlyph* vfixed(Glyph*, Coord y) const; virtual MonoGlyph* flexible( Glyph*, Coord stretch = fil, Coord shrink = fil ) const; virtual MonoGlyph* flexible_dimension( Glyph*, DimensionName, Coord stretch = fil, Coord shrink = fil ) const; virtual MonoGlyph* hflexible( Glyph*, Coord stretch = fil, Coord shrink = fil ) const; virtual MonoGlyph* vflexible( Glyph*, Coord stretch = fil, Coord shrink = fil ) const; virtual MonoGlyph* natural(Glyph*, Coord x, Coord y) const; virtual MonoGlyph* natural_dimension( Glyph*, DimensionName, Coord ) const; virtual MonoGlyph* hnatural(Glyph*, Coord x) const; virtual MonoGlyph* vnatural(Glyph*, Coord y) const; virtual MonoGlyph* margin(Glyph*, Coord) const; virtual MonoGlyph* margin(Glyph*, Coord hmargin, Coord vmargin) const; virtual MonoGlyph* margin( Glyph*, Coord lmargin, Coord rmargin, Coord bmargin, Coord tmargin ) const; virtual MonoGlyph* margin( Glyph*, Coord lmargin, Coord lstretch, Coord lshrink, Coord rmargin, Coord rstretch, Coord rshrink, Coord bmargin, Coord bstretch, Coord bshrink, Coord tmargin, Coord tstretch, Coord tshrink ) const; virtual MonoGlyph* hmargin(Glyph*, Coord) const; virtual MonoGlyph* hmargin(Glyph*, Coord lmargin, Coord rmargin) const; virtual MonoGlyph* hmargin( Glyph*, Coord lmargin, Coord lstretch, Coord lshrink, Coord rmargin, Coord rstretch, Coord rshrink ) const; virtual MonoGlyph* vmargin(Glyph*, Coord) const; virtual MonoGlyph* vmargin(Glyph*, Coord bmargin, Coord tmargin) const; virtual MonoGlyph* vmargin( Glyph*, Coord bmargin, Coord bstretch, Coord bshrink, Coord tmargin, Coord tstretch, Coord tshrink ) const; virtual MonoGlyph* lmargin(Glyph*, Coord) const; virtual MonoGlyph* lmargin( Glyph*, Coord, Coord stretch, Coord shrink ) const; virtual MonoGlyph* rmargin(Glyph*, Coord) const; virtual MonoGlyph* rmargin( Glyph*, Coord, Coord stretch, Coord shrink ) const; virtual MonoGlyph* bmargin(Glyph*, Coord) const; virtual MonoGlyph* bmargin( Glyph*, Coord, Coord stretch, Coord shrink ) const; virtual MonoGlyph* tmargin(Glyph*, Coord) const; virtual MonoGlyph* tmargin( Glyph*, Coord, Coord stretch, Coord shrink ) const; /* backward compatibility */ MonoGlyph* fixed_span(Glyph*, Coord x, Coord y) const; MonoGlyph* fixed_span_dimension(Glyph*, DimensionName, Coord) const; MonoGlyph* h_fixed_span(Glyph*, Coord x) const; MonoGlyph* v_fixed_span(Glyph*, Coord y) const; MonoGlyph* variable_span( Glyph*, Coord stretch = fil, Coord shrink = fil ) const; MonoGlyph* variable_span_dimension( Glyph*, DimensionName, Coord stretch = fil, Coord shrink = fil ) const; MonoGlyph* h_variable_span( Glyph*, Coord stretch = fil, Coord shrink = fil ) const; MonoGlyph* v_variable_span( Glyph*, Coord stretch = fil, Coord shrink = fil ) const; MonoGlyph* natural_span(Glyph*, Coord x, Coord y) const; MonoGlyph* natural_span_dimension( Glyph*, DimensionName, Coord ) const; MonoGlyph* h_natural_span(Glyph*, Coord x) const; MonoGlyph* v_natural_span(Glyph*, Coord y) const; MonoGlyph* h_margin(Glyph*, Coord) const; MonoGlyph* h_margin(Glyph*, Coord lmargin, Coord rmargin) const; MonoGlyph* h_margin( Glyph*, Coord lmargin, Coord lstretch, Coord lshrink, Coord rmargin, Coord rstretch, Coord rshrink ) const; MonoGlyph* v_margin(Glyph*, Coord) const; MonoGlyph* v_margin(Glyph*, Coord bmargin, Coord tmargin) const; MonoGlyph* v_margin( Glyph*, Coord bmargin, Coord bstretch, Coord bshrink, Coord tmargin, Coord tstretch, Coord tshrink ) const; MonoGlyph* l_margin(Glyph*, Coord) const; MonoGlyph* l_margin( Glyph*, Coord, Coord stretch, Coord shrink ) const; MonoGlyph* r_margin(Glyph*, Coord) const; MonoGlyph* r_margin( Glyph*, Coord, Coord stretch, Coord shrink ) const; MonoGlyph* b_margin(Glyph*, Coord) const; MonoGlyph* b_margin( Glyph*, Coord, Coord stretch, Coord shrink ) const; MonoGlyph* t_margin(Glyph*, Coord) const; MonoGlyph* t_margin( Glyph*, Coord, Coord stretch, Coord shrink ) const; }; /* inline old names to new names */ inline MonoGlyph* LayoutKit::fixed_span(Glyph* g, Coord x, Coord y) const { return fixed(g, x, y); } inline MonoGlyph* LayoutKit::fixed_span_dimension( Glyph* g, DimensionName d, Coord c ) const { return fixed_dimension(g, d, c); } inline MonoGlyph* LayoutKit::h_fixed_span(Glyph* g, Coord x) const { return hfixed(g, x); } inline MonoGlyph* LayoutKit::v_fixed_span(Glyph* g, Coord y) const { return vfixed(g, y); } inline MonoGlyph* LayoutKit::variable_span( Glyph* g, Coord stretch, Coord shrink ) const { return flexible(g, stretch, shrink); } inline MonoGlyph* LayoutKit::variable_span_dimension( Glyph* g, DimensionName d, Coord stretch, Coord shrink ) const { return flexible_dimension(g, d, stretch, shrink); } inline MonoGlyph* LayoutKit::h_variable_span( Glyph* g, Coord stretch, Coord shrink ) const { return hflexible(g, stretch, shrink); } inline MonoGlyph* LayoutKit::v_variable_span( Glyph* g, Coord stretch, Coord shrink ) const { return vflexible(g, stretch, shrink); } inline MonoGlyph* LayoutKit::natural_span(Glyph* g, Coord x, Coord y) const { return natural(g, x, y); } inline MonoGlyph* LayoutKit::natural_span_dimension( Glyph* g, DimensionName d, Coord c ) const { return natural_dimension(g, d, c); } inline MonoGlyph* LayoutKit::h_natural_span(Glyph* g, Coord x) const { return hnatural(g, x); } inline MonoGlyph* LayoutKit::v_natural_span(Glyph* g, Coord y) const { return vnatural(g, y); } inline MonoGlyph* LayoutKit::h_margin(Glyph* g, Coord m) const { return hmargin(g, m); } inline MonoGlyph* LayoutKit::h_margin( Glyph* g, Coord lmargin, Coord rmargin ) const { return hmargin(g, lmargin, rmargin); } inline MonoGlyph* LayoutKit::h_margin( Glyph* g, Coord lmargin, Coord lstretch, Coord lshrink, Coord rmargin, Coord rstretch, Coord rshrink ) const { return hmargin(g, lmargin, lstretch, lshrink, rmargin, rstretch, rshrink); } inline MonoGlyph* LayoutKit::v_margin(Glyph* g, Coord m) const { return vmargin(g, m); } inline MonoGlyph* LayoutKit::v_margin( Glyph* g, Coord bmargin, Coord tmargin ) const { return vmargin(g, bmargin, tmargin); } inline MonoGlyph* LayoutKit::v_margin( Glyph* g, Coord bmargin, Coord bstretch, Coord bshrink, Coord tmargin, Coord tstretch, Coord tshrink ) const { return vmargin(g, bmargin, bstretch, bshrink, tmargin, tstretch, tshrink); } inline MonoGlyph* LayoutKit::l_margin(Glyph* g, Coord m) const { return lmargin(g, m); } inline MonoGlyph* LayoutKit::l_margin( Glyph* g, Coord natural, Coord stretch, Coord shrink ) const { return lmargin(g, natural, stretch, shrink); } inline MonoGlyph* LayoutKit::r_margin(Glyph* g, Coord m) const { return rmargin(g, m); } inline MonoGlyph* LayoutKit::r_margin( Glyph* g, Coord natural, Coord stretch, Coord shrink ) const { return rmargin(g, natural, stretch, shrink); } inline MonoGlyph* LayoutKit::b_margin(Glyph* g, Coord m) const { return bmargin(g, m); } inline MonoGlyph* LayoutKit::b_margin( Glyph* g, Coord natural, Coord stretch, Coord shrink ) const { return bmargin(g, natural, stretch, shrink); } inline MonoGlyph* LayoutKit::t_margin(Glyph* g, Coord m) const { return tmargin(g, m); } inline MonoGlyph* LayoutKit::t_margin( Glyph* g, Coord natural, Coord stretch, Coord shrink ) const { return tmargin(g, natural, stretch, shrink); } #endif neuron-7.6.3/src/include/InterViews/leave-scope.h000077500000000000000000000026551340731477100217440ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifdef iv__scope_h #undef iv__scope_h #ifdef iv__current_h #undef iv__current_h #endif #ifdef iv__2_6_h #undef iv__2_6_h #endif #ifndef MAKEDEPEND #include #undef nil #undef String #endif #endif neuron-7.6.3/src/include/InterViews/lrmarker.h000066400000000000000000000037661340731477100213610ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * LRMarker - mark text region */ #ifndef iv_lrmarker_h #define iv_lrmarker_h #include class Color; class LRMarker : public MonoGlyph { public: LRMarker(Glyph* body, const Color* overlay, const Color* underlay); virtual ~LRMarker(); void bound(Coord left, Coord bottom, Coord right, Coord top); void mark(Coord x1, Coord y1, Coord h1, Coord x2, Coord y2, Coord h2); void unmark(); virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void undraw(); private: Canvas* canvas_; const Color* overlay_; const Color* underlay_; bool marked_; bool bounded_; Coord left_, right_, bottom_, top_; Coord x1_, y1_, h1_; Coord x2_, y2_, h2_; }; #endif neuron-7.6.3/src/include/InterViews/monoglyph.h000077500000000000000000000044171340731477100215530ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * MonoGlyph */ #ifndef iv_monoglyph_h #define iv_monoglyph_h #include #include class MonoGlyph : public Glyph { public: virtual ~MonoGlyph(); virtual void body(Glyph*); virtual Glyph* body() const; virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void print(Printer*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); virtual void undraw(); virtual void append(Glyph*); virtual void prepend(Glyph*); virtual void insert(GlyphIndex, Glyph*); virtual void remove(GlyphIndex); virtual void replace(GlyphIndex, Glyph*); virtual void change(GlyphIndex); virtual GlyphIndex count() const; virtual Glyph* component(GlyphIndex) const; virtual void allotment(GlyphIndex, DimensionName, Allotment&) const; protected: MonoGlyph(Glyph* = nil); private: Glyph* body_; }; #include #endif neuron-7.6.3/src/include/InterViews/observe.h000077500000000000000000000034231340731477100212000ustar00rootroot00000000000000/* * Copyright (c) 1992 Stanford University * Copyright (c) 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Observable - object to observe */ #ifndef iv_observe_h #define iv_observe_h #include #include class Observer; class ObserverList; class Observable { public: Observable(); virtual ~Observable(); virtual void attach(Observer*); virtual void detach(Observer*); virtual void notify(); private: ObserverList* observers_; }; class Observer { protected: Observer(); public: virtual ~Observer(); virtual void update(Observable*); virtual void disconnect(Observable*); }; #include #endif neuron-7.6.3/src/include/InterViews/page.h000066400000000000000000000050331340731477100204430ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Page - arbitrary placements */ #ifndef iv_page_h #define iv_page_h #include class PageInfo_List; class Page : public Glyph { public: Page(Glyph* background); virtual ~Page(); Coord left() const; Coord right() const; Coord bottom() const; Coord top() const; Coord x() const; Coord y() const; void move(GlyphIndex, Coord x, Coord y); void location(GlyphIndex, Coord& x, Coord& y); void show(GlyphIndex, bool); bool showing(GlyphIndex) const; virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void print(Printer*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); virtual void undraw(); virtual void append(Glyph*); virtual void prepend(Glyph*); virtual void insert(GlyphIndex, Glyph*); virtual void remove(GlyphIndex); virtual void replace(GlyphIndex, Glyph*); virtual void change(GlyphIndex); virtual GlyphIndex count() const; virtual Glyph* component(GlyphIndex) const; virtual void allotment(GlyphIndex, DimensionName, Allotment&) const; private: PageInfo_List* info_; Glyph* background_; Canvas* canvas_; Allocation allocation_; }; #endif neuron-7.6.3/src/include/InterViews/patch.h000077500000000000000000000043521340731477100206340ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Patch - for repairing glyphs */ #ifndef iv_patch_h #define iv_patch_h #include #include class Patch : public MonoGlyph { public: Patch(Glyph*); virtual ~Patch(); Canvas* canvas() const; const Transformer& transformer() const; const Allocation& allocation() const; const Extension& extension() const; virtual void redraw() const; virtual void reallocate(); virtual void repick(int depth, Hit&); virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void undraw(); private: Canvas* canvas_; Transformer transformer_; Allocation allocation_; Extension extension_; }; inline Canvas* Patch::canvas() const { return canvas_; } inline const Transformer& Patch::transformer() const { return transformer_; } inline const Allocation& Patch::allocation() const { return allocation_; } inline const Extension& Patch::extension() const { return extension_; } #endif neuron-7.6.3/src/include/InterViews/pattern.h000077500000000000000000000036641340731477100212170ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * A pattern is a bit array describing where to fill. */ #ifndef iv_pattern_h #define iv_pattern_h #include #include class PatternRep; class Pattern : public Resource { public: enum { solid = 0xffff, clear = 0, lightgray = 0x8020, gray = 0xa5a5, darkgray = 0xfafa }; Pattern(); Pattern(const char*, unsigned int width, unsigned int height); Pattern(int); /* 4 x 4 */ Pattern(const int*); /* 16 x 16 */ virtual ~Pattern(); PatternRep* rep() const; private: PatternRep* rep_; void init(const char*, unsigned int width, unsigned int height); }; inline PatternRep* Pattern::rep() const { return rep_; } #include #endif neuron-7.6.3/src/include/InterViews/place.h000077500000000000000000000106021340731477100206140ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Placement - monoglyph that positions its body using a layout */ #ifndef iv_place_h #define iv_place_h #include #include class Placement : public MonoGlyph { public: Placement(Glyph*, Layout*); virtual ~Placement(); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void print(Printer*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); private: Layout* layout_; }; class CenterLayout : public Layout { public: CenterLayout(const DimensionName, float alignment = 0.5); virtual ~CenterLayout(); virtual void request( GlyphIndex count, const Requisition*, Requisition& result ); virtual void allocate( const Allocation& given, GlyphIndex count, const Requisition*, Allocation* result ); private: DimensionName dimension_; float alignment_; }; class FixedLayout : public Layout { public: FixedLayout(const DimensionName, Coord span); virtual ~FixedLayout(); virtual void request( GlyphIndex count, const Requisition*, Requisition& result ); virtual void allocate( const Allocation& given, GlyphIndex count, const Requisition*, Allocation* result ); private: DimensionName dimension_; Coord span_; }; class VariableLayout : public Layout { public: VariableLayout(const DimensionName, Coord stretch, Coord shrink); virtual ~VariableLayout(); virtual void request( GlyphIndex count, const Requisition*, Requisition& result ); virtual void allocate( const Allocation& given, GlyphIndex count, const Requisition*, Allocation* result ); private: DimensionName dimension_; Coord stretch_; Coord shrink_; }; class NaturalLayout : public Layout { public: NaturalLayout(const DimensionName, Coord natural); virtual ~NaturalLayout(); virtual void request( GlyphIndex count, const Requisition*, Requisition& result ); virtual void allocate( const Allocation& given, GlyphIndex count, const Requisition*, Allocation* result ); private: DimensionName dimension_; Coord natural_; }; class MarginLayout : public Layout { public: MarginLayout(Coord margin); MarginLayout(Coord hmargin, Coord vmargin); MarginLayout(Coord lmargin, Coord rmargin, Coord bmargin, Coord tmargin); MarginLayout( Coord lmargin, Coord lstretch, Coord lshrink, Coord rmargin, Coord rstretch, Coord rshrink, Coord bmargin, Coord bstretch, Coord bshrink, Coord tmargin, Coord tstretch, Coord tshrink ); virtual ~MarginLayout(); virtual void request( GlyphIndex count, const Requisition*, Requisition& result ); virtual void allocate( const Allocation& given, GlyphIndex count, const Requisition*, Allocation* result ); private: Coord lnatural_, lstretch_, lshrink_; Coord rnatural_, rstretch_, rshrink_; Coord bnatural_, bstretch_, bshrink_; Coord tnatural_, tstretch_, tshrink_; Requisition requisition_; static Coord span( Coord span, const Requirement& total, Coord natural, Coord stretch, Coord shrink ); }; #endif neuron-7.6.3/src/include/InterViews/polyglyph.h000077500000000000000000000036411340731477100215640ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * PolyGlyph -- list of glyphs */ #ifndef iv_polyglyph_h #define iv_polyglyph_h #include #include class PolyGlyphImpl; class PolyGlyph : public Glyph { public: PolyGlyph(GlyphIndex initial_size = 10); virtual ~PolyGlyph(); virtual void undraw(); virtual void append(Glyph*); virtual void prepend(Glyph*); virtual void insert(GlyphIndex, Glyph*); virtual void remove(GlyphIndex); virtual void replace(GlyphIndex, Glyph*); virtual void change(GlyphIndex); virtual GlyphIndex count() const; virtual Glyph* component(GlyphIndex) const; virtual void modified(GlyphIndex); private: PolyGlyphImpl* impl_; }; #include #endif neuron-7.6.3/src/include/InterViews/printer.h000066400000000000000000000074551340731477100212240ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Printer - generate output for a printer */ #ifndef iv_printer_h #define iv_printer_h #include #if 1 || defined(CYGWIN) #include #else #include #endif class PrinterRep; class Printer : public Canvas { public: Printer(ostream*); virtual ~Printer(); virtual PixelCoord to_pixels(Coord, DimensionName) const; virtual Coord to_coord(PixelCoord, DimensionName) const; virtual Coord to_pixels_coord(Coord, DimensionName) const; #if defined(WIN32) || defined(MAC) virtual void size(Coord width, Coord height); virtual void psize(PixelCoord width, PixelCoord height); virtual Coord width() const; virtual Coord height() const; virtual PixelCoord pwidth() const; virtual PixelCoord pheight() const; virtual void transformer(const Transformer&); virtual const Transformer& transformer() const; virtual void damage(const Extension&); virtual void damage(Coord left, Coord bottom, Coord right, Coord top); virtual bool damaged(const Extension&) const; virtual bool damaged( Coord left, Coord bottom, Coord right, Coord top ) const; virtual void damage_area(Extension&); virtual void damage_all(); virtual bool any_damage() const; virtual void restrict_damage(const Extension&); virtual void restrict_damage( Coord left, Coord bottom, Coord right, Coord top ); virtual void redraw(Coord left, Coord bottom, Coord right, Coord top); virtual void repair(); #endif virtual void resize(Coord left, Coord bottom, Coord right, Coord top); virtual void prolog(const char* creator = "InterViews"); virtual void epilog(); virtual void comment(const char*); virtual void page(const char*); virtual void push_transform(); virtual void transform(const Transformer&); virtual void pop_transform(); #if defined(WIN32) || MAC virtual void push_clipping(bool all = false); #else virtual void push_clipping(); #endif virtual void clip(); virtual void pop_clipping(); virtual void new_path(); virtual void move_to(Coord x, Coord y); virtual void line_to(Coord x, Coord y); virtual void curve_to( Coord x, Coord y, Coord x1, Coord y1, Coord x2, Coord y2 ); virtual void close_path(); virtual void stroke(const Color*, const Brush*); virtual void fill(const Color*); virtual void character( const Font*, long c, Coord width, const Color*, Coord x, Coord y ); virtual void stencil(const Bitmap*, const Color*, Coord x, Coord y); virtual void image(const Raster*, Coord x, Coord y); protected: virtual void flush(); private: PrinterRep* rep_; }; #endif neuron-7.6.3/src/include/InterViews/psfont.h000066400000000000000000000034751340731477100210500ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * PSFont - use PostScript font metrics */ #ifndef iv_psfont_h #define iv_psfont_h #include #include class PSFontImpl; class PSFont : public Font { public: PSFont(const char* psname, Coord size, const char* name, float scale); virtual ~PSFont(); static bool exists(const char* psname); virtual const char* name() const; virtual const char* encoding() const; virtual Coord size() const; virtual Coord width(long) const; virtual Coord width(const char*, int) const; private: PSFontImpl* impl_; }; #include #endif neuron-7.6.3/src/include/InterViews/raster.h000077500000000000000000000051651340731477100210400ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Raster - rasterized image */ #ifndef iv_raster_h #define iv_raster_h #include #include #include #include class RasterRep; class Raster : public Resource { public: Raster(unsigned long width, unsigned long height); Raster(const Raster&); virtual ~Raster(); virtual Coord width() const; virtual Coord height() const; virtual unsigned long pwidth() const; virtual unsigned long pheight() const; virtual Coord left_bearing() const; virtual Coord right_bearing() const; virtual Coord ascent() const; virtual Coord descent() const; virtual void peek( unsigned long x, unsigned long y, ColorIntensity& red, ColorIntensity& green, ColorIntensity& blue, float& alpha ) const; virtual void poke( unsigned long x, unsigned long y, ColorIntensity red, ColorIntensity green, ColorIntensity blue, float alpha ); virtual void flush() const; RasterRep* rep() const; protected: Raster(RasterRep*); private: RasterRep* rep_; /* anachronisms */ public: unsigned int Width() const; unsigned int Height() const; }; inline RasterRep* Raster::rep() const { return rep_; } inline unsigned int Raster::Width() const { return (unsigned int)pwidth(); } inline unsigned int Raster::Height() const { return (unsigned int)pheight(); } #include #endif neuron-7.6.3/src/include/InterViews/regexp.h000077500000000000000000000047361340731477100210350ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Regexp - regular expression searching */ #ifndef iv_regexp_h #define iv_regexp_h #include /* * These definitions are from Henry Spencers public-domain regular * expression matching routines. * * Definitions etc. for regexp(3) routines. * * Caveat: this is V8 regexp(3) [actually, a reimplementation thereof], * not the System V one. */ #define NSUBEXP 10 struct regexp { char *startp[NSUBEXP]; char *endp[NSUBEXP]; char *textStart; char regstart; /* Internal use only. */ char reganch; /* Internal use only. */ char *regmust; /* Internal use only. */ int regmlen; /* Internal use only. */ char program[1]; /* Unwarranted chumminess with compiler. */ }; /* * The first byte of the regexp internal "program" is actually this magic * number; the start node begins in the second byte. */ #define REGEXP_MAGIC 0234 class Regexp { public: Regexp(const char*); Regexp(const char*, int length); ~Regexp(); const char* pattern() const; int Search(const char* text, int length, int index, int range); int Match(const char* text, int length, int index); int BeginningOfMatch(int subexp = 0); int EndOfMatch(int subexp = 0); private: char* pattern_; regexp* c_pattern; }; #endif neuron-7.6.3/src/include/InterViews/reqerr.h000077500000000000000000000031601340731477100210310ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Handling errors from window server. */ #ifndef iv_reqerr_h #define iv_reqerr_h #include #include class ReqErr { public: unsigned long msgid; int code; int request; int detail; void* id; char message[256]; ReqErr(); virtual ~ReqErr(); ReqErr* Install(); virtual void Error(); }; #include #endif neuron-7.6.3/src/include/InterViews/resource.h000066400000000000000000000041741340731477100213630ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Resources are shared objects. */ #ifndef iv_resource_h #define iv_resource_h #include class Resource { public: Resource(); virtual ~Resource(); virtual void ref() const; virtual void unref() const; virtual void unref_deferred() const; virtual void cleanup(); /* nops for nil pointers */ static void ref(const Resource*); static void unref(const Resource*); static void unref_deferred(const Resource*); /* postpone unref deletes */ static bool defer(bool); static void flush(); /* for backward compatibility */ virtual void Reference() const { ref(); } virtual void Unreference() const { unref(); } private: unsigned refcount_; private: /* prohibit default assignment */ Resource& operator =(const Resource&); }; /* * For backward compatibility */ static inline void Unref(const Resource* r) { Resource::unref(r); } #endif neuron-7.6.3/src/include/InterViews/rule.h000077500000000000000000000036251340731477100205060ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Rule - visible filling */ #ifndef ivlook_rule_h #define ivlook_rule_h #include class Color; class Rule : public Glyph { public: Rule(DimensionName, const Color*, Coord thickness); virtual ~Rule(); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; private: DimensionName dimension_; const Color* color_; Coord thickness_; }; class HRule : public Rule { public: HRule(const Color*, Coord thickness); virtual ~HRule(); }; class VRule : public Rule { public: VRule(const Color*, Coord thickness); virtual ~VRule(); }; #endif neuron-7.6.3/src/include/InterViews/scrbox.h000066400000000000000000000060761340731477100210370ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * ScrollBox - scrollable list of glyphs */ #ifndef iv_scrbox_h #define iv_scrbox_h #include #include #include class ScrollBox : public PolyGlyph, public Adjustable { protected: ScrollBox(GlyphIndex size = 10); virtual ~ScrollBox(); virtual bool shown(GlyphIndex) const; virtual GlyphIndex first_shown() const; virtual GlyphIndex last_shown() const; }; class TBScrollBoxImpl; class TBScrollBox : public ScrollBox { public: TBScrollBox(GlyphIndex size = 10); virtual ~TBScrollBox(); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void print(Printer*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); virtual void undraw(); virtual void modified(GlyphIndex); virtual bool shown(GlyphIndex) const; virtual GlyphIndex first_shown() const; virtual GlyphIndex last_shown() const; virtual void allotment(GlyphIndex, DimensionName, Allotment&) const; virtual Coord lower(DimensionName) const; virtual Coord upper(DimensionName) const; virtual Coord length(DimensionName) const; virtual Coord cur_lower(DimensionName) const; virtual Coord cur_upper(DimensionName) const; virtual Coord cur_length(DimensionName) const; virtual void scroll_forward(DimensionName); virtual void scroll_backward(DimensionName); virtual void page_forward(DimensionName); virtual void page_backward(DimensionName); virtual void scroll_to(DimensionName, Coord lower); private: TBScrollBoxImpl* impl_; TBScrollBoxImpl& impl() const; void scroll_by(DimensionName, long); void do_scroll(DimensionName, GlyphIndex new_start, GlyphIndex new_end); }; #include #endif neuron-7.6.3/src/include/InterViews/selection.h000077500000000000000000000065111340731477100215210ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv_selection_h #define iv_selection_h #include #include class Display; class SelectionHandler; class SelectionManagerRep; class String; class SelectionManager : public Resource { public: SelectionManager(Display*, const char*); SelectionManager(Display*, const String&); virtual ~SelectionManager(); virtual void own( SelectionHandler* convert, SelectionHandler* lose = nil, SelectionHandler* done = nil ); virtual void put_value(const void*, int length, int format = 8); virtual void retrieve( const String& type, SelectionHandler* ok, SelectionHandler* fail = nil ); virtual void get_value(String*& type, void*&, int&, int& format); SelectionManagerRep* rep() const; private: SelectionManagerRep* rep_; }; class SelectionHandler : public Resource { protected: SelectionHandler(); public: virtual ~SelectionHandler(); virtual void handle(SelectionManager*) = 0; }; #if defined(__STDC__) || defined(__ANSI_CPP__) #define __SelectionCallback(T) T##_SelectionCallback #define SelectionCallback(T) __SelectionCallback(T) #define __SelectionMemberFunction(T) T##_SelectionMemberFunction #define SelectionMemberFunction(T) __SelectionMemberFunction(T) #else #define __SelectionCallback(T) T/**/_SelectionCallback #define SelectionCallback(T) __SelectionCallback(T) #define __SelectionMemberFunction(T) T/**/_SelectionMemberFunction #define SelectionMemberFunction(T) __SelectionMemberFunction(T) #endif #define declareSelectionCallback(T) \ typedef void (T::*SelectionMemberFunction(T))(SelectionManager*); \ class SelectionCallback(T) : public SelectionHandler { \ public: \ SelectionCallback(T)(T*, SelectionMemberFunction(T)); \ \ virtual void handle(SelectionManager*); \ private: \ T* obj_; \ SelectionMemberFunction(T) func_; \ }; #define implementSelectionCallback(T) \ SelectionCallback(T)::SelectionCallback(T)( \ T* obj, SelectionMemberFunction(T) func \ ) { \ obj_ = obj; \ func_ = func; \ } \ \ void SelectionCallback(T)::handle(SelectionManager* s) { (obj_->*func_)(s); } #endif neuron-7.6.3/src/include/InterViews/session.h000066400000000000000000000114711340731477100212150ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Session -- coordinate control flow and display management */ #ifdef WIN32 // ======================================================================= // // Extensions // // 1.2 // 1997/03/28 22:04:06 // // Windows 3.1/NT InterViews Port // Copyright (c) 1993 Tim Prinzing // // Permission to use, copy, modify, distribute, and sell this software and // its documentation for any purpose is hereby granted without fee, provided // that (i) the above copyright notices and this permission notice appear in // all copies of the software and related documentation, and (ii) the name of // Tim Prinzing may not be used in any advertising or publicity relating to // the software without the specific, prior written permission of Tim Prinzing. // // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL Tim Prinzing BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // // ======================================================================= #endif #ifndef iv_session_h #define iv_session_h #include #include class Display; class Event; class Handler; class SessionRep; class String; class Style; class Window; class PropertyData { public: const char* path; /* class/instance(s) property name */ const char* value; /* property value */ #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif }; enum OptionStyle { OptionPropertyNext, /* Property and value are in argv[i+1] */ OptionValueNext, /* argv[i+1] */ OptionValueImplicit, /* OptionDesc.value */ OptionValueIsArg, /* argv[i] */ OptionValueAfter /* &argv[i][strlen(OptionDesc.name)] */ }; class OptionDesc { public: const char* name; const char* path; OptionStyle style; const char* value; #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif }; class Session { public: Session( const char*, int& argc, char** argv, const OptionDesc* = nil, const PropertyData* = nil ); virtual ~Session(); const char* name() const; const char* classname() const; int argc() const; char** argv() const; Style* style() const; void default_display(Display*); Display* default_display() const; virtual Display* connect(const String&); virtual Display* connect(const char*); virtual void disconnect(Display*); virtual int run(); virtual int run_window(Window*); virtual void quit(); virtual void unquit(); #if MAC virtual void screen_update(); // normally happens in event loop when no event #endif virtual bool done() const; virtual bool pending() const; virtual void read(Event&); virtual bool read(long sec, long usec, Event&); virtual void unread(Event&); virtual void poll(Event&); #if defined(WIN32) || MAC static const char* installLocation(); // This function is an extension of the InterViews distribution. // A pathname of location of the installation directory tree is // returned, that can be used to locate various pieces of configuration // information (such as application defaults). How this location // gets set is platform specific. #endif static Session* instance(); private: SessionRep* rep_; }; #include #endif neuron-7.6.3/src/include/InterViews/shadow.h000066400000000000000000000042111340731477100210110ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Shadow - a drop shadowing Glyph */ #ifndef iv_shadow_h #define iv_shadow_h #include class Color; class Shadow : public MonoGlyph { public: Shadow(Glyph*, Coord x, Coord y, const Color*, bool single = false); virtual ~Shadow(); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void print(Printer*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); private: Coord x_offset_; Coord y_offset_; const Color* color_; bool single_; void compute_requirement(Requirement&, Coord offset) const; void compute_allocation(Allocation&) const; void compute_allotment(Allotment&, Coord offset) const; void draw_shadow(Canvas*, const Allocation&) const; void draw_body(Canvas*, const Allocation&) const; }; #endif neuron-7.6.3/src/include/InterViews/simplecomp.h000077500000000000000000000032461340731477100217060ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv_simplecomp_h #define iv_simplecomp_h #include class SimpleCompositor : public Compositor { public: SimpleCompositor(); virtual ~SimpleCompositor(); virtual CompositorIndex compose( Coord* natural, Coord* stretch, Coord* shrink, int* penalites, CompositorIndex component_count, Coord* spans, CompositorIndex span_count, CompositorIndex* breaks, CompositorIndex break_count ); }; #endif neuron-7.6.3/src/include/InterViews/stencil.h000077500000000000000000000032541340731477100211760ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Stencil - mask Glyph */ #ifndef iv_stencil_h #define iv_stencil_h #include class Bitmap; class Color; class Stencil : public Glyph { public: Stencil(const Bitmap*, const Color*); virtual ~Stencil(); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; private: const Bitmap* mask_; const Color* color_; }; #endif neuron-7.6.3/src/include/InterViews/style.h000066400000000000000000000071431340731477100206730ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Style - style information */ #ifndef iv_style_h #define iv_style_h #include #include #include class Action; class Brush; class Color; class Font; class String; class StyleRep; class Style : public Resource { public: Style(); Style(const String& name); Style(Style* parent); Style(const String& name, Style* parent); Style(const Style&); virtual ~Style(); virtual void name(const String&); virtual const String* name() const; virtual void alias(const String&); virtual long alias_count() const; virtual const String* alias(long) const; void name(const char*); void alias(const char*); virtual Style* parent() const; virtual void append(Style*); virtual void remove(Style*); virtual long children() const; virtual Style* child(long) const; virtual void attribute(const String& name, const String& value, int = 0); virtual void remove_attribute(const String& name); virtual long attribute_count() const; virtual bool attribute(long, String& name, String& value) const; void attribute(const char* name, const char* value, int = 0); void remove_attribute(const char*); virtual void load_file(const String& filename, int = 0); virtual void load_list(const String&, int = 0); virtual void load_property(const String&, int = 0); virtual void add_trigger(const String& name, Action*); virtual void remove_trigger(const String& name, Action* = nil); virtual void add_trigger_any(Action*); virtual void remove_trigger_any(Action*); void add_trigger(const char*, Action*); void remove_trigger(const char*, Action* = nil); virtual bool find_attribute(const String& name, String& value) const; bool find_attribute(const char* name, String& value) const; bool find_attribute(const String& name, long&) const; bool find_attribute(const char* name, long&) const; bool find_attribute(const String& name, double&) const; bool find_attribute(const char* name, double&) const; bool find_attribute(const String& name, Coord&) const; bool find_attribute(const char* name, Coord&) const; bool value_is_on(const String& name) const; bool value_is_on(const char* name) const; private: friend class StyleRep; StyleRep* rep_; private: /* not implemented */ Style& operator =(const Style&); }; #include #endif neuron-7.6.3/src/include/InterViews/superpose.h000077500000000000000000000033761340731477100215670ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Superpose - composite layout */ #ifndef iv_superpose_h #define iv_superpose_h #include class Superpose : public Layout { public: Superpose( Layout*, Layout*, Layout* = nil, Layout* = nil, Layout* = nil ); virtual ~Superpose(); virtual void request( GlyphIndex count, const Requisition*, Requisition& result ); virtual void allocate( const Allocation& given, GlyphIndex count, const Requisition*, Allocation* result ); private: Layout** layout_; int count_; }; #endif neuron-7.6.3/src/include/InterViews/target.h000077500000000000000000000032671340731477100210270ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Target - pick sensitivity control */ #ifndef iv_target_h #define iv_target_h #include enum TargetSensitivity { TargetNeverHit, TargetAlwaysHit, TargetPrimitiveHit, TargetCharacterHit, TargetBodyHit }; class Target : public MonoGlyph { public: Target(Glyph* body, TargetSensitivity); virtual ~Target(); virtual void pick(Canvas*, const Allocation&, int depth, Hit&); private: TargetSensitivity sensitivity_; }; #endif neuron-7.6.3/src/include/InterViews/telltale.h000066400000000000000000000071141340731477100213370ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Telltale - glyph with a state that may affect appearance */ #ifndef ivlook_telltale_h #define ivlook_telltale_h #include #include class TelltaleGroup; typedef unsigned int TelltaleFlags; class TelltaleState : public Resource, public Observable { public: TelltaleState(const TelltaleFlags = 0); virtual ~TelltaleState(); enum { is_enabled = 0x1, is_visible = 0x2, is_enabled_visible = 0x3, is_active = 0x4, is_enabled_active = 0x5, is_visible_active = 0x6, is_enabled_visible_active = 0x7, is_chosen = 0x8, is_enabled_chosen = 0x9, is_visible_chosen = 0xa, is_enabled_visible_chosen = 0xb, is_active_chosen = 0xc, is_enabled_active_chosen = 0xd, is_visible_active_chosen = 0xe, is_enabled_visible_active_chosen = 0xf, is_running = 0x10, is_choosable = 0x20, is_toggle = 0x40, max_flags = 0x80 }; TelltaleFlags flags() const; TelltaleGroup* group() const; virtual void set(const TelltaleFlags, bool); virtual bool test(const TelltaleFlags) const; virtual void join(TelltaleGroup*); virtual void leave_group(); private: TelltaleFlags flags_; TelltaleGroup* group_; }; inline TelltaleFlags TelltaleState::flags() const { return flags_; } inline TelltaleGroup* TelltaleState::group() const { return group_; } class Telltale : public MonoGlyph, public Observer { protected: Telltale(Glyph*, TelltaleState* = nil); public: virtual ~Telltale(); virtual void state(TelltaleState*); virtual TelltaleState* state() const; virtual void disconnect(Observable*); private: TelltaleState* state_; /* backward compatibility */ public: void highlight(bool); bool highlighted() const; void choose(bool); bool chosen() const; void enable(bool); bool enabled() const; }; #define Telltale_access(writer,reader,flag) \ inline void Telltale::writer(bool b) { state()->set(flag, b); } \ inline bool Telltale::reader() const { return state()->test(flag); } Telltale_access(highlight,highlighted,TelltaleState::is_active) Telltale_access(choose,chosen,TelltaleState::is_chosen) Telltale_access(enable,enabled,TelltaleState::is_enabled) class TelltaleGroup : public Resource { public: TelltaleGroup(); virtual ~TelltaleGroup(); virtual void update(TelltaleState*); virtual void remove(TelltaleState*); private: TelltaleState* current_; }; #endif neuron-7.6.3/src/include/InterViews/texcomp.h000077500000000000000000000032751340731477100212170ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv_texcomp_h #define iv_texcomp_h #include class TeXCompositor : public Compositor { public: TeXCompositor(int penalty); virtual ~TeXCompositor(); virtual CompositorIndex compose( Coord* natural, Coord* stretch, Coord* shrink, int* penalites, CompositorIndex component_count, Coord* spans, CompositorIndex span_count, CompositorIndex* breaks, CompositorIndex break_count ); private: int penalty_; }; #endif neuron-7.6.3/src/include/InterViews/tformsetter.h000077500000000000000000000046561340731477100221220ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv_tformsetter_h #define iv_tformsetter_h #include #include class TransformSetter : public MonoGlyph { public: TransformSetter(Glyph*); TransformSetter(Glyph*, const Transformer&); virtual ~TransformSetter(); virtual const Transformer& transformer() const; virtual Transformer& transformer(); virtual void transformer(const Transformer&); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void print(Printer*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); protected: virtual void transform( Transformer&, const Allocation&, const Allocation& natural ) const; private: Transformer transformer_; Allocation natural_allocation_; void push_transform( Canvas*, const Allocation&, const Allocation& natural ) const; }; class TransformFitter : public TransformSetter { public: TransformFitter(Glyph*); virtual ~TransformFitter(); protected: virtual void transform( Transformer&, const Allocation&, const Allocation& natural ) const; }; #endif neuron-7.6.3/src/include/InterViews/tiff.h000066400000000000000000000027371340731477100204670ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF to Raster conversion */ #ifndef iv_tiff_h #define iv_tiff_h #include #include class Raster; class TIFFRaster { public: static Raster* load(const char* filename, bool make_gray = false); }; #include #endif neuron-7.6.3/src/include/InterViews/tile.h000077500000000000000000000056431340731477100204760ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Tile - tiled layout */ #ifndef iv_tile_h #define iv_tile_h #include class Tile : public Layout { public: Tile(DimensionName); virtual ~Tile(); virtual void request( GlyphIndex count, const Requisition*, Requisition& result ); virtual void allocate( const Allocation& given, GlyphIndex count, const Requisition*, Allocation* result ); private: DimensionName dimension_; Requisition requisition_; }; class TileReversed : public Layout { public: TileReversed(DimensionName); virtual ~TileReversed(); virtual void request( GlyphIndex count, const Requisition*, Requisition& result ); virtual void allocate( const Allocation& given, GlyphIndex count, const Requisition*, Allocation* result ); private: DimensionName dimension_; Requisition requisition_; }; class TileFirstAligned : public Layout { public: TileFirstAligned(DimensionName); virtual ~TileFirstAligned(); virtual void request( GlyphIndex count, const Requisition*, Requisition& result ); virtual void allocate( const Allocation& given, GlyphIndex count, const Requisition*, Allocation* result ); private: DimensionName dimension_; Requisition requisition_; }; class TileReversedFirstAligned : public Layout { public: TileReversedFirstAligned(DimensionName); virtual ~TileReversedFirstAligned(); virtual void request( GlyphIndex count, const Requisition*, Requisition& result ); virtual void allocate( const Allocation& given, GlyphIndex count, const Requisition*, Allocation* result ); private: DimensionName dimension_; Requisition requisition_; }; #endif neuron-7.6.3/src/include/InterViews/transformer.h000066400000000000000000000133361340731477100220760ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Interface to transformation matrices. */ #ifndef iv_transformer_h #define iv_transformer_h #include #include #include class Transformer : public Resource { public: Transformer(); /* identity */ Transformer(const Transformer&); Transformer(const Transformer*); Transformer( float a00, float a01, float a10, float a11, float a20, float a21 ); virtual ~Transformer(); bool identity() const; bool invertible() const; bool operator ==(const Transformer&) const; bool operator !=(const Transformer&) const; Transformer& operator =(const Transformer&); virtual void premultiply(const Transformer&); virtual void postmultiply(const Transformer&); virtual void invert(); virtual void translate(float dx, float dy); virtual void scale(float sx, float sy); virtual void rotate(float angle); virtual void skew(float sx, float sy); virtual void transform(float& x, float& y) const; virtual void transform(float x, float y, float& tx, float& ty) const; virtual void inverse_transform(float& tx, float& ty) const; virtual void inverse_transform( float tx, float ty, float& x, float& y ) const; float det() const; virtual void matrix( float& a00, float& a01, float& a10, float& a11, float& a20, float& a21 ) const; private: bool identity_; float mat00, mat01, mat10, mat11, mat20, mat21; void update(); public: /* * Old definitions for backward compatibility. */ void GetEntries( float& a00, float& a01, float& a10, float& a11, float& a20, float& a21 ) const; void Premultiply(Transformer* t); void Postmultiply(Transformer* t); void Invert(); void Translate(float dx, float dy); void Scale(float sx, float sy); void Rotate(float angle); bool Translated(float = 1e-6) const; bool Scaled(float = 1e-6) const; bool Stretched (float = 1e-6) const; bool Rotated(float = 1e-6) const; bool Rotated90(float = 1e-6) const; void Transform(IntCoord& x, IntCoord& y) const; void Transform(IntCoord x, IntCoord y, IntCoord& tx, IntCoord& ty) const; void Transform(float x, float y, float& tx, float& ty) const; void TransformList(IntCoord x[], IntCoord y[], int n) const; void TransformList( IntCoord x[], IntCoord y[], int n, IntCoord tx[], IntCoord ty[] ) const; void TransformRect(IntCoord&, IntCoord&, IntCoord&, IntCoord&) const; void TransformRect(float&, float&, float&, float&) const; void InvTransform(IntCoord& tx, IntCoord& ty) const; void InvTransform( IntCoord tx, IntCoord ty, IntCoord& x, IntCoord& y ) const; void InvTransform(float tx, float ty, float& x, float& y) const; void InvTransformList(IntCoord tx[], IntCoord ty[], int n) const; void InvTransformList( IntCoord tx[], IntCoord ty[], int n, IntCoord x[], IntCoord y[] ) const; void InvTransformRect(IntCoord&, IntCoord&, IntCoord&, IntCoord&) const; void InvTransformRect(float&, float&, float&, float&) const; }; inline float Transformer::det() const { return mat00*mat11 - mat01*mat10; } inline bool Transformer::identity() const { return identity_; } inline bool Transformer::invertible() const { return det() != 0; } inline bool Transformer::Translated(float tol) const { return -tol > mat20 || mat20 > tol || -tol > mat21 || mat21 > tol; } inline bool Transformer::Scaled(float tol) const { float l = 1 - tol, u = 1 + tol; return l > mat00 || mat00 > u || l > mat11 || mat11 > u; } inline bool Transformer::Stretched(float tol) const { float diff = mat00 - mat11; return -tol > diff || diff > tol; } inline bool Transformer::Rotated(float tol) const { return -tol > mat01 || mat01 > tol || -tol > mat10 || mat10 > tol; } inline bool Transformer::Rotated90(float tol) const { return Rotated(tol) && -tol <= mat00 && mat00 <= tol && -tol <= mat11 && mat11 <= tol; } inline void Transformer::GetEntries( float& a00, float& a01, float& a10, float& a11, float& a20, float& a21 ) const { matrix(a00, a01, a10, a11, a20, a21); } inline void Transformer::Translate(float dx, float dy) { translate(dx, dy); } inline void Transformer::Scale(float sx, float sy) { scale(sx, sy); } inline void Transformer::Rotate(float angle) { rotate(angle); } inline void Transformer::Premultiply(Transformer* t) { premultiply(*t); } inline void Transformer::Postmultiply(Transformer* t) { postmultiply(*t); } inline void Transformer::Invert() { invert(); } #include #endif neuron-7.6.3/src/include/InterViews/winbmp.h000077500000000000000000000031001340731477100210170ustar00rootroot00000000000000// ======================================================================= // // Windows BMP format raster loader. // // 1.1 // 1997/03/28 17:36:10 // // InterViews Port to the Windows 3.1/NT operating systems // Copyright (c) 1993 Tim Prinzing // // Permission to use, copy, modify, distribute, and sell this software and // its documentation for any purpose is hereby granted without fee, provided // that (i) the above copyright notice and this permission notice appear in // all copies of the software and related documentation, and (ii) the name of // Tim Prinzing may not be used in any advertising or publicity relating to // the software without the specific, prior written permission of Tim Prinzing. // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL Tim Prinzing BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // // ======================================================================= #ifndef iv_winbmp_h #define iv_winbmp_h #include #include class BMPRaster { public: static Raster* load(const char *filename); }; #include #endif neuron-7.6.3/src/include/InterViews/window.h000066400000000000000000000145261340731477100210450ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Window - top-level object for interfacing with window managers */ #ifndef iv_window_h #define iv_window_h #include #include #include #include class Bitmap; class Canvas; class Cursor; class Display; class Event; class Glyph; class Handler; class ManagedWindowRep; class String; class Style; class WindowRep; class Window { protected: Window(Glyph*); public: virtual ~Window(); virtual Glyph* glyph() const; virtual void style(Style*); Style* style() const; virtual void display(Display*); virtual Display* display() const; virtual Canvas* canvas() const; virtual void cursor(Cursor*); virtual Cursor* cursor() const; virtual void push_cursor(); virtual void pop_cursor(); virtual void place(Coord left, Coord bottom); virtual void pplace(IntCoord left, IntCoord bottom); virtual void align(float x, float y); virtual Coord left() const; virtual Coord bottom() const; virtual Coord width() const; virtual Coord height() const; virtual void map(); virtual void unmap(); virtual bool is_mapped() const; virtual void bind(); virtual void unbind(); virtual bool bound() const; virtual void raise(); virtual void lower(); virtual void move(Coord left, Coord bottom); virtual void resize(); virtual bool receive(const Event&); virtual Handler* target(const Event&) const; virtual void grab_pointer(Cursor* = nil) const; virtual void ungrab_pointer() const; virtual void repair(); WindowRep* rep() const; protected: Window(WindowRep*); virtual void configure(); virtual void default_geometry(); virtual void compute_geometry(); virtual void set_attributes(); virtual void set_props(); virtual void do_map(); #if defined(WIN32) || MAC protected: WindowRep* rep_; // The following is different from the SGI distribution. This stuff is not // device specific and only adds geometry.h as an include dependency, so it // seems more reasonable to keep it here. friend class WindowRep; Glyph* glyph_; Style* style_; Canvas* canvas_; Requisition shape_; Allocation allocation_; Handler* focus_in_; Handler* focus_out_; #else private: friend class WindowRep; WindowRep* rep_; #endif }; inline WindowRep* Window::rep() const { return rep_; } #if defined(WIN32) || MAC inline Glyph* Window::glyph() const { return glyph_; } inline Canvas* Window::canvas() const { return canvas_; } #endif class ManagedWindow : public Window { protected: ManagedWindow(Glyph*); public: virtual ~ManagedWindow(); #if defined(WIN32) || MAC virtual Coord width() const; // width of window virtual Coord height() const; // height of window #endif #if defined(WIN32) virtual bool receive(const Event&); #endif virtual void icon(ManagedWindow*); virtual ManagedWindow* icon() const; virtual void icon_bitmap(Bitmap*); virtual Bitmap* icon_bitmap() const; virtual void icon_mask(Bitmap*); virtual Bitmap* icon_mask() const; virtual void iconify(); virtual void deiconify(); virtual void focus_event(Handler* in, Handler* out); virtual void wm_delete(Handler*); virtual void resize(); ManagedWindowRep* rep() const; protected: virtual void compute_geometry(); virtual void set_props(); private: friend class ManagedWindowRep; ManagedWindowRep* mrep_; }; inline ManagedWindowRep* ManagedWindow::rep() const { return mrep_; } class ApplicationWindow : public ManagedWindow { public: ApplicationWindow(Glyph*); ~ApplicationWindow(); protected: virtual void compute_geometry(); virtual void set_props(); }; class TopLevelWindow : public ManagedWindow { public: TopLevelWindow(Glyph*); ~TopLevelWindow(); virtual void group_leader(Window*); virtual Window* group_leader() const; protected: virtual void set_props(); }; class TransientWindow : public TopLevelWindow { public: TransientWindow(Glyph*); ~TransientWindow(); virtual void transient_for(Window*); virtual Window* transient_for() const; protected: virtual void configure(); virtual void set_attributes(); }; class PopupWindow : public Window { public: PopupWindow(Glyph*); ~PopupWindow(); protected: virtual void set_attributes(); #if defined(WIN32) virtual bool receive(const Event&); #endif }; class IconWindow : public ManagedWindow { public: IconWindow(Glyph*); ~IconWindow(); protected: virtual void do_map(); }; #include #endif neuron-7.6.3/src/include/InterViews/xymarker.h000066400000000000000000000035541340731477100213770ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * XYMarker - mark rectangular region */ #ifndef iv_xymarker_h #define iv_xymarker_h #include class Color; class XYMarker : public MonoGlyph { public: XYMarker(Glyph* body, const Color* overlay, const Color* underlay); virtual ~XYMarker(); void mark(Coord left, Coord bottom, Coord right, Coord top); void unmark(); virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void undraw(); private: Canvas* canvas_; const Color* overlay_; const Color* underlay_; bool marked_; Coord left_, right_, top_, bottom_; }; #endif neuron-7.6.3/src/include/Makefile.in000077500000000000000000000043751340731477100173370ustar00rootroot00000000000000SHELL = @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 = ../.. INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @CARBON_FALSE@@CYGWIN_FALSE@@MINGW_FALSE@DIRS = Dispatch IV-2_6 IV-2_6/InterViews IV-X11 IV-look InterViews OS TIFF @CYGWIN_TRUE@DIRS = Dispatch IV-Win IV-look InterViews OS TIFF @MINGW_TRUE@DIRS = Dispatch IV-Win IV-look InterViews OS TIFF @CARBON_TRUE@DIRS = Dispatch IV-Mac IV-look InterViews OS TIFF @SET_MAKE@ subdir = src/include ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs all: clean: mostlyclean: Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status install: for dir in $(DIRS); do \ $(mkinstalldirs) $(DESTDIR)$(includedir)/$$dir; \ for file in $$dir/*.h; do \ $(INSTALL_DATA) $$file $(DESTDIR)$(includedir)/$$file; \ done; \ done $(mkinstalldirs) $(DESTDIR)$(includedir)/InterViews/Bitmaps for file in InterViews/Bitmaps/*.bm; do \ $(INSTALL_DATA) $$file $(DESTDIR)$(includedir)/$$file; \ done $(INSTALL_DATA) ivstream.h $(DESTDIR)$(includedir)/ivstream.h $(INSTALL_DATA) ivstrm.h $(DESTDIR)$(includedir)/ivstrm.h $(INSTALL_DATA) ivversion.h $(DESTDIR)$(includedir)/ivversion.h uninstall: for dir in $(DIRS); do \ cd $$dir; \ for file in *.h; do \ rm -f $(DESTDIR)$(includedir)/$$dir/$$file; \ done; \ cd ..; \ done for file in ivstream.h ivstrm.h ivversion.h do \ rm -f $(DESTDIR}$(includedir)/$$file; \ done .PHONY: all install clean mostlyclean distclean uninstall # 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: neuron-7.6.3/src/include/OS/000077500000000000000000000000001340731477100155775ustar00rootroot00000000000000neuron-7.6.3/src/include/OS/_defines.h000077500000000000000000000014441340731477100175320ustar00rootroot00000000000000#define u_char _lib_os(u_char) #define CopyString _lib_os(CopyString) #define Directory _lib_os(Directory) #define DirectoryImpl _lib_os(DirectoryImpl) #define File _lib_os(File) #define FileInfo _lib_os(FileInfo) #define Host _lib_os(Host) #define InputFile _lib_os(InputFile) #define List _lib_os(List) #define Math _lib_os(Math) #define Memory _lib_os(Memory) #define NullTerminatedString _lib_os(NullTerminatedString) #define OutputFile _lib_os(OutputFile) #define PtrList _lib_os(PtrList) #define StdInput _lib_os(StdInput) #define StdOutput _lib_os(StdOutput) #define String _lib_os(String) #define Table _lib_os(Table) #define Table2 _lib_os(Table2) #define UniqueString _lib_os(UniqueString) #define UniqueStringPool _lib_os(UniqueStringPool) #define UniqueStringTable _lib_os(UniqueStringTable) neuron-7.6.3/src/include/OS/_gendefs000077500000000000000000000007431340731477100173030ustar00rootroot00000000000000#! /bin/csh -f set tmp = /tmp/$$ cp /dev/null $tmp echo "boolean" >> $tmp echo "#if !MAC" >> $tmp echo "#if !defined(__GNUC__) || __GNUC__ < 4" >> $tmp echo "true" >> $tmp echo "false" >> $tmp echo "#endif" >> $tmp echo "#endif" >> $tmp echo "u_char" >> $tmp grep "^class" *.h | \ sed -e 's/.*class \([^ ;\*]*\).*$/\1/' | \ sort | uniq | fgrep -v "(" >> $tmp sed -e 's/\(.*\)/#define \1 _lib_os(\1)/' < $tmp > "_defines.h" sed -e 's/^/#undef /' < $tmp > "_undefs.h" rm $tmp neuron-7.6.3/src/include/OS/_undefs.h000077500000000000000000000005611340731477100174000ustar00rootroot00000000000000#undef u_char #undef CopyString #undef Directory #undef DirectoryImpl #undef File #undef FileInfo #undef Host #undef InputFile #undef List #undef Math #undef Memory #undef NullTerminatedString #undef OutputFile #undef PtrList #undef StdInput #undef StdOutput #undef String #undef Table #undef Table2 #undef UniqueString #undef UniqueStringPool #undef UniqueStringTable neuron-7.6.3/src/include/OS/directory.h000066400000000000000000000036651340731477100177660ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef os_directory_h #define os_directory_h #include class DirectoryImpl; class String; class Directory { protected: Directory(); public: virtual ~Directory(); static Directory* current(); static Directory* open(const String&); virtual void close(); virtual const String* path() const; virtual int count() const; virtual const String* name(int index) const; virtual int index(const String&) const; virtual bool is_directory(int index) const; static String* canonical(const String&); static bool match(const String& name, const String& pattern); private: DirectoryImpl* impl_; private: /* not allowed */ Directory(const Directory&); void operator =(const Directory&); }; #endif neuron-7.6.3/src/include/OS/dirent.h000077500000000000000000000060041340731477100172400ustar00rootroot00000000000000// ===================================================================== // dirent.h // // An implementation of the BSD directory routines for MS-Windows NT. // With the alternative filesystems available under NT, filenames can // be up to 256 character long. The berkeley routines have similar // counterparts in the WIN32 library. // // // $Revision: 1342 $ // $Date: 2003-02-11 15:21:54 -0500 (Tue, 11 Feb 2003) $ // // Windows 3.1/NT InterViews Port // Copyright (c) 1993 Tim Prinzing // // Permission to use, copy, modify, distribute, and sell this software and // its documentation for any purpose is hereby granted without fee, provided // that (i) the above copyright notice and this permission notice appear in // all copies of the software and related documentation, and (ii) the name of // Tim Prinzing may not be used in any advertising or publicity relating to // the software without the specific, prior written permission of Tim Prinzing. // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL Tim Prinzing BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // // ========================================================================== #ifndef nt_dir_h #define nt_dir_h #if defined(MINGW) #include #include #include #include #else #include #if (defined(WIN32) && defined(__MWERKS__)) #define ffblk _finddata_t #define findfirst(a,b,c) _findfirst(a,b) #define findnext _findnext #define ff_name name #else #include #endif #include #define rewinddir(dirp) seekdir(dirp, 0L) #define MAXNAMLEN _MAX_FNAME struct dirent { int d_namlen; // length of d_name char d_name[MAXNAMLEN + 1]; // name of the directory entry }; // The handle returned by the _findfirst function is all that is needed // to provide the access, but it must be swapped out to provide random // access, so we put it inside a structure so the clients pointer can // remain consistant. If any assumptions were made about DIR (ie clients // of the library used more knowledge than provided in the man page), // you're screwed because it's radically different in implementation here! typedef struct { long srchHandle; // handle to use struct ffblk data; // data of current file struct dirent conversion; // data in dirent format (almost anyway) short offs; // offset from first } DIR; // ---- prototypes ---- extern DIR *opendir(const char*); extern struct dirent *readdir(DIR*); extern void seekdir(DIR*, long); extern long telldir(DIR*); extern void closedir(DIR*); #endif // MINGW undefined #endif /* nt_dir_h */ neuron-7.6.3/src/include/OS/enter-scope.h000077500000000000000000000027011340731477100201770ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef iv_os__scope_h #define iv_os__scope_h #include #undef String #undef u_char #include #ifndef nil #define nil 0 #endif #ifndef iv_os_u_char #define iv_os_u_char typedef unsigned char u_char; #endif #endif neuron-7.6.3/src/include/OS/file.h000077500000000000000000000037601340731477100167000ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef os_file_h #define os_file_h #include class FileInfo; class String; class File { protected: File(FileInfo*); public: virtual ~File(); virtual const String* name() const; virtual long length() const; virtual void close(); virtual void limit(unsigned int buffersize); protected: FileInfo* rep() const; private: FileInfo* rep_; private: /* not allowed */ void operator =(const File&); }; class InputFile : public File { protected: InputFile(FileInfo*); public: virtual ~InputFile(); static InputFile* open(const String& name); virtual int read(const char*& start); }; class StdInput : public InputFile { public: StdInput(); virtual ~StdInput(); virtual long length() const; virtual int read(const char*& start); }; #endif neuron-7.6.3/src/include/OS/host.h000077500000000000000000000025321340731477100167320ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef os_host_h #define os_host_h #include class Host { public: static const char* name(); private: static char name_[100]; }; #endif neuron-7.6.3/src/include/OS/leave-scope.h000077500000000000000000000024311340731477100201560ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifdef iv_os__scope_h #undef iv_os__scope_h #include #endif neuron-7.6.3/src/include/OS/list.h000066400000000000000000000210751340731477100167300ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Generic list implemented as dynamic array */ #ifndef os_list_h #define os_list_h #include extern void ListImpl_range_error(long index); extern long ListImpl_best_new_count(long count, unsigned int size, unsigned int m = 1); #if 1 || defined(__STDC__) || defined(__ANSI_CPP__) #define __ListItr(List) List##_Iterator #define ListItr(List) __ListItr(List) #define __ListUpdater(List) List##_Updater #define ListUpdater(List) __ListUpdater(List) #else #define __ListItr(List) List/**/_Iterator #define ListItr(List) __ListItr(List) #define __ListUpdater(List) List/**/_Updater #define ListUpdater(List) __ListUpdater(List) #endif #define declareList(List,T) \ class List { \ public: \ List(long size = 0); \ ~List(); \ \ long count() const; \ T item(long index) const; \ T& item_ref(long index) const; \ \ void prepend(const T&); \ void append(const T&); \ void insert(long index, const T&); \ void remove(long index); \ void remove_all(); \ private: \ T* items_; \ long size_; \ long count_; \ long free_; \ }; \ \ inline long List::count() const { return count_; } \ \ inline T List::item(long index) const { \ if (index < 0 || index >= count_) { \ ListImpl_range_error(index); \ } \ long i = index < free_ ? index : index + size_ - count_; \ return items_[i]; \ } \ inline T& List::item_ref(long index) const { \ if (index < 0 || index >= count_) { \ ListImpl_range_error(index); \ } \ long i = index < free_ ? index : index + size_ - count_; \ return items_[i]; \ } \ \ inline void List::append(const T& item) { insert(count_, item); } \ inline void List::prepend(const T& item) { insert(0, item); } \ \ class ListItr(List) { \ public: \ ListItr(List)(const List&); \ \ bool more() const; \ T cur() const; \ T& cur_ref() const; \ void next(); \ private: \ const List* list_; \ long cur_; \ }; \ \ inline bool ListItr(List)::more() const { return cur_ < list_->count(); } \ inline T ListItr(List)::cur() const { return list_->item(cur_); } \ inline T& ListItr(List)::cur_ref() const { \ return list_->item_ref(cur_); \ } \ inline void ListItr(List)::next() { ++cur_; } \ \ class ListUpdater(List) { \ public: \ ListUpdater(List)(List&); \ \ bool more() const; \ T cur() const; \ T& cur_ref() const; \ void remove_cur(); \ void next(); \ private: \ List* list_; \ long cur_; \ }; \ \ inline bool ListUpdater(List)::more() const { \ return cur_ < list_->count(); \ } \ inline T ListUpdater(List)::cur() const { return list_->item(cur_); } \ inline T& ListUpdater(List)::cur_ref() const { \ return list_->item_ref(cur_); \ } \ inline void ListUpdater(List)::remove_cur() { list_->remove(cur_); } \ inline void ListUpdater(List)::next() { ++cur_; } /* * Lists of pointers * * Don't ask me to explain the AnyPtr nonsense. C++ compilers * have a hard time deciding between (const void*)& and const (void*&). * Typedefs help, though still keep me guessing. */ typedef void* __AnyPtr; declareList(__AnyPtrList,__AnyPtr) #define declarePtrList(PtrList,T) \ class PtrList { \ public: \ PtrList(long size = 0); \ \ long count() const; \ T* item(long index) const; \ \ void prepend(T*); \ void append(T*); \ void insert(long index, T*); \ void remove(long index); \ void remove_all(); \ private: \ __AnyPtrList impl_; \ }; \ \ inline PtrList::PtrList(long size) : impl_(size) { } \ inline long PtrList::count() const { return impl_.count(); } \ inline T* PtrList::item(long index) const { return (T*)impl_.item(index); } \ inline void PtrList::append(T* item) { insert(impl_.count(), item); } \ inline void PtrList::prepend(T* item) { insert(0, item); } \ inline void PtrList::remove(long index) { impl_.remove(index); } \ inline void PtrList::remove_all() { impl_.remove_all(); } \ \ class ListItr(PtrList) { \ public: \ ListItr(PtrList)(const PtrList&); \ \ bool more() const; \ T* cur() const; \ void next(); \ private: \ const PtrList* list_; \ long cur_; \ }; \ \ inline bool ListItr(PtrList)::more() const { \ return cur_ < list_->count(); \ } \ inline T* ListItr(PtrList)::cur() const { return list_->item(cur_); } \ inline void ListItr(PtrList)::next() { ++cur_; } \ \ class ListUpdater(PtrList) { \ public: \ ListUpdater(PtrList)(PtrList&); \ \ bool more() const; \ T* cur() const; \ void remove_cur(); \ void next(); \ private: \ PtrList* list_; \ long cur_; \ }; \ \ inline bool ListUpdater(PtrList)::more() const { \ return cur_ < list_->count(); \ } \ inline T* ListUpdater(PtrList)::cur() const { return list_->item(cur_); } \ inline void ListUpdater(PtrList)::remove_cur() { list_->remove(cur_); } \ inline void ListUpdater(PtrList)::next() { ++cur_; } /* * List implementation */ #define implementList(List,T) \ List::List(long size) { \ if (size > 0) { \ size_ = ListImpl_best_new_count(size, sizeof(T)); \ items_ = new T[size_]; \ } else { \ size_ = 0; \ items_ = 0; \ } \ count_ = 0; \ free_ = 0; \ } \ \ List::~List() { \ delete [] items_; \ } \ \ void List::insert(long index, const T& item) { \ if (count_ == size_) { \ long size = ListImpl_best_new_count(size_ + 1, sizeof(T), 2); \ T* items = new T[size]; \ if (items_ != 0) { \ register long i; \ for (i = 0; i < free_; ++i) { \ items[i] = items_[i]; \ } \ for (i = 0; i < count_ - free_; ++i) { \ items[free_ + size - count_ + i] = \ items_[free_ + size_ - count_ + i]; \ } \ delete [] items_; \ } \ items_ = items; \ size_ = size; \ } \ if (index >= 0 && index <= count_) { \ if (index < free_) { \ for (register long i = free_ - index - 1; i >= 0; --i) { \ items_[index + size_ - count_ + i] = items_[index + i]; \ } \ } else if (index > free_) { \ for (register long i = 0; i < index - free_; ++i) { \ items_[free_ + i] = items_[free_ + size_ - count_ + i]; \ } \ } \ free_ = index + 1; \ count_ += 1; \ items_[index] = item; \ } \ } \ \ void List::remove(long index) { \ if (index >= 0 && index <= count_) { \ if (index < free_) { \ for (register long i = free_ - index - 2; i >= 0; --i) { \ items_[size_ - count_ + index + 1 + i] = \ items_[index + 1 + i]; \ } \ } else if (index > free_) { \ for (register long i = 0; i < index - free_; ++i) { \ items_[free_ + i] = items_[free_ + size_ - count_ + i]; \ } \ } \ free_ = index; \ count_ -= 1; \ } \ } \ \ void List::remove_all() { \ count_ = 0; \ free_ = 0; \ } \ \ ListItr(List)::ListItr(List)(const List& list) { \ list_ = &list; \ cur_ = 0; \ } \ \ ListUpdater(List)::ListUpdater(List)(List& list) { \ list_ = &list; \ cur_ = 0; \ } #define implementPtrList(PtrList,T) \ void PtrList::insert(long index, T* item) { \ const __AnyPtr p = item; \ impl_.insert(index, p); \ } \ ListItr(PtrList)::ListItr(PtrList)(const PtrList& list) { \ list_ = &list; \ cur_ = 0; \ } \ \ ListUpdater(PtrList)::ListUpdater(PtrList)(PtrList& list) { \ list_ = &list; \ cur_ = 0; \ } #endif neuron-7.6.3/src/include/OS/math.h000066400000000000000000000065761340731477100167170ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef os_math_h #define os_math_h #ifdef WIN32 #ifdef max #undef max #endif #ifdef min #undef min #endif #endif #include /* * Common math operations on built-in types. */ #define declare_binary_minmax(Type) \ static Type min(Type a, Type b); \ static Type max(Type a, Type b) #define implement_binary_minmax(Type) \ inline Type Math::min(Type a, Type b) { return a < b ? a : b; } \ inline Type Math::max(Type a, Type b) { return a > b ? a : b; } #define declare_4_minmax(Type) \ static Type min(Type a, Type b, Type c, Type d); \ static Type max(Type a, Type b, Type c, Type d) /* * Compiler isn't smart enough to figure out how to do a 4-way min inline * with single nested if-then-else. */ #define implement_4_minmax(Type) \ inline Type Math::min(Type a, Type b, Type c, Type d) { \ Type r1 = min(a, b), r2 = min(c, d); \ return min(r1, r2); \ } \ \ inline Type Math::max(Type a, Type b, Type c, Type d) { \ Type r1 = max(a, b), r2 = max(c, d); \ return max(r1, r2); \ } class Math { public: declare_binary_minmax(int); declare_binary_minmax(unsigned); declare_binary_minmax(long); declare_binary_minmax(unsigned long); declare_binary_minmax(float); declare_binary_minmax(double); declare_4_minmax(int); declare_4_minmax(float); declare_4_minmax(double); static int abs(int); static long abs(long); static double abs(double); static int round(float); static int round(double); static bool equal(float x, float y, float e); static bool equal(double x, double y, double e); }; implement_binary_minmax(int) implement_binary_minmax(unsigned) implement_binary_minmax(long) implement_binary_minmax(unsigned long) implement_binary_minmax(float) implement_binary_minmax(double) implement_4_minmax(int) implement_4_minmax(float) implement_4_minmax(double) inline int Math::round(float x) { return x > 0 ? int(x+0.5) : -int(-x+0.5); } inline int Math::round(double x) { return x > 0 ? int(x+0.5) : -int(-x+0.5); } inline bool Math::equal(float x, float y, float e) { return x - y < e && y - x < e; } inline bool Math::equal(double x, double y, double e) { return x - y < e && y - x < e; } #endif neuron-7.6.3/src/include/OS/memory.h000077500000000000000000000027341340731477100172710ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef os_memory_h #define os_memory_h #include class Memory { public: static void copy(const void* from, void* to, unsigned int nbytes); static int compare(const void*, const void*, unsigned int nbytes); static void zero(void*, unsigned int nbytes); }; #endif neuron-7.6.3/src/include/OS/os.h000077500000000000000000000025421340731477100163770ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _lib_os_h #define _lib_os_h #if 1 || defined(__STDC__) || defined(__ANSI_CPP__) #define _lib_os(name) os##name #else #define _lib_os(name) os/**/name #endif #endif neuron-7.6.3/src/include/OS/string.h000066400000000000000000000115041340731477100172570ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef os_string_h #define os_string_h /* * String - simple (non-copying) string class */ #include class String { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif String(); String(const char*); String(const char*, int length); String(const String&); virtual ~String(); const char* string() const; int length() const; virtual unsigned long hash() const; virtual String& operator =(const String&); virtual String& operator =(const char*); virtual bool operator ==(const String&) const; virtual bool operator ==(const char*) const; virtual bool operator !=(const String&) const; virtual bool operator !=(const char*) const; virtual bool operator >(const String&) const; virtual bool operator >(const char*) const; virtual bool operator >=(const String&) const; virtual bool operator >=(const char*) const; virtual bool operator <(const String&) const; virtual bool operator <(const char*) const; virtual bool operator <=(const String&) const; virtual bool operator <=(const char*) const; virtual bool case_insensitive_equal(const String&) const; virtual bool case_insensitive_equal(const char*) const; u_char operator [](int index) const; virtual String substr(int start, int length) const; String left(int length) const; String right(int start) const; virtual void set_to_substr(int start, int length); void set_to_left(int length); void set_to_right(int start); virtual int search(int start, u_char) const; int index(u_char) const; int rindex(u_char) const; virtual bool convert(int&) const; virtual bool convert(long&) const; virtual bool convert(float&) const; virtual bool convert(double&) const; virtual bool null_terminated() const; protected: virtual void set_value(const char*); virtual void set_value(const char*, int); private: const char* data_; int length_; }; class CopyString : public String { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif CopyString(); CopyString(const char*); CopyString(const char*, int length); CopyString(const String&); CopyString(const CopyString&); virtual ~CopyString(); virtual String& operator =(const CopyString&); virtual String& operator =(const String&); virtual String& operator =(const char*); virtual bool null_terminated() const; protected: virtual void set_value(const char*); virtual void set_value(const char*, int); private: void strfree(); }; class NullTerminatedString : public String { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif NullTerminatedString(); NullTerminatedString(const String&); NullTerminatedString(const NullTerminatedString&); virtual ~NullTerminatedString(); virtual String& operator =(const String&); virtual String& operator =(const char*); virtual bool null_terminated() const; private: bool allocated_; void assign(const String&); void strfree(); }; inline const char* String::string() const { return data_; } inline int String::length() const { return length_; } inline u_char String::operator [](int index) const { return ((u_char*)data_)[index]; } inline String String::left(int length) const { return substr(0, length); } inline String String::right(int start) const { return substr(start, -1); } inline void String::set_to_left(int length) { set_to_substr(0, length); } inline void String::set_to_right(int start) { set_to_substr(start, -1); } inline int String::index(u_char c) const { return search(0, c); } inline int String::rindex(u_char c) const { return search(-1, c); } #endif neuron-7.6.3/src/include/OS/table.h000066400000000000000000000134501340731477100170420ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Generic object association table. */ #ifndef os_table_h #define os_table_h #include #if 1 || defined(__STDC__) || defined(__ANSI_CPP__) #define __TableEntry(Table) Table##_Entry #define TableEntry(Table) __TableEntry(Table) #define __TableIterator(Table) Table##_Iterator #define TableIterator(Table) __TableIterator(Table) #else #define __TableEntry(Table) Table/**/_Entry #define TableEntry(Table) __TableEntry(Table) #define __TableIterator(Table) Table/**/_Iterator #define TableIterator(Table) __TableIterator(Table) #endif #define declareTable(Table,Key,Value) \ struct TableEntry(Table); \ \ class Table { \ public: \ Table(int); \ ~Table(); \ \ void insert(Key, Value); \ bool find(Value&, Key); \ bool find_and_remove(Value&, Key); \ void remove(Key); \ private: \ friend class TableIterator(Table); \ \ int size_; \ TableEntry(Table)** first_; \ TableEntry(Table)** last_; \ \ TableEntry(Table)*& probe(Key); \ }; \ \ struct TableEntry(Table) { \ private: \ friend class Table; \ friend class TableIterator(Table); \ \ Key key_; \ Value value_; \ TableEntry(Table)* chain_; \ }; \ \ class TableIterator(Table) { \ public: \ TableIterator(Table)(Table&); \ \ Key& cur_key(); \ Value& cur_value(); \ bool more(); \ bool next(); \ private: \ TableEntry(Table)* cur_; \ TableEntry(Table)** entry_; \ TableEntry(Table)** last_; \ }; \ \ inline Key& TableIterator(Table)::cur_key() { return cur_->key_; } \ inline Value& TableIterator(Table)::cur_value() { return cur_->value_; } \ inline bool TableIterator(Table)::more() { return entry_ <= last_; } /* * Predefined hash functions */ #ifndef os_table2_h inline unsigned long key_to_hash(long k) { return (unsigned long)k; } #if defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ > __SIZEOF_LONG__ inline unsigned long key_to_hash(const void* k) { return (unsigned long)((unsigned long long)k); } #else inline unsigned long key_to_hash(const void* k) { return (unsigned long)k; } #endif #endif /* * Table implementation */ #define implementTable(Table,Key,Value) \ Table::Table(int n) { \ for (size_ = 32; size_ < n; size_ <<= 1); \ first_ = new TableEntry(Table)*[size_]; \ --size_; \ last_ = &first_[size_]; \ for (register TableEntry(Table)** e = first_; e <= last_; e++) { \ *e = nil; \ } \ } \ \ Table::~Table() { \ for (register TableEntry(Table)** e = first_; e <= last_; e++) { \ TableEntry(Table)* t = *e; \ for (register TableEntry(Table)* i = t; i; i = t) { \ t = i->chain_; \ delete i; \ } \ } \ delete [] first_; \ } \ \ inline TableEntry(Table)*& Table::probe(Key i) { \ return first_[key_to_hash(i) & size_]; \ } \ \ void Table::insert(Key k, Value v) { \ register TableEntry(Table)* e = new TableEntry(Table); \ e->key_ = k; \ e->value_ = v; \ register TableEntry(Table)** a = &probe(k); \ e->chain_ = *a; \ *a = e; \ } \ \ bool Table::find(Value& v, Key k) { \ for (register TableEntry(Table)* e = probe(k); e != nil; e = e->chain_) { \ if (e->key_ == k) { \ v = e->value_; \ return true; \ } \ } \ return false; \ } \ \ bool Table::find_and_remove(Value& v, Key k) { \ TableEntry(Table)** a = &probe(k); \ register TableEntry(Table)* e = *a; \ if (e != nil) { \ if (e->key_ == k) { \ v = e->value_; \ *a = e->chain_; \ delete e; \ return true; \ } else { \ register TableEntry(Table)* prev; \ do { \ prev = e; \ e = e->chain_; \ } while (e != nil && e->key_ != k); \ if (e != nil) { \ v = e->value_; \ prev->chain_ = e->chain_; \ delete e; \ return true; \ } \ } \ } \ return false; \ } \ \ void Table::remove(Key k) { \ TableEntry(Table)** a = &probe(k); \ register TableEntry(Table)* e = *a; \ if (e != nil) { \ if (e->key_ == k) { \ *a = e->chain_; \ delete e; \ } else { \ register TableEntry(Table)* prev; \ do { \ prev = e; \ e = e->chain_; \ } while (e != nil && e->key_ != k); \ if (e != nil) { \ prev->chain_ = e->chain_; \ delete e; \ } \ } \ } \ } \ \ TableIterator(Table)::TableIterator(Table)(Table& t) { \ last_ = t.last_; \ for (entry_ = t.first_; entry_ <= last_; entry_++) { \ cur_ = *entry_; \ if (cur_ != nil) { \ break; \ } \ } \ } \ \ bool TableIterator(Table)::next() { \ cur_ = cur_->chain_; \ if (cur_ != nil) { \ return true; \ } \ for (++entry_; entry_ <= last_; entry_++) { \ cur_ = *entry_; \ if (cur_ != nil) { \ return true; \ } \ } \ return false; \ } #endif neuron-7.6.3/src/include/OS/table2.h000066400000000000000000000124031340731477100171210ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Object association table with 2 keys. */ #ifndef os_table2_h #define os_table2_h #include #if defined(__STDC__) || defined(__ANSI_CPP__) #define __Table2Entry(Table2) Table2##_Entry #define Table2Entry(Table2) __Table2Entry(Table2) #define __Table2Iterator(Table2) Table2##_Iterator #define Table2Iterator(Table2) __Table2Iterator(Table2) #else #define __Table2Entry(Table2) Table2/**/_Entry #define Table2Entry(Table2) __Table2Entry(Table2) #define __Table2Iterator(Table2) Table2/**/_Iterator #define Table2Iterator(Table2) __Table2Iterator(Table2) #endif #define declareTable2(Table2,Key1,Key2,Value) \ struct Table2Entry(Table2); \ \ class Table2 { \ public: \ Table2(int); \ ~Table2(); \ \ void insert(Key1, Key2, Value); \ bool find(Value&, Key1, Key2); \ void remove(Key1, Key2); \ private: \ friend class Table2Iterator(Table2); \ \ int size_; \ Table2Entry(Table2)** first_; \ Table2Entry(Table2)** last_; \ \ Table2Entry(Table2)*& probe(Key1, Key2); \ }; \ \ struct Table2Entry(Table2) { \ private: \ friend class Table2; \ friend class Table2Iterator(Table2); \ \ Key1 key1_; \ Key2 key2_; \ Value value_; \ Table2Entry(Table2)* chain_; \ }; \ \ class Table2Iterator(Table2) { \ public: \ Table2Iterator(Table2)(Table2&); \ \ Key1& cur_key1(); \ Key2& cur_key2(); \ Value& cur_value(); \ bool more(); \ bool next(); \ private: \ Table2Entry(Table2)* cur_; \ Table2Entry(Table2)** entry_; \ Table2Entry(Table2)** last_; \ }; \ \ inline Key1& Table2Iterator(Table2)::cur_key1() { return cur_->key1_; } \ inline Key2& Table2Iterator(Table2)::cur_key2() { return cur_->key2_; } \ inline Value& Table2Iterator(Table2)::cur_value() { return cur_->value_; } \ inline bool Table2Iterator(Table2)::more() { return entry_ <= last_; } /* * Predefined hash functions */ #ifndef os_table_h inline unsigned long key_to_hash(long k) { return (unsigned long)k; } inline unsigned long key_to_hash(const void* k) { return (unsigned long)k; } #endif /* * Table2 implementation */ #define implementTable2(Table2,Key1,Key2,Value) \ Table2::Table2(int n) { \ for (size_ = 32; size_ < n; size_ <<= 1); \ first_ = new Table2Entry(Table2)*[size_]; \ --size_; \ last_ = &first_[size_]; \ for (register Table2Entry(Table2)** e = first_; e <= last_; e++) { \ *e = nil; \ } \ } \ \ Table2::~Table2() { \ delete [] first_; \ } \ \ inline Table2Entry(Table2)*& Table2::probe(Key1 k1, Key2 k2) { \ return first_[(key_to_hash(k1) ^ key_to_hash(k2)) & size_]; \ } \ \ void Table2::insert(Key1 k1, Key2 k2, Value v) { \ register Table2Entry(Table2)* e = new Table2Entry(Table2); \ e->key1_ = k1; \ e->key2_ = k2; \ e->value_ = v; \ register Table2Entry(Table2)** a = &probe(k1, k2); \ e->chain_ = *a; \ *a = e; \ } \ \ bool Table2::find(Value& v, Key1 k1, Key2 k2) { \ for ( \ register Table2Entry(Table2)* e = probe(k1, k2); \ e != nil; \ e = e->chain_ \ ) { \ if (e->key1_ == k1 && e->key2_ == k2) { \ v = e->value_; \ return true; \ } \ } \ return false; \ } \ \ void Table2::remove(Key1 k1, Key2 k2) { \ Table2Entry(Table2)** a = &probe(k1, k2); \ register Table2Entry(Table2)* e = *a; \ if (e != nil) { \ if (e->key1_ == k1 && e->key2_ == k2) { \ *a = e->chain_; \ delete e; \ } else { \ register Table2Entry(Table2)* prev; \ do { \ prev = e; \ e = e->chain_; \ } while (e != nil && (e->key1_ != k1 || e->key2_ != k2)); \ if (e != nil) { \ prev->chain_ = e->chain_; \ delete e; \ } \ } \ } \ } \ \ Table2Iterator(Table2)::Table2Iterator(Table2)(Table2& t) { \ last_ = t.last_; \ for (entry_ = t.first_; entry_ <= last_; entry_++) { \ cur_ = *entry_; \ if (cur_ != nil) { \ break; \ } \ } \ } \ \ bool Table2Iterator(Table2)::next() { \ cur_ = cur_->chain_; \ if (cur_ != nil) { \ return true; \ } \ for (++entry_; entry_ <= last_; entry_++) { \ cur_ = *entry_; \ if (cur_ != nil) { \ return true; \ } \ } \ return false; \ } #endif neuron-7.6.3/src/include/OS/types.h000077500000000000000000000024711340731477100171230ustar00rootroot00000000000000/* * Copyright (c) 1992 Stanford University * Copyright (c) 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef os_types_h #define os_types_h #include #if !defined(__MWERKS__) #include #endif #endif neuron-7.6.3/src/include/OS/ustring.h000066400000000000000000000036761340731477100174570ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef os_ustring_h #define os_ustring_h /* * UniqueString - unique string using hash table */ #include class UniqueStringPool; class UniqueStringTable; class UniqueString : public String { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif UniqueString(); UniqueString(const char*); UniqueString(const char*, int length); UniqueString(const String&); UniqueString(const UniqueString&); virtual ~UniqueString(); virtual unsigned long hash() const; virtual bool operator ==(const String&) const; virtual bool operator ==(const char*) const; virtual bool null_terminated() const; private: static UniqueStringTable* table_; static UniqueStringPool* pool_; void init(const String&); }; #endif neuron-7.6.3/src/include/TIFF/000077500000000000000000000000001340731477100160065ustar00rootroot00000000000000neuron-7.6.3/src/include/TIFF/format.h000077500000000000000000000040261340731477100174540ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef tiff_format_h #define tiff_format_h /* * Define constants for identifying different file formats. */ #define COMPRESS_MAGIC_NUM 0x1f9d #define TIFF1_MAGIC_NUM 0x4d4d /* TIFF with BIGENDIAN byte order */ #define TIFF2_MAGIC_NUM 0x4949 /* TIFF with LITLEENDIAN byte order */ #define SUN_MAGIC_NUM 0x59a6 /* Sun rasterfile (0x59a66a95) */ #define BM_MAGIC_NUM '!' /* bm format (!!) */ #define PBM_MAGIC_NUM 'P' /* pbm file (P1) */ #define ATK_MAGIC_NUM '\\' /* ATK file (\begindata{raster,length}) */ #define MP_MAGIC_NUM '\0' /* MacPaint (titlength in short) */ #define X11_MAGIC_NUM '#' /* X bitmaps (#define) */ #define PCX_MAGIC_NUM 0xa /* PCX, PC Paintbrush files */ #define IFF_MAGIC_NUM 'F' /* Amiga IFF format ("FORM") */ #define GIF_MAGIC_NUM 'G' /* GIF format (CompuServe) */ #define RLE_MAGIC_NUM 0x52 /* Utah RLE file (0x52 0xcc) */ #endif neuron-7.6.3/src/include/TIFF/tiff.h000077500000000000000000000313311340731477100171130ustar00rootroot00000000000000/* /local/src/master/iv/src/include/TIFF/tiff.h,v 1.2 1997/03/26 15:06:20 hines Exp */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _TIFF_ #define _TIFF_ /* * Tag Image File Format (TIFF) * * Based on Rev 6.0 from: * Developer's Desk * Aldus Corporation * 411 First Ave. South * Suite 200 * Seattle, WA 98104 * 206-622-5500 */ #define TIFF_VERSION 42 #define TIFF_BIGENDIAN 0x4d4d #define TIFF_LITTLEENDIAN 0x4949 typedef struct { unsigned short tiff_magic; /* magic number (defines byte order) */ unsigned short tiff_version; /* TIFF version number */ unsigned long tiff_diroff; /* byte offset to first directory */ } TIFFHeader; /* * TIFF Image File Directories are comprised of * a table of field descriptors of the form shown * below. The table is sorted in ascending order * by tag. The values associated with each entry * are disjoint and may appear anywhere in the file * (so long as they are placed on a word boundary). * * If the value is 4 bytes or less, then it is placed * in the offset field to save space. If the value * is less than 4 bytes, it is left-justified in the * offset field. */ typedef struct { unsigned short tdir_tag; /* see below */ unsigned short tdir_type; /* data type; see below */ unsigned long tdir_count; /* number of items; length in spec */ unsigned long tdir_offset; /* byte offset to field data */ } TIFFDirEntry; /* * NB: In the comments below, * - items marked with a + are obsoleted by revision 5.0, * - items marked with a ! are introduced in revision 6.0. * - items marked with a $ are obsoleted by revision 6.0. */ /* * Tag data type information. * * Note: RATIONALs are the ratio of two 32-bit integer values. */ typedef enum { TIFF_NOTYPE = 0, /* placeholder */ TIFF_BYTE = 1, /* 8-bit unsigned integer */ TIFF_ASCII = 2, /* 8-bit bytes w/ last byte null */ TIFF_SHORT = 3, /* 16-bit unsigned integer */ TIFF_LONG = 4, /* 32-bit unsigned integer */ TIFF_RATIONAL = 5, /* 64-bit unsigned fraction */ TIFF_SBYTE = 6, /* !8-bit signed integer */ TIFF_UNDEFINED = 7, /* !8-bit untyped data */ TIFF_SSHORT = 8, /* !16-bit signed integer */ TIFF_SLONG = 9, /* !32-bit signed integer */ TIFF_SRATIONAL = 10, /* !64-bit signed fraction */ TIFF_FLOAT = 11, /* !32-bit IEEE floating point */ TIFF_DOUBLE = 12 /* !64-bit IEEE floating point */ } TIFFDataType; /* * TIFF Tag Definitions. */ #define TIFFTAG_SUBFILETYPE 254 /* subfile data descriptor */ #define FILETYPE_REDUCEDIMAGE 0x1 /* reduced resolution version */ #define FILETYPE_PAGE 0x2 /* one page of many */ #define FILETYPE_MASK 0x4 /* transparency mask */ #define TIFFTAG_OSUBFILETYPE 255 /* +kind of data in subfile */ #define OFILETYPE_IMAGE 1 /* full resolution image data */ #define OFILETYPE_REDUCEDIMAGE 2 /* reduced size image data */ #define OFILETYPE_PAGE 3 /* one page of many */ #define TIFFTAG_IMAGEWIDTH 256 /* image width in pixels */ #define TIFFTAG_IMAGELENGTH 257 /* image height in pixels */ #define TIFFTAG_BITSPERSAMPLE 258 /* bits per channel (sample) */ #define TIFFTAG_COMPRESSION 259 /* data compression technique */ #define COMPRESSION_NONE 1 /* dump mode */ #define COMPRESSION_CCITTRLE 2 /* CCITT modified Huffman RLE */ #define COMPRESSION_CCITTFAX3 3 /* CCITT Group 3 fax encoding */ #define COMPRESSION_CCITTFAX4 4 /* CCITT Group 4 fax encoding */ #define COMPRESSION_LZW 5 /* Lempel-Ziv & Welch */ #define COMPRESSION_JPEG 6 /* !JPEG compression */ #define COMPRESSION_NEXT 32766 /* NeXT 2-bit RLE */ #define COMPRESSION_CCITTRLEW 32771 /* #1 w/ word alignment */ #define COMPRESSION_PACKBITS 32773 /* Macintosh RLE */ #define COMPRESSION_THUNDERSCAN 32809 /* ThunderScan RLE */ #define TIFFTAG_PHOTOMETRIC 262 /* photometric interpretation */ #define PHOTOMETRIC_MINISWHITE 0 /* min value is white */ #define PHOTOMETRIC_MINISBLACK 1 /* min value is black */ #define PHOTOMETRIC_RGB 2 /* RGB color model */ #define PHOTOMETRIC_PALETTE 3 /* color map indexed */ #define PHOTOMETRIC_MASK 4 /* $holdout mask */ #define PHOTOMETRIC_SEPARATED 5 /* !color separations */ #define PHOTOMETRIC_YCBCR 6 /* !CCIR 601 */ #define PHOTOMETRIC_CIELAB 8 /* !1976 CIE L*a*b* */ #define TIFFTAG_THRESHHOLDING 263 /* +thresholding used on data */ #define THRESHHOLD_BILEVEL 1 /* b&w art scan */ #define THRESHHOLD_HALFTONE 2 /* or dithered scan */ #define THRESHHOLD_ERRORDIFFUSE 3 /* usually floyd-steinberg */ #define TIFFTAG_CELLWIDTH 264 /* +dithering matrix width */ #define TIFFTAG_CELLLENGTH 265 /* +dithering matrix height */ #define TIFFTAG_FILLORDER 266 /* data order within a byte */ #define FILLORDER_MSB2LSB 1 /* most significant -> least */ #define FILLORDER_LSB2MSB 2 /* least significant -> most */ #define TIFFTAG_DOCUMENTNAME 269 /* name of doc. image is from */ #define TIFFTAG_IMAGEDESCRIPTION 270 /* info about image */ #define TIFFTAG_MAKE 271 /* scanner manufacturer name */ #define TIFFTAG_MODEL 272 /* scanner model name/number */ #define TIFFTAG_STRIPOFFSETS 273 /* offsets to data strips */ #define TIFFTAG_ORIENTATION 274 /* +image orientation */ #define ORIENTATION_TOPLEFT 1 /* row 0 top, col 0 lhs */ #define ORIENTATION_TOPRIGHT 2 /* row 0 top, col 0 rhs */ #define ORIENTATION_BOTRIGHT 3 /* row 0 bottom, col 0 rhs */ #define ORIENTATION_BOTLEFT 4 /* row 0 bottom, col 0 lhs */ #define ORIENTATION_LEFTTOP 5 /* row 0 lhs, col 0 top */ #define ORIENTATION_RIGHTTOP 6 /* row 0 rhs, col 0 top */ #define ORIENTATION_RIGHTBOT 7 /* row 0 rhs, col 0 bottom */ #define ORIENTATION_LEFTBOT 8 /* row 0 lhs, col 0 bottom */ #define TIFFTAG_SAMPLESPERPIXEL 277 /* samples per pixel */ #define TIFFTAG_ROWSPERSTRIP 278 /* rows per strip of data */ #define TIFFTAG_STRIPBYTECOUNTS 279 /* bytes counts for strips */ #define TIFFTAG_MINSAMPLEVALUE 280 /* +minimum sample value */ #define TIFFTAG_MAXSAMPLEVALUE 281 /* +maximum sample value */ #define TIFFTAG_XRESOLUTION 282 /* pixels/resolution in x */ #define TIFFTAG_YRESOLUTION 283 /* pixels/resolution in y */ #define TIFFTAG_PLANARCONFIG 284 /* storage organization */ #define PLANARCONFIG_CONTIG 1 /* single image plane */ #define PLANARCONFIG_SEPARATE 2 /* separate planes of data */ #define TIFFTAG_PAGENAME 285 /* page name image is from */ #define TIFFTAG_XPOSITION 286 /* x page offset of image lhs */ #define TIFFTAG_YPOSITION 287 /* y page offset of image lhs */ #define TIFFTAG_FREEOFFSETS 288 /* +byte offset to free block */ #define TIFFTAG_FREEBYTECOUNTS 289 /* +sizes of free blocks */ #define TIFFTAG_GRAYRESPONSEUNIT 290 /* $gray scale curve accuracy */ #define GRAYRESPONSEUNIT_10S 1 /* tenths of a unit */ #define GRAYRESPONSEUNIT_100S 2 /* hundredths of a unit */ #define GRAYRESPONSEUNIT_1000S 3 /* thousandths of a unit */ #define GRAYRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */ #define GRAYRESPONSEUNIT_100000S 5 /* hundred-thousandths */ #define TIFFTAG_GRAYRESPONSECURVE 291 /* $gray scale response curve */ #define TIFFTAG_GROUP3OPTIONS 292 /* 32 flag bits */ #define GROUP3OPT_2DENCODING 0x1 /* 2-dimensional coding */ #define GROUP3OPT_UNCOMPRESSED 0x2 /* data not compressed */ #define GROUP3OPT_FILLBITS 0x4 /* fill to byte boundary */ #define TIFFTAG_GROUP4OPTIONS 293 /* 32 flag bits */ #define GROUP4OPT_UNCOMPRESSED 0x2 /* data not compressed */ #define TIFFTAG_RESOLUTIONUNIT 296 /* units of resolutions */ #define RESUNIT_NONE 1 /* no meaningful units */ #define RESUNIT_INCH 2 /* english */ #define RESUNIT_CENTIMETER 3 /* metric */ #define TIFFTAG_PAGENUMBER 297 /* page numbers of multi-page */ #define TIFFTAG_COLORRESPONSEUNIT 300 /* $color curve accuracy */ #define COLORRESPONSEUNIT_10S 1 /* tenths of a unit */ #define COLORRESPONSEUNIT_100S 2 /* hundredths of a unit */ #define COLORRESPONSEUNIT_1000S 3 /* thousandths of a unit */ #define COLORRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */ #define COLORRESPONSEUNIT_100000S 5 /* hundred-thousandths */ #define TIFFTAG_TRANSFERFUNCTION 301 /* !colorimetry info */ #define TIFFTAG_SOFTWARE 305 /* name & release */ #define TIFFTAG_DATETIME 306 /* creation date and time */ #define TIFFTAG_ARTIST 315 /* creator of image */ #define TIFFTAG_HOSTCOMPUTER 316 /* machine where created */ #define TIFFTAG_PREDICTOR 317 /* prediction scheme w/ LZW */ #define TIFFTAG_WHITEPOINT 318 /* image white point */ #define TIFFTAG_PRIMARYCHROMATICITIES 319 /* !primary chromaticities */ #define TIFFTAG_COLORMAP 320 /* RGB map for pallette image */ #define TIFFTAG_HALFTONEHINTS 321 /* !highlight+shadow info */ #define TIFFTAG_TILEWIDTH 322 /* !rows/data tile */ #define TIFFTAG_TILELENGTH 323 /* !cols/data tile */ #define TIFFTAG_TILEOFFSETS 324 /* !offsets to data tiles */ #define TIFFTAG_TILEBYTECOUNTS 325 /* !byte counts for tiles */ #define TIFFTAG_BADFAXLINES 326 /* lines w/ wrong pixel count */ #define TIFFTAG_CLEANFAXDATA 327 /* regenerated line info */ #define CLEANFAXDATA_CLEAN 0 /* no errors detected */ #define CLEANFAXDATA_REGENERATED 1 /* receiver regenerated lines */ #define CLEANFAXDATA_UNCLEAN 2 /* uncorrected errors exist */ #define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */ #define TIFFTAG_INKSET 332 /* !inks in separated image */ #define INKSET_CMYK 1 /* !cyan-magenta-yellow-black */ #define TIFFTAG_INKNAMES 333 /* !ascii names of inks */ #define TIFFTAG_DOTRANGE 336 /* !0% and 100% dot codes */ #define TIFFTAG_TARGETPRINTER 337 /* !separation target */ #define TIFFTAG_EXTRASAMPLES 338 /* !info about extra samples */ #define EXTRASAMPLE_UNSPECIFIED 0 /* !unspecified data */ #define EXTRASAMPLE_ASSOCALPHA 1 /* !associated alpha data */ #define EXTRASAMPLE_UNASSALPHA 2 /* !unassociated alpha data */ #define TIFFTAG_SAMPLEFORMAT 339 /* !data sample format */ #define SAMPLEFORMAT_INT 1 /* !signed integer data */ #define SAMPLEFORMAT_UINT 2 /* !unsigned integer data */ #define SAMPLEFORMAT_IEEEFP 3 /* !IEEE floating point data */ #define SAMPLEFORMAT_VOID 4 /* !untyped data */ #define TIFFTAG_SMINSAMPLEVALUE 340 /* !variable MinSampleValue */ #define TIFFTAG_SMAXSAMPLEVALUE 341 /* !variable MaxSampleValue */ #define TIFFTAG_JPEGPROC 512 /* !JPEG processing algorithm */ #define JPEGPROC_BASELINE 1 /* !baseline sequential */ #define JPEGPROC_LOSSLESS 14 /* !Huffman coded lossless */ #define TIFFTAG_JPEGIFOFFSET 513 /* !pointer to SOI marker */ #define TIFFTAG_JPEGIFBYTECOUNT 514 /* !JFIF stream length */ #define TIFFTAG_JPEGRESTARTINTERVAL 515 /* !restart interval length */ #define TIFFTAG_JPEGLOSSLESSPREDICTORS 517 /* !lossless proc predictor */ #define TIFFTAG_JPEGPOINTTRANSFORM 518 /* !lossless point transform */ #define TIFFTAG_JPEGQTABLES 519 /* !Q matrice offsets */ #define TIFFTAG_JPEGDCTABLES 520 /* !DCT table offsets */ #define TIFFTAG_JPEGACTABLES 521 /* !AC coefficient offsets */ #define TIFFTAG_YCBCRCOEFFICIENTS 529 /* !RGB -> YCbCr transform */ #define TIFFTAG_YCBCRSUBSAMPLING 530 /* !YCbCr subsampling factors */ #define TIFFTAG_YCBCRPOSITIONING 531 /* !subsample positioning */ #define YCBCRPOSITION_CENTERED 1 /* !as in PostScript Level 2 */ #define YCBCRPOSITION_COSITED 2 /* !as in CCIR 601-1 */ #define TIFFTAG_REFERENCEBLACKWHITE 532 /* !colorimetry info */ /* tags 32995-32999 are private tags registered to SGI */ #define TIFFTAG_MATTEING 32995 /* $use ExtraSamples */ #define TIFFTAG_DATATYPE 32996 /* $use SampleFormat */ #define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */ #define TIFFTAG_TILEDEPTH 32998 /* z depth/data tile */ #endif /* _TIFF_ */ neuron-7.6.3/src/include/TIFF/tiffio.h000077500000000000000000000206171340731477100174500ustar00rootroot00000000000000/* /local/src/master/iv/src/include/TIFF/tiffio.h,v 1.4 1997/04/09 13:01:34 hines Exp */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _TIFFIO_ #define _TIFFIO_ /* * TIFF I/O Library Definitions. */ #include "tiff.h" /* * TIFF is defined as an incomplete type to hide the * library's internal data structures from clients. */ typedef struct tiff TIFF; #ifndef NULL #define NULL 0 #endif /* * Flags to pass to TIFFPrintDirectory to control * printing of data structures that are potentially * very large. Bit-or these flags to enable printing * multiple items. */ #define TIFFPRINT_NONE 0x0 /* no extra info */ #define TIFFPRINT_STRIPS 0x1 /* strips/tiles info */ #define TIFFPRINT_CURVES 0x2 /* color/gray response curves */ #define TIFFPRINT_COLORMAP 0x4 /* colormap */ #define TIFFPRINT_JPEGQTABLES 0x100 /* JPEG Q matrices */ #define TIFFPRINT_JPEGACTABLES 0x200 /* JPEG AC tables */ #define TIFFPRINT_JPEGDCTABLES 0x200 /* JPEG DC tables */ #if defined(__STDC__) || defined(__EXTENDED__) || USE_CONST extern const char TIFFVersion[]; extern const unsigned char TIFFBitRevTable[256]; extern const unsigned char TIFFNoBitRevTable[256]; #else extern char TIFFVersion[]; extern unsigned char TIFFBitRevTable[256]; extern unsigned char TIFFNoBitRevTable[256]; #endif /* * Macros for extracting components from the * packed ABGR form returned by TIFFReadRGBAImage. */ #define TIFFGetR(abgr) ((abgr) & 0xff) #define TIFFGetG(abgr) (((abgr) >> 8) & 0xff) #define TIFFGetB(abgr) (((abgr) >> 16) & 0xff) #define TIFFGetA(abgr) (((abgr) >> 24) & 0xff) #if defined(c_plusplus) || defined(__cplusplus) || defined(__STDC__) || defined(__EXTENDED__) || USE_PROTOTYPES #include #include typedef void (*TIFFErrorHandler)(char* module, char* fmt, va_list ap); #if defined(__cplusplus) extern "C" { #endif extern void TIFFClose(TIFF*); extern int TIFFFlush(TIFF*); extern int TIFFFlushData(TIFF*); extern int TIFFGetField(TIFF*, int, ...); extern int TIFFVGetField(TIFF*, int, va_list); extern int TIFFGetFieldDefaulted(TIFF*, int, ...); extern int TIFFVGetFieldDefaulted(TIFF*, int, va_list); extern int TIFFReadDirectory(TIFF*); extern int TIFFScanlineSize(TIFF*); extern unsigned long TIFFStripSize(TIFF*); extern unsigned long TIFFVStripSize(TIFF*, unsigned long); extern unsigned long TIFFTileRowSize(TIFF*); extern unsigned long TIFFTileSize(TIFF*); extern unsigned long TIFFVTileSize(TIFF*, unsigned long); extern int TIFFFileno(TIFF*); extern int TIFFGetMode(TIFF*); extern int TIFFIsTiled(TIFF*); extern long TIFFCurrentRow(TIFF*); extern int TIFFCurrentDirectory(TIFF*); extern int TIFFCurrentStrip(TIFF*); extern int TIFFCurrentTile(TIFF*); extern int TIFFReadBufferSetup(TIFF*, char*, unsigned); extern int TIFFSetDirectory(TIFF*, int); extern int TIFFSetField(TIFF*, int, ...); extern int TIFFVSetField(TIFF*, int, va_list); extern int TIFFWriteDirectory(TIFF *); #if defined(c_plusplus) || defined(__cplusplus) extern TIFF* TIFFOpen(const char*, const char*); extern TIFF* TIFFFdOpen(const int, const char*, const char*); extern const char* TIFFFileName(TIFF*); extern void TIFFError(const char*, const char*, ...); extern void TIFFWarning(const char*, const char*, ...); extern void TIFFPrintDirectory(TIFF*, FILE*, long = 0); extern int TIFFReadScanline(TIFF*, unsigned char*, unsigned, unsigned = 0); extern int TIFFWriteScanline(TIFF*, unsigned char*, unsigned, unsigned = 0); extern int TIFFReadRGBAImage(TIFF*, unsigned long, unsigned long, unsigned long*, int stop = 0); #else extern TIFF* TIFFOpen(char*, char*); extern TIFF* TIFFFdOpen(int, char*, char*); extern char* TIFFFileName(TIFF*); extern void TIFFError(char*, char*, ...); extern TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler handler); extern void TIFFWarning(char*, char*, ...); extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler handler); extern void TIFFPrintDirectory(TIFF*, FILE*, long); extern int TIFFReadScanline(TIFF*, unsigned char*, unsigned, unsigned); extern int TIFFWriteScanline(TIFF*, unsigned char*, unsigned, unsigned); extern int TIFFReadRGBAImage(TIFF*, unsigned long, unsigned long, unsigned long*, int stop); #endif extern unsigned int TIFFComputeTile(TIFF*, unsigned long, unsigned long, unsigned int, unsigned long); extern int TIFFCheckTile(TIFF*, unsigned long, unsigned long, unsigned long, unsigned); extern unsigned int TIFFNumberOfTiles(TIFF*); extern int TIFFReadTile(TIFF*, unsigned char*, unsigned long, unsigned long, unsigned long, unsigned); extern unsigned int TIFFComputeStrip(TIFF*, unsigned long, unsigned int); extern unsigned int TIFFNumberOfStrips(TIFF*); extern int TIFFReadEncodedStrip(TIFF*, unsigned, unsigned char*, unsigned); extern int TIFFReadRawStrip(TIFF*, unsigned, unsigned char*, unsigned); extern int TIFFReadEncodedTile(TIFF*, unsigned, unsigned char*, unsigned); extern int TIFFReadRawTile(TIFF*, unsigned, unsigned char*, unsigned); extern int TIFFWriteEncodedStrip(TIFF*, unsigned, unsigned char*, unsigned); extern int TIFFWriteRawStrip(TIFF*, unsigned, unsigned char*, unsigned); extern int TIFFWriteEncodedTile(TIFF*, unsigned, unsigned char*, unsigned); extern int TIFFWriteRawTile(TIFF*, unsigned, unsigned char*, unsigned); extern int TIFFSwabShort(unsigned short *); extern int TIFFSwabLong(unsigned long *); extern int TIFFSwabArrayOfShort(unsigned short *, int); extern int TIFFSwabArrayOfLong(unsigned long *, int); extern int TIFFReverseBits(unsigned char *, int); #if defined(__cplusplus) } #endif #else typedef void (*TIFFErrorHandler)(); extern void TIFFClose(); extern TIFF *TIFFOpen(); extern TIFF *TIFFFdOpen(); extern char* TIFFFileName(); extern int TIFFFileno(); extern int TIFFGetMode(); extern int TIFFIsTiled(); extern unsigned int TIFFComputeTile(); extern long TIFFCurrentRow(); extern int TIFFCurrentDirectory(); extern int TIFFCurrentStrip(); extern int TIFFCurrentTile(); extern void TIFFError(); extern TIFFErrorHandler TIFFSetErrorHandler(); extern int TIFFFlush(); extern int TIFFFlushData(); extern int TIFFGetField(); extern int TIFFVGetField(); extern int TIFFGetFieldDefaulted(); extern int TIFFVGetFieldDefaulted(); extern unsigned int TIFFNumberOfTiles(); extern void TIFFPrintDirectory(); extern int TIFFReadDirectory(); extern int TIFFReadBufferSetup(); extern int TIFFReadScanline(); extern int TIFFReadTile(); extern unsigned int TIFFComputeStrip(); extern unsigned int TIFFNumberOfStrips(); extern int TIFFReadEncodedStrip(); extern int TIFFReadRawStrip(); extern int TIFFReadEncodedTile(); extern int TIFFReadRGBAImage(); extern int TIFFReadRawTile(); extern int TIFFScanlineSize(); extern unsigned long TIFFStripSize(); extern unsigned long TIFFVStripSize(); extern unsigned long TIFFTileRowSize(); extern unsigned long TIFFTileSize(); extern unsigned long TIFFVTileSize(); extern int TIFFSetDirectory(); extern int TIFFSetField(); extern int TIFFVSetField(); extern void TIFFWarning(); extern TIFFErrorHandler TIFFSetWarningHandler(); extern int TIFFWriteDirectory(); extern int TIFFWriteScanline(); extern int TIFFWriteEncodedStrip(); extern int TIFFWriteRawStrip(); extern int TIFFWriteEncodedTile(); extern int TIFFWriteRawTile(); extern int TIFFSwabShort(); extern int TIFFSwabLong(); extern int TIFFSwabArrayOfShort(); extern int TIFFSwabArrayOfLong(); extern int TIFFReverseBits(); extern int TIFFCheckTile(); #endif #endif /* _TIFFIO_ */ neuron-7.6.3/src/include/Unidraw/000077500000000000000000000000001340731477100166675ustar00rootroot00000000000000neuron-7.6.3/src/include/Unidraw/Commands/000077500000000000000000000000001340731477100204305ustar00rootroot00000000000000neuron-7.6.3/src/include/Unidraw/Commands/align.h000066400000000000000000000044451340731477100217020ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * AlignCmd - aligns components relative to one another. * AlignToGridCmd - aligns components relative to a grid. */ #ifndef unidraw_commands_align_h #define unidraw_commands_align_h #include class GraphicComp; class GraphicView; class AlignCmd : public Command { public: AlignCmd(ControlInfo*, Alignment = Left, Alignment = Left); AlignCmd(Editor* = nil, Alignment = Left, Alignment = Left); void GetAlignment(Alignment&, Alignment&); GraphicComp* GetReference(GraphicComp*); virtual Command* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: Alignment _align1, _align2; }; class AlignToGridCmd : public Command { public: AlignToGridCmd(ControlInfo*); AlignToGridCmd(Editor* = nil); virtual void Execute(); virtual void Unexecute(); virtual void Align(GraphicView*, float, float); virtual void Unalign(GraphicView*); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: void Move(GraphicComp*); void Unmove(GraphicComp*); }; #endif neuron-7.6.3/src/include/Unidraw/Commands/brushcmd.h000066400000000000000000000033261340731477100224140ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Brush command. */ #ifndef unidraw_commands_brushcmd_h #define unidraw_commands_brushcmd_h #include class PSBrush; class BrushCmd : public Command { public: BrushCmd(ControlInfo*, PSBrush* = nil); BrushCmd(Editor* = nil, PSBrush* = nil); virtual void Execute(); PSBrush* GetBrush(); virtual Command* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: PSBrush* _br; }; inline PSBrush* BrushCmd::GetBrush () { return _br; } #endif neuron-7.6.3/src/include/Unidraw/Commands/catcmds.h000066400000000000000000000075411340731477100222260ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Cataloging commands. */ #ifndef unidraw_commands_catcmds_h #define unidraw_commands_catcmds_h #include #undef FileChooser #define FileChooser _lib_iv(FileChooser) class CatalogChooser; class FileChooser; class PrintDialog; class NewCompCmd : public Command { public: NewCompCmd(ControlInfo*, Component* prototype = nil); NewCompCmd(Editor* = nil, Component* prototype = nil); virtual ~NewCompCmd(); virtual void Execute(); virtual bool Reversible(); Component* GetPrototype(); virtual Command* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); private: Component* prototype_; }; inline Component* NewCompCmd::GetPrototype () { return prototype_; } class RevertCmd : public Command { public: RevertCmd(ControlInfo*); RevertCmd(Editor* = nil); virtual void Execute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class ViewCompCmd : public Command { public: ViewCompCmd(ControlInfo*, FileChooser* = nil); ViewCompCmd(Editor* = nil, FileChooser* = nil); virtual ~ViewCompCmd(); virtual void Execute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); private: FileChooser* chooser_; }; class SaveCompCmd : public Command { public: SaveCompCmd(ControlInfo*); SaveCompCmd(Editor* = nil); virtual void Execute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class SaveCompAsCmd : public Command { public: SaveCompAsCmd(ControlInfo*, FileChooser* = nil); SaveCompAsCmd(Editor* = nil, FileChooser* = nil); virtual ~SaveCompAsCmd(); virtual void Execute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); private: FileChooser* chooser_; }; class PrintCmd : public Command { public: PrintCmd(ControlInfo*, PrintDialog* = nil); PrintCmd(Editor* = nil, PrintDialog* = nil); virtual ~PrintCmd(); virtual void Execute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: int print(const char* print_cmd, const char* file); protected: PrintDialog* _dialog; }; class QuitCmd : public Command { public: QuitCmd(ControlInfo*); QuitCmd(Editor* = nil); virtual void Execute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; #endif neuron-7.6.3/src/include/Unidraw/Commands/colorcmd.h000066400000000000000000000035371340731477100224130ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Color command. */ #ifndef unidraw_commands_colorcmd_h #define unidraw_commands_colorcmd_h #include class PSColor; class ColorCmd : public Command { public: ColorCmd(ControlInfo*, PSColor* fg = nil, PSColor* bg = nil); ColorCmd(Editor* = nil, PSColor* fg = nil, PSColor* bg = nil); virtual void Execute(); PSColor* GetFgColor(); PSColor* GetBgColor(); virtual Command* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: PSColor* _fg, *_bg; }; inline PSColor* ColorCmd::GetFgColor () { return _fg; } inline PSColor* ColorCmd::GetBgColor () { return _bg; } #endif neuron-7.6.3/src/include/Unidraw/Commands/command.h000066400000000000000000000055051340731477100222240ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Command - an object that operates on selected components, an editor, * or unidraw itself. */ #ifndef unidraw_commands_command_h #define unidraw_commands_command_h #include class Clipboard; class Component; class ControlInfo; class Data; class DataCache; class Editor; class GraphicComp; class Iterator; class Selection; #include class Command { public: virtual void Execute(); virtual void Unexecute(); virtual bool Reversible(); virtual void Store(Component*, Data* = nil); virtual Data* Recall(Component*); virtual void Log(); virtual void SetControlInfo(ControlInfo*); virtual void SetEditor(Editor*); virtual void SetClipboard(Clipboard*); virtual ControlInfo* GetControlInfo(); virtual Editor* GetEditor(); virtual Clipboard* GetClipboard(); virtual void First(Iterator&); virtual void Last(Iterator&); virtual void Next(Iterator&); virtual void Prev(Iterator&); virtual bool Done(Iterator&); virtual ~Command(); virtual Command* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual ClassId GetSubstId(const char*& delim); virtual bool IsA(ClassId); protected: Command(ControlInfo*, Clipboard* = nil); Command(Editor* = nil, Clipboard* = nil); void InitCopy(Command*); ControlInfo* CopyControlInfo(); Clipboard* CopyClipboard(); Clipboard* DeepCopyClipboard(); GraphicComp* GetGraphicComp(); protected: ControlInfo* _ctrlInfo; Editor* _editor; Clipboard* _clipboard; private: DataCache* CopyData(); void SetData(DataCache*); private: DataCache* _cache; }; #endif neuron-7.6.3/src/include/Unidraw/Commands/data.h000077500000000000000000000026551340731477100215250ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Data - encapsulates undo information that components store in commands they * interpret. */ #ifndef unidraw_commands_data_h #define unidraw_commands_data_h #include #include class Data : public Resource { protected: Data(); }; #endif neuron-7.6.3/src/include/Unidraw/Commands/datas.h000077500000000000000000000042501340731477100217010ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * VoidData - stores a void*; its destructor does nothing. * MoveData - stores two floating point values for distance moved. * ColorData - stores foreground and background colors. * GSData - stores a complete set of graphics state. * MobilityData - stores mobility information. */ #ifndef unidraw_commands_datas_h #define unidraw_commands_datas_h #include #include class Graphic; class PSColor; class FullGraphic; class VoidData : public Data { public: VoidData(void*); public: void* _void; }; class MoveData : public Data { public: MoveData(float, float); public: float _dx, _dy; }; class ColorData : public Data { public: ColorData(PSColor*, PSColor*); public: PSColor* _fg, *_bg; }; class GSData : public Data { public: GSData(Graphic*); virtual ~GSData(); public: FullGraphic* _gs; }; class MobilityData : public Data { public: MobilityData(Mobility, Graphic*); virtual ~MobilityData(); public: Mobility _mobility; FullGraphic* _gs; }; #endif neuron-7.6.3/src/include/Unidraw/Commands/edit.h000066400000000000000000000116771340731477100215420ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Editing commands. */ #ifndef unidraw_commands_edit_h #define unidraw_commands_edit_h #include class Connector; class GraphicComp; class UndoCmd : public Command { public: UndoCmd(ControlInfo*); UndoCmd(Editor* = nil); virtual void Execute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class RedoCmd : public Command { public: RedoCmd(ControlInfo*); RedoCmd(Editor* = nil); virtual void Execute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class CutCmd : public Command { public: CutCmd(ControlInfo*, Clipboard* = nil); CutCmd(Editor* = nil, Clipboard* = nil); virtual ~CutCmd(); virtual void Execute(); virtual void Unexecute(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: bool _executed; }; class CopyCmd : public Command { public: CopyCmd(ControlInfo*, Clipboard* = nil); CopyCmd(Editor* = nil, Clipboard* = nil); virtual ~CopyCmd(); virtual void Execute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class PasteCmd : public Command { public: PasteCmd(ControlInfo*, Clipboard* = nil); PasteCmd(Editor* = nil, Clipboard* = nil); virtual ~PasteCmd(); virtual void Execute(); virtual void Unexecute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: bool _executed; }; class ReplaceCmd : public MacroCmd { public: ReplaceCmd(ControlInfo*, GraphicComp* = nil); ReplaceCmd(Editor* = nil, GraphicComp* = nil); GraphicComp* GetReplacement(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); private: void Init(GraphicComp*); }; class DupCmd : public Command { public: DupCmd(ControlInfo*, Clipboard* = nil); DupCmd(Editor* = nil, Clipboard* = nil); virtual ~DupCmd(); virtual void Execute(); virtual void Unexecute(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: bool _executed; }; class DeleteCmd : public Command { public: DeleteCmd(ControlInfo*, Clipboard* = nil); DeleteCmd(Editor* = nil, Clipboard* = nil); virtual ~DeleteCmd(); virtual void Execute(); virtual void Unexecute(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: bool _executed; }; class SlctAllCmd : public Command { public: SlctAllCmd(ControlInfo*); SlctAllCmd(Editor* = nil); virtual void Execute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class ConnectCmd : public Command { public: ConnectCmd(ControlInfo*, Connector* = nil, Connector* = nil); ConnectCmd(Editor* = nil, Connector* = nil, Connector* = nil); virtual void Execute(); virtual void Unexecute(); virtual bool Reversible(); void GetConnectors(Connector*&, Connector*&); virtual Command* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: Connector* _source, *_target; }; class MobilityCmd : public Command { public: MobilityCmd(ControlInfo*, Mobility = Fixed); MobilityCmd(Editor* = nil, Mobility = Fixed); Mobility GetMobility(); virtual Command* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: Mobility _mobility; }; #endif neuron-7.6.3/src/include/Unidraw/Commands/font.h000066400000000000000000000033051340731477100215500ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Font command. */ #ifndef unidraw_commands_font_h #define unidraw_commands_font_h #include class PSFont; class FontCmd : public Command { public: FontCmd(ControlInfo*, PSFont* = nil); FontCmd(Editor* = nil, PSFont* = nil); virtual void Execute(); PSFont* GetFont(); virtual Command* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: PSFont* _font; }; inline PSFont* FontCmd::GetFont () { return _font; } #endif neuron-7.6.3/src/include/Unidraw/Commands/import.h000066400000000000000000000040441340731477100221150ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * ImportCmd - a command for importing graphical objects */ #ifndef unidraw_commands_import_h #define unidraw_commands_import_h #include #undef FileChooser #define FileChooser _lib_iv(FileChooser) class FileChooser; class ImportCmd : public Command { public: ImportCmd(ControlInfo*, FileChooser* = nil); ImportCmd(Editor* = nil, FileChooser* = nil); virtual ~ImportCmd(); virtual void Execute(); virtual bool Reversible(); virtual GraphicComp* PostDialog(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); static GraphicComp* Import(const char*); static GraphicComp* TIFF_Image(const char*); static GraphicComp* PGM_Image(const char*); static GraphicComp* PPM_Image(const char*); static GraphicComp* XBitmap_Image(const char*); private: FileChooser* chooser_; void Init(FileChooser*); }; #endif neuron-7.6.3/src/include/Unidraw/Commands/macro.h000066400000000000000000000047411340731477100217100ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * MacroCmd - a command containing a sequence of other commands to execute. */ #ifndef unidraw_commands_macro_h #define unidraw_commands_macro_h #include class UList; class MacroCmd : public Command { public: MacroCmd(ControlInfo*); MacroCmd( Editor* = nil, Command* = nil, Command* = nil, Command* = nil, Command* = nil ); virtual ~MacroCmd(); virtual void Execute(); virtual void Unexecute(); virtual bool Reversible(); virtual void SetEditor(Editor*); virtual void First(Iterator&); virtual void Last(Iterator&); virtual void Next(Iterator&); virtual void Prev(Iterator&); virtual bool Done(Iterator&); virtual Command* GetCommand(Iterator&); virtual void SetCommand(Command*, Iterator&); void Append(Command*, Command* = nil, Command* = nil, Command* = nil); void Prepend(Command*, Command* = nil, Command* = nil, Command* = nil); void InsertBefore(Iterator&, Command*); void InsertAfter(Iterator&, Command*); void Remove(Command*); void Remove(Iterator&); virtual Command* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: Command* Cmd(UList*); UList* Elem(Iterator&); protected: UList* _cmds; }; #endif neuron-7.6.3/src/include/Unidraw/Commands/nop.h000066400000000000000000000027761340731477100214110ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Null command. */ #ifndef unidraw_commands_nop_h #define unidraw_commands_nop_h #include class NOPCmd : public Command { public: NOPCmd(ControlInfo*); NOPCmd(Editor* = nil); virtual void Execute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; #endif neuron-7.6.3/src/include/Unidraw/Commands/patcmd.h000066400000000000000000000033561340731477100220600ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Pattern command. */ #ifndef unidraw_commands_patcmd_h #define unidraw_commands_patcmd_h #include class PSPattern; class PatternCmd : public Command { public: PatternCmd(ControlInfo*, PSPattern* = nil); PatternCmd(Editor* = nil, PSPattern* = nil); virtual void Execute(); PSPattern* GetPattern(); virtual Command* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: PSPattern* _pat; }; inline PSPattern* PatternCmd::GetPattern () { return _pat; } #endif neuron-7.6.3/src/include/Unidraw/Commands/struct.h000066400000000000000000000061111340731477100221240ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Structuring commands. */ #ifndef unidraw_commands_struct_h #define unidraw_commands_struct_h #include class GraphicComp; class Iterator; class Selection; class GroupCmd : public Command { public: GroupCmd(ControlInfo*, GraphicComp* dest = nil); GroupCmd(Editor* = nil, GraphicComp* dest = nil); virtual ~GroupCmd(); virtual void Execute(); virtual void Unexecute(); virtual bool Reversible(); GraphicComp* GetGroup(); void SetGroup(GraphicComp*); virtual Command* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: bool _executed; private: void Init(GraphicComp*); private: GraphicComp* _group; }; inline GraphicComp* GroupCmd::GetGroup () { return _group; } inline void GroupCmd::SetGroup (GraphicComp* g) { _group = g; } class UngroupCmd : public Command { public: UngroupCmd(ControlInfo*); UngroupCmd(Editor* = nil); virtual ~UngroupCmd(); virtual void Execute(); virtual void Unexecute(); Clipboard* GetKids(); void SetKids(Clipboard*); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: bool _executed; private: void Init(); private: Clipboard* _kids; }; inline Clipboard* UngroupCmd::GetKids () { return _kids; } inline void UngroupCmd::SetKids (Clipboard* k) { _kids = k; } class FrontCmd : public Command { public: FrontCmd(ControlInfo*); FrontCmd(Editor* = nil); virtual void Execute(); virtual void Unexecute(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class BackCmd : public Command { public: BackCmd(ControlInfo*); BackCmd(Editor* = nil); virtual void Execute(); virtual void Unexecute(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; #endif neuron-7.6.3/src/include/Unidraw/Commands/transforms.h000066400000000000000000000051721340731477100230040ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Transformation commands. */ #ifndef unidraw_commands_transforms_h #define unidraw_commands_transforms_h #include #include class MoveCmd : public Command { public: MoveCmd(ControlInfo*, float = 0, float = 0); MoveCmd(Editor* = nil, float = 0, float = 0); void GetMovement(float&, float&); virtual Command* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: float _dx, _dy; }; class ScaleCmd : public Command { public: ScaleCmd(ControlInfo*, float = 1, float = 1, Alignment = Center); ScaleCmd(Editor* = nil, float = 1, float = 1, Alignment = Center); void GetScaling(float&, float&); Alignment GetAlignment(); virtual Command* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: float _sx, _sy; Alignment _align; }; inline Alignment ScaleCmd::GetAlignment () { return _align; } class RotateCmd : public Command { public: RotateCmd(ControlInfo*, float = 0); RotateCmd(Editor* = nil, float = 0); float GetRotation(); virtual Command* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: float _angle; }; inline float RotateCmd::GetRotation () { return _angle; } #include #endif neuron-7.6.3/src/include/Unidraw/Commands/viewcmds.h000066400000000000000000000067321340731477100224320ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * View commands. */ #ifndef unidraw_commands_viewcmds_h #define unidraw_commands_viewcmds_h #include class ControlInfo; class GridDialog; class NormSizeCmd : public Command { public: NormSizeCmd(ControlInfo*); NormSizeCmd(Editor* = nil); virtual void Execute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class RedToFitCmd : public Command { public: RedToFitCmd(ControlInfo*); RedToFitCmd(Editor* = nil); virtual void Execute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class CenterCmd : public Command { public: CenterCmd(ControlInfo*); CenterCmd(Editor* = nil); virtual void Execute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class GridCmd : public Command { public: GridCmd(ControlInfo*); GridCmd(Editor* = nil); virtual void Execute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class GridSpacingCmd : public Command { public: GridSpacingCmd(ControlInfo*); GridSpacingCmd(Editor* = nil); virtual ~GridSpacingCmd(); virtual void Execute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: GridDialog* _dialog; }; class GravityCmd : public Command { public: GravityCmd(ControlInfo*); GravityCmd(Editor* = nil); virtual void Execute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class OrientationCmd : public Command { public: OrientationCmd(ControlInfo*); OrientationCmd(Editor* = nil); virtual void Execute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class CloseEditorCmd : public Command { public: CloseEditorCmd(ControlInfo*); CloseEditorCmd(Editor* = nil); virtual void Execute(); virtual bool Reversible(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; #endif neuron-7.6.3/src/include/Unidraw/Components/000077500000000000000000000000001340731477100210145ustar00rootroot00000000000000neuron-7.6.3/src/include/Unidraw/Components/cglue.h000077500000000000000000000035101340731477100222660ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * CGlue - connector glue for specifying connection behavior */ #ifndef unidraw_components_cglue_h #define unidraw_components_cglue_h #include #include class Shape; class CGlue { public: CGlue( float hnat = 0, float vnat = 0, float hshr = 0, float hstr = 0, float vshr = 0, float vstr = 0, float hshrlim = 0, float hstrlim = 0, float vshrlim = 0, float vstrlim = 0 ); CGlue(const Shape&); CGlue* Copy(); void Rigid(); void Interpose(CGlue*); public: float _width, _height; float _hshrink, _hstretch, _vshrink, _vstretch; float _hshrlim, _hstrlim, _vshrlim, _vstrlim; }; #endif neuron-7.6.3/src/include/Unidraw/Components/component.h000066400000000000000000000050561340731477100231750ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Component - class of objects that are edited to * form domain-specific drawings. Component subjects contain structural, * connectivity, constraint, and transfer function information. */ #ifndef unidraw_components_component_h #define unidraw_components_component_h #include class Command; class ComponentView; class Iterator; class StateVar; class TransferFunct; class UList; #include class Component { public: virtual void Update(); virtual void Notify(); virtual void Interpret(Command*); virtual void Uninterpret(Command*); virtual Component* GetParent(); virtual Component* GetRoot(); virtual StateVar* GetState(const char*); virtual TransferFunct* GetTransferFunct(); virtual void First(Iterator&); virtual void Last(Iterator&); virtual void Next(Iterator&); virtual void Prev(Iterator&); virtual bool Done(Iterator); virtual void Attach(ComponentView*); virtual void Detach(ComponentView*); ComponentView* Create(ClassId); virtual ~Component(); virtual Component* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual ClassId GetSubstId(const char*& delim); virtual bool IsA(ClassId); protected: Component(); ComponentView* View(UList*); virtual void SetParent(Component* child, Component* parent); protected: UList* _views; }; #endif neuron-7.6.3/src/include/Unidraw/Components/compview.h000066400000000000000000000040531340731477100230200ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * ComponentView - base class for views of Components. */ #ifndef unidraw_components_compview_h #define unidraw_components_compview_h #include class Command; class Component; class Iterator; class ComponentView { public: virtual void Update(); virtual void Interpret(Command*); virtual void Uninterpret(Command*); virtual ComponentView* GetParent(); virtual void First(Iterator&); virtual void Last(Iterator&); virtual void Next(Iterator&); virtual void Prev(Iterator&); virtual bool Done(Iterator); Component* GetSubject(); virtual ~ComponentView(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: ComponentView(Component* subject = nil); friend class Component; virtual void SetSubject(Component*); virtual void SetParent(ComponentView* child, ComponentView* parent); protected: Component* _subject; }; #endif neuron-7.6.3/src/include/Unidraw/Components/connector.h000066400000000000000000000054571340731477100231720ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Connector - object for defining and maintaining connectivity between * components. */ #ifndef unidraw_components_connector_h #define unidraw_components_connector_h #include #include class CGlue; class CSolver; class CSolverInfo; class Path; class StateVar; class Connector : public GraphicComp { public: virtual ~Connector(); virtual void Connect(Connector*, CGlue* = nil); virtual void Disconnect(Connector*); virtual bool ConnectedTo(Connector*); void DisconnectAll(); virtual void GetCenter(float&, float&); virtual void SetBinding(StateVar*); virtual StateVar* GetBinding(); virtual void SetTransMethod(TransMethod); virtual TransMethod GetTransMethod(); virtual void Transmit(Path* = nil); virtual void Interpret(Command*); virtual void Uninterpret(Command*); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: Connector(Graphic* = nil); Connector* Conn(UList*); virtual void ConnectMe(Connector*); virtual void DisconnectMe(Connector*); void Retransmit(Path*); void Retransmit(Connector* peer, Path*); bool Transferable(Connector* peer); protected: UList* _cnxns; /* list of connections */ StateVar* _stateVar; TransMethod _transMethod; private: friend class CSolver; CSolverInfo* _csinfo; }; class ConnectorView : public GraphicView { public: Connector* GetConnector(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: ConnectorView(Connector* = nil); }; #endif neuron-7.6.3/src/include/Unidraw/Components/csolver.h000066400000000000000000000115401340731477100226430ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * CSolver - connector constraint solver. */ #ifndef unidraw_csolver_h #define unidraw_csolver_h #include class CCnxn; class CCnxn_HashTable; class CGlue; class CNet; class ConnInfo; class Connector; class CSolverState; #include class CSolver { public: CSolver(); ~CSolver(); void Connect(Connector*, Connector*, CGlue* = nil); void Disconnect(Connector*, Connector*); void Disconnect(Connector*); void Solve(); void Print(); // for debugging only CSolverState* GetState(Connector*); void SetState(CSolverState*); void Read(istream&); void Write(ostream&); private: friend class Connector; void Wrote(Connector*); CNet* Network(UList*); ConnInfo* Info(Connector*, Orientation); void SolveAll(UList*, Orientation); void Solve(CNet*, Orientation); void DestroyCnxns(); void DestroyCnxns(CNet*); void GetState(Connector*, ConnInfo*, Orientation, CSolverState*); void Update(); void UpdateInfo(CCnxn*, Orientation); void UpdateInfo(CCnxn*, ConnInfo*, ConnInfo*, UList*); void CreateNetwork(CCnxn*, ConnInfo*, ConnInfo*, UList*); void MergeNetworks(CNet*, CNet*, UList*); void DeleteCnxnsTo(Connector*, CNet*, UList*); void DeleteCnxnsBetween(Connector*, Connector*, CNet*); void DeletePeerInfo(Connector*, ConnInfo*); void DeletePeerInfo(Connector*, ConnInfo*, Connector*); void InitInfo(Connector*); void ReadConnectors(istream&, CNet*); void InitConnectors(CNet*, CNet*); void WriteConnectors(ostream&, CCnxn_HashTable*); void Wrote(Connector*, CNet* cl, CCnxn_HashTable* written); bool FoundFixed(CNet*, CNet*&); bool FoundSeries(CNet*, CNet*&, CNet*&, Orientation); bool FoundParallel(CNet*, CNet*&, CNet*&, Orientation); bool FoundY(CNet*, CNet*&, CNet*&, CNet*&, Orientation); bool Found2Fixed(CNet* net, Connector*& c1, Connector*& c2); void SubstFixedEquiv(CNet*, CNet*, CNet*&, Orientation); void SubstSeriesEquiv( CNet*, CNet*, CNet*, CNet*&, bool&, bool&, Orientation ); void SubstParallelEquiv(CNet*, CNet*, CNet*, CNet*&, bool&,Orientation); void SubstYEquiv( CNet*, CNet*, CNet*, CNet*, CNet*&, CNet*&, CNet*&, bool&, bool&, bool&, Orientation ); void SubstPseudoFixed(CNet*, Connector*, Connector*, CNet*&, Orientation); void ReplaceFixed(CNet*, CNet*, CNet*&, Orientation); void ReplaceSeries( CNet*, CNet*, CNet*, CNet*&, bool, bool, Orientation ); void ReplaceParallel(CNet*, CNet*, CNet*, CNet*&, bool, Orientation); void ReplaceY( CNet*, CNet*, CNet*, CNet*, CNet*&, CNet*&, CNet*&, bool, bool, bool, Orientation ); void ReplacePseudoFixed(CNet*, Connector*, Connector*, CNet*&,Orientation); void SubstFixedInfo(CNet*, Orientation); void SubstSeriesInfo(CNet*, CNet*, Orientation); void SubstParallelInfo(CNet*, Orientation); void SubstYInfo(CNet*, CNet*, CNet*, Orientation); void SubstPseudoFixedInfo(CNet*, Orientation); void ReplaceFixedInfo(CNet*, Orientation); void ReplaceSeriesInfo(CNet*, CNet*, Orientation); void ReplaceParallelInfo(CNet*, Orientation); void ReplaceYInfo(CNet*, CNet*, CNet*, Orientation); void ReplacePseudoFixedInfo(CNet*, Orientation); void DefaultPosition(CNet*); private: UList* _hnets, *_vnets; CCnxn_HashTable* _hwritten, *_vwritten; }; class CSolverState { public: ~CSolverState(); private: friend class CSolver; CSolverState(CCnxn* = nil, Orientation = Horizontal); CSolverState* First(); CSolverState* Next(); void Append(CSolverState*); private: CCnxn* _cnxn; Orientation _orient; CSolverState* _next; }; #endif neuron-7.6.3/src/include/Unidraw/Components/ellipse.h000066400000000000000000000045161340731477100226300ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Ellipse component declarations. */ #ifndef unidraw_components_ellipse_h #define unidraw_components_ellipse_h #include #include #include #include class SF_Ellipse; class EllipseComp : public GraphicComp { public: EllipseComp(SF_Ellipse* = nil); SF_Ellipse* GetEllipse(); virtual Component* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class EllipseView : public GraphicView { public: EllipseView(EllipseComp* = nil); virtual void Interpret(Command*); virtual void Update(); virtual Manipulator* CreateManipulator(Viewer*, Event&,Transformer*,Tool*); virtual Command* InterpretManipulator(Manipulator*); EllipseComp* GetEllipseComp(); virtual Graphic* GetGraphic(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class PSEllipse : public PostScriptView { public: PSEllipse(EllipseComp* = nil); virtual bool Definition(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; #include #endif neuron-7.6.3/src/include/Unidraw/Components/externview.h000066400000000000000000000044131340731477100233670ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * ExternView - external representation of component. */ #ifndef unidraw_components_externview_h #define unidraw_components_externview_h #include #include class ExternView : public ComponentView { public: virtual bool Emit(ostream&); virtual bool Definition(ostream&); virtual ExternView* GetView(Iterator); virtual void SetView(ExternView*, Iterator&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: ExternView(Component* = nil); }; class PreorderView : public ExternView { public: virtual bool Definition(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: PreorderView(Component* = nil); }; class InorderView : public ExternView { public: virtual bool Definition(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: InorderView(Component* = nil); }; class PostorderView : public ExternView { public: virtual bool Definition(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: PostorderView(Component* = nil); }; #endif neuron-7.6.3/src/include/Unidraw/Components/grcomp.h000066400000000000000000000116461340731477100224640ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * GraphicComp - a component that has a graphical representation. * GraphicComps - class for GraphicComp composition. */ #ifndef unidraw_components_grcomp_h #define unidraw_components_grcomp_h #include #include class Bitmap; class Clipboard; class Connector; class Editor; class Graphic; class Iterator; class PSBrush; class PSColor; class PSFont; class PSPattern; class Picture; class Raster; class Transformer; class GraphicComp : public Component { public: virtual ~GraphicComp(); virtual void Interpret(Command*); virtual void Uninterpret(Command*); virtual Graphic* GetGraphic(); virtual Component* GetParent(); virtual GraphicComp* GetComp(Iterator); virtual void SetComp(GraphicComp*, Iterator&); virtual void Bequeath(); virtual void Append(GraphicComp*); virtual void Prepend(GraphicComp*); virtual void InsertBefore(Iterator, GraphicComp*); virtual void InsertAfter(Iterator, GraphicComp*); virtual void Remove(GraphicComp*); virtual void Remove(Iterator&); virtual Mobility GetMobility(); virtual void SetMobility(Mobility); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: GraphicComp(Graphic* = nil); virtual GraphicComp* GetGraphicComp(Graphic*); virtual void SetGraphic(Graphic*); void Skip(istream&); void Mark(ostream&); int ReadBgFilled(istream&); PSBrush* ReadBrush(istream&); PSColor* ReadColor(istream&); PSFont* ReadFont(istream&); PSPattern* ReadPattern(istream&); Transformer* ReadTransformer(istream&); char* ReadString(istream&); Bitmap* ReadBitmap(istream&); Raster* ReadGraymap(istream&); Raster* ReadRaster(istream&); void ReadVertices(istream&, Coord*&, Coord*&, int&); void WriteBgFilled(bool, ostream&); void WriteBrush(PSBrush*, ostream&); void WriteColor(PSColor*, ostream&); void WriteFont(PSFont*, ostream&); void WritePattern(PSPattern*, ostream&); void WriteTransformer(Transformer*, ostream&); void WriteString(const char*, ostream&); void WriteBitmap(Bitmap*, ostream&); void WriteGraymap(Raster*, ostream&); void WriteRaster(Raster*, ostream&); void WriteVertices(const Coord*, const Coord*, int, ostream&); protected: Graphic* _gr; static UList* _brushes; static UList* _colors; static UList* _fonts; static UList* _patterns; }; class GraphicComps : public GraphicComp { public: GraphicComps(); GraphicComps(Graphic*); virtual ~GraphicComps(); virtual void Interpret(Command*); virtual void Uninterpret(Command*); virtual void First(Iterator&); virtual void Last(Iterator&); virtual void Next(Iterator&); virtual void Prev(Iterator&); virtual bool Done(Iterator); virtual GraphicComp* GetComp(Iterator); virtual void SetComp(GraphicComp*, Iterator&); virtual void Bequeath(); virtual void Append(GraphicComp*); virtual void Prepend(GraphicComp*); virtual void InsertBefore(Iterator, GraphicComp*); virtual void InsertAfter(Iterator, GraphicComp*); virtual void Remove(GraphicComp*); virtual void Remove(Iterator&); virtual void SetMobility(Mobility); virtual Component* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: GraphicComp* Comp(UList*); UList* Elem(Iterator); void SelectViewsOf(GraphicComp*, Editor*); void SelectClipboard(Clipboard*, Editor*); void StorePosition(GraphicComp*, Command*); void RestorePosition(GraphicComp*, Command*); void Group(Clipboard*, GraphicComp*, Command*); void Ungroup(GraphicComp*, Clipboard*, Command*); protected: UList* _comps; }; #include #endif neuron-7.6.3/src/include/Unidraw/Components/grview.h000066400000000000000000000117431340731477100224760ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * GraphicView - view of a GraphicComp. * GraphicViews - class for GraphicView Composition. */ #ifndef unidraw_components_grview_h #define unidraw_components_grview_h #include #include class ConnectorView; class Event; class Manipulator; class Graphic; class GraphicComp; class GraphicComps; class Picture; class Rubberband; class Selection; class Tool; class Transformer; class Viewer; class GraphicView : public ComponentView { public: virtual ~GraphicView(); virtual void Interpret(Command*); virtual void Uninterpret(Command*); virtual void DrawHandles(); virtual void RedrawHandles(); virtual void InitHandles(); virtual void EraseHandles(); virtual Manipulator* CreateManipulator(Viewer*,Event&,Transformer*,Tool*); virtual Command* InterpretManipulator(Manipulator*); virtual ComponentView* GetParent(); virtual Graphic* GetGraphic(); virtual Viewer* GetViewer(); GraphicComp* GetGraphicComp(); bool Includes(GraphicView*); GraphicView* GetGraphicView(Component*); virtual GraphicView* GetView(Iterator); virtual void SetView(GraphicView*, Iterator&); virtual Selection* SelectAll(); virtual Selection* ViewContaining(Coord, Coord); virtual Selection* ViewsContaining(Coord, Coord); virtual Selection* ViewIntersecting(Coord, Coord, Coord, Coord); virtual Selection* ViewsIntersecting(Coord, Coord, Coord, Coord); virtual Selection* ViewsWithin(Coord, Coord, Coord, Coord); virtual ConnectorView* ConnectorIntersecting(Coord, Coord, Coord, Coord); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: GraphicView(GraphicComp* = nil); virtual void SetGraphic(Graphic*); virtual void CreateHandles(); virtual int ClosestPoint(Coord x[], Coord y[], int n, Coord px, Coord py); GraphicView* View(UList*); GraphicView* GetGraphicView(Graphic*); Manipulator* CreateGraphicCompManip(Viewer*, Event&, Transformer*, Tool*); Manipulator* CreateStretchManip(Viewer*, Event&, Transformer*, Tool*); Command* InterpretGraphicCompManip(Manipulator*); Command* InterpretStretchManip(Manipulator*); friend class GVUpdater; void AddDamage(Graphic*); void IncurDamage(Graphic*); void Unselect(GraphicView*); virtual void Add(GraphicView*); virtual void Append(GraphicView*); virtual void InsertBefore(Iterator, GraphicView*); virtual void Remove(Iterator&); virtual void DeleteView(Iterator&); protected: Graphic* _gr; Rubberband* _handles; }; class GraphicViews : public GraphicView { public: GraphicViews(GraphicComps* = nil); virtual ~GraphicViews(); virtual void Interpret(Command*); virtual void Update(); virtual Graphic* GetGraphic(); GraphicComps* GetGraphicComps(); virtual void First(Iterator&); virtual void Last(Iterator&); virtual void Next(Iterator&); virtual void Prev(Iterator&); virtual bool Done(Iterator); virtual GraphicView* GetView(Iterator); virtual void SetView(GraphicView*, Iterator&); virtual Selection* SelectAll(); virtual Selection* ViewContaining(Coord, Coord); virtual Selection* ViewsContaining(Coord, Coord); virtual Selection* ViewIntersecting(Coord, Coord, Coord, Coord); virtual Selection* ViewsIntersecting(Coord, Coord, Coord, Coord); virtual Selection* ViewsWithin(Coord, Coord, Coord, Coord); virtual ConnectorView* ConnectorIntersecting(Coord, Coord, Coord, Coord); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: UList* Elem(Iterator); virtual void Add(GraphicView*); virtual void Append(GraphicView*); virtual void InsertBefore(Iterator, GraphicView*); virtual void Remove(Iterator&); virtual void DeleteView(Iterator&); protected: UList* _views; }; #include #endif neuron-7.6.3/src/include/Unidraw/Components/gvupdater.h000077500000000000000000000040411340731477100231700ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * GVUpdater - class for reconciling a GraphicView's state and structure * with its subject's. */ #ifndef unidraw_components_gvupdater_h #define unidraw_components_gvupdater_h #include class GraphicView; class GVU_HashTable; class Iterator; class GVUpdater { public: GVUpdater(GraphicView*); virtual void Update(); protected: void UpdateStructure(); void UpdateState(); void AddDamage(Graphic*); void IncurDamage(Graphic*); void Unselect(GraphicView*); void Add(GraphicView*); void Append(GraphicView*); void InsertBefore(Iterator, GraphicView*); void Remove(Iterator&); void DeleteView(Iterator&); virtual ClassId ViewCategory(); protected: GraphicView* _gv; private: void RegisterSubjects(GVU_HashTable*); void InitViews(GVU_HashTable*); void RearrangeViews(GVU_HashTable*); void DamageViews(GVU_HashTable*); }; #endif neuron-7.6.3/src/include/Unidraw/Components/line.h000066400000000000000000000063501340731477100221200ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Line and MultiLine component declarations. */ #ifndef unidraw_components_line_h #define unidraw_components_line_h #include #include class Line; class SF_MultiLine; class LineComp : public GraphicComp { public: LineComp(Line* = nil); virtual void Interpret(Command*); Line* GetLine(); virtual Component* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class LineView : public GraphicView { public: LineView(LineComp* = nil); virtual void Interpret(Command*); virtual void Update(); virtual Manipulator* CreateManipulator(Viewer*,Event&,Transformer*,Tool*); virtual Command* InterpretManipulator(Manipulator*); virtual void GetEndpoints(Coord&, Coord&, Coord&, Coord&); LineComp* GetLineComp(); virtual Graphic* GetGraphic(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: virtual void CreateHandles(); }; class PSLine : public PostScriptView { public: PSLine(LineComp* = nil); virtual bool Definition(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class MultiLineComp : public VerticesComp { public: MultiLineComp(SF_MultiLine* = nil); SF_MultiLine* GetMultiLine(); virtual Component* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class MultiLineView : public VerticesView { public: MultiLineView(MultiLineComp* = nil); virtual Manipulator* CreateManipulator(Viewer*,Event&,Transformer*,Tool*); virtual Command* InterpretManipulator(Manipulator*); MultiLineComp* GetMultiLineComp(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: virtual bool VertexChanged(); }; class PSMultiLine : public PSVertices { public: PSMultiLine(MultiLineComp* = nil); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: virtual const char* Name(); }; #include #endif neuron-7.6.3/src/include/Unidraw/Components/link.h000066400000000000000000000066201340731477100221260ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Link component declarations. */ #ifndef unidraw_components_link_h #define unidraw_components_link_h #include #include #include #include class Connector; class Line; class LinkComp : public GraphicComp { public: LinkComp(Line* = nil); virtual ~LinkComp(); virtual void Interpret(Command*); virtual void Uninterpret(Command*); virtual void Update(); virtual void First(Iterator&); virtual void Last(Iterator&); virtual void Next(Iterator&); virtual void Prev(Iterator&); virtual bool Done(Iterator); virtual GraphicComp* GetComp(Iterator); virtual void SetComp(GraphicComp*, Iterator&); virtual void SetMobility(Mobility); Line* GetLine(); void GetConnectors(Connector*&, Connector*&); virtual Component* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: Connector* _conn1, *_conn2; }; class LinkView : public GraphicView { public: LinkView(LinkComp* = nil); virtual ~LinkView(); virtual void Update(); virtual Manipulator* CreateManipulator(Viewer*,Event&,Transformer*,Tool*); virtual Command* InterpretManipulator(Manipulator*); virtual void First(Iterator&); virtual void Last(Iterator&); virtual void Next(Iterator&); virtual void Prev(Iterator&); virtual bool Done(Iterator); virtual GraphicView* GetView(Iterator); virtual void SetView(GraphicView*, Iterator&); virtual void GetEndpoints(Coord&, Coord&, Coord&, Coord&); LinkComp* GetLinkComp(); virtual Graphic* GetGraphic(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: virtual void CreateHandles(); Line* GetLine(); virtual LinkComp* NewSubject(Line*); Manipulator* CreateLinkCompManip(Viewer*, Event&, Transformer*, Tool*); Command* InterpLinkCompManip(Manipulator*); protected: ConnectorView* _connView1, *_connView2; }; class PSLink : public PostScriptView { public: PSLink(LinkComp* = nil); virtual bool Definition(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; #include #endif neuron-7.6.3/src/include/Unidraw/Components/pad.h000066400000000000000000000065711340731477100217420ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Pad component declarations. */ #ifndef unidraw_components_pad_h #define unidraw_components_pad_h #include #include #include #include class PadGraphic; class PadComp : public Connector { public: PadComp(PadGraphic* = nil); virtual void Interpret(Command*); virtual void Uninterpret(Command*); virtual void Connect(Connector*, CGlue* = nil); virtual Mobility GetMobility(); virtual void SetMobility(Mobility); PadGraphic* GetPad(); virtual Component* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: Mobility _mobility; }; class PadView : public ConnectorView { public: PadView(PadComp* = nil); virtual void Interpret(Command*); virtual void Update(); virtual Manipulator* CreateManipulator(Viewer*,Event&,Transformer*,Tool*); virtual Command* InterpretManipulator(Manipulator*); PadComp* GetPadComp(); virtual Graphic* GetGraphic(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: PadGraphic* GetPad(); virtual PadComp* NewSubject(PadGraphic*); Manipulator* CreateGraphicCompManip(Viewer*,Event&,Transformer*,Tool*); Manipulator* CreateConnectManip(Viewer*,Event&,Transformer*,Tool*); Command* InterpGraphicCompManip(Manipulator*); Command* InterpConnectManip(Manipulator*); }; class PadGraphic : public Graphic { public: PadGraphic(Coord = 0, Coord = 0, Coord = 0, Coord = 0, Graphic* = nil); virtual ~PadGraphic(); virtual void SetBrush(PSBrush*); virtual PSBrush* GetBrush(); void GetOriginal(Coord&, Coord&, Coord&, Coord&); virtual Graphic* Copy(); protected: virtual void concatGS(Graphic*, Graphic*, Graphic*); virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual void draw(Canvas*, Graphic*); protected: Coord _l, _b, _r, _t; PSBrush* _br; }; class PSPad : public PostScriptView { public: PSPad(PadComp* = nil); virtual bool Definition(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; #include #endif neuron-7.6.3/src/include/Unidraw/Components/pin.h000066400000000000000000000074031340731477100217570ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Pin component declarations. */ #ifndef unidraw_components_pin_h #define unidraw_components_pin_h #include #include #include #include #include class PinGraphic; class PinComp : public Connector { public: PinComp(PinGraphic* = nil); virtual void Interpret(Command*); virtual void Uninterpret(Command*); virtual void Connect(Connector*, CGlue* = nil); virtual Mobility GetMobility(); virtual void SetMobility(Mobility); PinGraphic* GetPin(); virtual Component* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: Mobility _mobility; }; class PinView : public ConnectorView { public: PinView(PinComp* = nil); virtual void Interpret(Command*); virtual void Update(); virtual Manipulator* CreateManipulator(Viewer*,Event&,Transformer*,Tool*); virtual Command* InterpretManipulator(Manipulator*); PinComp* GetPinComp(); virtual Graphic* GetGraphic(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: PinGraphic* GetPin(); virtual PinComp* NewSubject(PinGraphic*); Manipulator* CreateGraphicCompManip(Viewer*,Event&,Transformer*,Tool*); Manipulator* CreateConnectManip(Viewer*,Event&,Transformer*,Tool*); Command* InterpGraphicCompManip(Manipulator*); Command* InterpConnectManip(Manipulator*); }; class PinGraphic : public Graphic { public: PinGraphic(Coord = 0, Coord = 0, Graphic* = nil); virtual ~PinGraphic(); virtual void SetBrush(PSBrush*); virtual PSBrush* GetBrush(); void GetOriginal(Coord&, Coord&); virtual Graphic* Copy(); protected: virtual void concatGS(Graphic*, Graphic*, Graphic*); virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual void draw(Canvas*, Graphic*); protected: Coord _x, _y; PSBrush* _br; }; class PSPin : public PostScriptView { public: PSPin(PinComp* = nil); virtual bool Definition(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class SlidingPin : public SlidingEllipse { public: SlidingPin( Painter*, Canvas*, Coord cx, Coord cy, int, Coord rfx, Coord rfy ); virtual void Draw(); }; class FixedPin : public Rubberband { public: FixedPin(Painter*, Canvas*, Coord, Coord, int); virtual void GetOriginal(Coord&, Coord&, int&); virtual void Draw(); protected: Coord _cx, _cy; int _rad; }; #include #endif neuron-7.6.3/src/include/Unidraw/Components/polygon.h000066400000000000000000000042211340731477100226530ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Polygon component declarations. */ #ifndef unidraw_components_polygon_h #define unidraw_components_polygon_h #include class SF_Polygon; class PolygonComp : public VerticesComp { public: PolygonComp(SF_Polygon* = nil); SF_Polygon* GetPolygon(); virtual Component* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class PolygonView : public VerticesView { public: PolygonView(PolygonComp* = nil); virtual Manipulator* CreateManipulator(Viewer*,Event&,Transformer*,Tool*); virtual Command* InterpretManipulator(Manipulator*); PolygonComp* GetPolygonComp(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: virtual bool VertexChanged(); }; class PSPolygon : public PSVertices { public: PSPolygon(PolygonComp* = nil); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: virtual const char* Name(); }; #endif neuron-7.6.3/src/include/Unidraw/Components/psformat.h000077500000000000000000000047441340731477100230340ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * PostScript external representation format changes. */ #ifndef unidraw_components_psformat_h #define unidraw_components_psformat_h #include static const float PSV_UNIDRAW = 10; // Unidraw-based version static const float PSV_ISOLATIN1 = 9; // removed '/' from PostScript fonts // (they're def'ed in IdrawDict now) static const float PSV_EIGHTBIT = 8; // encoded 8-bit characters as \ddd static const float PSV_TEXTOFFSET = 7; // changed text positions on screen // and improved accuracy of // text positions on prfloatout static const float PSV_NONROTATED = 6; // replaced rotation of drawing with // rotation of view for landscape static const float PSV_GRIDSPACING = 5; // added grid spacing static const float PSV_FGANDBGCOLOR = 4; // added background color and // RGB values for overriding names; // used graylevel to eliminate // redundant patternfill data static const float PSV_NONREDUNDANT = 3; // eliminated unnecessary text // pattern and duplication of // font name, transformation matrix, // poly pofloats, and text data static const float PSV_FGCOLOR = 2; // added foreground color static const float PSV_ORIGINAL = 1; // original format #define PSV_LATEST PSV_UNIDRAW #endif neuron-7.6.3/src/include/Unidraw/Components/psview.h000066400000000000000000000110511340731477100225000ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * PostScriptView - idraw-compatible PostScript external representation * for graphical components. */ #ifndef unidraw_components_psview_h #define unidraw_components_psview_h #include #include class PostScriptView : public PreorderView { public: virtual bool Emit(ostream&); GraphicComp* GetGraphicComp(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: PostScriptView(GraphicComp* = nil); virtual void Comments(ostream&); virtual void PSVersion(ostream&); virtual void Creator(ostream&); virtual void FontNames(ostream&); virtual void Pages(ostream&); virtual void BoundingBox(ostream&); virtual void Prologue(ostream&); virtual void Version(ostream&); virtual void GridSpacing(ostream&); virtual void Trailer(ostream&); virtual void MinGS(ostream&); virtual void FullGS(ostream&); virtual void TextGS(ostream&); virtual void Brush(ostream&); virtual void FgColor(ostream&); virtual void BgColor(ostream&); virtual void Font(ostream&); virtual void Pattern(ostream&); virtual void Transformation(ostream&); virtual void SetPSFonts(UList* = nil); virtual UList* GetPSFonts(); virtual void GetBox(Coord&, Coord&, Coord&, Coord&); virtual void GetGridSpacing(float&, float&); virtual void ConstProcs(ostream&); virtual void BeginProc(ostream&); virtual void EndProc(ostream&); virtual void SetGSProcs(ostream&); virtual void SetBrushProc(ostream&); virtual void SetFgColorProc(ostream&); virtual void SetBgColorProc(ostream&); virtual void SetFontProc(ostream&); virtual void SetPatternProc(ostream&); virtual void ObjectProcs(ostream&); virtual void BSplineProc(ostream&); virtual void CircleProc(ostream&); virtual void ClosedBSplineProc(ostream&); virtual void EllipseProc(ostream&); virtual void LineProc(ostream&); virtual void MultiLineProc(ostream&); virtual void PolygonProc(ostream&); virtual void RectangleProc(ostream&); virtual void TextProc(ostream&); virtual void MiscProcs(ostream&); virtual void DefinitionProc(ostream&); virtual void FillProc(ostream&); virtual void StrokeProc(ostream&); virtual void ShowProc(ostream&); virtual void PatternProc(ostream&); virtual void MinMaxProcs(ostream&); virtual void MidpointProc(ostream&); virtual void ThirdpointProc(ostream&); virtual void SubsplineProc(ostream&); virtual void StoreVerticesProc(ostream&); PSFont* GetFont(UList*); PostScriptView* View(UList*); PostScriptView* CreatePSView(GraphicComp*); private: UList* _fonts; }; class PostScriptViews : public PostScriptView { public: PostScriptViews(GraphicComps* = nil); virtual ~PostScriptViews(); virtual bool Emit(ostream&); virtual bool Definition(ostream&); virtual void Update(); GraphicComps* GetGraphicComps(); virtual ExternView* GetView(Iterator); virtual void SetView(ExternView*, Iterator&); virtual void First(Iterator&); virtual void Last(Iterator&); virtual void Next(Iterator&); virtual void Prev(Iterator&); virtual bool Done(Iterator); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: UList* Elem(Iterator); void DeleteView(Iterator&); void DeleteViews(); protected: UList* _views; }; #include #endif neuron-7.6.3/src/include/Unidraw/Components/rastercomp.h000066400000000000000000000043221340731477100233450ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Raster component declarations. */ #ifndef unidraw_components_rastercomp_h #define unidraw_components_rastercomp_h #include #include #include class RasterRect; class RasterComp : public GraphicComp { public: RasterComp(RasterRect* = nil, const char* filename = nil); virtual ~RasterComp(); RasterRect* GetRasterRect(); const char* GetFileName(); virtual Component* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); private: char* _filename; }; class RasterView : public GraphicView { public: RasterView(RasterComp* = nil); virtual void Update(); RasterComp* GetRasterComp(); virtual Graphic* GetGraphic(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class PSRaster : public PostScriptView { public: PSRaster(RasterComp* = nil); virtual bool Definition(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; #endif neuron-7.6.3/src/include/Unidraw/Components/rect.h000066400000000000000000000046301340731477100221250ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Rect component declarations. */ #ifndef unidraw_components_rect_h #define unidraw_components_rect_h #include #include #include #include class SF_Rect; class RectComp : public GraphicComp { public: RectComp(SF_Rect* = nil); SF_Rect* GetRect(); virtual Component* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class RectView : public GraphicView { public: RectView(RectComp* = nil); virtual void Interpret(Command*); virtual void Update(); virtual Manipulator* CreateManipulator(Viewer*, Event&,Transformer*,Tool*); virtual Command* InterpretManipulator(Manipulator*); virtual void GetCorners(Coord*, Coord*); RectComp* GetRectComp(); virtual Graphic* GetGraphic(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: virtual void CreateHandles(); protected: int _reshapeCorner; }; class PSRect : public PostScriptView { public: PSRect(RectComp* = nil); virtual bool Definition(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; #include #endif neuron-7.6.3/src/include/Unidraw/Components/slot.h000066400000000000000000000105711340731477100221520ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Slot component declarations. */ #ifndef unidraw_components_slot_h #define unidraw_components_slot_h #include #include #include #include class SlotGraphic; class SlotComp : public Connector { public: virtual void Interpret(Command*); virtual void Uninterpret(Command*); virtual Mobility GetMobility(); virtual void SetMobility(Mobility); SlotGraphic* GetSlot(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: SlotComp(SlotGraphic* = nil); void SetOrientation(SlotGraphic*, Orientation); protected: Mobility _mobility; }; class SlotView : public ConnectorView { public: virtual void Interpret(Command*); virtual void Update(); virtual Manipulator* CreateManipulator(Viewer*,Event&,Transformer*,Tool*); virtual Command* InterpretManipulator(Manipulator*); SlotComp* GetSlotComp(); virtual Graphic* GetGraphic(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: SlotView(SlotComp* = nil); SlotGraphic* GetSlot(); virtual SlotComp* NewSubject(SlotGraphic*); Manipulator* CreateGraphicCompManip(Viewer*,Event&,Transformer*,Tool*); Manipulator* CreateConnectManip(Viewer*,Event&,Transformer*,Tool*); Command* InterpGraphicCompManip(Manipulator*); Command* InterpConnectManip(Manipulator*); }; class SlotGraphic : public Graphic { public: SlotGraphic(Coord, Coord, Coord, Graphic* = nil); virtual ~SlotGraphic(); virtual void SetBrush(PSBrush*); virtual PSBrush* GetBrush(); void GetOriginal(Coord&, Coord&, Coord&); Orientation GetOrientation(); virtual Graphic* Copy(); protected: virtual void concatGS(Graphic*, Graphic*, Graphic*); virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual void draw(Canvas*, Graphic*); protected: Coord _x, _y, _length; PSBrush* _br; private: friend class SlotComp; void SetOrientation(Orientation); }; class HSlotComp : public SlotComp { public: HSlotComp(SlotGraphic* = nil); virtual void Connect(Connector*, CGlue* = nil); virtual Component* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class HSlotView : public SlotView { public: HSlotView(HSlotComp* = nil); HSlotComp* GetHSlotComp(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: virtual SlotComp* NewSubject(SlotGraphic*); }; class VSlotComp : public SlotComp { public: VSlotComp(SlotGraphic* = nil); virtual void Connect(Connector*, CGlue* = nil); virtual Component* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class VSlotView : public SlotView { public: VSlotView(VSlotComp* = nil); VSlotComp* GetVSlotComp(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: virtual SlotComp* NewSubject(SlotGraphic*); }; class PSSlot : public PostScriptView { public: PSSlot(SlotComp* = nil); virtual bool Definition(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; #include #endif neuron-7.6.3/src/include/Unidraw/Components/spline.h000066400000000000000000000061071340731477100224630ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Spline component declarations. */ #ifndef unidraw_components_spline_h #define unidraw_components_spline_h #include class SFH_OpenBSpline; class SFH_ClosedBSpline; class SplineComp : public VerticesComp { public: SplineComp(SFH_OpenBSpline* = nil); SFH_OpenBSpline* GetSpline(); virtual Component* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class SplineView : public VerticesView { public: SplineView(SplineComp* = nil); virtual Manipulator* CreateManipulator(Viewer*,Event&,Transformer*,Tool*); virtual Command* InterpretManipulator(Manipulator*); SplineComp* GetSplineComp(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: virtual bool VertexChanged(); }; class PSSpline : public PSVertices { public: PSSpline(SplineComp* = nil); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: virtual const char* Name(); }; class ClosedSplineComp : public VerticesComp { public: ClosedSplineComp(SFH_ClosedBSpline* = nil); SFH_ClosedBSpline* GetClosedSpline(); virtual Component* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class ClosedSplineView : public VerticesView { public: ClosedSplineView(ClosedSplineComp* = nil); virtual Manipulator* CreateManipulator(Viewer*,Event&,Transformer*,Tool*); virtual Command* InterpretManipulator(Manipulator*); ClosedSplineComp* GetClosedSplineComp(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: virtual bool VertexChanged(); }; class PSClosedSpline : public PSVertices { public: PSClosedSpline(ClosedSplineComp* = nil); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: virtual const char* Name(); }; #endif neuron-7.6.3/src/include/Unidraw/Components/stencilcomp.h000066400000000000000000000043271340731477100235130ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Stencil component declarations. */ #ifndef unidraw_components_stencilcomp_h #define unidraw_components_stencilcomp_h #include #include #include class UStencil; class StencilComp : public GraphicComp { public: StencilComp(UStencil* = nil, const char* filename = nil); virtual ~StencilComp(); UStencil* GetStencil(); const char* GetFileName(); virtual Component* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); private: char* _filename; }; class StencilView : public GraphicView { public: StencilView(StencilComp* = nil); virtual void Update(); StencilComp* GetStencilComp(); virtual Graphic* GetGraphic(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class PSStencil : public PostScriptView { public: PSStencil(StencilComp* = nil); virtual bool Definition(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; #endif neuron-7.6.3/src/include/Unidraw/Components/text.h000066400000000000000000000064521340731477100221600ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Text component declarations. */ #ifndef unidraw_components_text_h #define unidraw_components_text_h #include #include #include #include #include class TextGraphic; class TextManip; class TextComp : public GraphicComp { public: TextComp(TextGraphic* = nil); virtual void Interpret(Command*); virtual void Uninterpret(Command*); TextGraphic* GetText(); virtual Component* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; class TextView : public GraphicView { public: TextView(TextComp* = nil); virtual void Interpret(Command*); virtual void Update(); virtual Manipulator* CreateManipulator(Viewer*,Event&,Transformer*,Tool*); virtual Command* InterpretManipulator(Manipulator*); TextComp* GetTextComp(); virtual Graphic* GetGraphic(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: virtual bool TextChanged(); }; class TextGraphic : public ULabel { public: TextGraphic(const char*, int h, Graphic* = nil); TextGraphic(const char*, Graphic*); void SetLineHeight(int); int GetLineHeight(); virtual bool operator == (TextGraphic&); virtual bool operator != (TextGraphic&); virtual Graphic* Copy(); protected: virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); private: void CalcBox(Coord&, Coord&, Coord&, Coord&, PSFont*); bool RotatedIntersects(BoxObj&, Graphic*); bool TransformedIntersects(BoxObj&, Graphic*); bool UntransformedIntersects(BoxObj&, Graphic*); protected: int _lineHt; }; class PSText : public PostScriptView { public: PSText(TextComp* = nil); virtual bool Definition(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: const char* Filter(const char*, int); }; #include #endif neuron-7.6.3/src/include/Unidraw/Components/vertices.h000066400000000000000000000046101340731477100230120ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Vertices component declarations. A vertices component's * geometry is defined by a set of vertices. */ #ifndef unidraw_components_vertices_h #define unidraw_components_vertices_h #include #include #include #include class Vertices; class VerticesComp : public GraphicComp { public: Vertices* GetVertices(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: VerticesComp(Vertices* = nil); }; class VerticesView : public GraphicView { public: virtual void Interpret(Command*); virtual void Update(); virtual void GetVertices(Coord*&, Coord*&, int&); VerticesComp* GetVerticesComp(); virtual Graphic* GetGraphic(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: VerticesView(VerticesComp* = nil); virtual void CreateHandles(); virtual bool VertexChanged(); protected: int _reshapePt; }; class PSVertices : public PostScriptView { public: virtual bool Definition(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: PSVertices(VerticesComp* = nil); virtual const char* Name(); }; #include #endif neuron-7.6.3/src/include/Unidraw/Graphic/000077500000000000000000000000001340731477100202445ustar00rootroot00000000000000neuron-7.6.3/src/include/Unidraw/Graphic/damage.h000066400000000000000000000051131340731477100216330ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Damage - maintains an array of non-overlapping rectangles representing * damaged areas of of a canvas, used for smart redraw. */ #ifndef unidraw_graphic_damage_h #define unidraw_graphic_damage_h #include #include #include class BoxObj; class Canvas; class Graphic; class Iterator; class Painter; class UList; class Damage { public: Damage(Canvas* = nil, Painter* = nil, Graphic* = nil); virtual ~Damage(); virtual bool Incurred(); virtual void Added(Graphic*); virtual void Incur(Graphic*); virtual void Incur(BoxObj&); virtual void Incur(Coord, Coord, Coord, Coord); virtual void Repair(); virtual void Reset(); void SetCanvas(Canvas*); void SetPainter(Painter*); void SetGraphic(Graphic*); Canvas* GetCanvas(); Painter* GetPainter(); Graphic* GetGraphic(); protected: int Area(BoxObj&); virtual void DrawAreas(); virtual void DrawAdditions(); virtual void Merge(BoxObj&); BoxObj* GetArea(Iterator); Graphic* GetAddition(Iterator); void FirstArea(Iterator&); void FirstAddition(Iterator&); void Next(Iterator&); bool Done(Iterator); UList* Elem(Iterator); void DeleteArea(BoxObj*); void DeleteAreas(); protected: UList* _additions; UList* _areas; private: Canvas* _canvas; Painter* _output; Graphic* _graphic; }; #include #endif neuron-7.6.3/src/include/Unidraw/Graphic/ellipses.h000066400000000000000000000077351340731477100222510ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Interface to Ellipses and Circles, objects derived from Graphic. */ #ifndef unidraw_graphic_ellipses_h #define unidraw_graphic_ellipses_h #include #include class Ellipse : public Graphic { public: void GetOriginal(Coord&, Coord&, int&, int&); protected: Ellipse(Coord x0, Coord y0, int r1, int r2, Graphic* gr = nil); void s_getExtent(float&, float&, float&, float&, float&, Graphic*); void f_getExtent(float&, float&, float&, float&, float&, Graphic*); bool s_contains(PointObj&, Graphic*); bool f_contains(PointObj&, Graphic*); bool s_intersects(BoxObj&, Graphic*); bool f_intersects(BoxObj&, Graphic*); protected: Coord _x0, _y0; int _r1, _r2; static Coord _x[8], _y[8]; private: void CalcControlPts(Transformer*); }; class S_Ellipse : public Ellipse { public: S_Ellipse(Coord x0, Coord y0, int r1, int r2, Graphic* gr = nil); virtual ~S_Ellipse(); virtual void SetBrush(PSBrush*); virtual PSBrush* GetBrush(); virtual Graphic* Copy(); protected: virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); private: PSBrush* _br; }; class F_Ellipse : public Ellipse { public: F_Ellipse(Coord x0, Coord y0, int r1, int r2, Graphic* gr = nil); virtual ~F_Ellipse(); virtual void SetPattern(PSPattern*); virtual PSPattern* GetPattern(); virtual Graphic* Copy(); protected: virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); private: PSPattern* _pat; }; class SF_Ellipse : public Ellipse { public: SF_Ellipse(Coord x0, Coord y0, int r1, int r2, Graphic* gr = nil); virtual ~SF_Ellipse(); virtual void SetBrush(PSBrush*); virtual PSBrush* GetBrush(); virtual void SetPattern(PSPattern*); virtual PSPattern* GetPattern(); virtual Graphic* Copy(); protected: virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); private: PSBrush* _br; PSPattern* _pat; }; class S_Circle : public S_Ellipse { public: S_Circle(Coord x0, Coord y0, int radius, Graphic* gr = nil); virtual Graphic* Copy(); }; class F_Circle : public F_Ellipse { public: F_Circle(Coord x0, Coord y0, int radius, Graphic* gr = nil); virtual Graphic* Copy(); }; class SF_Circle : public SF_Ellipse { public: SF_Circle(Coord x0, Coord y0, int radius, Graphic* gr = nil); virtual Graphic* Copy(); }; #include #endif neuron-7.6.3/src/include/Unidraw/Graphic/geomobjs.h000066400000000000000000000072751340731477100222350ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Interface to geometrical objects used to implement Graphic primitives. */ #ifndef unidraw_graphic_geomobjs_h #define unidraw_graphic_geomobjs_h #include #include #include class PointObj { public: PointObj(Coord = 0, Coord = 0); PointObj(PointObj*); float Distance(PointObj&); public: Coord _x, _y; }; class LineObj { public: LineObj(Coord = 0, Coord = 0, Coord = 0, Coord = 0); LineObj(LineObj*); bool Contains(PointObj&); int Same(PointObj& p1, PointObj& p2); bool Intersects(LineObj&); public: PointObj _p1, _p2; }; class BoxObj { public: BoxObj(Coord = 0, Coord = 0, Coord = 0, Coord = 0); BoxObj(BoxObj*); bool Contains(PointObj&); bool Intersects(BoxObj&); bool Intersects(LineObj&); BoxObj operator-(BoxObj&); BoxObj operator+(BoxObj&); bool Within(BoxObj&); public: Coord _left, _right; Coord _bottom, _top; }; class MultiLineObj { public: MultiLineObj(Coord* = nil, Coord* = nil, int = 0); void GetBox(BoxObj& b); bool Contains(PointObj&); bool Intersects(LineObj&); bool Intersects(BoxObj&); bool Within(BoxObj&); void SplineToMultiLine(Coord* cpx, Coord* cpy, int cpcount); void ClosedSplineToPolygon(Coord* cpx, Coord* cpy, int cpcount); protected: void GrowBuf(); bool CanApproxWithLine( double x0, double y0, double x2, double y2, double x3, double y3 ); void AddLine(double x0, double y0, double x1, double y1); void AddBezierArc( double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3 ); void CalcSection( Coord cminus1x, Coord cminus1y, Coord cx, Coord cy, Coord cplus1x, Coord cplus1y, Coord cplus2x, Coord cplus2y ); public: Coord* _x, *_y; int _count; }; class FillPolygonObj : public MultiLineObj { public: FillPolygonObj(Coord* = nil, Coord* = nil, int = 0); virtual ~FillPolygonObj(); bool Contains(PointObj&); bool Intersects(LineObj&); bool Intersects(BoxObj&); protected: void Normalize(); protected: Coord* _normx, *_normy; int _normCount; }; class Extent { public: Extent(float = 0, float = 0, float = 0, float = 0, float = 0); Extent(Extent&); bool Undefined(); bool Within(Extent& e); void Merge(Extent&); public: /* defines lower left and center of an object */ float _left, _bottom, _cx, _cy, _tol; }; /* * inlines */ inline bool Extent::Undefined () { return _left == _cx && _bottom == _cy; } #include #endif neuron-7.6.3/src/include/Unidraw/Graphic/graphic.h000066400000000000000000000264651340731477100220470ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Interface to Graphic base class and FullGraphic, a subclass of Graphic * for which all graphics state is defined. */ #ifndef unidraw_graphic_graphic_h #define unidraw_graphic_graphic_h #include #include #include static const int UNDEF = -1; class Canvas; class Iterator; class Painter; class Transformer; class Graphic { public: virtual ~Graphic(); virtual void Draw(Canvas*); virtual void Draw(Canvas*, Coord, Coord, Coord, Coord); virtual void DrawClipped(Canvas*, Coord, Coord, Coord, Coord); virtual void Erase(Canvas*); virtual void Erase(Canvas*, Coord, Coord, Coord, Coord); virtual void EraseClipped(Canvas*, Coord, Coord, Coord, Coord); virtual void FillBg(int); virtual int BgFilled(); virtual void SetColors(PSColor* f, PSColor* b); virtual PSColor* GetFgColor(); virtual PSColor* GetBgColor(); virtual void SetPattern(PSPattern*); virtual PSPattern* GetPattern(); virtual void SetBrush(PSBrush*); virtual PSBrush* GetBrush(); virtual void SetFont(PSFont*); virtual PSFont* GetFont(); void Translate(float dx, float dy); void Scale(float sx, float sy, float ctrx = 0.0, float ctry = 0.0); void Rotate(float angle, float ctrx = 0.0, float ctry = 0.0); void Align(Alignment, Graphic*, Alignment); void SetTransformer(Transformer*); Transformer* GetTransformer(); void TotalTransformation(Transformer&); void GetBounds(float&, float&, float&, float&); void GetBox(Coord&, Coord&, Coord&, Coord&); void GetBox(BoxObj&); virtual void GetCenter(float&, float&); virtual bool Contains(PointObj&); virtual bool Intersects(BoxObj&); void SetTag(void*); void* GetTag(); Graphic* Parent(); virtual void First(Iterator&); virtual void Last(Iterator&); virtual void Next(Iterator&); virtual void Prev(Iterator&); virtual bool Done(Iterator); virtual Graphic* GetGraphic(Iterator); virtual void SetGraphic(Graphic*, Iterator&); virtual void Append(Graphic*, Graphic* =nil, Graphic* =nil, Graphic* =nil); virtual void Prepend(Graphic*,Graphic* =nil, Graphic* =nil, Graphic* =nil); virtual void InsertBefore(Iterator, Graphic*); virtual void InsertAfter(Iterator, Graphic*); virtual void Remove(Graphic*); virtual void Remove(Iterator&); virtual void Bequeath(); virtual Graphic* FirstGraphicContaining(PointObj&); virtual Graphic* LastGraphicContaining(PointObj&); virtual Graphic* FirstGraphicIntersecting(BoxObj&); virtual Graphic* LastGraphicIntersecting(BoxObj&); virtual Graphic* FirstGraphicWithin(BoxObj&); virtual Graphic* LastGraphicWithin(BoxObj&); virtual Graphic& operator = (Graphic&); virtual Graphic* Copy(); protected: Graphic(Graphic* gr = nil); /* * Member functions that declare a "Graphic* gs" parameter * take into account that graphic's graphic state information when * performing their function. This is useful in hierarchical graphic objects * (such as Pictures) where higher-level graphics' graphics state influences * lower (and ultimately leaf) graphics'. */ void update(Graphic* gs); /* updates painter w/gs' state */ virtual void draw(Canvas*, Graphic* gs); virtual void drawClipped(Canvas*, Coord, Coord, Coord, Coord, Graphic* gs); virtual void erase(Canvas*, Graphic* gs); virtual void eraseClipped(Canvas*, Coord, Coord, Coord, Coord,Graphic* gs); /* * Bounding box operations. */ virtual void getExtent(float&, float&, float&, float&, float&,Graphic* gs); /* Returns lower-left and center coordinates, and a tolerance (tol) * (in canvas coordinates) by which the final extent will be grown * in each direction (i.e. l-=tol, b-=tol, r+=tol, t+=tol). */ void GetExtent(Extent& e); void getBounds(float&, float&, float&, float&, Graphic* gs); void getBox(Coord&, Coord&, Coord&, Coord&, Graphic* gs); void getBox(BoxObj&, Graphic* gs); virtual bool contains(PointObj&, Graphic* gs); virtual bool intersects(BoxObj&, Graphic* gs); /* * Parent-related operations. */ Graphic* getRoot(); /* top level parent */ void totalGS(Graphic& p); void parentXform(Transformer& t); /* parents' transformation */ void setParent(Graphic*, Graphic* parent); void unsetParent(Graphic*); /* * Bounding box caching operations. */ void cachingOn(); void cachingOff(); virtual bool extentCached(); virtual void uncacheExtent(); virtual void uncacheParents(); virtual void uncacheChildren(); virtual void invalidateCaches(); /* * Graphics state concatentation operations. */ virtual void concatGS(Graphic* a, Graphic* b, Graphic* dest); virtual void concatTransformer( Transformer* a, Transformer* b, Transformer* dest ); virtual void concat(Graphic* a, Graphic* b, Graphic* dest); /* * Convenient transformations that check first if there's a transformer and * then perform the (inverse) transformation. The functions use the * transformer of the supplied Graphic if there is one; otherwise this' * transformer is used. */ void transform(Coord& x, Coord& y, Graphic* = nil); void transform(Coord x, Coord y, Coord& tx, Coord& ty, Graphic* = nil); void transform(float x, float y, float& tx, float& ty, Graphic* = nil); void transformList( Coord x[], Coord y[], int n, Coord tx[], Coord ty[], Graphic* = nil ); void transformRect( float, float, float, float, float&, float&, float&, float&, Graphic* = nil ); void invTransform(Coord& tx, Coord& ty, Graphic* = nil); void invTransform(Coord tx, Coord ty, Coord& x, Coord& y, Graphic* = nil); void invTransform(float tx, float ty, float& x, float& y, Graphic* = nil); void invTransformList( Coord tx[], Coord ty[], int n, Coord x[], Coord y[], Graphic* = nil ); void invTransformRect( float, float, float, float, float&, float&, float&, float&, Graphic* = nil ); /* * "Helper" functions that allow graphic subclasses to call * the protected member functions redefined by other graphic subclasses. */ void drawGraphic(Graphic*, Canvas*, Graphic*); void drawClippedGraphic(Graphic*,Canvas*,Coord,Coord,Coord,Coord,Graphic*); void eraseGraphic(Graphic*, Canvas*, Graphic*); void eraseClippedGraphic( Graphic*, Canvas*, Coord, Coord, Coord, Coord, Graphic* ); void getExtentGraphic( Graphic*, float&, float&, float&, float&, float&, Graphic* gs ); bool containsGraphic(Graphic*, PointObj&, Graphic* gs); bool intersectsGraphic(Graphic*, BoxObj&, Graphic* gs); bool extentCachedGraphic(Graphic*); void uncacheExtentGraphic(Graphic*); void uncacheParentsGraphic(Graphic*); void uncacheChildrenGraphic(Graphic*); void invalidateCachesGraphic(Graphic*); void concatGSGraphic(Graphic*, Graphic*, Graphic*, Graphic*); void concatTransformerGraphic( Graphic*,Transformer*, Transformer*, Transformer* ); void concatGraphic(Graphic*, Graphic*, Graphic*, Graphic*); protected: static Transformer* _identity; /* identity matrix */ static bool _caching; /* state of bounding box caching */ static Painter* _p; static BoxObj* _clipping; /* current painter clipping, if any */ Graphic* _parent; int _fillBg; PSColor* _fg; PSColor* _bg; void* _tag; Transformer* _t; }; class FullGraphic : public Graphic { public: FullGraphic(Graphic* = nil); virtual ~FullGraphic(); virtual void SetPattern(PSPattern*); virtual PSPattern* GetPattern(); virtual void SetBrush(PSBrush*); virtual PSBrush* GetBrush(); virtual void SetFont(PSFont*); virtual PSFont* GetFont(); virtual Graphic* Copy(); private: PSPattern* _pat; PSBrush* _br; PSFont* _font; }; /* * inlines */ inline Transformer* Graphic::GetTransformer () { return _t; } inline Graphic* Graphic::Parent () { return _parent; } inline void Graphic::SetTag (void* tag) { _tag = tag; } inline void* Graphic::GetTag () { return _tag; } inline void Graphic::GetBox (BoxObj& b) { GetBox(b._left, b._bottom, b._right, b._top); } inline void Graphic::getBox (BoxObj& b, Graphic* p) { getBox(b._left, b._bottom, b._right, b._top, p); } inline void Graphic::getBounds ( float& l, float& b, float& r, float& t, Graphic* gs ) { float tol; getExtent(l, b, r, t, tol, gs); r += r - l; t += t - b; l -= tol; b -= tol; r += tol; t += tol; } inline void Graphic::drawGraphic (Graphic* g, Canvas* c, Graphic* gs) { g->draw(c, gs); } inline void Graphic::eraseGraphic (Graphic* g, Canvas* c, Graphic* gs) { g->erase(c, gs); } inline void Graphic::drawClippedGraphic ( Graphic* g, Canvas* c, Coord l, Coord b, Coord r, Coord t, Graphic* gs ) { g->drawClipped(c, l, b, r, t, gs); } inline void Graphic::eraseClippedGraphic ( Graphic* g, Canvas* c, Coord l, Coord b, Coord r, Coord t, Graphic* gs ) { g->eraseClipped(c, l, b, r, t, gs); } inline void Graphic::getExtentGraphic ( Graphic* g, float& l, float& b, float& r, float& t, float& tol, Graphic* gs ) { g->getExtent(l, b, r, t, tol, gs); } inline bool Graphic::containsGraphic (Graphic* g, PointObj& p, Graphic* gs){ return g->contains(p, gs); } inline bool Graphic::intersectsGraphic (Graphic* g, BoxObj& b, Graphic* gs){ return g->intersects(b, gs); } inline bool Graphic::extentCachedGraphic (Graphic* g) { return g->extentCached(); } inline void Graphic::uncacheExtentGraphic (Graphic* g) { g->uncacheExtent(); } inline void Graphic::uncacheParentsGraphic (Graphic* g) { g->uncacheParents();} inline void Graphic::uncacheChildrenGraphic (Graphic* g) { g->uncacheChildren(); } inline void Graphic::invalidateCachesGraphic (Graphic* g) { g->invalidateCaches(); } inline void Graphic::concatGSGraphic ( Graphic* g, Graphic* a, Graphic* b, Graphic* d ) { g->concatGS(a, b, d); } inline void Graphic::concatTransformerGraphic ( Graphic* g, Transformer* a, Transformer* b, Transformer* dest ) { g->concatTransformer(a, b, dest); } inline void Graphic::concatGraphic ( Graphic* g, Graphic* a, Graphic* b, Graphic* d ) { g->concat(a, b, d); } #include #endif neuron-7.6.3/src/include/Unidraw/Graphic/grblock.h000066400000000000000000000057051340731477100220470ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * GraphicBlock - an interactor that contains a picture. */ #ifndef unidraw_graphic_grblock_h #define unidraw_graphic_grblock_h #include #include #include enum Zooming { Continuous, Binary }; class Graphic; class Perspective; class GraphicBlock : public Interactor { public: GraphicBlock( Graphic*, Coord pad = 0, Alignment = Center, Zooming = Continuous ); GraphicBlock( const char*, Graphic*, Coord pad = 0, Alignment = Center, Zooming = Continuous ); virtual ~GraphicBlock(); virtual void Update(); virtual void Draw(); virtual void Adjust(Perspective&); virtual void Highlight(bool); virtual Graphic* GetGraphic(); virtual float GetMagnification(); virtual void SetGraphic(Graphic*); virtual void SetMagnification(float); protected: virtual void Resize(); virtual void Redraw(Coord, Coord, Coord, Coord); void Init(); void UpdatePerspective(); /* recalc based on graphic's bbox */ void GrabScroll(Event&); void RateScroll(Event&); virtual void GetGraphicBox(Coord&, Coord&, Coord&, Coord&); virtual void Zoom(Perspective&); virtual void Scroll(Perspective&); virtual float LimitMagnification(float); protected: Graphic* _graphic; private: void Normalize(Perspective&); /* normalize units */ void Align(); /* align graphic */ void Fix(); /* keep alignment fixed during resize */ float NearestPow2(float); /* convert to nearest power of 2 */ float ScaleFactor(Perspective&); private: Coord _pad; Alignment _align; Zooming _zooming; Coord _x0, _y0; /* graphic offset */ float _mag; /* total magnification */ bool _highlighted; }; #include #endif neuron-7.6.3/src/include/Unidraw/Graphic/lines.h000066400000000000000000000075011340731477100215320ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Interface to Points, Lines, and MultiLines, objects derived from Graphic. */ #ifndef unidraw_graphic_lines_h #define unidraw_graphic_lines_h #include #include class Point : public Graphic { public: Point(Coord x, Coord y, Graphic* gr = nil); virtual ~Point(); void GetOriginal(Coord&, Coord&); virtual void SetBrush(PSBrush*); virtual PSBrush* GetBrush(); virtual Graphic* Copy(); protected: virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); protected: Coord _x, _y; PSBrush* _br; }; class Line : public Graphic { public: Line(Coord x0, Coord y0, Coord x1, Coord y1, Graphic* gr = nil); virtual ~Line(); void GetOriginal(Coord& x0, Coord& y0, Coord& x1, Coord& y1); virtual void SetBrush(PSBrush*); virtual PSBrush* GetBrush(); virtual Graphic* Copy(); protected: virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); protected: Coord _x0, _y0, _x1, _y1; PSBrush* _br; }; class MultiLine : public Vertices { protected: MultiLine(Coord* x, Coord* y, int count, Graphic* gr = nil) ; bool s_contains(PointObj&, Graphic*); bool f_contains(PointObj&, Graphic*); bool s_intersects(BoxObj&, Graphic*); bool f_intersects(BoxObj&, Graphic*); }; class S_MultiLine : public MultiLine { public: S_MultiLine(Coord* x, Coord* y, int count, Graphic* gr = nil); virtual ~S_MultiLine(); virtual void SetBrush(PSBrush*); virtual PSBrush* GetBrush(); virtual Graphic* Copy(); protected: virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); void virtual draw(Canvas*, Graphic*); protected: PSBrush* _br; }; class SF_MultiLine : public MultiLine { public: SF_MultiLine(Coord* x, Coord* y, int count, Graphic* = nil); virtual ~SF_MultiLine(); virtual void SetBrush(PSBrush*); virtual PSBrush* GetBrush(); virtual void SetPattern(PSPattern*); virtual PSPattern* GetPattern(); virtual Graphic* Copy(); protected: virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); private: PSBrush* _br; PSPattern* _pat; }; #include #endif neuron-7.6.3/src/include/Unidraw/Graphic/picture.h000066400000000000000000000061471340731477100221000ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Interface to Picture, a composite of one or more Graphics. */ #ifndef unidraw_graphic_picture_h #define unidraw_graphic_picture_h #include #include class UList; class Picture : public FullGraphic { public: Picture(Graphic* gr = nil); virtual ~Picture(); virtual void First(Iterator&); virtual void Last(Iterator&); virtual void Next(Iterator&); virtual void Prev(Iterator&); virtual bool Done(Iterator); bool IsEmpty(); virtual Graphic* GetGraphic(Iterator); virtual void SetGraphic(Graphic*, Iterator&); virtual void Append(Graphic*, Graphic* =nil, Graphic* =nil, Graphic* =nil); virtual void Prepend(Graphic*,Graphic* =nil, Graphic* =nil, Graphic* =nil); virtual void InsertBefore(Iterator, Graphic*); virtual void InsertAfter(Iterator, Graphic*); virtual void Remove(Graphic*); virtual void Remove(Iterator&); virtual void Bequeath(); virtual Graphic* FirstGraphicContaining(PointObj&); virtual Graphic* LastGraphicContaining(PointObj&); virtual Graphic* FirstGraphicIntersecting(BoxObj&); virtual Graphic* LastGraphicIntersecting(BoxObj&); virtual Graphic* FirstGraphicWithin(BoxObj&); virtual Graphic* LastGraphicWithin(BoxObj&); virtual Graphic* Copy(); protected: Graphic* graphic(UList*); UList* Elem(Iterator); virtual void draw(Canvas*, Graphic*); virtual void drawClipped(Canvas*, Coord, Coord, Coord, Coord, Graphic*); virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); void getCachedExtent(float&, float&, float&, float&, float&); virtual bool extentCached(); virtual void cacheExtent(float, float, float, float, float); virtual void uncacheExtent(); virtual void uncacheChildren(); protected: UList* _kids; private: Extent* _extent; }; #include #endif neuron-7.6.3/src/include/Unidraw/Graphic/polygons.h000066400000000000000000000123651340731477100222760ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Interface to Rects and Polygons, objects derived from Graphic. */ #ifndef unidraw_graphic_polygons_h #define unidraw_graphic_polygons_h #include #include class Rect : public Graphic { public: void GetOriginal(Coord&, Coord&, Coord&, Coord&); protected: Rect(Coord x0, Coord y0, Coord x1, Coord y1, Graphic* = nil); void s_getExtent(float&, float&, float&, float&, float&, Graphic*); void f_getExtent(float&, float&, float&, float&, float&, Graphic*); bool s_contains(PointObj&, Graphic*); bool f_contains(PointObj&, Graphic*); bool s_intersects(BoxObj&, Graphic*); bool f_intersects(BoxObj&, Graphic*); protected: Coord _x0, _y0, _x1, _y1; }; class S_Rect : public Rect { public: S_Rect(Coord x0, Coord y0, Coord x1, Coord y1, Graphic* = nil); virtual ~S_Rect(); virtual void SetBrush(PSBrush*); virtual PSBrush* GetBrush(); virtual Graphic* Copy(); protected: virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); private: PSBrush* _br; }; class F_Rect : public Rect { public: F_Rect(Coord x0, Coord y0, Coord x1, Coord y1, Graphic* = nil); virtual ~F_Rect(); virtual void SetPattern(PSPattern*); virtual PSPattern* GetPattern(); virtual Graphic* Copy(); protected: virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); private: PSPattern* _pat; }; class SF_Rect : public Rect { public: SF_Rect(Coord x0, Coord y0, Coord x1, Coord y1, Graphic* = nil); virtual ~SF_Rect(); virtual void SetBrush(PSBrush*); virtual PSBrush* GetBrush(); virtual void SetPattern(PSPattern*); virtual PSPattern* GetPattern(); virtual Graphic* Copy(); protected: virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); private: PSBrush* _br; PSPattern* _pat; }; class Polygon : public Vertices { protected: Polygon(Coord* x, Coord* y, int count, Graphic* gr = nil) ; bool s_contains(PointObj&, Graphic*); bool f_contains(PointObj&, Graphic*); bool s_intersects(BoxObj&, Graphic*); bool f_intersects(BoxObj&, Graphic*); }; class S_Polygon : public Polygon { public: S_Polygon(Coord* x, Coord* y, int count, Graphic* = nil); virtual ~S_Polygon(); virtual void SetBrush(PSBrush*); virtual PSBrush* GetBrush(); virtual Graphic* Copy(); protected: virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); private: PSBrush* _br; }; class F_Polygon : public Polygon { public: F_Polygon(Coord* x, Coord* y, int count, Graphic* = nil); virtual ~F_Polygon(); virtual void SetPattern(PSPattern*); virtual PSPattern* GetPattern(); virtual Graphic* Copy(); protected: virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); private: PSPattern* _pat; }; class SF_Polygon : public Polygon { public: SF_Polygon(Coord* x, Coord* y, int count, Graphic* = nil); virtual ~SF_Polygon(); virtual void SetBrush(PSBrush*); virtual PSBrush* GetBrush(); virtual void SetPattern(PSPattern*); virtual PSPattern* GetPattern(); virtual Graphic* Copy(); protected: virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); private: PSBrush* _br; PSPattern* _pat; }; #include #endif neuron-7.6.3/src/include/Unidraw/Graphic/pspaint.h000066400000000000000000000103351340731477100220750ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Persistent paint subclasses that incorporate additional information * needed to generate idraw-compatible PostScript. */ #ifndef unidraw_graphic_pspaint_h #define unidraw_graphic_pspaint_h #include #include #include static const int patternWidth = 16; static const int patternHeight = 16; class PSBrush : public Brush { public: PSBrush(); PSBrush(int, int); int GetLinePattern(); int Width(); bool None(); const int* GetDashPattern(); int GetDashPatternSize(); int GetDashOffset(); protected: void CalcDashPat(int); private: bool _none; int _linepat; int _dashpat[patternWidth]; // stores dash pattern int _dashpatsize; // stores number of defined elements in dashpat int _dashoffset; // stores dash pattern's offset }; inline bool PSBrush::None () { return _none; } inline int PSBrush::GetLinePattern () { return _linepat; } inline const int* PSBrush::GetDashPattern () { return _dashpat; } inline int PSBrush::GetDashPatternSize () { return _dashpatsize; } inline int PSBrush::GetDashOffset () { return _dashoffset; } class PSColor : public Color { public: PSColor(ColorIntensity, ColorIntensity, ColorIntensity, const char*); virtual ~PSColor(); const char* GetName(); void GetIntensities(ColorIntensity&, ColorIntensity&, ColorIntensity&); private: char* _name; // stores name passed into constructor ColorIntensity _r, _g, _b; // stores intensities passed to ctor }; inline const char* PSColor::GetName () { return _name; } class PSFont : public Font { public: PSFont(const char*, const char*, const char*); virtual ~PSFont(); const char* GetName(); const char* GetPrintFont(); const char* GetPrintSize(); const char* GetPrintFontAndSize(); int GetLineHt(); private: char* _name; // name used by window system char* _printfont; // name used by printer char* _printsize; // scale used by printer char* _printfontandsize; // name and size separated by a blank int _lineHt; // printsize converted to int }; inline const char* PSFont::GetName () { return _name ? _name : "fixed"; } inline const char* PSFont::GetPrintFont () { return _printfont; } inline const char* PSFont::GetPrintSize () { return _printsize; } inline const char* PSFont::GetPrintFontAndSize () { return _printfontandsize; } inline int PSFont::GetLineHt () { return _lineHt; } class PSPattern : public Pattern { public: PSPattern(); PSPattern(int, float); PSPattern(const int* pattern, int); bool None(); float GetGrayLevel(); const int* GetData(); int GetSize(); private: bool _none; int _data[patternHeight]; float _graylevel; // stores gray level for grayscale patterns int _size; // stores pat's orig size (4x4, 8x8, or 16x16) }; inline bool PSPattern::None () { return _none; } inline float PSPattern::GetGrayLevel () { return _graylevel; } inline const int* PSPattern::GetData () { return _data; } inline int PSPattern::GetSize () { return _size; } #include #endif neuron-7.6.3/src/include/Unidraw/Graphic/rasterrect.h000066400000000000000000000035631340731477100226020ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Interface to RasterRect, an object derived from Graphic. */ #ifndef unidraw_graphic_rasterrect_h #define unidraw_graphic_rasterrect_h #include #include class Raster; class RasterRect : public Graphic { public: RasterRect(Raster*, Graphic* = nil); virtual ~RasterRect(); Raster* GetOriginal(); virtual Graphic* Copy(); protected: virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); private: Raster* _raster; }; inline Raster* RasterRect::GetOriginal () { return _raster; } #include #endif neuron-7.6.3/src/include/Unidraw/Graphic/splines.h000066400000000000000000000133511340731477100220750ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Interface to BSplines, objects derived from Graphic. */ #ifndef unidraw_graphic_splines_h #define unidraw_graphic_splines_h #include #include class OpenBSpline : public Vertices { public: virtual int GetOriginal(const Coord*&, const Coord*&); protected: OpenBSpline(Coord* x, Coord* y, int count, Graphic* gr = nil) ; bool s_contains(PointObj&, Graphic*); bool f_contains(PointObj&, Graphic*); bool s_intersects(BoxObj&, Graphic*); bool f_intersects(BoxObj&, Graphic*); }; class S_OpenBSpline : public OpenBSpline { public: S_OpenBSpline(Coord* x, Coord* y, int count, Graphic* gr =nil); virtual ~S_OpenBSpline(); virtual void SetBrush(PSBrush*); virtual PSBrush* GetBrush(); virtual Graphic* Copy(); protected: virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); private: PSBrush* _br; }; class F_OpenBSpline : public OpenBSpline { public: F_OpenBSpline(Coord* x, Coord* y, int count, Graphic* = nil); virtual ~F_OpenBSpline(); virtual void SetPattern(PSPattern*); virtual PSPattern* GetPattern(); virtual Graphic* Copy(); protected: virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); private: PSPattern* _pat; }; class SF_OpenBSpline : public OpenBSpline { public: SF_OpenBSpline(Coord* x, Coord* y, int count, Graphic* = nil); virtual ~SF_OpenBSpline(); virtual void SetBrush(PSBrush*); virtual PSBrush* GetBrush(); virtual void SetPattern(PSPattern*); virtual PSPattern* GetPattern(); virtual Graphic* Copy(); protected: virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); private: PSBrush* _br; PSPattern* _pat; }; class SFH_OpenBSpline : public SF_OpenBSpline { public: SFH_OpenBSpline(Coord* x, Coord* y, int count, Graphic* = nil); virtual Graphic* Copy(); protected: virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); }; class ClosedBSpline : public Vertices { protected: ClosedBSpline(Coord* x, Coord* y, int count, Graphic* gr = nil) ; bool s_contains(PointObj&, Graphic*); bool f_contains(PointObj&, Graphic*); bool s_intersects(BoxObj&, Graphic*); bool f_intersects(BoxObj&, Graphic*); }; class S_ClosedBSpline : public ClosedBSpline { public: S_ClosedBSpline(Coord* x, Coord* y, int count, Graphic* gr =nil); virtual ~S_ClosedBSpline(); virtual void SetBrush(PSBrush*); virtual PSBrush* GetBrush(); virtual Graphic* Copy(); protected: virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); private: PSBrush* _br; }; class F_ClosedBSpline : public ClosedBSpline { public: F_ClosedBSpline(Coord* x, Coord* y, int count, Graphic* gr =nil); virtual ~F_ClosedBSpline(); virtual void SetPattern(PSPattern*); virtual PSPattern* GetPattern(); virtual Graphic* Copy(); protected: virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); private: PSPattern* _pat; }; class SF_ClosedBSpline : public ClosedBSpline { public: SF_ClosedBSpline(Coord* x, Coord* y, int count, Graphic* = nil); virtual ~SF_ClosedBSpline(); virtual void SetBrush(PSBrush*); virtual PSBrush* GetBrush(); virtual void SetPattern(PSPattern*); virtual PSPattern* GetPattern(); virtual Graphic* Copy(); protected: virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); private: PSBrush* _br; PSPattern* _pat; }; class SFH_ClosedBSpline : public SF_ClosedBSpline { public: SFH_ClosedBSpline(Coord* x, Coord* y, int count, Graphic* = nil); virtual Graphic* Copy(); protected: virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); }; #include #endif neuron-7.6.3/src/include/Unidraw/Graphic/ulabel.h000066400000000000000000000040771340731477100216710ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Interface to ULabel, an object derived from Graphic. */ #ifndef unidraw_graphic_ulabel_h #define unidraw_graphic_ulabel_h #include #include class ULabel : public Graphic { public: ULabel(const char*, Graphic* = nil); virtual ~ULabel(); const char* GetOriginal(); virtual void SetFont(PSFont*); virtual PSFont* GetFont(); virtual PSPattern* GetPattern(); // diallows patterned text // to work around IV botch virtual Graphic* Copy(); protected: virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); protected: char* _string; PSFont* _font; }; inline const char* ULabel::GetOriginal () { return _string; } #include #endif neuron-7.6.3/src/include/Unidraw/Graphic/ustencil.h000066400000000000000000000037761340731477100222600ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Interface to UStencil, an object derived from Graphic. */ #ifndef unidraw_graphic_ustencil_h #define unidraw_graphic_ustencil_h #include #include class Bitmap; class UStencil : public Graphic { public: UStencil(Bitmap* image, Bitmap* mask = nil, Graphic* = nil); virtual ~UStencil(); void GetOriginal(Bitmap*&, Bitmap*&); virtual PSPattern* GetPattern(); // disallows patterned bitmaps // to work around IV botch virtual Graphic* Copy(); protected: virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual bool contains(PointObj&, Graphic*); virtual bool intersects(BoxObj&, Graphic*); virtual void draw(Canvas*, Graphic*); protected: Bitmap* _image; Bitmap* _mask; }; #include #endif neuron-7.6.3/src/include/Unidraw/Graphic/util.h000077500000000000000000000050631340731477100214010ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Various useful types and functions. */ #ifndef unidraw_graphic_util_h #define unidraw_graphic_util_h #include #include #include #include #include inline void exch (int& a, int& b) { int temp = a; a = b; b = temp; } inline int square(int a) { return a *= a; } inline float square(float a) { return a *= a; } inline float degrees(float rad) { return rad * 180.0 / M_PI; } inline float radians(float deg) { return deg * M_PI / 180.0; } inline float Distance(Coord x0, Coord y0, Coord x1, Coord y1) { return sqrt(float(square(x0 - x1) + square(y0 - y1))); } inline void ArrayCopy ( const Coord* x, const Coord* y, int n, Coord* newx, Coord* newy ) { Memory::copy(x, newx, n * sizeof(Coord)); Memory::copy(y, newy, n * sizeof(Coord)); } inline void ArrayDup ( const Coord* x, const Coord* y, int n, Coord*& newx, Coord*& newy ) { newx = new Coord[n]; newy = new Coord[n]; Memory::copy(x, newx, n * sizeof(Coord)); Memory::copy(y, newy, n * sizeof(Coord)); } inline void Midpoint ( double x0, double y0, double x1, double y1, double& mx, double& my ) { mx = (x0 + x1) / 2.0; my = (y0 + y1) / 2.0; } inline void ThirdPoint ( double x0, double y0, double x1, double y1, double& tx, double& ty ) { tx = (2*x0 + x1) / 3.0; ty = (2*y0 + y1) / 3.0; } #include #endif neuron-7.6.3/src/include/Unidraw/Graphic/verts.h000066400000000000000000000042251340731477100215630ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Vertices is a base class for graphics that are characterized by a set * of vertices. */ #ifndef unidraw_graphic_verts_h #define unidraw_graphic_verts_h #include #include class Vertices : public Graphic { public: virtual ~Vertices(); virtual int GetOriginal(const Coord*&, const Coord*&); virtual bool operator == (const Vertices&)const; virtual bool operator != (const Vertices&)const; virtual Graphic* Copy(); protected: Vertices(Graphic* gr = nil); Vertices(Coord* x, Coord* y, int count, Graphic* gr = nil); virtual bool extentCached(); void cacheExtent(float, float, float, float, float); virtual void uncacheExtent(); void getCachedExtent(float&, float&, float&, float&, float&); void s_getExtent(float&, float&, float&, float&, float&, Graphic*); void f_getExtent(float&, float&, float&, float&, float&, Graphic*); protected: Coord* _x, *_y; int _count; Extent* _extent; }; #include #endif neuron-7.6.3/src/include/Unidraw/Tools/000077500000000000000000000000001340731477100177675ustar00rootroot00000000000000neuron-7.6.3/src/include/Unidraw/Tools/connect.h000066400000000000000000000032051340731477100215710ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Connect tool declarations. */ #ifndef unidraw_tools_connect_h #define unidraw_tools_connect_h #include class ConnectorView; class ConnectTool : public Tool { public: ConnectTool(ControlInfo* = nil); virtual Manipulator* CreateManipulator(Viewer*, Event&, Transformer* =nil); virtual Command* InterpretManipulator(Manipulator*); virtual Tool* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); private: ConnectorView* _source; }; #endif neuron-7.6.3/src/include/Unidraw/Tools/grcomptool.h000066400000000000000000000037741340731477100223400ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Graphic component tool declarations. */ #ifndef unidraw_tools_grcomptool_h #define unidraw_tools_grcomptool_h #include class Command; class GraphicComp; class GraphicView; class GraphicCompTool : public Tool { public: GraphicCompTool(); GraphicCompTool(ControlInfo*, GraphicComp* prototype); virtual ~GraphicCompTool(); virtual Manipulator* CreateManipulator(Viewer*, Event&, Transformer* =nil); virtual Command* InterpretManipulator(Manipulator*); GraphicComp* GetPrototype(); virtual Tool* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); private: void Init(GraphicComp*); private: GraphicComp* _prototype; GraphicView* _protoview; }; inline GraphicComp* GraphicCompTool::GetPrototype () { return _prototype; } #endif neuron-7.6.3/src/include/Unidraw/Tools/magnify.h000066400000000000000000000031121340731477100215670ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Magnify tool declarations. */ #ifndef unidraw_tools_magnify_h #define unidraw_tools_magnify_h #include class MagnifyTool : public Tool { public: MagnifyTool(ControlInfo* = nil); virtual Manipulator* CreateManipulator(Viewer*, Event&, Transformer* =nil); virtual Command* InterpretManipulator(Manipulator*); virtual Tool* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; #endif neuron-7.6.3/src/include/Unidraw/Tools/move.h000066400000000000000000000030731340731477100211110ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Move tool declarations. */ #ifndef unidraw_tools_move_h #define unidraw_tools_move_h #include class MoveTool : public Tool { public: MoveTool(ControlInfo* = nil); virtual Manipulator* CreateManipulator(Viewer*, Event&, Transformer* =nil); virtual Command* InterpretManipulator(Manipulator*); virtual Tool* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; #endif neuron-7.6.3/src/include/Unidraw/Tools/reshape.h000066400000000000000000000031121340731477100215640ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Reshape tool declarations. */ #ifndef unidraw_tools_reshape_h #define unidraw_tools_reshape_h #include class ReshapeTool : public Tool { public: ReshapeTool(ControlInfo* = nil); virtual Manipulator* CreateManipulator(Viewer*, Event&, Transformer* =nil); virtual Command* InterpretManipulator(Manipulator*); virtual Tool* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; #endif neuron-7.6.3/src/include/Unidraw/Tools/rotate.h000066400000000000000000000031051340731477100214350ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Rotate tool declarations. */ #ifndef unidraw_tools_rotate_h #define unidraw_tools_rotate_h #include class RotateTool : public Tool { public: RotateTool(ControlInfo* = nil); virtual Manipulator* CreateManipulator(Viewer*, Event&, Transformer* =nil); virtual Command* InterpretManipulator(Manipulator*); virtual Tool* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; #endif neuron-7.6.3/src/include/Unidraw/Tools/scale.h000066400000000000000000000031001340731477100212210ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Scale tool declarations. */ #ifndef unidraw_tools_scale_h #define unidraw_tools_scale_h #include class ScaleTool : public Tool { public: ScaleTool(ControlInfo* = nil); virtual Manipulator* CreateManipulator(Viewer*, Event&, Transformer* =nil); virtual Command* InterpretManipulator(Manipulator*); virtual Tool* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; #endif neuron-7.6.3/src/include/Unidraw/Tools/select.h000066400000000000000000000032221340731477100214160ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Select tool declarations. */ #ifndef unidraw_tools_select_h #define unidraw_tools_select_h #include class Selection; class SelectTool : public Tool { public: SelectTool(ControlInfo* = nil); virtual Manipulator* CreateManipulator(Viewer*, Event&, Transformer* =nil); virtual Command* InterpretManipulator(Manipulator*); virtual Tool* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: virtual void Localize(Selection*, Viewer*); }; #endif neuron-7.6.3/src/include/Unidraw/Tools/stretch.h000066400000000000000000000031121340731477100216110ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Stretch tool declarations. */ #ifndef unidraw_tools_stretch_h #define unidraw_tools_stretch_h #include class StretchTool : public Tool { public: StretchTool(ControlInfo* = nil); virtual Manipulator* CreateManipulator(Viewer*, Event&, Transformer* =nil); virtual Command* InterpretManipulator(Manipulator*); virtual Tool* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; #endif neuron-7.6.3/src/include/Unidraw/Tools/tool.h000066400000000000000000000037631340731477100211260ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Tool - supports direct manipulation of components. */ #ifndef unidraw_tools_tool_h #define unidraw_tools_tool_h #include class Command; class ControlInfo; class Viewer; class Event; class Manipulator; class Transformer; #include class Tool { public: virtual Manipulator* CreateManipulator(Viewer*, Event&, Transformer* =nil); virtual Command* InterpretManipulator(Manipulator*); virtual void SetControlInfo(ControlInfo*); virtual ControlInfo* GetControlInfo(); virtual ~Tool(); virtual Tool* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual ClassId GetSubstId(const char*& delim); virtual bool IsA(ClassId); protected: Tool(ControlInfo* = nil); ControlInfo* CopyControlInfo(); private: ControlInfo* _ctrlInfo; }; #endif neuron-7.6.3/src/include/Unidraw/_defines.h000077500000000000000000000236021340731477100206220ustar00rootroot00000000000000#define ClassId _lib_iv(ClassId) #define Orientation _lib_iv(Orientation) #define Zooming _lib_iv(Zooming) #define AcknowledgeDialog _lib_iv(AcknowledgeDialog) #define AlignCmd _lib_iv(AlignCmd) #define AlignToGridCmd _lib_iv(AlignToGridCmd) #define BackCmd _lib_iv(BackCmd) #define BasicDialog _lib_iv(BasicDialog) #define BoxObj _lib_iv(BoxObj) #define BrushCmd _lib_iv(BrushCmd) #define BrushVar _lib_iv(BrushVar) #define BrushVarView _lib_iv(BrushVarView) #define CCnxn _lib_iv(CCnxn) #define CCnxn_HashTable _lib_iv(CCnxn_HashTable) #define CGlue _lib_iv(CGlue) #define CNet _lib_iv(CNet) #define CSolver _lib_iv(CSolver) #define CSolverInfo _lib_iv(CSolverInfo) #define CSolverState _lib_iv(CSolverState) #define Catalog _lib_iv(Catalog) #define CatalogChooser _lib_iv(CatalogChooser) #define CenterCmd _lib_iv(CenterCmd) #define Clipboard _lib_iv(Clipboard) #define CloseEditorCmd _lib_iv(CloseEditorCmd) #define ClosedBSpline _lib_iv(ClosedBSpline) #define ClosedSplineComp _lib_iv(ClosedSplineComp) #define ClosedSplineView _lib_iv(ClosedSplineView) #define ColorCmd _lib_iv(ColorCmd) #define ColorData _lib_iv(ColorData) #define ColorVar _lib_iv(ColorVar) #define Command _lib_iv(Command) #define CommandControl _lib_iv(CommandControl) #define CommandInteractor _lib_iv(CommandInteractor) #define CompNameVar _lib_iv(CompNameVar) #define CompNameVarView _lib_iv(CompNameVarView) #define Component _lib_iv(Component) #define ComponentView _lib_iv(ComponentView) #define ConfirmDialog _lib_iv(ConfirmDialog) #define ConnInfo _lib_iv(ConnInfo) #define ConnectCmd _lib_iv(ConnectCmd) #define ConnectManip _lib_iv(ConnectManip) #define ConnectTool _lib_iv(ConnectTool) #define Connector _lib_iv(Connector) #define ConnectorView _lib_iv(ConnectorView) #define ControlInfo _lib_iv(ControlInfo) #define CopyCmd _lib_iv(CopyCmd) #define Creator _lib_iv(Creator) #define CutCmd _lib_iv(CutCmd) #define Damage _lib_iv(Damage) #define Data _lib_iv(Data) #define DataCache _lib_iv(DataCache) #define DeleteCmd _lib_iv(DeleteCmd) #define DragManip _lib_iv(DragManip) #define DupCmd _lib_iv(DupCmd) #define Editor _lib_iv(Editor) #define EditorImpl _lib_iv(EditorImpl) #define EditorInfo _lib_iv(EditorInfo) #define Ellipse _lib_iv(Ellipse) #define EllipseComp _lib_iv(EllipseComp) #define EllipseView _lib_iv(EllipseView) #define Extent _lib_iv(Extent) #define ExternView _lib_iv(ExternView) #define F_Circle _lib_iv(F_Circle) #define F_ClosedBSpline _lib_iv(F_ClosedBSpline) #define F_Ellipse _lib_iv(F_Ellipse) #define F_OpenBSpline _lib_iv(F_OpenBSpline) #define F_Polygon _lib_iv(F_Polygon) #define F_Rect _lib_iv(F_Rect) #define FileNameVarView _lib_iv(FileNameVarView) #define FillPolygonObj _lib_iv(FillPolygonObj) #define FixedPin _lib_iv(FixedPin) #define FontCmd _lib_iv(FontCmd) #define FontVar _lib_iv(FontVar) #define FontVarView _lib_iv(FontVarView) #define FrontCmd _lib_iv(FrontCmd) #define FullGraphic _lib_iv(FullGraphic) #define GSData _lib_iv(GSData) #define GVU_HashTable _lib_iv(GVU_HashTable) #define GVUpdater _lib_iv(GVUpdater) #define Graphic _lib_iv(Graphic) #define GraphicBlock _lib_iv(GraphicBlock) #define GraphicComp _lib_iv(GraphicComp) #define GraphicCompTool _lib_iv(GraphicCompTool) #define GraphicComps _lib_iv(GraphicComps) #define GraphicView _lib_iv(GraphicView) #define GraphicViews _lib_iv(GraphicViews) #define GravityCmd _lib_iv(GravityCmd) #define GravityVar _lib_iv(GravityVar) #define GravityVarView _lib_iv(GravityVarView) #define Grid _lib_iv(Grid) #define GridCmd _lib_iv(GridCmd) #define GridDialog _lib_iv(GridDialog) #define GridSpacingCmd _lib_iv(GridSpacingCmd) #define GroupCmd _lib_iv(GroupCmd) #define HPanelControl _lib_iv(HPanelControl) #define HSlotComp _lib_iv(HSlotComp) #define HSlotView _lib_iv(HSlotView) #define HistoryMap _lib_iv(HistoryMap) #define ImportCmd _lib_iv(ImportCmd) #define InorderView _lib_iv(InorderView) #define Iterator _lib_iv(Iterator) #define KeyMap _lib_iv(KeyMap) #define Line _lib_iv(Line) #define LineComp _lib_iv(LineComp) #define LineObj _lib_iv(LineObj) #define LineView _lib_iv(LineView) #define LinkComp _lib_iv(LinkComp) #define LinkView _lib_iv(LinkView) #define MacroCmd _lib_iv(MacroCmd) #define MagnifVar _lib_iv(MagnifVar) #define MagnifVarView _lib_iv(MagnifVarView) #define MagnifyTool _lib_iv(MagnifyTool) #define ManagedWindow _lib_iv(ManagedWindow) #define ManipGroup _lib_iv(ManipGroup) #define Manipulator _lib_iv(Manipulator) #define MatchEditor _lib_iv(MatchEditor) #define MobilityCmd _lib_iv(MobilityCmd) #define MobilityData _lib_iv(MobilityData) #define ModifStatusVar _lib_iv(ModifStatusVar) #define ModifStatusVarView _lib_iv(ModifStatusVarView) #define MoveCmd _lib_iv(MoveCmd) #define MoveData _lib_iv(MoveData) #define MoveTool _lib_iv(MoveTool) #define MultiLine _lib_iv(MultiLine) #define MultiLineComp _lib_iv(MultiLineComp) #define MultiLineObj _lib_iv(MultiLineObj) #define MultiLineView _lib_iv(MultiLineView) #define NOPCmd _lib_iv(NOPCmd) #define NameMap _lib_iv(NameMap) #define NameVar _lib_iv(NameVar) #define NameVarView _lib_iv(NameVarView) #define NewCompCmd _lib_iv(NewCompCmd) #define NormSizeCmd _lib_iv(NormSizeCmd) #define ObjectMap _lib_iv(ObjectMap) #define ObjectMapElem _lib_iv(ObjectMapElem) #define OpenBSpline _lib_iv(OpenBSpline) #define OrientationCmd _lib_iv(OrientationCmd) #define PSBrush _lib_iv(PSBrush) #define PSClosedSpline _lib_iv(PSClosedSpline) #define PSColor _lib_iv(PSColor) #define PSEllipse _lib_iv(PSEllipse) #define PSLine _lib_iv(PSLine) #define PSLink _lib_iv(PSLink) #define PSMultiLine _lib_iv(PSMultiLine) #define PSPad _lib_iv(PSPad) #define PSPattern _lib_iv(PSPattern) #define PSPin _lib_iv(PSPin) #define PSPolygon _lib_iv(PSPolygon) #define PSRaster _lib_iv(PSRaster) #define PSRect _lib_iv(PSRect) #define PSSlot _lib_iv(PSSlot) #define PSSpline _lib_iv(PSSpline) #define PSStencil _lib_iv(PSStencil) #define PSText _lib_iv(PSText) #define PSVertices _lib_iv(PSVertices) #define PadComp _lib_iv(PadComp) #define PadGraphic _lib_iv(PadGraphic) #define PadView _lib_iv(PadView) #define PanelControl _lib_iv(PanelControl) #define PanelInteractor _lib_iv(PanelInteractor) #define PasteCmd _lib_iv(PasteCmd) #define Path _lib_iv(Path) #define PatternCmd _lib_iv(PatternCmd) #define PatternVar _lib_iv(PatternVar) #define PatternVarView _lib_iv(PatternVarView) #define Picture _lib_iv(Picture) #define PinComp _lib_iv(PinComp) #define PinGraphic _lib_iv(PinGraphic) #define PinView _lib_iv(PinView) #define Point _lib_iv(Point) #define PointObj _lib_iv(PointObj) #define Polygon _lib_iv(Polygon) #define PolygonComp _lib_iv(PolygonComp) #define PolygonView _lib_iv(PolygonView) #define PostScriptView _lib_iv(PostScriptView) #define PostScriptViews _lib_iv(PostScriptViews) #define PostorderView _lib_iv(PostorderView) #define PreorderView _lib_iv(PreorderView) #define PrintBS _lib_iv(PrintBS) #define PrintCmd _lib_iv(PrintCmd) #define PrintDialog _lib_iv(PrintDialog) #define QuitCmd _lib_iv(QuitCmd) #define RasterComp _lib_iv(RasterComp) #define RasterRect _lib_iv(RasterRect) #define RasterView _lib_iv(RasterView) #define RectComp _lib_iv(RectComp) #define RectView _lib_iv(RectView) #define RedToFitCmd _lib_iv(RedToFitCmd) #define RedoCmd _lib_iv(RedoCmd) #define ReplaceCmd _lib_iv(ReplaceCmd) #define ReshapeTool _lib_iv(ReshapeTool) #define RevertCmd _lib_iv(RevertCmd) #define RotateCmd _lib_iv(RotateCmd) #define RotateTool _lib_iv(RotateTool) #define SFH_ClosedBSpline _lib_iv(SFH_ClosedBSpline) #define SFH_OpenBSpline _lib_iv(SFH_OpenBSpline) #define SF_Circle _lib_iv(SF_Circle) #define SF_ClosedBSpline _lib_iv(SF_ClosedBSpline) #define SF_Ellipse _lib_iv(SF_Ellipse) #define SF_MultiLine _lib_iv(SF_MultiLine) #define SF_OpenBSpline _lib_iv(SF_OpenBSpline) #define SF_Polygon _lib_iv(SF_Polygon) #define SF_Rect _lib_iv(SF_Rect) #define S_Circle _lib_iv(S_Circle) #define S_ClosedBSpline _lib_iv(S_ClosedBSpline) #define S_Ellipse _lib_iv(S_Ellipse) #define S_MultiLine _lib_iv(S_MultiLine) #define S_OpenBSpline _lib_iv(S_OpenBSpline) #define S_Polygon _lib_iv(S_Polygon) #define S_Rect _lib_iv(S_Rect) #define SaveCompAsCmd _lib_iv(SaveCompAsCmd) #define SaveCompCmd _lib_iv(SaveCompCmd) #define ScaleCmd _lib_iv(ScaleCmd) #define ScaleTool _lib_iv(ScaleTool) #define SelectTool _lib_iv(SelectTool) #define SlctAllCmd _lib_iv(SlctAllCmd) #define SlidingPin _lib_iv(SlidingPin) #define SlotComp _lib_iv(SlotComp) #define SlotGraphic _lib_iv(SlotGraphic) #define SlotView _lib_iv(SlotView) #define SplineComp _lib_iv(SplineComp) #define SplineView _lib_iv(SplineView) #define StateVar _lib_iv(StateVar) #define StateVarView _lib_iv(StateVarView) #define StencilComp _lib_iv(StencilComp) #define StencilView _lib_iv(StencilView) #define StretchTool _lib_iv(StretchTool) #define TF_2Port _lib_iv(TF_2Port) #define TF_Direct _lib_iv(TF_Direct) #define TextBuffer _lib_iv(TextBuffer) #define TextComp _lib_iv(TextComp) #define TextGraphic _lib_iv(TextGraphic) #define TextInteractor _lib_iv(TextInteractor) #define TextManip _lib_iv(TextManip) #define TextView _lib_iv(TextView) #define Tool _lib_iv(Tool) #define TransferFunct _lib_iv(TransferFunct) #define UArray _lib_iv(UArray) #define UChooser _lib_iv(UChooser) #define UControl _lib_iv(UControl) #define UControlInteractor _lib_iv(UControlInteractor) #define UHashElem _lib_iv(UHashElem) #define UHashTable _lib_iv(UHashTable) #define ULabel _lib_iv(ULabel) #define UList _lib_iv(UList) #define UMap _lib_iv(UMap) #define UMapElem _lib_iv(UMapElem) #define UPage _lib_iv(UPage) #define UStencil _lib_iv(UStencil) #define UndoCmd _lib_iv(UndoCmd) #define UngroupCmd _lib_iv(UngroupCmd) #define Unidraw _lib_iv(Unidraw) #define VPanelControl _lib_iv(VPanelControl) #define VSlotComp _lib_iv(VSlotComp) #define VSlotView _lib_iv(VSlotView) #define VertexManip _lib_iv(VertexManip) #define Vertices _lib_iv(Vertices) #define VerticesComp _lib_iv(VerticesComp) #define VerticesView _lib_iv(VerticesView) #define ViewCompCmd _lib_iv(ViewCompCmd) #define Viewer _lib_iv(Viewer) #define ViewerView _lib_iv(ViewerView) #define VoidData _lib_iv(VoidData) #define PSFont UnidrawPSFont neuron-7.6.3/src/include/Unidraw/_gendefs000077500000000000000000000023211340731477100203650ustar00rootroot00000000000000#! /bin/csh -f set tmp = /tmp/$$ cp /dev/null $tmp echo "ClassId" >> $tmp echo "Orientation" >> $tmp echo "Zooming" >> $tmp grep "^class" {.,*}/*.h | \ sed -e 's/.*class \([^ ;\*]*\).*$/\1/' | \ sort | uniq | \ fgrep -v "(" | \ grep -v '^Bitmap$' | \ grep -v '^Canvas$' | \ grep -v '^Event$' | \ grep -v '^FileChooser$' | \ grep -v '^Font$' | \ grep -v '^Frame$' | \ grep -v '^GrowingVertices$' | \ grep -v '^Interactor$' | \ grep -v '^IOHandler$' | \ grep -v '^MarginFrame$' | \ grep -v '^OptionDesc$' | \ grep -v '^Painter$' | \ grep -v '^Perspective$' | \ grep -v '^PropertyData$' | \ grep -v '^PSFont$' | \ grep -v '^Raster$' | \ grep -v '^Resource$' | \ grep -v '^Rubberband$' | \ grep -v '^Selection$' | \ grep -v '^Shape$' | \ grep -v '^State$' | \ grep -v '^String$' | \ grep -v '^TextDisplay$' | \ grep -v '^Transformer$' | \ grep -v '^TransientWindow$' | \ grep -v '^World$' | \ grep -v '^Rect$' | \ grep -v '^istream$' | \ grep -v '^iostream$' | \ grep -v '^ostream$' \ >> $tmp sed -e 's/\(.*\)/#define \1 _lib_iv(\1)/' < $tmp > "_defines.h" sed -e 's/^/#undef /' < $tmp > "_undefs.h" echo '#define PSFont UnidrawPSFont' >> "_defines.h" echo '#undef PSFont' >> "_undefs.h" rm $tmp neuron-7.6.3/src/include/Unidraw/_undefs.h000077500000000000000000000110661340731477100204720ustar00rootroot00000000000000#undef ClassId #undef Orientation #undef Zooming #undef AcknowledgeDialog #undef AlignCmd #undef AlignToGridCmd #undef BackCmd #undef BasicDialog #undef BoxObj #undef BrushCmd #undef BrushVar #undef BrushVarView #undef CCnxn #undef CCnxn_HashTable #undef CGlue #undef CNet #undef CSolver #undef CSolverInfo #undef CSolverState #undef Catalog #undef CatalogChooser #undef CenterCmd #undef Clipboard #undef CloseEditorCmd #undef ClosedBSpline #undef ClosedSplineComp #undef ClosedSplineView #undef ColorCmd #undef ColorData #undef ColorVar #undef Command #undef CommandControl #undef CommandInteractor #undef CompNameVar #undef CompNameVarView #undef Component #undef ComponentView #undef ConfirmDialog #undef ConnInfo #undef ConnectCmd #undef ConnectManip #undef ConnectTool #undef Connector #undef ConnectorView #undef ControlInfo #undef CopyCmd #undef Creator #undef CutCmd #undef Damage #undef Data #undef DataCache #undef DeleteCmd #undef DragManip #undef DupCmd #undef Editor #undef EditorImpl #undef EditorInfo #undef Ellipse #undef EllipseComp #undef EllipseView #undef Extent #undef ExternView #undef F_Circle #undef F_ClosedBSpline #undef F_Ellipse #undef F_OpenBSpline #undef F_Polygon #undef F_Rect #undef FileNameVarView #undef FillPolygonObj #undef FixedPin #undef FontCmd #undef FontVar #undef FontVarView #undef FrontCmd #undef FullGraphic #undef GSData #undef GVU_HashTable #undef GVUpdater #undef Graphic #undef GraphicBlock #undef GraphicComp #undef GraphicCompTool #undef GraphicComps #undef GraphicView #undef GraphicViews #undef GravityCmd #undef GravityVar #undef GravityVarView #undef Grid #undef GridCmd #undef GridDialog #undef GridSpacingCmd #undef GroupCmd #undef HPanelControl #undef HSlotComp #undef HSlotView #undef HistoryMap #undef ImportCmd #undef InorderView #undef Iterator #undef KeyMap #undef Line #undef LineComp #undef LineObj #undef LineView #undef LinkComp #undef LinkView #undef MacroCmd #undef MagnifVar #undef MagnifVarView #undef MagnifyTool #undef ManagedWindow #undef ManipGroup #undef Manipulator #undef MatchEditor #undef MobilityCmd #undef MobilityData #undef ModifStatusVar #undef ModifStatusVarView #undef MoveCmd #undef MoveData #undef MoveTool #undef MultiLine #undef MultiLineComp #undef MultiLineObj #undef MultiLineView #undef NOPCmd #undef NameMap #undef NameVar #undef NameVarView #undef NewCompCmd #undef NormSizeCmd #undef ObjectMap #undef ObjectMapElem #undef OpenBSpline #undef OrientationCmd #undef PSBrush #undef PSClosedSpline #undef PSColor #undef PSEllipse #undef PSLine #undef PSLink #undef PSMultiLine #undef PSPad #undef PSPattern #undef PSPin #undef PSPolygon #undef PSRaster #undef PSRect #undef PSSlot #undef PSSpline #undef PSStencil #undef PSText #undef PSVertices #undef PadComp #undef PadGraphic #undef PadView #undef PanelControl #undef PanelInteractor #undef PasteCmd #undef Path #undef PatternCmd #undef PatternVar #undef PatternVarView #undef Picture #undef PinComp #undef PinGraphic #undef PinView #undef Point #undef PointObj #undef Polygon #undef PolygonComp #undef PolygonView #undef PostScriptView #undef PostScriptViews #undef PostorderView #undef PreorderView #undef PrintBS #undef PrintCmd #undef PrintDialog #undef QuitCmd #undef RasterComp #undef RasterRect #undef RasterView #undef RectComp #undef RectView #undef RedToFitCmd #undef RedoCmd #undef ReplaceCmd #undef ReshapeTool #undef RevertCmd #undef RotateCmd #undef RotateTool #undef SFH_ClosedBSpline #undef SFH_OpenBSpline #undef SF_Circle #undef SF_ClosedBSpline #undef SF_Ellipse #undef SF_MultiLine #undef SF_OpenBSpline #undef SF_Polygon #undef SF_Rect #undef S_Circle #undef S_ClosedBSpline #undef S_Ellipse #undef S_MultiLine #undef S_OpenBSpline #undef S_Polygon #undef S_Rect #undef SaveCompAsCmd #undef SaveCompCmd #undef ScaleCmd #undef ScaleTool #undef SelectTool #undef SlctAllCmd #undef SlidingPin #undef SlotComp #undef SlotGraphic #undef SlotView #undef SplineComp #undef SplineView #undef StateVar #undef StateVarView #undef StencilComp #undef StencilView #undef StretchTool #undef TF_2Port #undef TF_Direct #undef TextBuffer #undef TextComp #undef TextGraphic #undef TextInteractor #undef TextManip #undef TextView #undef Tool #undef TransferFunct #undef UArray #undef UChooser #undef UControl #undef UControlInteractor #undef UHashElem #undef UHashTable #undef ULabel #undef UList #undef UMap #undef UMapElem #undef UPage #undef UStencil #undef UndoCmd #undef UngroupCmd #undef Unidraw #undef VPanelControl #undef VSlotComp #undef VSlotView #undef VertexManip #undef Vertices #undef VerticesComp #undef VerticesView #undef ViewCompCmd #undef Viewer #undef ViewerView #undef VoidData #undef PSFont neuron-7.6.3/src/include/Unidraw/catalog.h000066400000000000000000000204471340731477100204610ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Catalog - manages persistent information. */ #ifndef unidraw_catalog_h #define unidraw_catalog_h #include #include #include #include class Bitmap; class Clipboard; class Command; class Component; class ControlInfo; class Creator; class EditorInfo; class NameMap; class ObjectMap; class ObjectMapElem; class PSBrush; class PSColor; class PSFont; class PSPattern; class Raster; class StateVar; class Tool; class TransferFunct; class Transformer; class UArray; class UHashTable; class Unidraw; class UList; class World; #include class Catalog { public: Catalog(const char*, Creator*, float version = UV_LATEST); virtual ~Catalog(); virtual bool Save(EditorInfo*, const char*); virtual bool Save(Component*, const char*); virtual bool Save(Command*, const char*); virtual bool Save(Tool*, const char*); virtual bool Retrieve(const char*, EditorInfo*&); virtual bool Retrieve(const char*, Component*&); virtual bool Retrieve(const char*, Command*&); virtual bool Retrieve(const char*, Tool*&); virtual void Forget(EditorInfo*, const char* = nil); virtual void Forget(Component*, const char* = nil); virtual void Forget(Command*, const char* = nil); virtual void Forget(Tool*, const char* = nil); virtual const char* GetName(EditorInfo*); virtual const char* GetName(Component*); virtual const char* GetName(Command*); virtual const char* GetName(Tool*); virtual bool Valid(const char*, EditorInfo*&); virtual bool Valid(const char*, Component*&); virtual bool Valid(const char*, Command*&); virtual bool Valid(const char*, Tool*&); virtual Component* Copy(Component*); virtual Command* Copy(Command*); virtual Tool* Copy(Tool*); virtual bool Exists(const char*); virtual bool Writable(const char*); void SetClipboard(Clipboard*); void SetEditorInfo(EditorInfo*); Clipboard* GetClipboard(); EditorInfo* GetEditorInfo(); const char* GetName(); Creator* GetCreator(); float GetVersion(); float FileVersion(); const char* GetAttribute(const char*); virtual float ReadVersion(istream&); virtual Component* ReadComponent(istream&); virtual Command* ReadCommand(istream&); virtual Tool* ReadTool(istream&); virtual StateVar* ReadStateVar(istream&); virtual TransferFunct* ReadTransferFunct(istream&); virtual void WriteVersion(float, ostream&); virtual void WriteComponent(Component*, ostream&); virtual void WriteCommand(Command*, ostream&); virtual void WriteTool(Tool*, ostream&); virtual void WriteStateVar(StateVar*, ostream&); virtual void WriteTransferFunct(TransferFunct*, ostream&); PSBrush* ReadBrush(const char*, int index); // read from Xdefaults PSColor* ReadColor(const char*, int index); PSFont* ReadFont(const char*, int index); PSPattern* ReadPattern(const char*, int index); void Skip(istream&); void Mark(ostream&); int ReadBgFilled(istream&); PSBrush* ReadBrush(istream&); PSColor* ReadColor(istream&); PSFont* ReadFont(istream&); PSPattern* ReadPattern(istream&); Transformer* ReadTransformer(istream&); char* ReadString(istream&); ControlInfo* ReadControlInfo(istream&); EditorInfo* ReadEditorInfo(istream&); Bitmap* ReadBitmap(istream&); void ReadBitmapData(Bitmap*, istream&); Raster* ReadGraymap(istream&); void ReadGraymapData(Raster*, istream&); Raster* ReadRaster(istream&); void ReadRasterData(Raster*, istream&); void WriteBgFilled(bool, ostream&); void WriteBrush(PSBrush*, ostream&); void WriteColor(PSColor*, ostream&); void WriteFont(PSFont*, ostream&); void WritePattern(PSPattern*, ostream&); void WriteTransformer(Transformer*, ostream&); void WriteString(const char*, ostream&); void WriteControlInfo(ControlInfo*, ostream&); void WriteEditorInfo(EditorInfo*, ostream&); void WriteBitmap(Bitmap*, ostream&); void WriteBitmapData(Bitmap*, ostream&); void WriteGraymap(Raster*, ostream&); void WriteGraymapData(Raster*, ostream&); void WriteRaster(Raster*, ostream&); void WriteRasterData(Raster*, ostream&); PSBrush* FindNoneBrush(); PSBrush* FindBrush(int, int); PSColor* FindColor(const char*, int = 0, int = 0, int = 0); PSFont* FindFont(const char*, const char* = "", const char* = ""); PSPattern* FindNonePattern(); PSPattern* FindGrayLevel(float); PSPattern* FindPattern(int[], int); protected: void Register(EditorInfo*, const char*); void Register(Component*, const char*); void Register(Command*, const char*); void Register(Tool*, const char*); int GetToken(istream& in, char* buf, int buf_size); private: friend class Unidraw; void Init(World*); const char* Name(const char*, int); ClassId ReadClassId(istream&, int& inst_id, ClassId&, const char*&); void* ReadObject(istream&); void* ReadSubstObject( istream&, int inst_id, ClassId orig_id, ClassId subst_id, const char* delim ); void ReadExtraData(istream&, const char* delim, UArray*); void WriteClassId( ClassId, ostream&, int inst_id = 0, ClassId subst_id = UNDEFINED_CLASS, const char* delim = "" ); void WriteClassId(void*, ClassId, ostream&, int id = 0); void WriteObject(void*, ClassId, ostream&); void WriteIt(void*, ClassId, ostream&); void* CopyObject(void*, ClassId); void Forget(void*, const char* name, NameMap*); bool SaveObject(void*, ClassId, ostream&); bool RetrieveObject(istream&, void*&); bool FileSave(void*, ClassId, const char*); bool FileRetrieve(const char*, void*&); private: char* _name; Creator* _creator; float _version; Clipboard* _clipboard; EditorInfo* _edInfo; World* _world; UList* _brs; UList* _colors; UList* _fonts; UList* _pats; ObjectMap* _curMap; ObjectMap* _substMap; float _fileVersion; #if defined(__xlC__) || defined(__GNUG__) || defined(__PGIC__) char* _tmpfile; #endif NameMap* _edInfoMap; NameMap* _compMap; NameMap* _cmdMap; NameMap* _toolMap; }; inline const char* Catalog::GetName () { return _name; } inline Creator* Catalog::GetCreator () { return _creator; } inline float Catalog::GetVersion () { return _version; } inline float Catalog::FileVersion () { return _fileVersion; } inline Clipboard* Catalog::GetClipboard () { return _clipboard; } inline EditorInfo* Catalog::GetEditorInfo () { return _edInfo; } class ObjectMap : public UMap { public: ObjectMap(void* client, ClassId clientId); void Register(void* obj, int id); void Register( void* obj, int id, ClassId orig_id, const char* delim, UArray* extra_data ); void Unregister(void* obj); void Unregister(int id); void* GetClient(); ClassId GetClientId(); void* GetObject(int id); int GetId(void* obj); ClassId GetOrigClassId(void* obj); const char* GetDelim(void* obj); UArray* GetExtraData(void* obj); private: ObjectMapElem* Find(void*); ObjectMapElem* Find(int); private: UHashTable _objKeys, _idKeys; void* _client; ClassId _id; }; #endif neuron-7.6.3/src/include/Unidraw/classes.h000077500000000000000000000157371340731477100205150ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Unique unidraw class identifiers. */ #ifndef unidraw_classes_h #define unidraw_classes_h #include inline ClassId Combine (ClassId subj, ClassId view) {return 10000*subj + view;} #define UNDEFINED_CLASS 0 #define ALIGN_CMD 9001 #define BACK_CMD 9002 #define BRUSH_CMD 9003 #define CENTER_CMD 9004 #define COMMAND 9006 #define COMPONENT 9007 #define COMPONENT_VIEW 9008 #define COMPONENT_VIEWS 9009 #define CONNECT_CMD 9010 #define CONNECT_TOOL 9011 #define CONNECTOR 9012 #define CONNECTOR_VIEW 9013 #define COPY_CMD 9015 #define CUT_CMD 9016 #define DELETE_CMD 9017 #define DUP_CMD 9018 #define EXTERN_VIEW 9020 #define FONT_CMD 9021 #define FRONT_CMD 9023 #define GRAPHIC_COMP 9024 #define GRAPHIC_COMPS 9025 #define GRAPHIC_COMP_TOOL 9026 #define GRID_CMD 9027 #define GROUP_CMD 9028 #define GROUP_COMP 9029 #define LINE_COMP 9030 #define MACRO_CMD 9031 #define MAGNIFY_TOOL 9032 #define MOVE_TOOL 9033 #define MOBILITY_CMD 9034 #define MOVE_CMD 9035 #define NEWCOMP_CMD 9036 #define NORMSIZE_CMD 9037 #define PAD_COMP 9038 #define PASTE_CMD 9039 #define PATTERN_CMD 9040 #define PIN_COMP 9041 #define STATE_VAR 9042 #define NAME_VAR 9043 #define QUIT_CMD 9044 #define RECT_COMP 9045 #define MODIFSTATUS_VAR 9046 #define REDTOFIT_CMD 9047 #define REVERT_CMD 9048 #define ROTATE_CMD 9049 #define ROTATE_TOOL 9050 #define SAVECOMP_CMD 9051 #define SCALE_CMD 9052 #define SCALE_TOOL 9053 #define SELECT_TOOL 9054 #define SLCTALL_CMD 9055 #define SLOT_COMP 9056 #define MAGNIF_VAR 9057 #define TOOL 9058 #define UNDO_CMD 9059 #define UNGROUP_CMD 9060 #define VIEWCOMP_CMD 9061 #define VIEWER_VIEW 9062 #define FONT_VAR 9063 #define SAVECOMPAS_CMD 9064 #define BRUSH_VAR 9065 #define PATTERN_VAR 9066 #define COMPONENT_MAP 9067 #define COMMAND_MAP 9068 #define TOOL_MAP 9069 #define COMPNAME_VAR 9070 #define ALIGNTOGRID_CMD 9071 #define PERSPECTIVE_INFO 9072 #define TRANSFER_FUNCT 9073 #define STRUCT_CMD 9074 #define TF_2PORT 9075 #define ELLIPSE_COMP 9076 #define TF_DIRECT 9077 #define POLYGON_COMP 9078 #define VERTICES_COMP 9079 #define CLOSEEDITOR_CMD 9080 #define SPLINE_COMP 9081 #define PRINT_CMD 9082 #define CLOSEDSPLINE_COMP 9083 #define COLOR_VAR 9084 #define COLOR_CMD 9085 #define GRAVITY_VAR 9086 #define GRAVITY_CMD 9087 #define ORIENTATION_CMD 9088 #define GRIDSPACING_CMD 9089 #define TEXT_COMP 9090 #define MULTILINE_COMP 9091 #define DIRTY_CMD 9092 #define RESHAPE_TOOL 9093 #define STRETCH_TOOL 9094 #define HSLOT_COMP 9095 #define VSLOT_COMP 9096 #define RASTER_COMP 9097 #define REPLACE_CMD 9098 #define REDO_CMD 9099 #define PREORDER_VIEW 9100 #define INORDER_VIEW 9101 #define POSTORDER_VIEW 9102 #define POSTSCRIPT_VIEW 9103 #define LINK_COMP 9104 #define STENCIL_COMP 9105 #define IMPORT_CMD 9106 #define NOP_CMD 9107 /* Composite ids associating subjects with their views */ #define CLOSEDSPLINE_VIEW Combine(CLOSEDSPLINE_COMP, COMPONENT_VIEW) #define ELLIPSE_VIEW Combine(ELLIPSE_COMP, COMPONENT_VIEW) #define GRAPHIC_VIEW Combine(GRAPHIC_COMP, COMPONENT_VIEW) #define GRAPHIC_VIEWS Combine(GRAPHIC_COMPS, COMPONENT_VIEW) #define GROUP_VIEW Combine(GROUP_COMP, COMPONENT_VIEW) #define HSLOT_VIEW Combine(HSLOT_COMP, COMPONENT_VIEW) #define LINE_VIEW Combine(LINE_COMP, COMPONENT_VIEW) #define LINK_VIEW Combine(LINK_COMP, COMPONENT_VIEW) #define MULTILINE_VIEW Combine(MULTILINE_COMP, COMPONENT_VIEW) #define PAD_VIEW Combine(PAD_COMP, COMPONENT_VIEW) #define PIN_VIEW Combine(PIN_COMP, COMPONENT_VIEW) #define POLYGON_VIEW Combine(POLYGON_COMP, COMPONENT_VIEW) #define POSTSCRIPT_VIEWS Combine(GRAPHIC_COMPS, POSTSCRIPT_VIEW) #define PS_CLOSEDSPLINE Combine(CLOSEDSPLINE_COMP, POSTSCRIPT_VIEW) #define PS_ELLIPSE Combine(ELLIPSE_COMP, POSTSCRIPT_VIEW) #define PS_GROUP Combine(GROUP_COMP, POSTSCRIPT_VIEW) #define PS_HSLOT Combine(HSLOT_COMP, POSTSCRIPT_VIEW) #define PS_LINE Combine(LINE_COMP, POSTSCRIPT_VIEW) #define PS_LINK Combine(LINK_COMP, POSTSCRIPT_VIEW) #define PS_MULTILINE Combine(MULTILINE_COMP, POSTSCRIPT_VIEW) #define PS_PAD Combine(PAD_COMP, POSTSCRIPT_VIEW) #define PS_PIN Combine(PIN_COMP, POSTSCRIPT_VIEW) #define PS_POLYGON Combine(POLYGON_COMP, POSTSCRIPT_VIEW) #define PS_RASTER Combine(RASTER_COMP, POSTSCRIPT_VIEW) #define PS_RECT Combine(RECT_COMP, POSTSCRIPT_VIEW) #define PS_SLOT Combine(SLOT_COMP, POSTSCRIPT_VIEW) #define PS_SPLINE Combine(SPLINE_COMP, POSTSCRIPT_VIEW) #define PS_STENCIL Combine(STENCIL_COMP, POSTSCRIPT_VIEW) #define PS_TEXT Combine(TEXT_COMP, POSTSCRIPT_VIEW) #define PS_VERTICES Combine(VERTICES_COMP, POSTSCRIPT_VIEW) #define PS_VSLOT Combine(VSLOT_COMP, POSTSCRIPT_VIEW) #define RASTER_VIEW Combine(RASTER_COMP, COMPONENT_VIEW) #define RECT_VIEW Combine(RECT_COMP, COMPONENT_VIEW) #define SLOT_VIEW Combine(SLOT_COMP, COMPONENT_VIEW) #define STENCIL_VIEW Combine(STENCIL_COMP, COMPONENT_VIEW) #define SPLINE_VIEW Combine(SPLINE_COMP, COMPONENT_VIEW) #define TEXT_VIEW Combine(TEXT_COMP, COMPONENT_VIEW) #define VERTICES_VIEW Combine(VERTICES_COMP, COMPONENT_VIEW) #define VSLOT_VIEW Combine(VSLOT_COMP, COMPONENT_VIEW) #endif neuron-7.6.3/src/include/Unidraw/clipboard.h000066400000000000000000000044171340731477100210050ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Clipboard - contains a list of component subjects. */ #ifndef unidraw_clipboard_h #define unidraw_clipboard_h #include #include #include class GraphicComp; class Iterator; class UList; class Selection; class Clipboard { public: Clipboard(GraphicComp* = nil); virtual ~Clipboard(); void Init(Selection*); void CopyInit(Selection*); void Clear(); void DeleteComps(); void Append(GraphicComp*); void Prepend(GraphicComp*); void InsertAfter(Iterator, GraphicComp*); void InsertBefore(Iterator, GraphicComp*); void Remove(GraphicComp*); void Remove(Iterator&); GraphicComp* GetComp(Iterator); void SetComp(GraphicComp*, Iterator&); void First(Iterator&); void Last(Iterator&); void Next(Iterator&); void Prev(Iterator&); bool Done(Iterator); bool IsEmpty(); bool Includes(GraphicComp*); virtual Clipboard* Copy(); virtual Clipboard* DeepCopy(); protected: UList* Elem(Iterator); GraphicComp* Comp(UList*); protected: UList* _comps; }; #include #endif neuron-7.6.3/src/include/Unidraw/creator.h000077500000000000000000000033071340731477100205050ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Object creator class. */ #ifndef unidraw_creator_h #define unidraw_creator_h #include #define CREATE(classname, instream, objmap, objid) { \ classname* o = new classname; \ if (objmap != nil) objmap->Register(o, objid); \ o->Read(instream); \ return o; \ } class ObjectMap; #include class Creator { public: Creator(); virtual void* Create( // for subjects ClassId, istream&, ObjectMap* = nil, int = 0 ); virtual void* Create(ClassId); // for views }; #endif neuron-7.6.3/src/include/Unidraw/ctrlinfo.h000077500000000000000000000046411340731477100206700ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * ControlInfo - manages persistent information contained in a Control. */ #ifndef unidraw_ctrlinfo_h #define unidraw_ctrlinfo_h #include #include #include class GraphicComp; class ControlInfo { public: ControlInfo( GraphicComp*, const char* = "", const char* = "", void* = nil ); ControlInfo( const char*, const char* = "", const char* = "", void* = nil ); virtual ~ControlInfo(); void SetLabel(GraphicComp*); void SetLabel(const char*); void SetKeyLabel(const char*); void SetKeyCode(const char*); void SetOwner(void*); GraphicComp* GetLabel(); const char* GetKeyLabel(); const char* GetKeyCode(); void* GetOwner(); virtual ControlInfo* Copy(); private: void Init(const char*, const char*, void*); private: GraphicComp* _label; char* _keyLabel; char* _keyCode; void* _owner; }; inline void ControlInfo::SetOwner (void* o) { _owner = o; } inline GraphicComp* ControlInfo::GetLabel () { return _label; } inline const char* ControlInfo::GetKeyLabel () { return _keyLabel; } inline const char* ControlInfo::GetKeyCode () { return _keyCode; } inline void* ControlInfo::GetOwner() { return _owner; } #include #endif neuron-7.6.3/src/include/Unidraw/dialogs.h000066400000000000000000000072531340731477100204710ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Various dialog boxes. */ #ifndef unidraw_dialogs_h #define unidraw_dialogs_h #include #include #include #include class MarginFrame; class MatchEditor; class PrintBS; class BasicDialog : public Dialog { public: void SetTitle(const char*); void SetSubtitle(const char*); protected: BasicDialog( ButtonState*, const char* title = "", const char* subtitle = "", Alignment = Center ); BasicDialog( const char* name, ButtonState*, const char* = "", const char* = "", Alignment = Center ); virtual void Forward(Event&); bool IsAChild(Interactor*); protected: MarginFrame* _title, *_subtitle; private: void Init(const char*, const char*); }; class AcknowledgeDialog : public BasicDialog { public: AcknowledgeDialog(const char* title, const char* subtitle = ""); virtual void Acknowledge(); private: Interactor* Interior(); }; class ConfirmDialog : public BasicDialog { public: ConfirmDialog(const char* title, const char* subtitle = ""); virtual char Confirm(); private: Interactor* Interior(); }; class UChooser : public StringChooser { public: UChooser( const char* title, const char* subtitle, const char* acceptLabel, const char* sample ); void Clear(); void Include(const char*); void Exclude(const char*); void SetTitle(const char*); void SetSubtitle(const char*); virtual void Reconfig(); protected: UChooser(ButtonState*, int rows, int cols, Alignment); void Init(const char* title, const char* subtitle); Interactor* Interior(const char* acptlbl); Interactor* AddScroller(Interactor*); virtual int Position(const char*); protected: MarginFrame* _title, *_subtitle; }; class PrintDialog : public FileChooser { public: PrintDialog(bool to_printer = true); virtual ~PrintDialog(); void ToPrinter(bool); bool ToPrinter(); protected: virtual void UpdateEditor(); virtual void UpdateBrowser(); private: Interactor* Interior(); private: PrintBS* _dest; char* _last_print_cmd; char* _last_file_name; int _to_printer; }; class GridDialog : public BasicDialog { public: GridDialog(); virtual bool Accept(); virtual void Handle(Event&); virtual void GetValues(float& xincr, float& yincr); void SelectMessage(); private: Interactor* Interior(); private: MatchEditor* _medit; ButtonState* _units; }; #include #endif neuron-7.6.3/src/include/Unidraw/editor.h000066400000000000000000000054661340731477100203410ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Editor class from which domain-specific editors are derived. * An editor defines the interface to editing GraphicViews; it typically * consists of a viewer, command menus, and tool palettes. */ #ifndef unidraw_editor_h #define unidraw_editor_h #include #include #include class Component; class EditorImpl; class KeyMap; class Interactor; class ManagedWindow; class Selection; class StateVar; class Tool; class Viewer; class Editor : public InputHandler { public: virtual ~Editor(); virtual void Open(); virtual void Close(); virtual void Update(); virtual void SetWindow(ManagedWindow*); virtual ManagedWindow* GetWindow() const; virtual Component* GetComponent(); virtual Viewer* GetViewer(int = 0); virtual KeyMap* GetKeyMap(); virtual Tool* GetCurTool(); virtual Selection* GetSelection(); virtual void SetComponent(Component*); virtual void SetViewer(Viewer*, int = 0); virtual void SetKeyMap(KeyMap*); virtual void SetCurTool(Tool*); virtual void SetSelection(Selection*); virtual StateVar* GetState(const char*); virtual bool DependsOn(Component*); virtual void InsertDialog(Glyph*); virtual void RemoveDialog(Glyph*); virtual void SetClassName(const char*); virtual void SetInstance(const char*); virtual void keystroke(const Event&); protected: Editor(); void Insert(Interactor*); private: ManagedWindow* _window; EditorImpl* _impl; }; inline void Editor::SetWindow(ManagedWindow* w) { _window = w; } inline ManagedWindow* Editor::GetWindow() const { return _window; } #include #endif neuron-7.6.3/src/include/Unidraw/editorinfo.h000066400000000000000000000036311340731477100212050ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * EditorInfo - manages persistent information contained in an editor. */ #ifndef unidraw_editorinfo_h #define unidraw_editorinfo_h #include #include #include class EditorInfo : public UMap { public: EditorInfo(); virtual ~EditorInfo(); void Register(const char* name, const char* info = ""); void UnregisterName(const char* name); void UnregisterInfo(const char* info); bool Registered(const char* name); const char* GetName(const char* info); const char* GetName(int index); const char* GetInfo(const char* name); const char* GetInfo(int index); private: virtual UMapElem* FindId(void*); virtual UMapElem* FindTag(void*); }; #include #endif neuron-7.6.3/src/include/Unidraw/enter-scope.h000077500000000000000000000025671340731477100213010ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef ud__scope_h #define ud__scope_h #include #ifndef MAKEDEPEND #include #include #endif #endif neuron-7.6.3/src/include/Unidraw/globals.h000077500000000000000000000064241340731477100204740ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Global constants, objects, and classes. */ #ifndef unidraw_globals_h #define unidraw_globals_h #include #include #include class CSolver; class Graphic; class PSBrush; class PSColor; class PSFont; class PSPattern; class Resource; class UList; class Unidraw; /* * global types */ typedef unsigned long ClassId; enum DragConstraint { None = 0x0, XFixed = 0x1, YFixed = 0x2, XYEqual = 0x4, HorizOrVert = 0x8, Gravity = 0x10 }; enum Mobility { Fixed = 0, Floating = 1, Undef = 2 }; typedef unsigned Orientation; enum { Normal = 0, Rotated = 1 }; enum { Portrait = 0, Landscape = 1 }; enum { Vertical = 0, Horizontal = 1 }; enum TransMethod { In = 0, Out = 1, InOut = 2 }; /* * global data */ extern CSolver* csolver; extern Unidraw* unidraw; extern PSColor* psblack; extern PSColor* pswhite; extern PSPattern* pssolid; extern PSPattern* psclear; extern PSPattern* psnonepat; extern PSBrush* pssingle; extern PSBrush* psnonebr; extern PSFont* psstdfont; extern Graphic* stdgraphic; /* like default painter */ static const int CHARBUFSIZE = 256; /* size of char buffers used internally */ static const int HANDLE_SIZE = 4; /* length of selection handle edge */ static const char MARK[] = "%I"; /* marks beginning of input */ static const int PIN_RAD = 5; /* radius of pin connector view */ static const int SLOP = 2; /* hit detection tolerance */ /* * global functions */ extern void NormalRect(Coord& left, Coord& bottom, Coord& right, Coord& top); /* assures left < right, bottom < top */ extern void GetLine(const char*, int, int beg,int& end,int& size,int& nextBeg); /* extract lines from a string */ extern void GetAlignmentPoint(Graphic*, Alignment, float&, float&); /* return alignment point on graphic */ extern void Ref(Resource*); /* calls Reference if resource is nonnil */ extern char* strnew(const char*); /* return a copy of the given string */ #include #endif neuron-7.6.3/src/include/Unidraw/grid.h000066400000000000000000000035621340731477100177730ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Grid - constrains points to lie on a grid and provides a corresponding * visual representation of the grid. */ #ifndef unidraw_grid_h #define unidraw_grid_h #include #include #include class Graphic; class Grid { public: Grid(float w, float h, float xincr, float yincr); virtual ~Grid(); virtual Graphic* GetGraphic(); // redefine all virtuals virtual void Constrain(Coord&, Coord&); // if you redefine GetGraphic virtual void Visibility(bool); virtual bool IsVisible(); virtual void SetSpacing(float incr, float yincr); protected: Grid(Graphic*); protected: Graphic* _graphic; }; #include #endif neuron-7.6.3/src/include/Unidraw/iterator.h000077500000000000000000000031311340731477100206720ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Iterator - an object that marks a position in a data structure. */ #ifndef unidraw_iterator_h #define unidraw_iterator_h #include #include #include class Iterator { public: Iterator(); Iterator(Iterator&); Iterator& operator =(Iterator&); virtual void* GetValue(); virtual void SetValue(void*); protected: void* _value; }; #include #endif neuron-7.6.3/src/include/Unidraw/keymap.h000077500000000000000000000032301340731477100203270ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * KeyMap - maintains a keycode-to-UControl mapping. */ #ifndef unidraw_keymap_h #define unidraw_keymap_h #include class UControl; class KeyMap { public: KeyMap(); virtual ~KeyMap(); void Register(UControl*); void Register(KeyMap*); void Unregister(UControl*); void Unregister(KeyMap*); void Execute(const char* keyCode); private: KeyMap(UControl*); KeyMap(KeyMap*); void Init(); private: KeyMap* _next; KeyMap* _submap; UControl* _ctrl; }; #endif neuron-7.6.3/src/include/Unidraw/kybd.h000077500000000000000000000107331340731477100200000ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Keycode equivalents for controls. */ #ifndef unidraw_kybd_h #define unidraw_kybd_h #include /* * components */ extern const char* KLBL_LINE, *CODE_LINE; extern const char* KLBL_ELLIPSE, *CODE_ELLIPSE; extern const char* KLBL_RECT, *CODE_RECT; extern const char* KLBL_POLY, *CODE_POLY; extern const char* KLBL_MULTILINE, *CODE_MULTILINE; extern const char* KLBL_SPLINE, *CODE_SPLINE; extern const char* KLBL_CSPLINE, *CODE_CSPLINE; extern const char* KLBL_TEXT, *CODE_TEXT; extern const char* KLBL_PIN, *CODE_PIN; extern const char* KLBL_SLOT, *CODE_SLOT; extern const char* KLBL_PAD, *CODE_PAD; extern const char* KLBL_LINK, *CODE_LINK; /* * commands */ extern const char* KLBL_NEWCOMP, *CODE_NEWCOMP; /* catalog */ extern const char* KLBL_REVERT, *CODE_REVERT; extern const char* KLBL_VIEWCOMP, *CODE_VIEWCOMP; extern const char* KLBL_SAVECOMP, *CODE_SAVECOMP; extern const char* KLBL_SAVECOMPAS, *CODE_SAVECOMPAS; extern const char* KLBL_PRINT, *CODE_PRINT; extern const char* KLBL_IMPORT, *CODE_IMPORT; extern const char* KLBL_QUIT, *CODE_QUIT; extern const char* KLBL_UNDO, *CODE_UNDO; /* edit */ extern const char* KLBL_REDO, *CODE_REDO; extern const char* KLBL_CUT, *CODE_CUT; extern const char* KLBL_COPY, *CODE_COPY; extern const char* KLBL_PASTE, *CODE_PASTE; extern const char* KLBL_DUP, *CODE_DUP; extern const char* KLBL_DEL, *CODE_DEL; extern const char* KLBL_SLCTALL, *CODE_SLCTALL; extern const char* KLBL_HFLIP, *CODE_HFLIP; extern const char* KLBL_VFLIP, *CODE_VFLIP; extern const char* KLBL_CW90, *CODE_CW90; extern const char* KLBL_CCW90, *CODE_CCW90; extern const char* KLBL_GROUP, *CODE_GROUP; /* structure */ extern const char* KLBL_UNGROUP, *CODE_UNGROUP; extern const char* KLBL_SHOWSTRUCT, *CODE_SHOWSTRUCT; extern const char* KLBL_FRONT, *CODE_FRONT; extern const char* KLBL_BACK, *CODE_BACK; extern const char* KLBL_INSTANCE, *CODE_INSTANCE; extern const char* KLBL_ALGNLEFT, *CODE_ALGNLEFT; /* align */ extern const char* KLBL_ALGNRIGHT, *CODE_ALGNRIGHT; extern const char* KLBL_ALGNTOP, *CODE_ALGNTOP; extern const char* KLBL_ALGNBOT, *CODE_ALGNBOT; extern const char* KLBL_ALGNHCTR, *CODE_ALGNHCTR; extern const char* KLBL_ALGNVCTR, *CODE_ALGNVCTR; extern const char* KLBL_ALGNCTR, *CODE_ALGNCTR; extern const char* KLBL_ABUTLEFT, *CODE_ABUTLEFT; extern const char* KLBL_ABUTRIGHT, *CODE_ABUTRIGHT; extern const char* KLBL_ABUTUP, *CODE_ABUTUP; extern const char* KLBL_ABUTDOWN, *CODE_ABUTDOWN; extern const char* KLBL_ALGNTOGRID, *CODE_ALGNTOGRID; extern const char* KLBL_NORMSIZE, *CODE_NORMSIZE; /* view */ extern const char* KLBL_REDTOFIT, *CODE_REDTOFIT; extern const char* KLBL_CENTER, *CODE_CENTER; extern const char* KLBL_GRID, *CODE_GRID; extern const char* KLBL_GRIDSPC, *CODE_GRIDSPC; extern const char* KLBL_GRAVITY, *CODE_GRAVITY; extern const char* KLBL_ORIENTATION, *CODE_ORIENTATION; extern const char* KLBL_CLOSEEDITOR, *CODE_CLOSEEDITOR; /* * tools */ extern const char* KLBL_SELECT, *CODE_SELECT; extern const char* KLBL_MOVE, *CODE_MOVE; extern const char* KLBL_CONNECT, *CODE_CONNECT; extern const char* KLBL_DETACH, *CODE_DETACH; extern const char* KLBL_SCALE, *CODE_SCALE; extern const char* KLBL_STRETCH, *CODE_STRETCH; extern const char* KLBL_ROTATE, *CODE_ROTATE; extern const char* KLBL_RESHAPE, *CODE_RESHAPE; extern const char* KLBL_MAGNIFY, *CODE_MAGNIFY; #endif neuron-7.6.3/src/include/Unidraw/leave-scope.h000077500000000000000000000025271340731477100212540ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifdef ud__scope_h #undef ud__scope_h #ifndef MAKEDEPEND #include #endif #include #endif neuron-7.6.3/src/include/Unidraw/manip.h000066400000000000000000000034041340731477100201450ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Manipulator - base class for defining direct manipulation semantcs. */ #ifndef unidraw_manip_h #define unidraw_manip_h #include #include #include class Event; class Tool; class Viewer; class Manipulator { public: virtual ~Manipulator(); virtual void Grasp(Event&); virtual bool Manipulating(Event&); virtual void Effect(Event&); virtual void SetViewer(Viewer*); virtual void SetTool(Tool*); virtual Viewer* GetViewer(); virtual Tool* GetTool(); protected: Manipulator(); }; #include #endif neuron-7.6.3/src/include/Unidraw/manips.h000066400000000000000000000157631340731477100203430ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * ManipGroup - composition of Manipulators * DragManip - downclick-drag-upclick-style manipulation * VertexManip - multi-click DragManip * ConnectManip - DragManip that snaps to nearest connector * TextManip - creates and edits text */ #ifndef unidraw_manips_h #define unidraw_manips_h #include #include #include #include class ConnectorView; class GrowingVertices; class Iterator; class Painter; class Rubberband; class Selection; class TextBuffer; class TextDisplay; class Transformer; class UList; class ManipGroup : public Manipulator { public: ManipGroup(Viewer* = nil, Tool* = nil); virtual ~ManipGroup(); virtual void Grasp(Event&); virtual bool Manipulating(Event&); virtual void Effect(Event&); virtual void SetViewer(Viewer*); virtual void SetTool(Tool*); virtual Viewer* GetViewer(); virtual Tool* GetTool(); virtual void First(Iterator&); virtual void Last(Iterator&); virtual void Next(Iterator&); virtual void Prev(Iterator&); virtual bool Done(Iterator); virtual Manipulator* GetManip(Iterator); virtual void SetManip(Manipulator*, Iterator&); virtual void Append( Manipulator*, Manipulator* =nil, Manipulator* =nil, Manipulator* =nil ); virtual void Prepend( Manipulator*, Manipulator* =nil, Manipulator* =nil, Manipulator* =nil ); virtual void InsertBefore(Iterator, Manipulator*); virtual void InsertAfter(Iterator, Manipulator*); virtual void Remove(Manipulator*); virtual void Remove(Iterator&); protected: Manipulator* Manip(UList*); UList* Elem(Iterator); protected: UList* _kids; Viewer* _viewer; Tool* _tool; }; class DragManip : public Manipulator { public: DragManip( Viewer*, Rubberband*, Transformer* = nil, Tool* = nil, DragConstraint = None ); DragManip( Viewer*, Rubberband*, Transformer*, Tool*, DragConstraint, Coord, Coord ); virtual ~DragManip(); virtual void Grasp(Event&); virtual bool Manipulating(Event&); virtual void Effect(Event&); virtual void SetViewer(Viewer*); virtual void SetRubberband(Rubberband*); virtual void SetTransformer(Transformer*); virtual void SetTool(Tool*); virtual void SetConstraint(DragConstraint); virtual Viewer* GetViewer(); virtual Rubberband* GetRubberband(); virtual Transformer* GetTransformer(); virtual Tool* GetTool(); virtual DragConstraint GetConstraint(); const Event& GraspEvent(); protected: void Init(Viewer*, Rubberband*, Transformer*, Tool*, DragConstraint); virtual void Constrain(Event&); private: Viewer* _viewer; Rubberband* _r; Transformer* _relative; Tool* _tool; DragConstraint _constraint; bool _origPreset; Coord _origx, _origy; Event _grasp_e; }; inline const Event& DragManip::GraspEvent () { return _grasp_e; } class VertexManip : public DragManip { public: VertexManip( Viewer*, GrowingVertices*, Transformer* = nil, Tool* = nil, DragConstraint = None ); virtual bool Manipulating(Event&); GrowingVertices* GetGrowingVertices(); }; class ConnectManip : public DragManip { public: ConnectManip(Viewer*, Rubberband*, Transformer* = nil, Tool* = nil); virtual bool Manipulating(Event&); ConnectorView* GetTarget(); protected: ConnectorView* _target; }; class TextManip : public Manipulator { public: TextManip(Viewer*, Painter*, Coord tab, Tool* = nil); TextManip(Viewer*, Painter*, Coord h, Coord tab, Tool* = nil); TextManip( Viewer*, const char*, int, Coord, Coord, Painter*, Coord tab, Tool* = nil ); TextManip( Viewer*, const char*, int, Coord, Coord, Painter*, Coord h, Coord tab, Tool* = nil ); virtual ~TextManip(); virtual void Grasp(Event&); virtual bool Manipulating(Event&); virtual void Effect(Event&); virtual void SetViewer(Viewer*); virtual void SetTool(Tool*); virtual Viewer* GetViewer(); virtual Tool* GetTool(); virtual Painter* GetPainter(); virtual Coord GetLineHeight(); virtual Coord GetTabWidth(); virtual const char* GetText(int&); virtual void GetPosition(Coord&, Coord&); const Event& GraspEvent(); virtual bool HandleKey(Event&); int Dot(); int Mark(); void InsertCharacter(char); void DeleteCharacter(int); void InsertText(const char*, int); void DeleteText(int); void DeleteLine(); void DeleteSelection(); void BackwardCharacter(int = 1), ForwardCharacter(int = 1); void BackwardLine(int = 1), ForwardLine(int = 1); void BackwardWord(int = 1), ForwardWord(int = 1); void BeginningOfLine(), EndOfLine(); void BeginningOfWord(), EndOfWord(); void BeginningOfSelection(), EndOfSelection(); void BeginningOfText(), EndOfText(); void Select(int dot); void SelectMore(int mark); void SelectAll(); void Select(int dot, int mark); bool Contains(Coord, Coord); int Locate(Coord, Coord); private: void Init( Viewer*, Painter*, Coord, Coord, Tool*, bool,const char* =nil,int =0 ); void InitTextDisplay(const char*, int); void PlaceTextDisplay (Coord, Coord); void CheckBuf(int more); private: bool _prepositioned; bool _selecting; Coord _xpos, _ypos; Viewer* _viewer; Selection* _selection; Painter* _painter; Tool* _tool; PSFont* _font; Coord _lineHt, _tabWidth; bool _multiline; TextBuffer* _text; TextDisplay* _display; char* _buf; int _bufsize; int _dot, _mark; Event _grasp_e; }; inline int TextManip::Dot () { return _dot; } inline int TextManip::Mark () { return _mark; } inline const Event& TextManip::GraspEvent () { return _grasp_e; } #include #endif neuron-7.6.3/src/include/Unidraw/path.h000066400000000000000000000032401340731477100177730ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Path - accumulates information about the transmission path during * state variable propagation. */ #ifndef unidraw_path_h #define unidraw_path_h #include #include #include static const int SLOTS = 100; class Connector; class UList; class Path { public: Path(Path* = nil); virtual ~Path(); virtual void Visit(Connector*); virtual bool Visited(Connector*); private: class UList* _slot[SLOTS]; }; #include #endif neuron-7.6.3/src/include/Unidraw/selection.h000066400000000000000000000053621340731477100210330ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Selection - manages a set of selected components. */ #ifndef unidraw_selection_h #define unidraw_selection_h #include #include #include class GraphicView; class Iterator; class Painter; class UList; class Viewer; class Selection { public: Selection(Selection* = nil); virtual ~Selection(); void Show(Viewer* = nil); /* inits and draws handles (in given viewer) */ void Update(Viewer* = nil); /* draws newly-added handles */ void Hide(Viewer* = nil); void Init(Viewer* = nil); /* explicitly init handles */ void Clear(Viewer* = nil); /* removes & clears all views */ void Append(GraphicView*); void Prepend(GraphicView*); void InsertAfter(Iterator, GraphicView*); void InsertBefore(Iterator, GraphicView*); void Remove(GraphicView*); void Remove(Iterator&); GraphicView* GetView(Iterator); void SetView(GraphicView*, Iterator&); void First(Iterator&); void Last(Iterator&); void Next(Iterator&); void Prev(Iterator&); bool Done(Iterator); bool IsEmpty(); bool Includes(GraphicView*); int Number(); void Sort(GraphicView*); void Exclusive(Selection*); /* union minus intersection */ void Merge(Selection*); /* union of this's & Selection's */ /* GraphicViews */ void GetBox(Coord&, Coord&, Coord&, Coord&); /* box bounding selection */ protected: GraphicView* View(UList*); UList* Elem(Iterator); protected: UList* _ulist; int _count; }; #include #endif neuron-7.6.3/src/include/Unidraw/statevar.h000066400000000000000000000036451340731477100207010ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * StateVar state variable subject. */ #ifndef unidraw_statevar_h #define unidraw_statevar_h #include class Connector; class StateVarView; #include class StateVar { public: Connector* GetBinding(); virtual void Attach(StateVarView*); virtual void Detach(StateVarView*); virtual void Notify(); virtual StateVar& operator = (StateVar&); virtual ~StateVar(); virtual StateVar* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual ClassId GetSubstId(const char*& delim); virtual bool IsA(ClassId); protected: StateVar(); private: friend class Connector; void SetBinding(Connector*); private: class UList* _views; Connector* _conn; }; #endif neuron-7.6.3/src/include/Unidraw/statevars.h000066400000000000000000000124441340731477100210610ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * State variable subclasses. */ #ifndef unidraw_statevars_h #define unidraw_statevars_h #include class Component; class PSBrush; class PSColor; class PSPattern; class PSFont; class NameVar : public StateVar { public: NameVar(const char* = nil); virtual const char* GetName(); virtual void SetName(const char*); virtual StateVar& operator = (StateVar&); virtual StateVar* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); private: char* _name; }; class CompNameVar : public NameVar { public: CompNameVar(Component* = nil); virtual Component* GetComponent(); virtual void SetComponent(Component*); virtual void UpdateName(); virtual const char* PartOf(); virtual StateVar& operator = (StateVar&); virtual StateVar* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); private: const char* CatalogName(Component*); private: Component* _comp; }; class ModifStatusVar : public StateVar { public: ModifStatusVar(Component* = nil, bool = false); ~ModifStatusVar(); virtual bool GetModifStatus(); virtual void SetModifStatus(bool); virtual Component* GetComponent(); virtual void SetComponent(Component*); virtual StateVar& operator = (StateVar&); virtual StateVar* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: void modified(int); private: int _modified; Component* _component; static class UList* _vars; }; class MagnifVar : public StateVar { public: MagnifVar(float = 1); virtual float GetMagnif(); virtual void SetMagnif(float); virtual StateVar& operator = (StateVar&); virtual StateVar* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); private: float _magnif; }; class GravityVar : public StateVar { public: GravityVar(bool = false); virtual bool IsActive(); virtual void Activate(bool); virtual StateVar& operator = (StateVar&); virtual StateVar* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); private: int _active; }; class FontVar : public StateVar { public: FontVar(PSFont* = nil); virtual ~FontVar(); virtual PSFont* GetFont(); virtual void SetFont(PSFont*); virtual StateVar& operator = (StateVar&); virtual StateVar* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); private: PSFont* _psfont; }; class BrushVar : public StateVar { public: BrushVar(PSBrush* = nil); virtual ~BrushVar(); virtual PSBrush* GetBrush(); virtual void SetBrush(PSBrush*); virtual StateVar& operator = (StateVar&); virtual StateVar* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); private: PSBrush* _psbrush; }; class PatternVar : public StateVar { public: PatternVar(PSPattern* = nil); virtual ~PatternVar(); virtual PSPattern* GetPattern(); virtual void SetPattern(PSPattern*); virtual StateVar& operator = (StateVar&); virtual StateVar* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); private: PSPattern* _pspattern; }; class ColorVar : public StateVar { public: ColorVar(PSColor* fg = nil, PSColor* bg = nil); virtual ~ColorVar(); virtual PSColor* GetFgColor(); virtual PSColor* GetBgColor(); virtual void SetColors(PSColor* fg, PSColor* bg); virtual StateVar& operator = (StateVar&); virtual StateVar* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); private: PSColor* _psfgcolor, *_psbgcolor; }; #endif neuron-7.6.3/src/include/Unidraw/stateview.h000066400000000000000000000033601340731477100210550ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * StateVarView state variable view. */ #ifndef unidraw_stateview_h #define unidraw_stateview_h #include #include #include class StateVar; class StateVarView : public MonoScene { public: virtual ~StateVarView(); virtual void Update(); StateVar* GetSubject(); protected: StateVarView(StateVar*); virtual void Init(); virtual bool Stale(); virtual void Reconfig(); protected: StateVar* _subject; private: friend class StateVar; virtual void SetSubject(StateVar*); }; #include #endif neuron-7.6.3/src/include/Unidraw/stateviews.h000066400000000000000000000072251340731477100212440ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * StateVarView subclasses. */ #ifndef unidraw_stateviews_h #define unidraw_stateviews_h #include #include class BrushVar; class ColorVar; class FontVar; class GravityVar; class MagnifVar; class ModifStatusVar; class NameVar; class PatternVar; class PSBrush; class PSColor; class PSPattern; class PSFont; class TextInteractor; class NameVarView : public StateVarView { public: NameVarView(NameVar*, Alignment = Center, const char* sample = nil); protected: virtual void Init(); virtual bool Stale(); }; class FileNameVarView : public StateVarView { public: FileNameVarView( NameVar*, Alignment = Center, bool relative = true, const char* sample = nil ); protected: virtual void Init(); protected: bool _relative; }; class CompNameVarView : public StateVarView { public: CompNameVarView( CompNameVar*, Alignment = Center, bool relative = true, const char* sample = nil ); protected: virtual void Init(); protected: bool _relative; }; class ModifStatusVarView : public StateVarView { public: ModifStatusVarView(ModifStatusVar*, Alignment = Center); protected: virtual void Init(); virtual bool Stale(); virtual void Reconfig(); bool WriteProtected(); protected: bool _prevVal, _prevProt; }; class MagnifVarView : public StateVarView { public: MagnifVarView(MagnifVar*, Alignment = Center); protected: virtual void Init(); virtual bool Stale(); protected: float _prevVal; }; class GravityVarView : public StateVarView { public: GravityVarView(GravityVar*, Alignment = Center); protected: virtual void Init(); virtual bool Stale(); protected: bool _prevVal; }; class FontVarView : public StateVarView { public: FontVarView(FontVar*, Alignment = Center, const char* sample = nil); protected: virtual void Init(); virtual bool Stale(); protected: PSFont* _prevVal; }; class BrushVarView : public StateVarView { public: BrushVarView(BrushVar*, ColorVar* = nil); virtual ~BrushVarView(); protected: virtual void Init(); virtual bool Stale(); protected: PSBrush* _prevVal; PSColor* _prevFg, *_prevBg; ColorVar* _colorSubj; }; class PatternVarView : public StateVarView { public: PatternVarView(PatternVar*, ColorVar* = nil); virtual ~PatternVarView(); protected: virtual void Init(); virtual bool Stale(); protected: PSPattern* _prevVal; PSColor* _prevFg, *_prevBg; ColorVar* _colorSubj; }; #include #endif neuron-7.6.3/src/include/Unidraw/transfn.h000066400000000000000000000033301340731477100205120ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Transfer function base class. */ #ifndef unidraw_transfn_h #define unidraw_transfn_h #include class Connector; class Path; class StateVar; #include class TransferFunct { public: virtual void Evaluate(Path* = nil); virtual ~TransferFunct(); virtual TransferFunct* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual ClassId GetSubstId(const char*& delim); virtual bool IsA(ClassId); protected: TransferFunct(); Connector* GetBinding(StateVar*); }; #endif neuron-7.6.3/src/include/Unidraw/transfns.h000066400000000000000000000046501340731477100207030ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Transfer function subclasses. */ #ifndef unidraw_transfns_h #define unidraw_transfns_h #include class TF_2Port : public TransferFunct { public: virtual void Evaluate(Path* = nil); virtual StateVar* GetInput(int index); virtual StateVar* GetOutput(int index); virtual void SetInput(StateVar*, int index); virtual void SetOutput(StateVar*, int index); virtual int Inputs(); virtual int Outputs(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: TF_2Port(); virtual void Transfer(); virtual bool ChangedOutput(int index = 0); }; class TF_Direct : public TF_2Port { public: TF_Direct(StateVar* input = nil, StateVar* output = nil); virtual StateVar* GetInput(int index = 0); virtual StateVar* GetOutput(int index = 0); virtual void SetInput(StateVar*, int index = 0); virtual void SetOutput(StateVar*, int index = 0); virtual int Inputs(); virtual int Outputs(); virtual TransferFunct* Copy(); virtual void Read(istream&); virtual void Write(ostream&); virtual ClassId GetClassId(); virtual bool IsA(ClassId); protected: virtual void Transfer(); virtual bool ChangedOutput(int index = 0); private: StateVar* _input, *_output; bool _changed; }; #endif neuron-7.6.3/src/include/Unidraw/uarray.h000077500000000000000000000032411340731477100203460ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * UArray - dynamic array object. */ #ifndef unidraw_uarray_h #define unidraw_uarray_h #include class UArray { public: UArray(int = 16); ~UArray(); void*& operator[](int index); void Insert(void*, int index); void Remove(int index); int Index(void*); int Count(); void Clear(); private: void Check(int index); private: void** _buf; int _bufsize; int _count; }; inline int UArray::Count () { return _count; } inline void UArray::Clear () { _count = 0; } #endif neuron-7.6.3/src/include/Unidraw/uctrl.h000066400000000000000000000045061340731477100201760ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * UControl - base class for KeyMap-compatible controls. * UControlInteractor - base class for interactors that base their * appearance on ControlInfo information */ #ifndef unidraw_uctrl_h #define unidraw_uctrl_h #include #include #include class ControlInfo; class Graphic; class UControl : public Control { public: virtual void SetControlInfo(ControlInfo*); ControlInfo* GetControlInfo(); protected: UControl(ControlInfo*); UControl(const char*, ControlInfo*); protected: ControlInfo* _info; private: void Init(ControlInfo*); }; class UControlInteractor : public Interactor { public: virtual ~UControlInteractor(); virtual void Highlight(bool); virtual void SetControlInfo(ControlInfo*); ControlInfo* GetControlInfo(); protected: UControlInteractor(ControlInfo*); UControlInteractor(); virtual void Redraw(Coord, Coord, Coord, Coord); virtual void Invert(); Graphic* InitLabel(ControlInfo*); protected: ControlInfo* _info; Graphic* _picture; Graphic* _label; bool _highlighted; private: void Init(ControlInfo*); }; #include #endif neuron-7.6.3/src/include/Unidraw/uctrls.h000077500000000000000000000052211340731477100203570ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * UControl and UControlInteractor subclasses. */ #ifndef unidraw_uctrls_h #define unidraw_uctrls_h #include #include class CommandControl : public UControl { public: CommandControl(ControlInfo*); CommandControl(const char*, ControlInfo*); virtual void Do(); protected: virtual void Busy(); virtual void Done(); private: void Init(ControlInfo*); }; class PanelControl : public UControl { public: PanelControl(Interactor*, ControlInfo*, ControlState* = nil); PanelControl(const char*, Interactor*, ControlInfo*, ControlState* = nil); virtual void Do(); protected: virtual void Down(); virtual void Enter(); virtual void Leave(); virtual void Select(); private: void Init(Interactor*, ControlState*); }; class HPanelControl : public PanelControl { public: HPanelControl(ControlInfo*, ControlState* = nil); HPanelControl(const char*, ControlInfo*, ControlState* = nil); }; class VPanelControl : public PanelControl { public: VPanelControl(ControlInfo*, ControlState* = nil); VPanelControl(const char*, ControlInfo*, ControlState* = nil); }; class CommandInteractor : public UControlInteractor { public: CommandInteractor(ControlInfo*); protected: virtual void Reconfig(); virtual void Resize(); }; class PanelInteractor : public UControlInteractor { public: PanelInteractor(ControlInfo*, Orientation); protected: virtual void Reconfig(); virtual void Resize(); private: Orientation _orient; }; #endif neuron-7.6.3/src/include/Unidraw/uformat.h000077500000000000000000000026411340731477100205230ustar00rootroot00000000000000/* * Copyright (c) 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Unidraw format version history. */ #ifndef unidraw_uformat_h #define unidraw_uformat_h #include static const float UV_ORIGINAL = 1; // original 3.0 release static const float UV_PRERELEASE = 0; // pre-3.0 release #define UV_LATEST UV_ORIGINAL #endif neuron-7.6.3/src/include/Unidraw/uhash.h000066400000000000000000000043421340731477100201530ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * UHash - hash table. */ #ifndef unidraw_uhash_h #define unidraw_uhash_h #include #include #include class Iterator; class UList; class UHashElem { public: UHashElem(void* = nil); virtual ~UHashElem(); void* GetKey(); void SetKey(void*); private: void* _key; }; inline void* UHashElem::GetKey () { return _key; } inline void UHashElem::SetKey (void* key) { _key = key; } class UHashTable { public: UHashTable(int nslots); virtual ~UHashTable(); virtual void Register(void* key, UHashElem* = nil); virtual void Unregister(void* key); void First(Iterator&); void Next(Iterator&); bool Done(Iterator); UHashElem* GetElem(Iterator); UHashElem* Find(void* key); protected: virtual UHashElem* CreateElem(); virtual int Hash(void*); virtual bool Equal(void* key1, void* key2); protected: int _nslots; private: UList* UElem(Iterator); UHashElem* Elem(UList*); void DeleteSlot(UList*); private: UList** _slot; }; #include #endif neuron-7.6.3/src/include/Unidraw/ulist.h000066400000000000000000000041561340731477100202060ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * UList - list object. */ #ifndef unidraw_ulist_h #define unidraw_ulist_h #include #include #include class UList { public: UList(void* = nil); virtual ~UList(); bool IsEmpty(); void Append(UList*); void Prepend(UList*); void Remove(UList*); void Delete(void*); UList* Find(void*); UList* First(); UList* Last(); UList* End(); UList* Next(); UList* Prev(); void* operator()(); UList* operator[](int count); protected: void* _object; UList* _next; UList* _prev; }; inline bool UList::IsEmpty () { return _next == this; } inline UList* UList::First () { return _next; } inline UList* UList::Last () { return _prev; } inline UList* UList::End () { return this; } inline UList* UList::Next () { return _next; } inline UList* UList::Prev () { return _prev; } inline void* UList::operator() () { return _object; } #include #endif neuron-7.6.3/src/include/Unidraw/umap.h000077500000000000000000000037011340731477100200060ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * UMap - maintains a void* <-> void* mapping (linear search by default). */ #ifndef unidraw_umap_h #define unidraw_umap_h #include class UMapElem { public: virtual ~UMapElem(); virtual void* id(); virtual void* tag(); protected: UMapElem(); }; class UMap { public: virtual ~UMap(); int Count(); void Clear(); protected: UMap(); void Register(UMapElem*); void Unregister(UMapElem*); int Index(UMapElem*); UMapElem* Elem(int index); virtual UMapElem* FindId(void*); virtual UMapElem* FindTag(void*); protected: UArray _elems; }; inline int UMap::Index (UMapElem* elem) { return _elems.Index(elem); } inline UMapElem* UMap::Elem (int index) { return (UMapElem*) _elems[index]; } inline int UMap::Count () { return _elems.Count(); } #endif neuron-7.6.3/src/include/Unidraw/unidraw.h000066400000000000000000000067571340731477100205300ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Unidraw - performs top-level event handling, catalog initialization, and * manages multiple editors. */ #ifndef unidraw_h #define unidraw_h #include class Catalog; class Command; class Component; class Editor; class Event; class Iterator; class HistoryMap; class OptionDesc; class PropertyData; class UList; class World; class Unidraw { public: Unidraw( Catalog*, int& argc, char** argv, OptionDesc* = nil, PropertyData* = nil ); Unidraw(Catalog*, World*); virtual ~Unidraw(); virtual void Run(); virtual void Update(bool immediate = false); virtual void Quit(); virtual void Open(Editor*); virtual void Close(Editor*); // delete editor virtual void CloseDependents(Component*); virtual void CloseAll(); virtual bool Opened(Editor*); void First(Iterator&); void Next(Iterator&); bool Done(Iterator); Editor* GetEditor(Iterator); Editor* Find(Component*); Editor* FindAny(Component*); Catalog* GetCatalog(); World* GetWorld(); void SetHistoryLength(int); int GetHistoryLength(); void Log(Command*); void Undo(Component*, int = 1); void Redo(Component*, int = 1); void ClearHistory(Component* = nil); void ClearHistory(Editor*); protected: virtual void Process(); bool IsClean(Editor*); void Mark(Editor*); void Sweep(); void DoUpdate(); void GetHistory(Component*, UList*& past, UList*& future); void ClearHistory(UList*, int = 1); UList* elem(Iterator); Command* command(UList*); bool alive(); bool updated(); void alive(bool); void updated(bool); private: void Init(Catalog*, World*); void InitAttributes(); void DeleteComponent(Component*); Editor* editor(UList*); Editor* FindAny(Component*, UList*); Editor* FindAnyDead(Component*); private: Catalog* _catalog; World* _world; UList* _editors; UList* _deadEditors; bool _alive; bool _updated; HistoryMap* _histories; int _histlen; }; inline Catalog* Unidraw::GetCatalog () { return _catalog; } inline World* Unidraw::GetWorld () { return _world; } inline bool Unidraw::alive () { return _alive; } inline bool Unidraw::updated () { return _updated; } inline void Unidraw::alive (bool a) { _alive = a; } inline void Unidraw::updated (bool u) { _updated = u; } #endif neuron-7.6.3/src/include/Unidraw/upage.h000077500000000000000000000027131340731477100201470ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * UPage - defines the viewer's page boundary. */ #ifndef unidraw_upage_h #define unidraw_upage_h #include class Graphic; class UPage { public: UPage(float w, float h); UPage(Graphic*); virtual ~UPage(); virtual Graphic* GetGraphic(); protected: Graphic* _graphic; }; #endif neuron-7.6.3/src/include/Unidraw/viewer.h000077500000000000000000000076041340731477100203530ustar00rootroot00000000000000/* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Viewer - a GraphicBlock that displays the graphic contributed by a * GraphicView. */ #ifndef unidraw_viewer_h #define unidraw_viewer_h #include #include #include class Damage; class Editor; class GraphicComp; class GraphicView; class Grid; class KeyMap; class Manipulator; class Rubberband; class Selection; class State; class TextDisplay; class Tool; class Transformer; class UPage; class ViewerView; class Viewer : public GraphicBlock { public: Viewer( Editor*, GraphicView*, UPage*, Grid* = nil, Coord = 0, Coord = 0, Orientation = Normal, Alignment = Center, Zooming = Binary ); Viewer( const char*, Editor*, GraphicView*, UPage*, Grid* = nil, Coord = 0, Coord = 0, Orientation = Normal, Alignment = Center, Zooming = Binary ); virtual ~Viewer(); virtual void Update(); virtual void Adjust(Perspective&); virtual void Handle(Event&); virtual void Reconfig(); virtual void Draw(); virtual void SetGraphicView(GraphicView*); virtual void SetPage(UPage*); virtual void SetGrid(Grid*); virtual void SetMagnification(float); virtual void SetOrientation(Orientation); virtual Graphic* GetGraphic(); virtual GraphicView* GetGraphicView(); virtual UPage* GetPage(); virtual Grid* GetGrid(); virtual Orientation GetOrientation(); virtual Editor* GetEditor(); virtual Selection* GetSelection(); virtual Damage* GetDamage(); virtual void InitRubberband(Rubberband*); virtual void InitTextDisplay(TextDisplay*, Painter*); virtual void IncurTextDisplayDamage(TextDisplay*, Painter*); virtual void CenterOp(); virtual void Magnify(Coord, Coord, Coord, Coord); virtual void ReduceToFit(); virtual void Constrain(Coord&, Coord&); virtual void UseTool(Tool*); virtual void Align(GraphicComp*, Alignment); protected: void Init(Editor*, GraphicView*, UPage*, Grid*, Coord, Coord, Orientation); void Init(Editor*, GraphicView*, UPage*, Grid*); Tool* CurTool(); Transformer* GetTransformer(); virtual void Manipulate(Manipulator*, Event&); // direct manipulation loop virtual void UseTool(Tool*, Event&); virtual void MomentaryUseTool(const char*, Event&); virtual void GetGraphicBox(Coord&, Coord&, Coord&, Coord&); virtual void Reorient(); virtual void UpdateMagnifVar(); virtual float LimitMagnification(float); virtual ClassId ViewCategory(); virtual void Redraw(Coord, Coord, Coord, Coord); virtual void Resize(); private: Editor* _editor; Damage* _damage; GraphicView* _gview; UPage* _page; Grid* _grid; Orientation _orientation; ViewerView* _viewerView; }; #include #endif neuron-7.6.3/src/include/ivcarbon.h000077500000000000000000000003631340731477100172370ustar00rootroot00000000000000#include #include #include #include #pragma once off #define SYSV 1 #define MAC 1 #define motif_kit #define sgi_motif_kit #define default_kit SMFKit #define HAVE_UNISTD_H 1 #define carbon 1 neuron-7.6.3/src/include/ivmcw.h000077500000000000000000000002661340731477100165630ustar00rootroot00000000000000#define WIN32 1 #define _WIN32 #define motif_kit #define sgi_motif_kit //#define HAVE_DIRENT_H 1 //#define CYGWIN 1 //#define MAC 1 #if __MWERKS__ >= 7 #define _MSL_DIRENT_H #endif neuron-7.6.3/src/include/ivstream.h000066400000000000000000000004551340731477100172650ustar00rootroot00000000000000/* src/include/ivstream.h. Generated from ivstream.h.in by configure. */ #ifndef ivstream_h #define ivstream_h /* The standard is */ #define HAVE_SSTREAM /**/ /* Define if the openmodes output,append,input are not defined */ /* #undef NO_OUTPUT_OPENMODE */ #include #endif neuron-7.6.3/src/include/ivstream.h.in000077500000000000000000000003261340731477100176720ustar00rootroot00000000000000#ifndef ivstream_h #define ivstream_h /* The standard is */ #undef HAVE_SSTREAM /* Define if the openmodes output,append,input are not defined */ #undef NO_OUTPUT_OPENMODE #include #endif neuron-7.6.3/src/include/ivstrm.h000077500000000000000000000034321340731477100167600ustar00rootroot00000000000000#ifndef ivstrm_h #define ivstrm_h /* prevent subsequent inclusion of ivstream if this didnt come from there since it defines things already possibly defined in config.h */ #ifndef ivstream_h #define ivstream_h #endif #if defined(HAVE_SSTREAM) /* the current standard. Note that one of the arms below is obsolete */ /* this was introduced to avoid the g++ 3.2 warning (and to get more up to date) /usr/include/c++/3.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the header for the header for C++ includes, or instead of the deprecated header . To disable this warning use -Wno-deprecated. */ #include #include #include #define IOS_OUT std::ios::out #define IOS_IN std::ios::in #define IOS_APP std::ios::app using namespace std; #else /* do not have sstream */ /* introduced for macos since stream.h does not exist. also takes care of the declaration of output and input with regard to streams Note: the above standard certainly obsoletes the NO_OUTPUT_OPENMODE stuff. So macos now handled by the HAVE_SSTREAM case. */ #if defined(HAVE_STREAM_H) #include #else #define _STREAM_COMPAT #include #endif // for some compilers stream.h is insufficient // following for gcc-3.0.1 #if defined(NO_OUTPUT_OPENMODE) #include // for filebuf #include // for ends #define IOS_OUT std::ios_base::out #define IOS_IN std::ios_base::in #define IOS_APP std::ios_base::app #else #define IOS_OUT output #define IOS_IN input #define IOS_APP append #endif #endif /* do not have sstream */ #endif neuron-7.6.3/src/include/ivversion.h000077500000000000000000000001171340731477100174550ustar00rootroot00000000000000#ifndef iv_version_h #define iv_version_h #define iv_hines_version 19 #endif neuron-7.6.3/src/include/macivdef.h000077500000000000000000000003111340731477100172030ustar00rootroot00000000000000#pragma precompile_target "iv_def.h" #define MSL_USE_PRECOMPILED_HEADERS 1 #include #define SYSV 1 #define MAC 1 #define motif_kit #define sgi_motif_kit #define default_kit SMFKit neuron-7.6.3/src/lib/000077500000000000000000000000001340731477100144015ustar00rootroot00000000000000neuron-7.6.3/src/lib/Dispatch/000077500000000000000000000000001340731477100161405ustar00rootroot00000000000000neuron-7.6.3/src/lib/Dispatch/dispatcher.cpp000066400000000000000000000475311340731477100210040ustar00rootroot00000000000000// for gcc-2.96 (but not 3.1 or 3.2) including sys/wait.h in its normal place // below when HAVE_SSTREAM there is a problem with __WAIT_STATUS and WNOHANG #include #ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #define __USE_XOPEN 1 // Necessary for compilation with glibc 2.1. #ifndef _LANGUAGE_C_PLUS_PLUS #define _LANGUAGE_C_PLUS_PLUS 1 //gcc-2.8.1 mips-sgi-irix6.2 #endif // Dispatcher provides an interface to the "select" system call. #include #include #include #include #include #include #include #ifdef HAVE_UNISTD_H #include #endif #undef NULL #include #ifdef HAVE_SYS_SELECT_H //#if defined(AIXV3) || defined(svr4) || defined(AIXV4) #include #endif #include #include #include #include #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif /* no standard place for this */ extern "C" { #ifndef HAVE_SYS_SELECT_H // #if !defined(AIXV3) && !defined(SVR4) && !defined(__lucid) extern int select(int, fd_set*, fd_set*, fd_set*, struct timeval*); #endif #ifdef NEED_GETTIMEOFDAY_PROTOTYPE // #if (defined(__DECCXX) || (defined(__GNUC__) && !defined(SVR4))) extern int gettimeofday(struct timeval*, struct timezone*); #endif } #ifndef SIGCLD #define SIGCLD SIGCHLD #endif #ifdef LINUX // This doesn't appear to be necessary any more, since LINUX is // no longer defined and it still compiles fine on linux. #ifndef howmany #define howmany(x,y) ((((u_int)(x))+(((u_int)(y))-1))/((u_int)(y))) #endif #endif Dispatcher* Dispatcher::_instance; class FdMask : public fd_set { public: FdMask(); void zero(); void setBit(int); void clrBit(int); bool isSet(int) const; bool anySet() const; int numSet() const; }; FdMask::FdMask() { zero(); } void FdMask::zero() { Memory::zero(this, sizeof(FdMask)); } void FdMask::setBit(int fd) { FD_SET(fd,(fd_set*)this); } void FdMask::clrBit(int fd) { FD_CLR(fd,(fd_set*)this); } bool FdMask::isSet(int fd) const { return FD_ISSET(fd,(fd_set*)this); } bool FdMask::anySet() const { #if 0 && defined(_XOPEN_SOURCE) const int mskcnt = howmany(FD_SETSIZE,NFDBITS); for (int i = 0; i < mskcnt; i++) { if (fds_bits[i]) { return true; } } #else // // Redo using entirely standard macros. This is slightly less efficient. // for (int fd_idx = 0; fd_idx < FD_SETSIZE; ++fd_idx) if (FD_ISSET(fd_idx, (fd_set*)this)) return true; #endif return false; } int FdMask::numSet() const { int n = 0; // // Redone using entirely standard macros. // for (int i = 0; i < FD_SETSIZE; ++i) if (FD_ISSET(i, (fd_set*)this)) ++n; // const int mskcnt = howmany(FD_SETSIZE,NFDBITS); // for (int i = 0; i < mskcnt; i++) { // if (fds_bits[i]) { // for (int j = 0; j < NFDBITS; j++) { // if ((fds_bits[i] & (1 << j)) != 0) { // n += 1; // } // } // } // } return n; } /* * Operations on timeval structures. */ const long ONE_SECOND = 1000000; timeval operator+(timeval src1, timeval src2) { timeval sum; sum.tv_sec = src1.tv_sec + src2.tv_sec; sum.tv_usec = src1.tv_usec + src2.tv_usec; if (sum.tv_usec >= ONE_SECOND) { sum.tv_usec -= ONE_SECOND; sum.tv_sec++; } else if (sum.tv_sec >= 1 && sum.tv_usec < 0) { sum.tv_usec += ONE_SECOND; sum.tv_sec--; } return sum; } timeval operator-(timeval src1, timeval src2) { timeval delta; delta.tv_sec = src1.tv_sec - src2.tv_sec; delta.tv_usec = src1.tv_usec - src2.tv_usec; if (delta.tv_usec < 0) { delta.tv_usec += ONE_SECOND; delta.tv_sec--; } else if (delta.tv_usec >= ONE_SECOND) { delta.tv_usec -= ONE_SECOND; delta.tv_sec++; } return delta; } bool operator>(timeval src1, timeval src2) { if (src1.tv_sec > src2.tv_sec) { return true; } else if (src1.tv_sec == src2.tv_sec && src1.tv_usec > src2.tv_usec) { return true; } else { return false; } } bool operator<(timeval src1, timeval src2) { if (src1.tv_sec < src2.tv_sec) { return true; } else if (src1.tv_sec == src2.tv_sec && src1.tv_usec < src2.tv_usec) { return true; } else { return false; } } /* * Interface to timers. */ struct Timer { Timer(timeval t, IOHandler* h, Timer* n); timeval timerValue; IOHandler* handler; Timer* next; }; class TimerQueue { public: TimerQueue(); virtual ~TimerQueue(); bool isEmpty() const; static timeval zeroTime(); timeval earliestTime() const; static timeval currentTime(); void insert(timeval, IOHandler*); void remove(IOHandler*); void expire(timeval); private: Timer* _first; static timeval _zeroTime; }; Timer::Timer(timeval t, IOHandler* h, Timer* n) : timerValue(t), handler(h), next(n) {} timeval TimerQueue::_zeroTime; TimerQueue::TimerQueue() : _first(nil) {} TimerQueue::~TimerQueue() { Timer* doomed = _first; while (doomed != nil) { Timer* next = doomed->next; delete doomed; doomed = next; } } inline bool TimerQueue::isEmpty() const { return _first == nil; } inline timeval TimerQueue::zeroTime() { return _zeroTime; } inline timeval TimerQueue::earliestTime() const { return _first->timerValue; } timeval TimerQueue::currentTime() { timeval curTime; #if 0 && defined(SVR4) && !defined(__GNUC__) gettimeofday(&curTime); #else struct timezone curZone; gettimeofday(&curTime, &curZone); #endif return curTime; } void TimerQueue::insert(timeval futureTime, IOHandler* handler) { if (isEmpty() || futureTime < earliestTime()) { _first = new Timer(futureTime, handler, _first); } else { Timer* before = _first; Timer* after = _first->next; while (after != nil && futureTime > after->timerValue) { before = after; after = after->next; } before->next = new Timer(futureTime, handler, after); } } void TimerQueue::remove(IOHandler* handler) { Timer* before = nil; Timer* doomed = _first; while (doomed != nil && doomed->handler != handler) { before = doomed; doomed = doomed->next; } if (doomed != nil) { if (before == nil) { _first = doomed->next; } else { before->next = doomed->next; } delete doomed; } } void TimerQueue::expire(timeval curTime) { while (!isEmpty() && earliestTime() < curTime) { Timer* expired = _first; _first = _first->next; expired->handler->timerExpired(curTime.tv_sec, curTime.tv_usec); delete expired; } } /* * Interface to child process handling. */ struct Child { Child(pid_t pid, IOHandler* h, Child* n); pid_t pid; // process's PID int status; // wait status IOHandler* handler; // associated handler Child* next; }; class ChildQueue { public: ChildQueue(); virtual ~ChildQueue(); bool isEmpty() const; bool isReady() const; void insert(pid_t, IOHandler*); void remove(IOHandler*); void notify(); void setStatus(pid_t, int status); private: Child* _first; // queue head bool _ready; // something is ready }; Child::Child(pid_t p, IOHandler* h, Child* n) { pid = p; status = -1; handler = h; next = n; } ChildQueue::ChildQueue() { _first = nil; _ready = false; } ChildQueue::~ChildQueue() { Child* doomed = _first; while (doomed != nil) { Child* next = doomed->next; delete doomed; doomed = next; } } inline bool ChildQueue::isEmpty() const { return _first == nil; } inline bool ChildQueue::isReady() const { return _ready; } void ChildQueue::insert(pid_t p, IOHandler* handler) { if (isEmpty()) { _first = new Child(p, handler, _first); } else { Child* before = _first; Child* after = _first->next; while (after != nil && p > after->pid) { before = after; after = after->next; } before->next = new Child(p, handler, after); } } void ChildQueue::remove(IOHandler* handler) { Child* before = nil; Child* doomed = _first; while (doomed != nil && doomed->handler != handler) { before = doomed; doomed = doomed->next; } if (doomed != nil) { if (before == nil) { _first = doomed->next; } else { before->next = doomed->next; } delete doomed; } } void ChildQueue::setStatus(pid_t p, int status) { for (Child* c = _first; c != nil; c = c->next) { if (c->pid == p) { c->status = status; _ready = true; break; } } } void ChildQueue::notify() { Child** prev = &_first; Child* c; while ((c = *prev) != nil) { if (c->status != -1) { c->handler->childStatus(c->pid, c->status); *prev = c->next; delete c; } else { prev = &c->next; } } _ready = false; } Dispatcher::Dispatcher() { _nfds = 0; _rmask = new FdMask; _wmask = new FdMask; _emask = new FdMask; _rmaskready = new FdMask; _wmaskready = new FdMask; _emaskready = new FdMask; _rtable = new IOHandler*[NOFILE]; _wtable = new IOHandler*[NOFILE]; _etable = new IOHandler*[NOFILE]; _queue = new TimerQueue; _cqueue = new ChildQueue; for (int i = 0; i < NOFILE; i++) { _rtable[i] = nil; _wtable[i] = nil; _etable[i] = nil; } } Dispatcher::~Dispatcher() { delete _rmask; delete _wmask; delete _emask; delete _rmaskready; delete _wmaskready; delete _emaskready; delete [] _rtable; delete [] _wtable; delete [] _etable; delete _queue; delete _cqueue; } Dispatcher& Dispatcher::instance() { if (_instance == nil) { _instance = new Dispatcher; } return *_instance; } void Dispatcher::instance(Dispatcher* d) { _instance = d; } IOHandler* Dispatcher::handler(int fd, DispatcherMask mask) const { if (fd < 0 || fd >= NOFILE) { abort(); } IOHandler* cur = nil; if (mask == ReadMask) { cur = _rtable[fd]; } else if (mask == WriteMask) { cur = _wtable[fd]; } else if (mask == ExceptMask) { cur = _etable[fd]; } else { abort(); } return cur; } void Dispatcher::link(int fd, DispatcherMask mask, IOHandler* handler) { if (fd < 0 || fd >= NOFILE) { abort(); } attach(fd, mask, handler); } void Dispatcher::unlink(int fd) { if (fd < 0 || fd >= NOFILE) { abort(); } detach(fd); } void Dispatcher::attach(int fd, DispatcherMask mask, IOHandler* handler) { if (mask == ReadMask) { _rmask->setBit(fd); _rtable[fd] = handler; } else if (mask == WriteMask) { _wmask->setBit(fd); _wtable[fd] = handler; } else if (mask == ExceptMask) { _emask->setBit(fd); _etable[fd] = handler; } else { abort(); } if (_nfds < fd+1) { _nfds = fd+1; } } void Dispatcher::detach(int fd) { _rmask->clrBit(fd); _rtable[fd] = nil; _wmask->clrBit(fd); _wtable[fd] = nil; _emask->clrBit(fd); _etable[fd] = nil; if (_nfds == fd+1) { while (_nfds > 0 && _rtable[_nfds-1] == nil && _wtable[_nfds-1] == nil && _etable[_nfds-1] == nil ) { _nfds--; } } } void Dispatcher::startTimer(long sec, long usec, IOHandler* handler) { timeval deltaTime; deltaTime.tv_sec = sec; deltaTime.tv_usec = usec; _queue->insert(TimerQueue::currentTime() + deltaTime, handler); } void Dispatcher::stopTimer(IOHandler* handler) { _queue->remove(handler); } void Dispatcher::startChild(int pid, IOHandler* handler) { _cqueue->insert(pid, handler); } void Dispatcher::stopChild(IOHandler* handler) { _cqueue->remove(handler); } bool Dispatcher::setReady(int fd, DispatcherMask mask) { if (handler(fd, mask) == nil) { return false; } if (mask == ReadMask) { _rmaskready->setBit(fd); } else if (mask == WriteMask) { _wmaskready->setBit(fd); } else if (mask == ExceptMask) { _emaskready->setBit(fd); } else { return false; } return true; } void Dispatcher::dispatch() { dispatch(nil); } bool Dispatcher::dispatch(long& sec, long& usec) { timeval howlong; timeval prevTime; timeval elapsedTime; howlong.tv_sec = sec; howlong.tv_usec = usec; prevTime = TimerQueue::currentTime(); bool success = dispatch(&howlong); elapsedTime = TimerQueue::currentTime() - prevTime; if (howlong > elapsedTime) { howlong = howlong - elapsedTime; } else { howlong = TimerQueue::zeroTime(); /* Used all of timeout */ } sec = howlong.tv_sec; usec = howlong.tv_usec; return success; } bool Dispatcher::dispatch(timeval* howlong) { FdMask rmaskret; FdMask wmaskret; FdMask emaskret; int nfound; if (anyReady()) { nfound = fillInReady(rmaskret, wmaskret, emaskret); } else { nfound = waitFor(rmaskret, wmaskret, emaskret, howlong); } notify(nfound, rmaskret, wmaskret, emaskret); return (nfound != 0); } bool Dispatcher::anyReady() const { return _rmaskready->anySet() || _wmaskready->anySet() || _emaskready->anySet(); } int Dispatcher::fillInReady( FdMask& rmaskret, FdMask& wmaskret, FdMask& emaskret ) { rmaskret = *_rmaskready; wmaskret = *_wmaskready; emaskret = *_emaskready; _rmaskready->zero(); _wmaskready->zero(); _emaskready->zero(); return rmaskret.numSet() + wmaskret.numSet() + emaskret.numSet(); } //#if defined(sgi) //void Dispatcher::sigCLD(...) { //#else //#if defined(AIXV4) //void Dispatcher::sigCLD(int) { //#else //void Dispatcher::sigCLD() { //#endif //#endif // // From what I can see from other packages that have been ported to a lot // of systems, it looks like you can get away with declaring your signal // handlers to have an argument of int. I'm not entirely sure this is // true, however. Apparently you had some problems in the past with this. // The actual type could be guessed by autoconf, I suppose, if it's // worth it to devise a test. // RETSIGTYPE #if defined(HAVE_BSD_SIGNALS) || defined(HAVE_POSIX_SIGNALS) Dispatcher::sigCLD(int) #else // When is this used? Dispatcher::sigCLD(...) #endif { pid_t pid; int status; while ((pid = waitpid(-1, &status, WNOHANG)) > 0) { Dispatcher::instance()._cqueue->setStatus(pid, status); } } #define fxSIGHANDLER #define fxSIGVECHANDLER #define fxSIGACTIONHANDLER // Shouldn't be necessary to cast if the // compiler is ANSI conformant since it // already knows the type of the routine. // (Unless I've overlooked something.) //#ifndef fxSIGHANDLER //#define fxSIGHANDLER //#endif //#ifndef fxSIGVECHANDLER //#define fxSIGVECHANDLER (void(*)(int)) //#endif //#if !defined(fxSIGACTIONHANDLER) && (defined(__GNUC__) || (defined(SGI) && SGI == 5)) //#define fxSIGACTIONHANDLER (void(*)(...)) //#endif //#if !defined(fxSIGACTIONHANDLER) && (defined(SVR4) || defined(sgi)) //#define fxSIGACTIONHANDLER (void(*)(int)) //#endif //#if !defined(fxSIGACTIONHANDLER) //#define fxSIGACTIONHANDLER (void(*)()) //#endif #ifndef SA_INTERRUPT #define SA_INTERRUPT 0 #endif #if defined(sun) && defined(__GNUC__) && !defined(SVR4) extern "C" { int sigvec(int, struct sigvec*, struct sigvec*);} #endif #if defined(AIXV3) extern "C" { int sigvec(int, struct sigvec*, struct sigvec*);} #endif int Dispatcher::waitFor( FdMask& rmaskret, FdMask& wmaskret, FdMask& emaskret, timeval* howlong ) { int nfound; #if defined(HAVE_BSD_SIGNALS) // ifdef SV_INTERRUPT /* BSD-style */ static struct sigvec sv, osv; #elif defined(HAVE_POSIX_SIGNALS) // #ifdef SA_NOCLDSTOP /* POSIX */ static struct sigaction sa, osa; #else /* System V-style */ void (*osig)(); #endif if (!_cqueue->isEmpty()) { #if defined(HAVE_BSD_SIGNALS) // #ifdef SV_INTERRUPT /* BSD-style */ sv.sv_handler = fxSIGVECHANDLER(&Dispatcher::sigCLD); sv.sv_flags = SV_INTERRUPT; sigvec(SIGCLD, &sv, &osv); #elif defined(HAVE_POSIX_SIGNALS) // #ifdef SA_NOCLDSTOP /* POSIX */ sa.sa_handler = fxSIGACTIONHANDLER(&Dispatcher::sigCLD); sa.sa_flags = SA_INTERRUPT; sigaction(SIGCLD, &sa, &osa); #else /* System V-style */ osig = (void (*)())signal(SIGCLD, fxSIGHANDLER(&Dispatcher::sigCLD)); #endif } do { rmaskret = *_rmask; wmaskret = *_wmask; emaskret = *_emask; howlong = calculateTimeout(howlong); //#if 0 && defined(hpux) // nfound = select( // _nfds, (int*)&rmaskret, (int*)&wmaskret, (int*)&emaskret, howlong // ); //#else nfound = select(_nfds, &rmaskret, &wmaskret, &emaskret, howlong); //#endif } while (nfound < 0 && !handleError()); if (!_cqueue->isEmpty()) { #if defined(HAVE_BSD_SIGNALS) // #ifdef SV_INTERRUPT /* BSD-style */ sigvec(SIGCLD, &osv, (struct sigvec*) 0); #elif defined(HAVE_POSIX_SIGNALS) // #ifdef SA_NOCLDSTOP /* POSIX */ sigaction(SIGCLD, &osa, (struct sigaction*) 0); #else /* System V-style */ (void) signal(SIGCLD, fxSIGHANDLER(osig)); #endif } return nfound; /* Timed out or input available */ } void Dispatcher::notify( int nfound, FdMask& rmaskret, FdMask& wmaskret, FdMask& emaskret ) { for (int i = 0; i < _nfds && nfound > 0; i++) { if (rmaskret.isSet(i)) { int status = _rtable[i]->inputReady(i); if (status < 0) { detach(i); } else if (status > 0) { _rmaskready->setBit(i); } nfound--; } if (wmaskret.isSet(i)) { int status = _wtable[i]->outputReady(i); if (status < 0) { detach(i); } else if (status > 0) { _wmaskready->setBit(i); } nfound--; } if (emaskret.isSet(i)) { int status = _etable[i]->exceptionRaised(i); if (status < 0) { detach(i); } else if (status > 0) { _emaskready->setBit(i); } nfound--; } } if (!_queue->isEmpty()) { _queue->expire(TimerQueue::currentTime()); } if (_cqueue->isReady()) { _cqueue->notify(); } } timeval* Dispatcher::calculateTimeout(timeval* howlong) const { static timeval timeout; if (!_queue->isEmpty()) { timeval curTime; curTime = TimerQueue::currentTime(); if (_queue->earliestTime() > curTime) { timeout = _queue->earliestTime() - curTime; if (howlong == nil || *howlong > timeout) { howlong = &timeout; } } else { timeout = TimerQueue::zeroTime(); howlong = &timeout; } } return howlong; } bool Dispatcher::handleError() { switch (errno) { case EBADF: checkConnections(); break; case EINTR: if (_cqueue->isReady()) { return true; } break; #if defined(CYGWIN) case 0: break; #endif default: printf("errno=%d\n", errno); exit(1); /*NOTREACHED*/ } return false; // retry select; } void Dispatcher::checkConnections() { FdMask rmask; timeval poll = TimerQueue::zeroTime(); for (int fd = 0; fd < _nfds; fd++) { if (_rtable[fd] != nil) { rmask.setBit(fd); //#if 0 && defined(hpux) // if (select(fd+1, (int*)&rmask, nil, nil, &poll) < 0) { //#else if (select(fd+1, &rmask, nil, nil, &poll) < 0) { //#endif detach(fd); } rmask.clrBit(fd); } } } neuron-7.6.3/src/lib/Dispatch/iohandler.cpp000077500000000000000000000033241340731477100206160ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include // Implement conceptually abstract virtual functions in the base class // so derived classes don't have to implement unused ones. IOHandler::IOHandler() {} IOHandler::~IOHandler() {} int IOHandler::inputReady(int) { return -1; } int IOHandler::outputReady(int) { return -1; } int IOHandler::exceptionRaised(int) { return -1; } void IOHandler::timerExpired(long, long) {} void IOHandler::childStatus(pid_t, int) {} neuron-7.6.3/src/lib/Dispatch/iostreamb.cpp000066400000000000000000000277221340731477100206430ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include // Make sure that these assumptions about the sizes of integral types // hold for your machine. If your machine does not have 32-bit and // 16-bit integers, then you cannot use binary I/O because other // machines will expect the integers to be these sizes. If your // machine does not have 8-bit characters, then I don't know how // you're going to communicate with other machines! typedef long INT32; typedef short INT16; typedef unsigned long UINT32; typedef unsigned short UINT16; // Assume the peer machine has the same endian architecture but // disable binary I/O by default anyway. The two machines should // always negotiate these two options before enabling binary I/O. iosb::iosb() : _binary(false), _swapped(false) {} iosb::~iosb() {} // Get and set iosb's extra state information. Verify that the // assumptions about sizes of integral types hold before enabling // binary I/O; if they do not hold, then refuse to enable binary I/O. bool iosb::binary() const { return _binary; } void iosb::binary(bool binary) { if (binary) { // don't use consts; cfront has wrong idea of their values UINT32 max32 = ~0; UINT16 max16 = ~0; if (max32 != 0xffffffff || max16 != 0xffff) { binary = false; } } _binary = binary; } bool iosb::swapped() const { return _swapped; } void iosb::swapped(bool swapped) { _swapped = swapped; } // Provide a constructor for derived classes to use and a constructor // for public use. istreamb::istreamb() {} istreamb::istreamb(streambuf* b) { init(b); } istreamb::~istreamb() {} // Redefine these functions to extract binary data where possible for // faster I/O throughput and to discard delimiters automatically. // Binary integral values occupy the length implied by their type and // already fit this machine's endian architecture. Formatted integral // and floating point values end in a blank character that is // extracted. Strings end in a null character that is extracted. istreamb& istreamb::operator>>(char& c) { get(c); // assume c is 8 bits long on all machines return *this; } istreamb& istreamb::operator>>(unsigned char& uc) { get(uc); // assume uc is 8 bits long on all machines return *this; } istreamb& istreamb::operator>>(short& s) { if (_binary) { INT16 value; read((char*)&value, sizeof(value)); if (good()) { s = (short)value; if (s != value) { setstate(ios::failbit); // overflow: value won't fit in short } } } else { istream::operator>>(s); get(); } return *this; } istreamb& istreamb::operator>>(unsigned short& us) { if (_binary) { UINT16 value; read((char*)&value, sizeof(value)); if (good()) { us = (unsigned short)value; if (us != value) { setstate(ios::failbit); // overflow: value won't fit in ushort } } } else { istream::operator>>(us); get(); } return *this; } istreamb& istreamb::operator>>(int& i) { if (_binary) { INT32 value; read((char*)&value, sizeof(value)); if (good()) { i = (int)value; if (i != value) { setstate(ios::failbit); // overflow: value won't fit in int } } } else { istream::operator>>(i); get(); } return *this; } istreamb& istreamb::operator>>(unsigned int& ui) { if (_binary) { UINT32 value; read((char*)&value, sizeof(value)); if (good()) { ui = (unsigned int)value; if (ui != value) { setstate(ios::failbit); // overflow: value won't fit in uint } } } else { istream::operator>>(ui); get(); } return *this; } istreamb& istreamb::operator>>(long& l) { if (_binary) { INT32 value; read((char*)&value, sizeof(value)); if (good()) { l = (long)value; if (l != value) { setstate(ios::failbit); // overflow: value won't fit in long } } } else { istream::operator>>(l); get(); } return *this; } istreamb& istreamb::operator>>(unsigned long& ul) { if (_binary) { UINT32 value; read((char*)&value, sizeof(value)); if (good()) { ul = (unsigned long)value; if (ul != value) { setstate(ios::failbit); // overflow: value won't fit in ulong } } } else { istream::operator>>(ul); get(); } return *this; } istreamb& istreamb::operator>>(float& f) { istream::operator>>(f); get(); return *this; } istreamb& istreamb::operator>>(double& d) { istream::operator>>(d); get(); return *this; } istreamb& istreamb::operator>>(char* p) { const int MAXINT = (int)(((unsigned)-1) >> 1); const int w = width(0); getline(p, w ? w : MAXINT, '\0'); if (w && gcount() == w - 1) { setstate(ios::failbit); } return *this; } istreamb& istreamb::operator>>(unsigned char* up) { const int MAXINT = (int)(((unsigned)-1) >> 1); const int w = width(0); getline(up, w ? w : MAXINT, '\0'); if (w && gcount() == w - 1) { setstate(ios::failbit); } return *this; } // Redefine the rest of the overloaded operator>> functions that we // want to keep in the derived class. istreamb& istreamb::operator>>(istream& (*f)(istream&)) { istream::operator>>(f); return *this; } istreamb& istreamb::operator>>(ios& (*f)(ios&)) { istream::operator>>(f); return *this; } // Provide a constructor for derived classes to use and a constructor // for public use. ostreamb::ostreamb() {} ostreamb::ostreamb(streambuf* b) { init(b); } ostreamb::~ostreamb() {} // Decrement the width by one to take into account the delimiter // character that all the inserters insert after a formatted value. inline void ostreamb::fixwidth() { register int w = width(); if (w) { width(w - 1); } } // Redefine these functions to insert binary data where possible for // faster I/O throughput and to delimit formatted data automatically. // Binary integral values will occupy the length implied by their type // and fit the peer's endian architecture. Formatted integral and // floating point values will end in a blank character. Strings will // end in a null character. You need not, and should not, insert // explicit delimiters. ostreamb& ostreamb::operator<<(char c) { put(c); // assume c is 8 bits long on all machines return *this; } ostreamb& ostreamb::operator<<(unsigned char uc) { put(uc); // assume uc is 8 bits long on all machines return *this; } ostreamb& ostreamb::operator<<(short s) { if (_binary) { INT16 value = (INT16)s; if (value != s) { setstate(ios::failbit); // overflow: number won't fit in 16 bits } else if (_swapped) { INT16 copy = value; ((char*)&value)[0] = ((char*)©)[1]; ((char*)&value)[1] = ((char*)©)[0]; } width(0); write((char*)&value, sizeof(value)); } else { fixwidth(); ostream::operator<<(s); put(' '); } return *this; } ostreamb& ostreamb::operator<<(unsigned short us) { if (_binary) { UINT16 value = (UINT16)us; if (value != us) { setstate(ios::failbit); // number won't fit } else if (_swapped) { UINT16 copy = value; ((char*)&value)[0] = ((char*)©)[1]; ((char*)&value)[1] = ((char*)©)[0]; } width(0); write((char*)&value, sizeof(value)); } else { fixwidth(); ostream::operator<<(us); put(' '); } return *this; } ostreamb& ostreamb::operator<<(int i) { return *this << (long)i; } ostreamb& ostreamb::operator<<(unsigned int ui) { return *this << (unsigned long)ui; } ostreamb& ostreamb::operator<<(long l) { if (_binary) { INT32 value = (INT32)l; if (value != l) { setstate(ios::failbit); // overflow: number won't fit in 32 bits } else if (_swapped) { INT32 copy = value; ((char*)&value)[0] = ((char*)©)[3]; ((char*)&value)[1] = ((char*)©)[2]; ((char*)&value)[2] = ((char*)©)[1]; ((char*)&value)[3] = ((char*)©)[0]; } width(0); write((char*)&value, sizeof(value)); } else { fixwidth(); ostream::operator<<(l); put(' '); } return *this; } ostreamb& ostreamb::operator<<(unsigned long ul) { if (_binary) { UINT32 value = (UINT32)ul; if (value != ul) { setstate(ios::failbit); // overflow: number won't fit in 32 bits } else if (_swapped) { UINT32 copy = value; ((char*)&value)[0] = ((char*)©)[3]; ((char*)&value)[1] = ((char*)©)[2]; ((char*)&value)[2] = ((char*)©)[1]; ((char*)&value)[3] = ((char*)©)[0]; } width(0); write((char*)&value, sizeof(value)); } else { fixwidth(); ostream::operator<<(ul); put(' '); } return *this; } ostreamb& ostreamb::operator<<(float f) { fixwidth(); ostream::operator<<(f); put(' '); return *this; } ostreamb& ostreamb::operator<<(double d) { fixwidth(); ostream::operator<<(d); put(' '); return *this; } ostreamb& ostreamb::operator<<(const char* p) { fixwidth(); ostream::operator<<(p); put('\0'); return *this; } ostreamb& ostreamb::operator<<(const unsigned char* up) { fixwidth(); ostream::operator<<((const char*)up); // 2.0 ostream omitted unsigned char* put('\0'); return *this; } // Redefine the rest of the overloaded operator<< functions that we // want to keep in the derived class. ostreamb& ostreamb::operator<<(ostream& (*f)(ostream&)) { ostream::operator<<(f); return *this; } ostreamb& ostreamb::operator<<(ios& (*f)(ios&)) { ostream::operator<<(f); return *this; } // Provide a constructor for derived classes to use and a constructor // for public use. iostreamb::iostreamb() {} iostreamb::iostreamb(streambuf* b) { init(b); } iostreamb::~iostreamb() {} // Negotiate the option of binary I/O with the remote iostreamb. If // binary I/O is set, compare endians to enable swapping if necessary. // Ordinarily we don't need an explicit flush when we're switching // from insertion to extraction, but we do here because the first // underflow may read both format and remoteEndian, thus preventing // underflow from being called again and flushing localEndian. Tying // the stream to itself won't work either because 1) ipfx won't call // flush if remoteEndian is already available, and 2) opfx will make // the stream flush itself before every insertion because it doesn't // check for streams tied to themselves. Sigh.... void iostreamb::negotiate(bool b) { if (!good()) { return; } binary(b); char format = binary() ? 'T' : 'F'; *this << format; flush(); *this >> format; if (format != 'T' && format != 'F') { setstate(ios::badbit); } else if (format == 'F') { binary(false); } if (binary()) { int indian = 1; char localEndian = (*(char*)&indian) ? 'l' : 'B'; char remoteEndian = localEndian; *this << localEndian; flush(); *this >> remoteEndian; if (remoteEndian != 'l' && remoteEndian != 'B') { setstate(ios::badbit); } else if (remoteEndian != localEndian) { swapped(true); } } } neuron-7.6.3/src/lib/Dispatch/netinet_in.h000077500000000000000000000034431340731477100204540ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * C++ interface to internet definitions. */ #ifndef netinet_in_h /* * Don't try to hide the ntohl prototypes because they may be * defined as macros, but don't define them as extern "C" either. */ #include #ifndef __lucid #ifndef ntohl /* * The operations are defined as functions, possibly without prototypes, * so we provide our own extern "C" declarations. */ extern "C" { unsigned long ntohl(unsigned long); unsigned long htonl(unsigned long); unsigned short ntohs(unsigned short); unsigned short htons(unsigned short); } #endif #endif #endif neuron-7.6.3/src/lib/Dispatch/rpcbuf.cpp000066400000000000000000000354751340731477100201430ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include /* must come before on some systems */ #include #include "netinet_in.h" #include #include #include #include #ifndef __DECCXX #include #endif #include #include #include // I need a pointer to an iostreamb so I can insert and extract values // in the length field of RPC requests. If I don't have a stream, I // won't allow you to call start_request(). rpcbuf::rpcbuf(iostreamb* mystream) : streambuf(), _mystream(mystream), _rptr(nil), _actualWidth(0), _host(nil), _port(0), _fd(-1), _opened(false), _close(false), _nonblocking(false), _verbose(true) {} // Free the buffer used to store the put area. The streambuf // destructor will free the buffer used to store the get area. rpcbuf::~rpcbuf() { close(); delete pbase(); setp(nil, nil); } // Return information about the connection. const char* rpcbuf::host() { return _host; } int rpcbuf::port() { if (!_opened) { return 0; } if (_port) { return _port; } struct sockaddr_in name; int name_len = sizeof(name); if (getsockname(_fd, (struct sockaddr*)&name, &name_len) < 0) { sys_error("rpcbuf::port: getsockname"); return 0; } _port = ntohs(name.sin_port); return _port; } int rpcbuf::fd() { return _fd; } bool rpcbuf::opened() { return _opened; } bool rpcbuf::nonblocking() { return _nonblocking; } // Create a socket, bind the socket to a port address, and prepare to // accept incoming connections. rpcbuf* rpcbuf::listen(int port) { struct sockaddr_in name; Memory::zero(&name, sizeof(name)); name.sin_family = AF_INET; name.sin_port = htons(port); name.sin_addr.s_addr = htonl(INADDR_ANY); if (_opened) { error("rpcbuf::listen: already using a file number"); return nil; } int fd = socket(AF_INET, SOCK_STREAM, 0); if (fd < 0) { sys_error("rpcbuf::listen: socket"); return nil; } if (bind(fd, (struct sockaddr*)&name, sizeof(name)) < 0) { sys_error("rpcbuf::listen: bind"); ::close(fd); return nil; } if (::listen(fd, SOMAXCONN) < 0) { sys_error("rpcbuf::listen: listen"); ::close(fd); return nil; } _host = nil; _port = port; _fd = fd; _opened = true; _close = true; _nonblocking = false; return this; } // Create a socket and make a connection to another socket. Do // retries in case the peer has hit its backlog, but not too many // retries since the error is indistinguishable from there not being a // peer listening at all. rpcbuf* rpcbuf::connect(const char* host, int port) { struct sockaddr_in name; Memory::zero(&name, sizeof(name)); name.sin_family = AF_INET; name.sin_port = htons(port); if (_opened) { error("rpcbuf::connect: already using a file number"); return nil; } const unsigned long INVALIDADDR = (unsigned long) -1; unsigned long hostinetaddr = INVALIDADDR; if (isascii(host[0]) && isdigit(host[0])) { hostinetaddr = inet_addr(host); name.sin_addr.s_addr = hostinetaddr; } if (hostinetaddr == INVALIDADDR) { /* cast to workaround bug in prototype on some systems */ struct hostent* hp = gethostbyname((char*)host); if (hp == nil) { error("rpcbuf::connect: gethostbyname: no such host"); return nil; } if (hp->h_addrtype != AF_INET) { error("rpcbuf::connect: gethostbyname: not an Internet host"); return nil; } Memory::copy(hp->h_addr, &name.sin_addr, sizeof(name.sin_addr)); } int fd = -1; int retries = 2; do { fd = socket(AF_INET, SOCK_STREAM, 0); if (fd < 0) { sys_error("rpcbuf::connect: socket"); return nil; } if (::connect(fd, (struct sockaddr*)&name, sizeof(name)) < 0) { if (errno == ECONNREFUSED && retries > 0) { // try again since peer's backlog may just be full ::close(fd); sleep(1); continue; } else { sys_error("rpcbuf::connect: connect"); ::close(fd); return nil; } } break; // the connection succeeded } while (retries-- > 0); _host = host; _port = port; _fd = fd; _opened = true; _close = true; _nonblocking = false; return this; } // Accept an incoming connection, allocate a new file descriptor for // it, and return the new file descriptor. rpcbuf* rpcbuf::accept(int& fd) { struct sockaddr_in name; int name_len = sizeof(name); if (!_opened) { error("rpcbuf::accept: not using a file number yet"); return nil; } fd = ::accept(_fd, (struct sockaddr*)&name, &name_len); if (fd < 0) { sys_error("rpcbuf::accept: accept"); return nil; } return this; } // Attach the streambuf to a file descriptor. The streambuf cannot // close the file descriptor because something else might be using it. rpcbuf* rpcbuf::attach(int fd) { if (_opened) { error("rpcbuf::attach: already using a file number"); return nil; } if (fd < 0) { error("rpcbuf::attach: cannot use a negative file number"); return nil; } _host = nil; _port = 0; _fd = fd; _opened = true; _close = false; _nonblocking = false; return this; } // Empty the get/put areas, close the file descriptor if nothing else // might use it, and detach the streambuf from the file descriptor. rpcbuf* rpcbuf::close() { if (!_opened) { return nil; } sync(); int ok = 0; if (_close) { ok = ::close(_fd); if (ok < 0) { sys_error("rpcbuf::close: close"); } } _host = nil; _port = 0; _fd = -1; _opened = false; _close = false; _nonblocking = false; return (ok < 0) ? nil : this; } // Set or clear non-blocking I/O on the file descriptor. rpcbuf* rpcbuf::nonblocking(bool nonblocking) { if (!_opened) { error("rpcbuf::nonblocking: not using a file number yet"); return nil; } if (_nonblocking != nonblocking) { int flags = fcntl(_fd, F_GETFL, 0); if (flags < 0) { sys_error("rpcbuf::nonblocking: F_GETFL fcntl"); return nil; } if (nonblocking) { flags |= O_NDELAY; } else { flags &= ~O_NDELAY; } if (fcntl(_fd, F_SETFL, flags) < 0) { sys_error("rpcbuf::nonblocking: F_SETFL fcntl"); return nil; } } _nonblocking = nonblocking; return this; } // Set or clear printing of system error messages. rpcbuf* rpcbuf::verbose(bool verbose) { _verbose = verbose; return this; } // Finish the current request, if any, and then start a new request. // The request begins with a length field, so insert a zero with // enough padding characters (if using formatted I/O) to overwrite the // zero later with 2**32 - 1, the largest possible length for a // request (the length must fit in an int). const int FIELDWIDTH = 11; // large enough to hold "2147483647 " int rpcbuf::start_request() { if (!_mystream || !_opened || allocate() == EOF) { return EOF; } finish_request(); setr(pptr()); const int length = 0; mystream().width(FIELDWIDTH); mystream() << length; _actualWidth = pptr() - rptr(); return 0; } // Finish the current request by inserting its final length in the // length field at the beginning of the request (overwriting the old // value). The length of the request includes its own length field. void rpcbuf::finish_request() { int length = pptr() - rptr(); if (rptr() && length > 0) { pbump(-length); mystream().width(FIELDWIDTH); mystream() << length; if (_actualWidth != pptr() - rptr()) { error("rpcbuf::finish_request: length field's width changed"); } pbump(length - (pptr() - rptr())); } setr(nil); } // Calculate the width of the length field (_actualWidth) and check // that all of the length field is in the buffer. If so, extract the // length, move the get pointer back to the beginning of the request, // and return 0 if all of the request is in the buffer. Otherwise, // return EOF. By checking for EOF, the caller avoids extracting a // request before it's completely buffered. The caller must call // select() to wait for new input and call rpcbuf::underflow() to // enqueue it until the complete request is buffered. int rpcbuf::read_request() { if (!_mystream) { return EOF; } if (!_actualWidth) { char* orig = pptr(); const int length = 0; mystream().width(FIELDWIDTH); mystream() << length; _actualWidth = pptr() - orig; pbump(orig - pptr()); } int navail = in_avail(); if (navail < _actualWidth) { return EOF; } char* orig = gptr(); int length = 0; mystream() >> length; gbump(orig - gptr()); if (length <= 0) { error("rpcbuf::read_request: zero or negative length"); return EOF; } if (length > ebuf() - eback() && !expand_g(length * 2)) { error("rpcbuf::read_request: out of memory"); return EOF; } if (navail < length) { return EOF; } else { return 0; } } // Finish the current RPC request if there's nothing to append to it, // thus allowing flush to send the current RPC request. Send any // outgoing data using a loop to safeguard against partial writes. // Shift any still incomplete RPC request to the beginning of the put // area to make room for more data. Append the overflow char if any. int rpcbuf::overflow(int c) { if (!_opened || allocate() == EOF) { return EOF; } if (c == EOF) { finish_request(); } if (rptr() == pbase() && pptr() >= epptr() && !expand_p()) { error("rpcbuf::overflow: out of memory"); return EOF; } int nwrite = (rptr() >= pbase()) ? rptr() - pbase() : out_waiting(); int count = 0; while (count < nwrite) { int nsent = write(_fd, pbase() + count, nwrite - count); if (nsent < 0) { sys_error("rpcbuf::overflow: write"); return EOF; } count += nsent; } if (rptr() > pbase()) { Memory::copy(rptr(), pbase(), pptr() - rptr()); rbump(-nwrite); } pbump(-nwrite); if (c != EOF) { sputc(c); } return zapeof(c); } // Empty the put area before filling the get area in case the input // depends on the output just flushed. Move any unread data between // gptr() and egptr() to the beginning of the get area. The get area // may contain unread data under nonblocking I/O because an incomplete // RPC request is not extracted until the rest of its data arrives. // Read as much data as available into the free space between egptr() // and ebuf() (the get area occupies the entire buffer). Move egptr() // to the end of the new data. Return the first unread character. int rpcbuf::underflow() { if (!_opened || allocate() == EOF) { return EOF; } if (overflow() == EOF) { return EOF; } int nunread = in_avail(); if (nunread) { Memory::copy(gptr(), eback(), nunread); } setg(eback(), eback(), eback() + nunread); int nread = read(_fd, egptr(), ebuf() - egptr()); if (nread < 0) { sys_error("rpcbuf::underflow: read"); return EOF; } if (nread == 0) { return EOF; } setg(eback(), gptr(), egptr() + nread); return zapeof(*gptr()); } // Probably called from ios's destructor. Can't do anything with // still unread data except discard it, but can flush any outgoing RPC // requests from the put area. int rpcbuf::sync() { gbump(in_avail()); return out_waiting() ? overflow() : 0; } // Can't seek on a socket, but can return the get pointer's current // position so that the caller can find out how many bytes he read // since the get pointer's last position (within the same request). #ifdef cplusplus_2_1 streampos rpcbuf::seekoff(streamoff offset, ios::seek_dir dir, int mode) { #else streampos rpcbuf::seekoff(streamoff offset, seek_dir dir, int mode) { #endif if (!_opened || !gptr()) { return EOF; } if (offset != 0 || dir != ios::cur || mode != ios::in) { return EOF; } return (streampos)gptr(); } // Refuse any attempt to set the buffers for storing incoming and // outgoing RPC requests because we need the ability to dynamically // expand the buffers' sizes. streambuf* rpcbuf::setbuf(char*, int) { return nil; } // Dynamically allocate two separate buffers for storing incoming and // outgoing RPC requests. Allocating separate buffers for the get and // put areas makes it easier to expand either area later if necessary. int rpcbuf::doallocate() { const int RPCBUFSIZE = 2032; char* get = new char[RPCBUFSIZE]; if (!get) { error("rpcbuf::doallocate: out of memory"); return EOF; } setb(get, get + RPCBUFSIZE, true); setg(get, get, get); char* put = new char[RPCBUFSIZE]; if (!put) { error("rpcbuf::doallocate: out of memory"); return EOF; } setp(put, put + RPCBUFSIZE); setr(nil); return 0; } // Expand the get area to make room for a large incoming request. bool rpcbuf::expand_g(int newsize) { char* get = new char[newsize]; if (!get) { return false; } int navail = in_avail(); Memory::copy(gptr(), get, navail); delete eback(); setb(get, get + newsize, true); setg(get, get, get + navail); return true; } // Expand the put area to make room for additional data to be appended // to an outgoing request. bool rpcbuf::expand_p() { int newsize = (epptr() - pbase()) * 2; char* put = new char[newsize]; if (!put) { return false; } int nwaiting = out_waiting(); Memory::copy(pbase(), put, nwaiting); delete pbase(); setp(put, put + newsize); pbump(nwaiting); setr(put); return true; } // Print a user error message. void rpcbuf::error(const char* msg) { if (_verbose) { cerr << msg << "\n"; cerr.flush(); } } // Print a system error message. void rpcbuf::sys_error(const char* msg) { if (_verbose) { perror(msg); } } neuron-7.6.3/src/lib/Dispatch/rpchdr.cpp000077500000000000000000000065211340731477100201350ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include // Initialize the header for an outgoing RPC request. RpcHdr::RpcHdr(void* writer, int request) : _writer(writer), _request(request), _ndata(0) {} // Initialize the header for an incoming RPC request. RpcHdr::RpcHdr() : _reader(0), _request(0), _ndata(0) {} // If incomplete_request was set, explicitly call underflow in an // attempt to complete an incoming RPC request by reading additional // data and reset the flag. Set the stream in eof state if no // additional data was available or in fail state if it was already in // eof state. If the stream is still good, call read_request to check // if the incoming RPC request is complete yet. If it is, extract its // header, else set incomplete_request to note so. Decrement the // length (which counted the entire request) by the space that the // header occupied to count only the data following the header. rpcstream& operator>>(rpcstream& client, RpcHdr& hdr) { if (client.good() && client.incomplete_request()) { if (client.rdbuf()->underflow() != EOF) { client.incomplete_request(false); } else { client.clear(client.rdstate() | ios::eofbit); } } else if (client.eof()) { client.clear(client.rdstate() | ios::failbit); } if (client.good()) { if (client.rdbuf()->read_request() != EOF) { streampos beginning = client.tellg(); client >> hdr._ndata >> hdr._reader >> hdr._request; hdr._ndata -= (int)(client.tellg() - beginning); } else { client.incomplete_request(true); } } return client; } // Store the beginning of a new RPC request. The rpcbuf automatically // initializes the length field of the previous RPC request and skips // the put pointer past the length field of the new RPC request so // there's no need to examine hdr._ndata or insert its value. rpcstream& operator<<(rpcstream& server, const RpcHdr& hdr) { if (server && server.rdbuf()->start_request() != EOF) { server << hdr._reader << hdr._request; } else { server.clear(server.rdstate() | ios::failbit); } return server; } neuron-7.6.3/src/lib/Dispatch/rpcpeer.cpp000077500000000000000000000100061340731477100203040ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include #include #include // Store our parameters for use later since we can't call a derived // class's virtual function from a base constructor. RpcPeer::RpcPeer( const char* lPath, int lPort ) : IOHandler(), _lPath(lPath), _lPort(lPort), _service(nil), _running(false), _remote(false), _rHost(nil) {} // Delete our RPC service if we created one. Free any storage // allocated by RpcRegistry::find for the remote service's host name. RpcPeer::~RpcPeer() { if (_service) { stopListening(); } delete _rHost; } // Find the host name and port number registered by the remote RPC // service and try to open a connection to it. Unregister the remote // RPC service to prevent another attempt if the connection could not // be opened. If necessary, start up our own RPC service and wait for // the remote RPC service to contact us. void RpcPeer::init(const char* rPath) { if (_service || _remote) { return; } int rPort; _remote = RpcRegistry::find(rPath, _rHost, rPort); if (_remote && !createReaderAndWriter(_rHost, rPort)) { RpcRegistry::erase(rPath); _remote = false; } if (!_remote) { startListening(); } } // Read RPC requests until something tells us to quit the run loop. // If you're using the InterViews event-reading code, you don't have // to use this code since that code will also read RPC requests. void RpcPeer::run() { _running = true; while (_running) { Dispatcher::instance().dispatch(); } } void RpcPeer::quitRunning() { _running = false; } // Open an RPC service at a port number (zero means any available port // number). Store our RPC service's assigned port number in a file to // allow clients to find our service. Start listening for connections // from clients. void RpcPeer::startListening() { _service = new rpcbuf; rpcbuf* ok = _service->listen(_lPort); _lPort = _service->port(); if (!ok) { abort(); } if (!RpcRegistry::record(_lPath, _lPort)) { abort(); } Dispatcher::instance().link(_service->fd(), Dispatcher::ReadMask, this); } // Stop listening for connections from clients, unregister our RPC // service, and delete it. void RpcPeer::stopListening() { Dispatcher::instance().unlink(_service->fd()); RpcRegistry::erase(_lPath); delete _service; _service = nil; } // Accept a connection from a client. Ask a derived class to attach a // reader and a writer which will read RPC requests and send RPC // requests over the same connection. int RpcPeer::inputReady(int) { int fd; rpcbuf* ok = _service->accept(fd); if (!ok) { abort(); } createReaderAndWriter(fd); return 0; } neuron-7.6.3/src/lib/Dispatch/rpcreader.cpp000066400000000000000000000126471340731477100206250ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include #include // Prepare to read RPC requests from somebody else's connection or // prepare to handle RPC requests read by somebody else. Assume the // I/O format has already been negotiated. Start listening for RPC // requests on the connection, taking into account the special case // where RPC requests have already been buffered. Zero the function // array that a derived class will initialize with addresses of static // member functions to unmarshall RPC requests. RpcReader::RpcReader(rpcstream* _client, int nfcns) : IOHandler(), _nfcns(nfcns), _function(new PF[nfcns]), _client(_client), _delete(false), _fd(_client ? _client->rdbuf()->fd() : -1) { if (_client) { client().nonblocking(true); Dispatcher::instance().link(_fd, Dispatcher::ReadMask, this); if (client().rdbuf()->read_request() != EOF) { Dispatcher::instance().setReady(_fd, Dispatcher::ReadMask); client().incomplete_request(false); } } for (int i = 0; i < nfcns; i++) { _function[i] = nil; } } // Connect to a client through an already open file number. Negotiate // the I/O format. Start listening for RPC requests on the // connection, taking into account the special case where RPC requests // have already been buffered (when the I/O format was negotiated). // Zero the function array that a derived class will initialize with // addresses of static member functions to unmarshall RPC requests. RpcReader::RpcReader(int fd, int nfcns, bool binary) : IOHandler(), _nfcns(nfcns), _function(new PF[nfcns]), _client(new rpcstream), _delete(true), _fd(fd) { client().attach(fd); client().negotiate(binary); client().nonblocking(true); Dispatcher::instance().link(fd, Dispatcher::ReadMask, this); if (client().rdbuf()->read_request() != EOF) { Dispatcher::instance().setReady(fd, Dispatcher::ReadMask); client().incomplete_request(false); } for (int i = 0; i < nfcns; i++) { _function[i] = nil; } } // Stop listening for RPC requests on the connection if we have one. // Delete the connection if we created it ourselves. Note that // deleting a connection attached to a file number will not close that // file number. RpcReader::~RpcReader() { if (_fd >= 0) { Dispatcher::instance().unlink(_fd); } if (_delete) { delete _client; } delete[] _function; } // Read only one RPC request per call to allow the program to // interleave RPC requests from multiple clients. Look up the proper // reader to execute the request or skip over the request's data if it // could not be executed. Ask a derived class to take the appropriate // action (perhaps closing the file number or deleting ``this'') if no // more data is available or the data wasn't what we expected. int RpcReader::inputReady(int fd) { RpcHdr hdr; client() >> hdr; if (client().good() && !client().incomplete_request()) { RpcReader* reader = map(hdr.reader()); if (!execute(reader, hdr)) { client().ignore(hdr.ndata()); } } if (client().eof() || client().fail()) { connectionClosed(fd); return -1; // don't ever call me again (i.e., detach me) } else if (client().incomplete_request()) { return 0; // call me only when more input arrives } else { return 1; // call me again as soon as possible } } // Map the number to the reader that should unmarshall the RPC // request. Return this reader itself by default; derived classes // could return a different reader. RpcReader* RpcReader::map(unsigned long) { return this; } // Look up the static member function that will unmarshall the RPC // request's arguments and execute the request. Call that function // with the reader, RPC request header, and connection as arguments. // Return true if the function was called, false otherwise. bool RpcReader::execute(RpcReader* reader, RpcHdr& hdr) { if (!reader) { return false; } if (hdr.request() < 0 || hdr.request() >= reader->_nfcns) { return false; } PF func = reader->_function[hdr.request()]; if (!func) { return false; } (*func)(reader, hdr, client()); return true; } neuron-7.6.3/src/lib/Dispatch/rpcregistry.cpp000066400000000000000000000073771340731477100212370ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include #include #include #ifndef __DECCXX #include #endif #include #include #include #if defined(sun) && defined(SVR4) #include #define MAXHOSTNAMELEN SYS_NMLN #endif // Print a short error message describing the last error encountered // during a call to a system function. static ostream& perror(ostream& s) { #if defined(sun) && defined(SVR4) s << ": " << strerror(errno); #else if (errno > 0 && errno < sys_nerr) { s << ": " << sys_errlist[errno]; } #endif s << '\n'; return s; } // Record the RPC service's hostname and port number in the given // file. Remove the file before opening it in case it already exists // and the user has permission to delete it but not permission to // write data into it. bool RpcRegistry::record(const char* path, int port) { if (!path) { return false; } unlink(path); ofstream registry(path); if (!registry) { cerr << "RpcRegistry::record: open(" << path << ")" << perror; return false; } registry << Host::name() << ends << port; if (!registry) { cerr << "RpcRegistry::record: write" << perror; return false; } return true; } // Remove the file which stores the RPC service's hostname and port // number so that no more clients will be able to contact the RPC // service. bool RpcRegistry::erase(const char* path) { if (!path) { return false; } if (unlink(path) < 0) { cerr << "RpcRegistry::erase: unlink(" << path << ")" << perror; return false; } return true; } // Open the file which stores the RPC service's hostname and port // number. If the file does not exist, return failure silently. If // the file does exist, read the RPC service's hostname and port // number from it. If the RPC service and client are on the same // host, speed up I/O between them by returning "localhost" instead of // the host's true name. bool RpcRegistry::find(const char* path, char*& hostname, int& port) { if (!path) { return false; } ifstream registry(path); if (!registry) { return false; } if (!hostname) { hostname = new char[MAXHOSTNAMELEN]; } registry.getline(hostname, MAXHOSTNAMELEN, '\0'); registry >> port; if (!registry) { cerr << "RpcRegistry::find: error reading " << path << '\n'; return false; } if (strcmp(hostname, Host::name()) == 0) { strcpy(hostname, "localhost"); } return true; } neuron-7.6.3/src/lib/Dispatch/rpcservice.cpp000077500000000000000000000066641340731477100210300ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include #include #include // Start up an RPC service. If a filename is given, store our // service's assigned port number in it so clients can find us. RpcService::RpcService(int port) : IOHandler(), _path(nil), _port(port), _service(new rpcbuf), _running(false) { startListening(); } RpcService::RpcService(const char* path, int port) : IOHandler(), _path(path), _port(port), _service(new rpcbuf), _running(false) { startListening(); } // Close our RPC service if it was open. RpcService::~RpcService() { if (_service->opened()) { stopListening(); } delete _service; } // Read RPC requests until something tells us to quit the run loop. // If you're using the InterViews event-reading code, you don't have // to use this code since that code will also read RPC requests. void RpcService::run() { _running = true; while (_running) { Dispatcher::instance().dispatch(); } } void RpcService::quitRunning() { _running = false; } // Open an RPC service at a port number (zero means any available port // number). If a filename was given, store our service's assigned // port number in it to allow clients to find us. Start listening for // connections from clients. void RpcService::startListening() { rpcbuf* ok = _service->listen(_port); _port = _service->port(); if (!ok) { abort(); } if (_path && !RpcRegistry::record(_path, _port)) { abort(); } Dispatcher::instance().link(_service->fd(), Dispatcher::ReadMask, this); } // Stop listening for connections from clients, unregister our RPC // service if it was registered, and close it. void RpcService::stopListening() { Dispatcher::instance().unlink(_service->fd()); if (_path) { RpcRegistry::erase(_path); } _service->close(); } // Accept a connection from a client. Ask a derived class to attach a // reader which will read RPC requests from the connection. int RpcService::inputReady(int) { int fd; rpcbuf* ok = _service->accept(fd); if (!ok) { abort(); } createReader(fd); return 0; } neuron-7.6.3/src/lib/Dispatch/rpcstream.cpp000066400000000000000000000052051340731477100206460ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include // Specialize this class to RPC requests by initializing an rpcbuf. // Set incomplete_request to ensure the first attempt to extract an RPC // request will call underflow. rpcstream::rpcstream() : _buf(this), _incomplete_request(true) { init(&_buf); } rpcstream::~rpcstream() {} // Provide operations on the rpcbuf. Most change the stream's state // so radically that it's either cleared or failed. void rpcstream::listen(int port) { verify(rdbuf()->listen(port) != nil); } void rpcstream::connect(const char* host, int port) { verify(rdbuf()->connect(host, port) != nil); } int rpcstream::accept() { // no effect on stream's state int fd; if (!rdbuf()->accept(fd)) { return -1; } return fd; } void rpcstream::attach(int fd) { verify(rdbuf()->attach(fd) != nil); } void rpcstream::close() { verify(rdbuf()->close() != nil); } void rpcstream::nonblocking(bool nonblocking) { // can only fail, not clear if (!rdbuf()->nonblocking(nonblocking)) { setstate(ios::failbit); } } void rpcstream::verbose(bool verbose) { // no effect on stream's state rdbuf()->verbose(verbose); } // For some of the functions above, success means starting over with a // clean slate while failure means setting failbit as usual. void rpcstream::verify(int ok) { if (ok) { clear(); } else { setstate(ios::failbit); } } neuron-7.6.3/src/lib/Dispatch/rpcwriter.cpp000066400000000000000000000067021340731477100206720ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include #include /* for abort() */ // Open a connection to an RPC service at its registered host name and // port number, or give the host name and port number needed to open a // connection to the RPC service, or give the number of an already // open file descriptor, or give the address of an already open // rpcstream (connection). Negotiate the I/O format if opening a // connection. Terminate the program if errors should be fatal. RpcWriter::RpcWriter(const char* path, bool fatal, bool binary) : _server(new rpcstream), _delete(true), _host(nil) { open(path, fatal, binary); } RpcWriter::RpcWriter( const char* host, int port, bool fatal, bool binary ) : _server(new rpcstream), _delete(true), _host(nil) { server().verbose(fatal); server().connect(host, port); server().negotiate(binary); if (!server() && fatal) { abort(); } } RpcWriter::RpcWriter(int fd, bool fatal, bool binary) : _server(new rpcstream), _delete(true), _host(nil) { server().verbose(fatal); server().attach(fd); server().negotiate(binary); if (!server() && fatal) { abort(); } } RpcWriter::RpcWriter(rpcstream* server) : _server(server), _delete(false), _host(nil) {} // Close the connection to the server, although the file number won't // be closed if we attached the connection to it. Free any storage // allocated by RpcRegistry::find for the host name. RpcWriter::~RpcWriter() { if (_delete) { delete _server; } delete _host; } // Use a member function to open a connection to an RPC service at its // registered host name and port number so that a derived class's // constructor can retry the attempt if necessary. void RpcWriter::open(const char* path, bool fatal, bool binary) { int port; if (RpcRegistry::find(path, _host, port)) { server().verbose(fatal); server().connect(_host, port); server().negotiate(binary); } else { server().clear(ios::failbit | ios::badbit); } if (!server() && fatal) { cerr << "RpcWriter::open: service " << path << " not found" << "\n"; cerr.flush(); abort(); } } neuron-7.6.3/src/lib/IV-2_6/000077500000000000000000000000001340731477100153035ustar00rootroot00000000000000neuron-7.6.3/src/lib/IV-2_6/adjuster2_6.cpp000066400000000000000000000272341340731477100201470ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Implementation of Adjuster and derived classes. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include Adjuster::Adjuster(Interactor* i, int d) { Init(i, d); } Adjuster::Adjuster(const char* name, Interactor* i, int d) { SetInstance(name); Init(i, d); } void Adjuster::Init(Interactor* i, int d) { SetClassName("Adjuster"); view = i; highlighted = false; delay = d; timer = false; shown = new Perspective; plain = nil; hit = nil; mask = nil; input = new Sensor(onoffEvents); input->Catch(UpEvent); input->Catch(DownEvent); } void Adjuster::Reconfig() { Painter* p = new Painter(output); p->Reference(); Unref(output); output = p; shape->width = mask->Width(); shape->height = mask->Height(); } void Adjuster::AutoRepeat() { Event e; Poll(e); e.eventType = DownEvent; do { if (Check()) { Read(e); if (e.target == this) { switch (e.eventType) { case EnterEvent: Highlight(true); break; case LeaveEvent: Highlight(false); break; default: break; } } } else if (highlighted) { Flash(); AdjustView(e); Sync(); } } while (e.eventType != UpEvent); } static const int USEC_PER_DELAY_UNIT = 100000; // delay unit = 1/10 secs void Adjuster::HandlePress() { Event e; do { if (timer) { if (!Read(0, delay * USEC_PER_DELAY_UNIT, e)) { AutoRepeat(); return; } } else { Read(e); } if (e.target == this) { switch (e.eventType) { case EnterEvent: TimerOn(); Highlight(true); break; case LeaveEvent: TimerOff(); Highlight(false); break; case UpEvent: if (highlighted) { AdjustView(e); } break; default: break; } } } while (e.eventType != UpEvent); } void Adjuster::Flash() { Highlight(false); Highlight(true); } void Adjuster::TimerOn() { if (delay >= 0) { timer = true; } } void Adjuster::TimerOff() { timer = false; } Adjuster::~Adjuster() { Unref(shown); } void Adjuster::Handle(Event& e) { if (e.eventType == DownEvent) { Highlight(true); TimerOn(); if (delay == 0) { AutoRepeat(); } else { HandlePress(); } Highlight(false); TimerOff(); } } void Adjuster::Redraw(IntCoord, IntCoord, IntCoord, IntCoord) { IntCoord x = (xmax+1 - mask->Width())/2; IntCoord y = (ymax+1 - mask->Height())/2; if (highlighted) { output->Stencil(canvas, x, y, hit, mask); } else { output->Stencil(canvas, x, y, plain, mask); } } void Adjuster::Reshape(Shape& s) { shape->Rigid(s.hshrink, s.hstretch, s.vshrink, s.vstretch); } void Adjuster::Highlight(bool on) { if (highlighted != on) { highlighted = on; Draw(); } } void Adjuster::AdjustView(Event&) { // nop default } Zoomer::Zoomer(Interactor* i, float f) : Adjuster(i, NO_AUTOREPEAT) { Init(f); } Zoomer::Zoomer( const char* name, Interactor* i, float f ) : Adjuster(name, i, NO_AUTOREPEAT) { Init(f); } Zoomer::~Zoomer() { } void Zoomer::Init(float f) { SetClassName("Zoomer"); factor = f; } void Zoomer::AdjustView(Event&) { register Perspective* s = shown; IntCoord cx, cy; *s = *view->GetPerspective(); cx = s->curx + s->curwidth/2; cy = s->cury + s->curheight/2; s->curwidth = Math::round(float(s->curwidth) / factor); s->curheight = Math::round(float(s->curheight) / factor); s->curx = cx - s->curwidth/2; s->cury = cy - s->curheight/2; view->Adjust(*s); } inline Bitmap* MakeBitmap(void* bits, int width, int height) { Bitmap* b = new Bitmap(bits, width, height); b->Reference(); return b; } static Bitmap* enlMask; static Bitmap* enlPlain; static Bitmap* enlHit; Enlarger::Enlarger(Interactor* i) : Zoomer(i, 2.0) { Init(); } Enlarger::Enlarger(const char* name, Interactor* i) : Zoomer(name, i, 2.0) { Init(); } Enlarger::~Enlarger() { } void Enlarger::Init() { SetClassName("Enlarger"); if (enlMask == nil) { enlMask = MakeBitmap( enlarger_mask_bits, enlarger_mask_width, enlarger_mask_height ); enlPlain = MakeBitmap( enlarger_plain_bits, enlarger_plain_width, enlarger_plain_height ); enlHit = MakeBitmap( enlarger_hit_bits, enlarger_hit_width, enlarger_hit_height ); } mask = enlMask; plain = enlPlain; hit = enlHit; shape->Rigid(shape->width/2, hfil, shape->height/2); } static Bitmap* redMask; static Bitmap* redPlain; static Bitmap* redHit; Reducer::Reducer(Interactor* i) : Zoomer(i, 0.5) { Init(); } Reducer::Reducer(const char* name, Interactor* i) : Zoomer(name, i, 0.5) { Init(); } Reducer::~Reducer() { } void Reducer::Init() { SetClassName("Reducer"); if (redMask == nil) { redMask = MakeBitmap( reducer_mask_bits, reducer_mask_width, reducer_mask_height ); redPlain = MakeBitmap( reducer_plain_bits, reducer_plain_width, reducer_plain_height ); redHit = MakeBitmap( reducer_hit_bits, reducer_hit_width, reducer_hit_height ); } mask = redMask; plain = redPlain; hit = redHit; shape->Rigid(shape->width/2, hfil, shape->height/2); } enum MoveType { MOVE_LEFT, MOVE_RIGHT, MOVE_UP, MOVE_DOWN, MOVE_UNDEF }; Mover::Mover(Interactor* i, int delay1, int mt) : Adjuster(i, delay1) { Init(mt); } Mover::Mover( const char* name, Interactor* i, int delay1, int mt ) : Adjuster(name, i, delay1) { Init(mt); } Mover::~Mover() { } void Mover::Init(int mt) { SetClassName("Mover"); moveType = mt; } void Mover::AdjustView(Event& e) { register Perspective* s = shown; int amtx, amty; *s = *view->GetPerspective(); amtx = e.shift ? s->lx : s->sx; amty = e.shift ? s->ly : s->sy; switch (moveType) { case MOVE_LEFT: s->curx -= amtx; break; case MOVE_RIGHT: s->curx += amtx; break; case MOVE_UP: s->cury += amty; break; case MOVE_DOWN: s->cury -= amty; break; default: break; } view->Adjust(*s); } static Bitmap* lmoverMask; static Bitmap* lmoverPlain; static Bitmap* lmoverHit; LeftMover::LeftMover(Interactor* i, int delay1) : Mover(i, delay1, MOVE_LEFT) { Init(); } LeftMover::LeftMover( const char* name, Interactor* i, int delay1 ) : Mover(name, i, delay1, MOVE_LEFT) { Init(); } LeftMover::~LeftMover() { } void LeftMover::Init() { SetClassName("LeftMover"); if (lmoverMask == nil) { lmoverMask = MakeBitmap( lmover_mask_bits, lmover_mask_width, lmover_mask_height ); lmoverPlain = MakeBitmap( lmover_plain_bits, lmover_plain_width, lmover_plain_height ); lmoverHit = MakeBitmap( lmover_hit_bits, lmover_hit_width, lmover_hit_height ); } mask = lmoverMask; plain = lmoverPlain; hit = lmoverHit; shape->Rigid(shape->width/2, 0, shape->height/2, vfil); } static Bitmap* rmoverMask; static Bitmap* rmoverPlain; static Bitmap* rmoverHit; RightMover::RightMover(Interactor* i, int d) : Mover(i, d, MOVE_RIGHT) { Init(); } RightMover::RightMover( const char* name, Interactor* i, int d ) : Mover(name, i, d, MOVE_RIGHT) { Init(); } RightMover::~RightMover() { } void RightMover::Init() { SetClassName("RightMover"); if (rmoverMask == nil) { rmoverMask = MakeBitmap( rmover_mask_bits, rmover_mask_width, rmover_mask_height ); rmoverPlain = MakeBitmap( rmover_plain_bits, rmover_plain_width, rmover_plain_height ); rmoverHit = MakeBitmap( rmover_hit_bits, rmover_hit_width, rmover_hit_height ); } mask = rmoverMask; plain = rmoverPlain; hit = rmoverHit; shape->Rigid(shape->width/2, 0, shape->height/2, vfil); } static Bitmap* umoverMask; static Bitmap* umoverPlain; static Bitmap* umoverHit; UpMover::UpMover(Interactor* i, int d) : Mover(i, d, MOVE_UP) { Init(); } UpMover::UpMover( const char* name, Interactor* i, int d ) : Mover(name, i, d, MOVE_UP) { Init(); } UpMover::~UpMover() { } void UpMover::Init() { SetClassName("UpMover"); if (umoverMask == nil) { umoverMask = MakeBitmap( umover_mask_bits, umover_mask_width, umover_mask_height ); umoverPlain = MakeBitmap( umover_plain_bits, umover_plain_width, umover_plain_height ); umoverHit = MakeBitmap( umover_hit_bits, umover_hit_width, umover_hit_height ); } mask = umoverMask; plain = umoverPlain; hit = umoverHit; shape->Rigid(shape->width/2, hfil, shape->height/2); } static Bitmap* dmoverMask; static Bitmap* dmoverPlain; static Bitmap* dmoverHit; DownMover::DownMover(Interactor* i, int d) : Mover(i, d, MOVE_DOWN) { Init(); } DownMover::DownMover( const char* name, Interactor* i, int d ) : Mover(name, i, d, MOVE_DOWN) { Init(); } DownMover::~DownMover() { } void DownMover::Init() { SetClassName("DownMover"); if (dmoverMask == nil) { dmoverMask = MakeBitmap( dmover_mask_bits, dmover_mask_width, dmover_mask_height ); dmoverPlain = MakeBitmap( dmover_plain_bits, dmover_plain_width, dmover_plain_height ); dmoverHit = MakeBitmap( dmover_hit_bits, dmover_hit_width, dmover_hit_height ); } mask = dmoverMask; plain = dmoverPlain; hit = dmoverHit; shape->Rigid(shape->width/2, hfil, shape->height/2); } neuron-7.6.3/src/lib/IV-2_6/banner.cpp000077500000000000000000000061131340731477100172600ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Banner implementation. */ #include #include #include #include #include static const int pad = 2*pixels; /* space around banner text */ Banner::Banner(char* lt, char* m, char* rt) { Init(lt, m, rt); } Banner::Banner(const char* name, char* lt, char* m, char* rt) { SetInstance(name); Init(lt, m, rt); } void Banner::Init(char* lt, char* m, char* rt) { SetClassName("Banner"); left = lt; middle = m; right = rt; highlight = false; inverse = nil; } void Banner::Reconfig() { int w; const Font* f = output->GetFont(); lw = left == nil ? 0 : f->Width(left); mw = middle == nil ? 0 : f->Width(middle); rw = right == nil ? 0 : f->Width(right); if (mw > 0) { w = mw + 2*Math::max(lw, rw); } else { w = lw + rw; } shape->width = 2*pad + w + f->Width(" "); shape->height = f->Height() + 2*pad; shape->Rigid(0, hfil, 0, 0); Unref(inverse); inverse = new Painter(output); inverse->Reference(); inverse->SetColors(output->GetBgColor(), output->GetFgColor()); } Banner::~Banner() { Unref(inverse); } void Banner::Redraw(IntCoord x1, IntCoord y1, IntCoord x2, IntCoord y2) { Painter* p = highlight ? inverse : output; p->ClearRect(canvas, x1, y1, x2, y2); if (right != nil && rx <= x2) { p->MoveTo(rx, pad); p->Text(canvas, right); } if (middle != nil && mx + mw >= x1 && mx <= x2) { p->MoveTo(mx, pad); p->Text(canvas, middle); } if (left != nil && lx + lw >= x1) { p->MoveTo(lx, pad); p->Text(canvas, left); } } void Banner::Resize() { lx = pad; mx = (xmax - mw) / 2; rx = xmax - rw + 1 - pad; } void Banner::Update() { if (canvas != nil) { Reconfig(); Resize(); Draw(); } } neuron-7.6.3/src/lib/IV-2_6/border2_6.cpp000077500000000000000000000046721340731477100176070ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Border implementation. */ #include #include #include #include Border::Border(int t) { thickness = t; } Border::Border(const char* name, int t) { SetInstance(name); thickness = t; } Border::~Border() { } void Border::Redraw(IntCoord x1, IntCoord y1, IntCoord x2, IntCoord y2) { output->FillRect(canvas, x1, y1, x2, y2); } void Border::DefaultThickness(int t) { if (thickness == -1) { thickness = t; } } HBorder::HBorder(int t) : Border(t) { Init(); } HBorder::HBorder(const char* name, int t) : Border(name, t) { Init(); } HBorder::~HBorder() { } void HBorder::Init() { SetClassName("HBorder"); } void HBorder::Reconfig() { DefaultThickness(1); shape->height = thickness; shape->Rigid(hfil, hfil, 0, 0); } VBorder::VBorder(int t) : Border(t) { Init(); } VBorder::VBorder(const char* name, int t) : Border(name, t) { Init(); } VBorder::~VBorder() { } void VBorder::Init() { SetClassName("VBorder"); } void VBorder::Reconfig() { DefaultThickness(1); shape->width = thickness; shape->Rigid(0, 0, vfil, vfil); } neuron-7.6.3/src/lib/IV-2_6/box2_6.cpp000066400000000000000000000245411340731477100171140ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Basic composite object for interaction. */ #include #include #include #include class BoxElement { public: Interactor* child; bool visible; BoxElement* next; }; class BoxDimension { public: int natural; int stretch; int shrink; }; class BoxCanonical { public: BoxDimension major; BoxDimension minor; }; Box::Box() { nelements = 0; head = nil; tail = nil; } Box::~Box() { register BoxElement* e; register BoxElement* next; for (e = head; e != nil; e = next) { next = e->next; delete e->child; delete e; } } void Box::Align(Alignment a) { align = a; } void Box::DoInsert(Interactor* i, bool, IntCoord&, IntCoord&) { register BoxElement* e; ++nelements; e = new BoxElement; e->child = i; e->next = nil; if (head == nil) { head = e; tail = e; } else { tail->next = e; tail = e; } } void Box::DoChange(Interactor*) { Reconfig(); } void Box::DoRemove(Interactor* i) { register BoxElement* e, * prev; --nelements; prev = nil; for (e = head; e != nil; e = e->next) { if (e->child == i) { if (prev == nil) { head = e->next; } else { prev->next = e->next; } if (e == tail) { tail = prev; } delete e; break; } prev = e; } ComputeShape(shape); } void Box::Reconfig() { ComputeShape(shape); } void Box::Resize() { register BoxElement* e; /* box element */ Shape aggrshape; /* combined shape of components */ BoxCanonical total; /* components' shape along major axis */ int major, minor; /* actual dimensions of box */ register int have; /* how much box is willing to change */ register int need; /* how much box needs to change to fit */ bool grow; /* true if stretching, false if shrinking */ BoxCanonical s; /* element shape along major axis */ register int pos; /* where to put next element on major axis */ register int len; /* size of element along major axis */ register int n; /* temporary variable */ ComputeShape(&aggrshape); GetActual(major, minor); GetCanonical(&aggrshape, total); n = total.major.natural; if (major > n) { /* more space than desired ==> stretch elements */ grow = true; have = total.major.stretch; need = Math::min(major - n, have); } else { /* less (or equal) space than desired ==> (maybe) shrink elements */ grow = false; have = total.major.shrink; need = Math::min(n - major, have); } pos = 0; for (e = head; e != nil; e = e->next) { GetCanonical(e->child->GetShape(), s); len = s.major.natural; if (have > 0) { if (grow) { n = int(double(s.major.stretch)*double(need)/double(have)); len += n; have -= s.major.stretch; } else { n = int(double(s.major.shrink)*double(need)/double(have)); len -= n; have -= s.major.shrink; } need -= n; } n = s.minor.natural; if (n == 0) { n = minor; } else if (n > minor) { n = Math::max(n - s.minor.shrink, minor); } else if (n < minor) { n = Math::min(n + s.minor.stretch, minor); } if (n > 0 && len > 0) { e->visible = true; PlaceElement(e->child, pos, len, minor, n); } else { e->visible = false; } pos += len; } } void Box::Draw() { register BoxElement* e; for (e = head; e != nil; e = e->next) { if (e->visible) { e->child->Draw(); } } } void Box::GetComponents(Interactor** c, int nc, Interactor**& a, int& n) { register BoxElement* e; register Interactor** ap; n = nelements; a = (n <= nc) ? c : new Interactor*[n]; ap = a; for (e = head; e != nil; e = e->next) { *ap++ = e->child; } } inline BoxElement* Box::Head() { return head; } /* * Default virtuals. */ void Box::ComputeShape(Shape*) {} void Box::GetActual(int& /* major */, int& /* minor */) {} void Box::GetCanonical(Shape*, BoxCanonical&) {} void Box::PlaceElement(Interactor*, IntCoord, int, int, int) {} void HBox::Init() { align = Bottom; shape->Rigid(0, 0, vfil, vfil); } HBox::HBox() { Init(); } HBox::HBox(Interactor* i1) { Init(); Insert(i1); } HBox::HBox(Interactor* i1, Interactor* i2) { Init(); Insert(i1); Insert(i2); } HBox::HBox(Interactor* i1, Interactor* i2, Interactor* i3) { Init(); Insert(i1); Insert(i2); Insert(i3); } HBox::HBox(Interactor* i1, Interactor* i2, Interactor* i3, Interactor* i4) { Init(); Insert(i1); Insert(i2); Insert(i3); Insert(i4); } HBox::HBox( Interactor* i1, Interactor* i2, Interactor* i3, Interactor* i4, Interactor* i5 ) { Init(); Insert(i1); Insert(i2); Insert(i3); Insert(i4); Insert(i5); } HBox::HBox( Interactor* i1, Interactor* i2, Interactor* i3, Interactor* i4, Interactor* i5, Interactor* i6 ) { Init(); Insert(i1); Insert(i2); Insert(i3); Insert(i4); Insert(i5); Insert(i6); } HBox::HBox( Interactor* i1, Interactor* i2, Interactor* i3, Interactor* i4, Interactor* i5, Interactor* i6, Interactor* i7 ) { Init(); Insert(i1); Insert(i2); Insert(i3); Insert(i4); Insert(i5); Insert(i6); Insert(i7); } HBox::~HBox() { } void HBox::ComputeShape(register Shape* box) { register BoxElement* e; register Shape* s; register int vmin, vmax; box->width = 0; box->height = 0; box->Rigid(0, 0, vfil, vfil); vmin = -vfil; vmax = vfil; for (e = Head(); e != nil; e = e->next) { s = e->child->GetShape(); box->width += s->width; box->height = Math::max(box->height, s->height); box->hstretch += s->hstretch; box->hshrink += s->hshrink; vmin = Math::max(s->height - s->vshrink, vmin); vmax = Math::min(s->height + s->vstretch, vmax); } box->vstretch = Math::max(0, vmax - box->height); box->vshrink = Math::max(0, box->height - vmin); } void HBox::GetActual(int& major, int& minor) { major = xmax + 1; minor = ymax + 1; } void HBox::GetCanonical(register Shape* s, register BoxCanonical& b) { b.major.natural = s->width; b.major.shrink = s->hshrink; b.major.stretch = s->hstretch; b.minor.natural = s->height; b.minor.shrink = s->vshrink; b.minor.stretch = s->vstretch; } void HBox::PlaceElement( Interactor* i, IntCoord x, int length, int size, int h ) { IntCoord x1, y1, x2, y2; x1 = x; if (align == Top) { y1 = size - h; } else if (align == Center) { y1 = (size - h) / 2; } else /* Bottom */ { y1 = 0; } x2 = x1 + length - 1; y2 = y1 + h - 1; Place(i, x1, y1, x2, y2); } void VBox::Init() { align = Left; shape->Rigid(hfil, hfil, 0, 0); } VBox::VBox() { Init(); } VBox::VBox(Interactor* i1) { Init(); Insert(i1); } VBox::VBox(Interactor* i1, Interactor* i2) { Init(); Insert(i1); Insert(i2); } VBox::VBox(Interactor* i1, Interactor* i2, Interactor* i3) { Init(); Insert(i1); Insert(i2); Insert(i3); } VBox::VBox(Interactor* i1, Interactor* i2, Interactor* i3, Interactor* i4) { Init(); Insert(i1); Insert(i2); Insert(i3); Insert(i4); } VBox::VBox( Interactor* i1, Interactor* i2, Interactor* i3, Interactor* i4, Interactor* i5 ) { Init(); Insert(i1); Insert(i2); Insert(i3); Insert(i4); Insert(i5); } VBox::VBox( Interactor* i1, Interactor* i2, Interactor* i3, Interactor* i4, Interactor* i5, Interactor* i6 ) { Init(); Insert(i1); Insert(i2); Insert(i3); Insert(i4); Insert(i5); Insert(i6); } VBox::VBox( Interactor* i1, Interactor* i2, Interactor* i3, Interactor* i4, Interactor* i5, Interactor* i6, Interactor* i7 ) { Init(); Insert(i1); Insert(i2); Insert(i3); Insert(i4); Insert(i5); Insert(i6); Insert(i7); } VBox::~VBox() { } void VBox::ComputeShape(register Shape* box) { register BoxElement* e; register Shape* s; register int hmin, hmax; box->width = 0; box->height = 0; box->Rigid(hfil, hfil, 0, 0); hmin = -hfil; hmax = hfil; for (e = Head(); e != nil; e = e->next) { s = e->child->GetShape(); box->width = Math::max(box->width, s->width); box->height += s->height; box->vstretch += s->vstretch; box->vshrink += s->vshrink; hmin = Math::max(s->width - s->hshrink, hmin); hmax = Math::min(s->width + s->hstretch, hmax); } box->hstretch = Math::max(0, hmax - box->width); box->hshrink = Math::max(0, box->width - hmin); } void VBox::GetActual(int& major, int& minor) { major = ymax + 1; minor = xmax + 1; } void VBox::GetCanonical(register Shape* s, register BoxCanonical& b) { b.major.natural = s->height; b.major.shrink = s->vshrink; b.major.stretch = s->vstretch; b.minor.natural = s->width; b.minor.shrink = s->hshrink; b.minor.stretch = s->hstretch; } void VBox::PlaceElement( Interactor* i, IntCoord y, int length, int size, int w ) { IntCoord x1, y1, x2, y2; if (align == Right) { x1 = size - w; } else if (align == Center) { x1 = (size - w) / 2; } else /* Left */ { x1 = 0; } x2 = x1 + w - 1; y2 = ymax - y; y1 = y2 - length + 1; Place(i, x1, y1, x2, y2); } neuron-7.6.3/src/lib/IV-2_6/button2_6.cpp000066400000000000000000000335441340731477100176420ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Button management. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static const int sep = 3; static const int pad = 3; inline int HalfRadioButtonSize (int h) { return Math::round(.4*h); } inline int HalfCheckBoxSize (int h) { return Math::round(.4*h); } /* * A button state is a value that is settable from one or more buttons. * When the state is modified, it updates all its buttons. */ ButtonState::ButtonState() { value = nil; ref(); } ButtonState::ButtonState(int v) { value = (void*)long(v); ref(); } ButtonState::ButtonState(void* v) { value = v; ref(); } ButtonState::~ButtonState() { } void ButtonState::SetValue(int v) { Modify((void*)long(v)); } void ButtonState::SetValue(void* v) { Modify(v); } void ButtonState::operator =(ButtonState& s) { Modify(s.value); } void ButtonState::Modify(void* v) { if (value != v) { value = v; Notify(); } } /* * Simple list of buttons. */ class ButtonList { public: Button* cur; ButtonList* next; ButtonList (Button* b) { cur = b; next = nil; } }; static void Remove(ButtonList*& blist, Button* b) { register ButtonList* bl; register ButtonList* prev; prev = nil; for (bl = blist; bl != nil; bl = bl->next) { if (bl->cur == b) { if (prev == nil) { blist = bl->next; } else { prev->next = bl->next; } delete bl; break; } prev = bl; } } static void DeleteList(ButtonList* blist) { register ButtonList* bl; register ButtonList* next; for (bl = blist; bl != nil; bl = next) { next = bl->next; delete bl; } } /* * A button has a ButtonState subject that it modifies when pressed. * Also, a button may have associated buttons that are enabled/disabled * when it is chosen/unchosen. */ Button::Button(ButtonState* s, void* v) { Init(s, v); } Button::Button(const char* name, ButtonState* s, void* v) { SetInstance(name); Init(s, v); } void Button::Init(ButtonState* s, void* v) { SetClassName("Button"); value = v; subject = s; associates = nil; enabled = true; chosen = false; hit = false; subject->Attach(this); Update(); input = new Sensor(updownEvents); input->Catch(EnterEvent); input->Catch(LeaveEvent); } Button::~Button() { if (subject != nil) { subject->Detach(this); } DeleteList(associates); } void Button::Attach(Button* b) { ButtonList* head; head = new ButtonList(b); head->next = associates; associates = head; if (chosen) { b->Enable(); } else { b->Disable(); } } void Button::Detach(Button* b) { Remove(associates, b); } void Button::Enable() { if (!enabled) { enabled = true; if (ValidCanvas(canvas)) { Draw(); } } } void Button::Disable() { if (enabled) { enabled = false; if (ValidCanvas(canvas)) { Draw(); } } } void Button::Choose() { register ButtonList* bl; if (!chosen) { chosen = true; if (enabled) { if (ValidCanvas(canvas)) { Refresh(); } for (bl = associates; bl != nil; bl = bl->next) { bl->cur->Enable(); } } } } void Button::UnChoose() { register ButtonList* bl; if (chosen) { chosen = false; if (enabled) { if (ValidCanvas(canvas)) { Refresh(); } for (bl = associates; bl != nil; bl = bl->next) { bl->cur->Disable(); } } } } void Button::Refresh() { } void Button::Handle(register Event& e) { if (e.eventType == DownEvent && e.target == this) { bool inside = true; do { if (enabled && e.target == this) { if (e.eventType == EnterEvent) { inside = true; } else if (e.eventType == LeaveEvent) { inside = false; } if (inside) { if (!hit) { hit = true; Refresh(); } } else { if (hit) { hit = false; Refresh(); } } } Read(e); } while (e.eventType != UpEvent); if (hit) { hit = false; Refresh(); } if (enabled && inside) { Press(); } } } void Button::Press() { if (subject != nil) { subject->SetValue(value); } else { Refresh(); } } void Button::Update() { void* v; subject->GetValue(v); if (!chosen && value == v) { Choose(); } else if (chosen && value != v) { UnChoose(); } } TextButton::TextButton( const char* str, ButtonState* s, void* v ) : Button(s, v) { Init(str); } TextButton::TextButton( const char* name, const char* str, ButtonState* s, void* v ) : Button(name, s, v) { Init(str); } void TextButton::Init(const char* str) { SetClassName("TextButton"); if (str == nil) { text = nil; } else { text = new char[strlen(str) + 1]; strcpy(text, str); } background = nil; grayout = nil; } void TextButton::Reconfig() { const char* a = GetAttribute("text"); if (a != nil) { delete [] text; text = new char[strlen(a) + 1]; strcpy(text, a); } } void TextButton::MakeBackground() { Unref(background); background = new Painter(output); background->Reference(); background->SetColors(output->GetBgColor(), output->GetFgColor()); static Pattern* gray_pat; if (gray_pat == nil) { gray_pat = new Pattern(Pattern::gray); gray_pat->Reference(); } Unref(grayout); grayout = new Painter(background); grayout->Reference(); grayout->SetPattern(gray_pat); grayout->FillBg(false); } void TextButton::MakeShape() { if (text != nil) { const Font* f = output->GetFont(); shape->width += f->Width(text); shape->height += f->Height(); } shape->Rigid(); } TextButton::~TextButton() { delete [] text; Unref(background); Unref(grayout); } PushButton::PushButton( const char* str, ButtonState* s, int v ) : TextButton(str, s, (void*)((long)v)) { Init(); } PushButton::PushButton( const char* str, ButtonState* s, void* v ) : TextButton(str, s, v) { Init(); } PushButton::PushButton( const char* name, const char* str, ButtonState* s, int v ) : TextButton(name, str, s, (void*)((long)v)) { Init(); } PushButton::PushButton( const char* name, const char* str, ButtonState* s, void* v ) : TextButton(name, str, s, v) { Init(); } PushButton::~PushButton() { } void PushButton::Init() { SetClassName("PushButton"); } void PushButton::Reconfig() { TextButton::Reconfig(); MakeBackground(); if (shape->Undefined()) { MakeShape(); shape->width += output->GetFont()->Width(" "); shape->height += 2*pad; } } void PushButton::Redraw(IntCoord x1, IntCoord y1, IntCoord x2, IntCoord y2) { output->ClearRect(canvas, x1, y1, x2, y2); Refresh(); } void PushButton::Refresh() { register int r; IntCoord x[16], y[16]; IntCoord tx, ty; r = Math::min(10*pixels, Math::min(xmax+1, ymax+1)/6); x[0] = 0; y[0] = r; x[1] = 0; y[1] = r + r; x[2] = 0; y[2] = ymax - r - r; x[3] = 0; y[3] = ymax - r; x[4] = r; y[4] = ymax; x[5] = r + r; y[5] = ymax; x[6] = xmax - r - r; y[6] = ymax; x[7] = xmax - r; y[7] = ymax; x[8] = xmax; y[8] = ymax - r; x[9] = xmax; y[9] = ymax - r - r; x[10] = xmax; y[10] = r + r; x[11] = xmax; y[11] = r; x[12] = xmax - r; y[12] = 0; x[13] = xmax - r - r; y[13] = 0; x[14] = r + r; y[14] = 0; x[15] = r; y[15] = 0; tx = (xmax - output->GetFont()->Width(text))/2; ty = pad; if (chosen || hit) { output->FillBSpline(canvas, x, y, 16); background->Text(canvas, text, tx, ty); } else { background->FillRect(canvas, 0, 0, xmax, ymax); output->ClosedBSpline(canvas, x, y, 16); output->Text(canvas, text, tx, ty); } if (!enabled) { grayout->FillRect(canvas, 0, 0, xmax, ymax); } } static Bitmap* radioMask; static Bitmap* radioPlain; static Bitmap* radioHit; static Bitmap* radioChosen; static Bitmap* radioBoth; RadioButton::RadioButton( const char* str, ButtonState* s, int v ) : TextButton(str, s, (void*)((long)v)) { Init(); } RadioButton::RadioButton( const char* str, ButtonState* s, void* v ) : TextButton(str, s, v) { Init(); } RadioButton::RadioButton( const char* name, const char* str, ButtonState* s, int v ) : TextButton(name, str, s, (void*)((long)v)) { Init(); } RadioButton::RadioButton( const char* name, const char* str, ButtonState* s, void* v ) : TextButton(name, str, s, v) { Init(); } RadioButton::~RadioButton() { } void RadioButton::Init() { SetClassName("RadioButton"); } void RadioButton::Reconfig() { TextButton::Reconfig(); MakeBackground(); if (shape->Undefined()) { MakeShape(); shape->width += shape->height + sep; } if (radioMask == nil) { radioMask = new Bitmap( radio_mask_bits, radio_mask_width, radio_mask_height ); radioMask->Reference(); radioPlain = new Bitmap( radio_plain_bits, radio_plain_width, radio_plain_height ); radioPlain->Reference(); radioHit = new Bitmap( radio_hit_bits, radio_hit_width, radio_hit_height ); radioHit->Reference(); radioChosen = new Bitmap( radio_chosen_bits, radio_chosen_width, radio_chosen_height ); radioChosen->Reference(); radioBoth = new Bitmap( radio_both_bits, radio_both_width, radio_both_height ); radioBoth->Reference(); } } void RadioButton::Redraw(IntCoord x1, IntCoord y1, IntCoord x2, IntCoord y2) { int h = output->GetFont()->Height(); int r = radio_plain_width; output->ClearRect(canvas, x1, y1, x2, y2); IntCoord tx = r + sep; IntCoord ty = (ymax + 1 - h) / 2; output->Text(canvas, text, tx, ty); Refresh(); } void RadioButton::Refresh() { IntCoord x = 0; IntCoord y = (ymax+1 - radio_plain_height)/2; if (!hit && !chosen) { output->Stencil(canvas, x, y, radioPlain, radioMask); } else if (hit && !chosen) { output->Stencil(canvas, x, y, radioHit, radioMask); } else if (!hit && chosen) { output->Stencil(canvas, x, y, radioChosen, radioMask); } else if (hit && chosen) { output->Stencil(canvas, x, y, radioBoth, radioMask); } if (!enabled) { grayout->FillRect(canvas, 0, 0, xmax, ymax); } } CheckBox::CheckBox( const char* str, ButtonState* s, int on, int off ) : TextButton(str, s, (void*)((long)on)) { Init((void*)((long)off)); } CheckBox::CheckBox( const char* str, ButtonState* s, void* on, void* off ) : TextButton(str, s, on) { Init(off); } CheckBox::CheckBox( const char* name, const char* str, ButtonState* s, int on, int off ) : TextButton(name, str, s, (void*)((long)on)) { Init((void*)((long)off)); } CheckBox::CheckBox( const char* name, const char* str, ButtonState* s, void* on, void* off ) : TextButton(name, str, s, on) { Init(off); } CheckBox::~CheckBox() { } void CheckBox::Init(void* v) { SetClassName("CheckBox"); offvalue = v; } void CheckBox::Reconfig() { TextButton::Reconfig(); MakeBackground(); if (shape->Undefined()) { MakeShape(); shape->width += shape->height + sep; } Update(); } void CheckBox::Press() { if (chosen) { subject->GetValue(value); subject->SetValue(offvalue); } else { subject->SetValue(value); } } void CheckBox::Update() { void* v; subject->GetValue(v); if (v != offvalue) { Choose(); value = v; } else { UnChoose(); } } void CheckBox::Redraw(IntCoord x1, IntCoord y1, IntCoord x2, IntCoord y2) { int h = output->GetFont()->Height(); int t = HalfCheckBoxSize(h); output->ClearRect(canvas, x1, y1, x2, y2); IntCoord tx = 2*t + sep; IntCoord ty = (ymax + 1 - h) / 2; output->Text(canvas, text, tx, ty); Refresh(); } void CheckBox::Refresh() { int h = output->GetFont()->Height(); int t = HalfCheckBoxSize(h); IntCoord cx = t; IntCoord cy = (ymax + 1)/2; IntCoord left = cx - t; IntCoord right = cx + t; IntCoord bottom = cy - t; IntCoord top = cy + t; output->Rect(canvas, left, bottom, right, top); background->FillRect(canvas, left+1, bottom+1, right-1, top-1); if (hit) { output->Rect(canvas, left+1, bottom+1, right-1, top-1); } if (chosen) { output->Line(canvas, left, bottom, right, top); output->Line(canvas, left, top, right, bottom); } if (!enabled) { grayout->FillRect(canvas, 0, 0, xmax, ymax); } } neuron-7.6.3/src/lib/IV-2_6/compeditor.cpp000066400000000000000000000065101340731477100201560ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * CompletionEditor - StringEditor with completion */ #include #include #include #include #include CompletionEditor::CompletionEditor ( ButtonState* s, const char* sample1, const char* done1 ) : StringEditor(s, sample1, done1) { Init(); } CompletionEditor::CompletionEditor ( const char* name, ButtonState* s, const char* sample1, const char* done1 ) : StringEditor(name, s, sample1, done1) { Init(); } CompletionEditor::~CompletionEditor() { } void CompletionEditor::Init () { complete_ = CEComplete; completions_ = nil; count_ = 0; } void CompletionEditor::Completions (const char* list[], int c, char comp) { complete_ = comp; completions_ = list; count_ = c; } bool CompletionEditor::HandleChar (char c) { if (c == complete_) { InsertText("", 0); const char* best = nil; int match = 0; int length = text->LineOffset(text->EndOfLine(0)); for (int i = 0; i < count_; ++i) { for (int j = 0; ; ++j) { char c = completions_[i][j]; if (j < length) { if (text->Char(j) != c) { match = Math::max(match, j); break; } } else { if (best == nil) { best = completions_[i]; match = strlen(best); break; } else { if (c == '\0' || best[j] != c) { match = Math::min(match, j); break; } } } } } Select(match, length); if (match > length) { InsertText(best+length, match-length); } else if (best != nil && best[match] != '\0') { GetWorld()->RingBell(1); } return false; } else { return StringEditor::HandleChar(c); } } neuron-7.6.3/src/lib/IV-2_6/control.cpp000066400000000000000000000131231340731477100174670ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Implementation of control classes */ #include #include #include /** class Control **/ Control::Control(Interactor* i) { Init(nil, i); } Control::Control(const char* name, Interactor* i) { Init(name, i); } void Control::Init(const char* name, Interactor* i) { if (name != nil) { SetInstance(name); } enabled_ = true; parent_ = nil; state_ = new ControlState; state_->Attach(this); input = new Sensor; input->Catch(EnterEvent); input->Catch(LeaveEvent); input->Catch(DownEvent); input->Catch(UpEvent); if (i != nil) { Insert(i); } } Control::~Control () { state_->Detach(this); } void Control::Handle(Event& e) { switch (e.eventType) { case DownEvent: Down(); break; case UpEvent: Up(); break; case EnterEvent: Enter(); break; case LeaveEvent: Leave(); break; } } void Control::Enable(bool b) { if (b != enabled_) { enabled_ = b; } } /* * Hitting a control is equivalent to making the state active and * then selecting it. */ void Control::Down() { if (Enabled() && !state_->Active()) { state_->Activate(); state_->NotifySelection(this); } } void Control::Enter() { if (Enabled() && state_->Active()) { state_->NotifySelection(this); } } void Control::Leave() { if (Enabled() && state_->Active()) { state_->NotifySelection(nil); } } void Control::Select() { Highlight(true); Open(); Grab(); } void Control::Unselect() { Close(); Highlight(false); } void Control::Grab() { Event e; do { Read(e); e.target->Handle(e); if (e.target == this && e.eventType == LeaveEvent) { Skip(); break; } } while (state_->Active()); } /* * Skip all input events until we see something for another open control. */ void Control::Skip() { Event e; for (;;) { Read(e); if (e.eventType == EnterEvent && IsGrabbing(e.target)) { UnRead(e); break; } else if (e.eventType == UpEvent) { Up(); break; } } } /* * Check whether an interactor (usually an event target) is a grabbing * control. Trivially, the current control is grabbing. Any other controls * attached to the control's state are also grabbing. Similarly, any controls * attached to other control's state up the stack from the current one * are also considered to be grabbing. */ bool Control::IsGrabbing(Interactor* i) { if (i == this) { return true; } ControlState* c; for (c = state_; c != nil; c = c->Next()) { if (c->IsView(i)) { return true; } } for (c = state_->Prev(); c != nil; c = c->Prev()) { if (c->IsView(i)) { return true; } } return false; } /* * On an up event, deactivate all the control states and then * call Do the current selection (if any). */ void Control::Up() { if (state_->Active()) { Control* target = state_->Selection(); state_->Action(target); for (ControlState* c = state_; c != nil; c = c->Prev()) { c->Deactivate(); } if (target != nil) { Busy(); target->Do(); Done(); } } } void Control::Open() { } void Control::Close() { } void Control::Do() { } void Control::Busy() { } void Control::Done() { } Control* Control::RootControl() { Control* root = this; Control* parent1 = ParentControl(); while (parent1 != nil) { root = parent1; parent1 = parent1->ParentControl(); } return root; } void Control::SetState(ControlState* s) { state_->Detach(this); state_ = s; s->Attach(this); } void Control::Reparent(Control* ctrl, Control* parent1) { ctrl->parent_ = parent1; } /** class ControlState **/ ControlState::ControlState(unsigned s) { status = s; selection = nil; action = nil; next = nil; prev = nil; } ControlState::~ControlState() { } void ControlState::NotifySelection(Control* c) { if (selection != c) { if (selection != nil) { selection->Unselect(); } selection = c; if (selection != nil) { selection->Select(); } } } void ControlState::Push(ControlState* s) { next = s; s->prev = this; } void ControlState::Pop() { if (prev != nil) { prev->next = next; prev = nil; } Deactivate(); } void ControlState::Deactivate() { Set(ControlActive, false); if (selection != nil) { selection->Unselect(); selection = nil; } } neuron-7.6.3/src/lib/IV-2_6/deck2_6.cpp000066400000000000000000000137231340731477100172320ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Deck - a Scene for stacking Interactors */ #include #include #include #include #include class Card { public: Interactor* i; Card* next; Card* prev; Card (Interactor* ii = nil) { i = ii; next = prev = this; } ~Card () { next->prev = prev; prev->next = next; } }; Deck::Deck() { Init(); } Deck::Deck(const char* name) { SetInstance(name); Init(); } void Deck::Init() { SetClassName("Deck"); top = nil; cards = new Card; register Perspective* p = new Perspective; perspective = p; p->sx = p->lx = 1; p->sy = p->ly = 1; p->curwidth = p->curheight = 1; p->width = p->height = 0; p->x0 = 1; p->y0 = 0; } Deck::~Deck() { register Card* c, * next; for (c = cards->next; c != cards; c = next) { next = c->next; delete c->i; delete c; } delete cards; Unref(perspective); } void Deck::Reconfig() { int hnat = 0, hmin = 0, hmax = hfil; int vnat = 0, vmin = 0, vmax = vfil; Card* card = cards->next; while (card != cards) { Shape* s = card->i->GetShape(); hnat = Math::max(hnat, s->width); hmin = Math::max(hmin, s->width - s->hshrink); hmax = Math::min(hmax, s->width + s->hstretch); vnat = Math::max(vnat, s->height); vmin = Math::max(vmin, s->height - s->vshrink); vmax = Math::min(vmax, s->height + s->vstretch); card = card->next; } shape->width = hnat; shape->hshrink = Math::max(0, shape->width - hmin); shape->hstretch = Math::max(0, hmax - shape->width); shape->height = vnat; shape->vshrink = Math::max(0, shape->height - vmin); shape->vstretch = Math::max(0, vmax - shape->height); FixPerspective(); } void Deck::FixPerspective() { register Perspective* p = perspective; p->curx = Math::max(p->x0, Math::min(p->width, p->curx)); p->cury = p->y0 + p->height - (p->curx - p->x0) - p->curheight; p->Update(); } void Deck::NewTop() { Card* card = cards; for (int i = perspective->curx; i > 0; --i) { card = card->next; } if (top != nil && card->i != top) { Map(card->i); Unmap(top); top = card->i; } } void Deck::DoInsert(Interactor* i, bool, IntCoord&, IntCoord&) { if (i != nil) { Card* c = new Card(i); c->prev = cards->prev; c->next = cards; cards->prev->next = c; cards->prev = c; ++perspective->width; ++perspective->height; FixPerspective(); } } void Deck::DoRemove(Interactor* i) { Card* card = cards->next; while (card != cards) { if (card->i == i) { card->prev->next = card->next; card->next->prev = card->prev; delete card; --perspective->width; --perspective->height; FixPerspective(); break; } else { card = card->next; } } } void Deck::DoChange(Interactor*) { Reconfig(); } void Deck::Resize() { int pos = 1; Card* card = cards->next; while (card != cards) { Interactor* i = card->i; Shape* s = i->GetShape(); int l, r, b, t; int width = xmax+1; width = Math::max(width, s->width - s->hshrink); width = Math::min(width, s->width + s->hstretch); int height = ymax+1; height = Math::max(height, s->height - s->vshrink); height = Math::min(height, s->height + s->vstretch); l = (xmax+1-width)/2; r = xmax - l; b = (ymax+1-height)/2; t = ymax - b; if (pos == perspective->curx) { top = i; Place(i, l, b, r, t, true); } else { Place(i, l, b, r, t, false); } card = card->next; pos += 1; } } void Deck::Draw() { if (top != nil) { top->Draw(); } } void Deck::GetComponents(Interactor** c, int nc, Interactor**& a, int& n) { register Card* card; register Interactor** ap; n = perspective->width; if (n > 0) { a = (n <= nc) ? c : new Interactor*[n]; ap = a; for (card = cards->next; card != cards; card = card->next) { *ap++ = card->i; } } } void Deck::Adjust(Perspective& np) { Perspective* p = perspective; int nx = Math::round( float(np.curx-np.x0) / float(np.width) * float(p->width) ); int ny = Math::round( float(np.y0 + np.height - np.cury - np.curheight) / float(np.height) * float(p->height) ); if (nx != p->curx - p->x0) { p->curx = p->x0 + nx; } else if (ny != p->curx - p->x0) { p->curx = p->x0 + ny; } FixPerspective(); np = *p; NewTop(); } void Deck::Flip(int count) { perspective->curx += count; FixPerspective(); NewTop(); } void Deck::FlipTo(int position) { if (position > 0) { perspective->curx = position; } else if (position < 0) { perspective->curx = perspective->width + 1 + position; } FixPerspective(); NewTop(); } neuron-7.6.3/src/lib/IV-2_6/dialog2_6.cpp000066400000000000000000000050501340731477100175550ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Dialog class implementation. */ #include #include #include #include #include #include Dialog::Dialog(ButtonState* b, Interactor* i, Alignment a) { Init(b, i, a); } Dialog::Dialog(const char* name, ButtonState* b, Interactor* i, Alignment a) { SetInstance(name); Init(b, i, a); } void Dialog::Init(ButtonState* b, Interactor* i, Alignment a) { SetClassName("Dialog"); state = b; Resource::ref(state); align = a; if (i != nil) { Insert(i); } } Dialog::~Dialog() { Resource::unref(state); } bool Dialog::Popup(Event& e, bool placed) { World* w; IntCoord wx, wy; bool accept; e.GetAbsolute(w, wx, wy); if (placed) { w->InsertTransient(this, e.target, wx, wy, align); } else { w->InsertTransient(this, e.target); } accept = Accept(); w->Remove(this); return accept; } bool Dialog::Accept() { Event e; int v; state->SetValue(0); v = 0; do { Read(e); e.target->Handle(e); state->GetValue(v); } while (v == 0 && e.target != nil); return v == 1 || e.target == nil; } int Dialog::Status() { int v; state->GetValue(v); return v; } neuron-7.6.3/src/lib/IV-2_6/filebrowser.cpp000066400000000000000000000266171340731477100203460ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * FileBrowser implementation. */ #ifndef UMK #define UMK 1 //unicosmk CRAY T3E #endif #include #include #include #include #include #include #include #include #include #include #if defined(mips) && defined(ultrix) #undef NULL #endif #include #include /* no standard place for this */ extern "C" { extern uid_t getuid(); #ifdef __DECCXX extern struct passwd* getpwuid(uid_t); #endif } #include static const unsigned int max_filename_length = 256; class FBDirectory { public: FBDirectory(const char* name); ~FBDirectory(); bool LoadDirectory(const char*); const char* Normalize(const char*); const char* ValidDirectories(const char*); int Index(const char*); const char* File(unsigned int index); int Count(); bool IsADirectory(const char*); private: const char* Home(const char* = nil); const char* ElimDot(const char*); const char* ElimDotDot(const char*); const char* InterpSlashSlash(const char*); const char* InterpTilde(const char*); const char* ExpandTilde(const char*, int); const char* RealPath(const char*); bool Reset(const char*); private: Directory* dir; }; int FBDirectory::Count() { return dir == nil ? 0 : dir->count(); } const char* FBDirectory::File(unsigned int i) { return dir == nil ? nil : dir->name(i)->string(); } static inline char* fb_strdup(const char* s) { char* dup = new char[strlen(s) + 1]; strcpy(dup, s); return dup; } FBDirectory::FBDirectory(const char* name) { dir = nil; LoadDirectory(name); } FBDirectory::~FBDirectory() { delete dir; } const char* FBDirectory::RealPath(const char* path) { const char* realpath; if (*path == '\0') { realpath = "./"; } else { realpath = InterpTilde(InterpSlashSlash(path)); } return realpath; } bool FBDirectory::LoadDirectory(const char* name) { char buf[max_filename_length+2]; const char* path = buf; strcpy(buf, ValidDirectories(RealPath(name))); return Reset(buf); } int FBDirectory::Index(const char* name) { if (dir == nil) { return -1; } return dir->index(name); } bool FBDirectory::Reset(const char* path) { Directory* d = Directory::open(path); if (d == nil) { return false; } delete dir; dir = d; return true; } bool FBDirectory::IsADirectory(const char* path) { struct stat st; return stat(path, &st) == 0 && (st.st_mode & S_IFMT) == S_IFDIR; } const char* FBDirectory::Home(const char* name) { /* cast to workaround DEC C++ prototype bug */ struct passwd* pw = (name == nil) ? getpwuid(getuid()) : getpwnam((char*)name); return (pw == nil) ? nil : pw->pw_dir; } inline bool DotSlash(const char* path) { return path[0] != '\0' && path[0] == '.' && (path[1] == '/' || path[1] == '\0'); } inline bool DotDotSlash(const char* path) { return path[0] != '\0' && path[1] != '\0' && path[0] == '.' && path[1] == '.' && (path[2] == '/' || path[2] == '\0'); } const char* FBDirectory::Normalize(const char* path) { static char newpath[MAXPATHLEN+1]; const char* buf; buf = InterpSlashSlash(path); buf = ElimDot(buf); buf = ElimDotDot(buf); buf = InterpTilde(buf); if (*buf == '\0') { strcpy(newpath, "./"); } else if (!DotSlash(buf) && !DotDotSlash(buf) && *buf != '/') { strcpy(newpath, "./"); strcat(newpath, buf); } else if (IsADirectory(buf) && buf[strlen(buf)-1] != '/') { strcpy(newpath, buf); strcat(newpath, "/"); } else { strcpy(newpath, buf); } return newpath; } const char* FBDirectory::ValidDirectories(const char* path) { static char buf[MAXPATHLEN+1]; strcpy(buf, path); int i = strlen(path); while (!IsADirectory(RealPath(buf)) && i >= 0) { for (--i; buf[i] != '/' && i >= 0; --i); buf[i+1] = '\0'; } return buf; } const char* FBDirectory::InterpSlashSlash(const char* path) { for (int i = strlen(path)-1; i > 0; --i) { if (path[i] == '/' && path[i-1] == '/') { return &path[i]; } } return path; } const char* FBDirectory::ElimDot(const char* path) { static char newpath[MAXPATHLEN+1]; const char* src; char* dest = newpath; for (src = path; src < &path[strlen(path)]; ++src) { if (!DotSlash(src)) { *dest++ = *src; } else if (*(dest-1) == '/') { ++src; } else { *dest++ = *src; } } *dest = '\0'; return newpath; } static bool CollapsedDotDotSlash(const char* path, const char*& start) { if (path == start || *(start-1) != '/') { return false; } else if (path == start-1 && *path == '/') { return true; } else if (path == start-2) { /* NB: won't handle '//' right */ start = path; return *start != '.'; } else if (path < start-2 && !DotDotSlash(start-3)) { for (start -= 2; path <= start; --start) { if (*start == '/') { ++start; return true; } } start = path; return true; } return false; } const char* FBDirectory::ElimDotDot(const char* path) { static char newpath[MAXPATHLEN+1]; const char* src; char* dest = newpath; for (src = path; src < &path[strlen(path)]; ++src) { if (DotDotSlash(src) && CollapsedDotDotSlash(newpath, (const char*&)dest) ) { src += 2; } else { *dest++ = *src; } } *dest = '\0'; return newpath; } const char* FBDirectory::InterpTilde(const char* path) { static char realpath[MAXPATHLEN+1]; const char* beg = strrchr(path, '~'); bool validTilde = beg != nil && (beg == path || *(beg-1) == '/'); if (validTilde) { const char* end = strchr(beg, '/'); int length = (end == nil) ? strlen(beg) : end - beg; const char* expandedTilde = ExpandTilde(beg, length); if (expandedTilde == nil) { validTilde = false; } else { strcpy(realpath, expandedTilde); if (end != nil) { strcat(realpath, end); } } } return validTilde ? realpath : path; } const char* FBDirectory::ExpandTilde(const char* tildeName, int length) { const char* name = nil; if (length > 1) { static char buf[max_filename_length+1]; strncpy(buf, tildeName+1, length-1); buf[length-1] = '\0'; name = buf; } return Home(name); } /* class FileBrowser */ FileBrowser::FileBrowser( ButtonState* bs, const char* dir1, int r, int c, bool u, int h, const char* d ) : StringBrowser(bs, r, c, u, h, d) { Init(dir1); UpdateStrings(); } FileBrowser::FileBrowser( const char* name, ButtonState* bs, const char* dir1, int r, int c, bool u, int h, const char* d ) : StringBrowser(name, bs, r, c, u, h, d) { Init(dir1); UpdateStrings(); } void FileBrowser::Init(const char* d) { dir = new FBDirectory(d); lastpath = fb_strdup(ValidDirectories(Normalize(d))); regexp = nil; directory_regexp = nil; mode = 0; directory_mode = 0; } FileBrowser::~FileBrowser() { delete dir; delete [] lastpath; delete regexp; delete directory_regexp; } static const char* Concat(const char* path, const char* file) { static char buf[MAXPATHLEN+1]; strcpy(buf, path); if (path[strlen(path)-1] != '/') { strcat(buf, "/"); } return strcat(buf, file); } bool FileBrowser::IsADirectory(const char* path) { return dir->IsADirectory(Normalize(path)); } bool FileBrowser::SetDirectory(const char* path) { bool successful = true; path = ValidDirectories(path); const char* normpath = Normalize(path); if (strcmp(normpath, lastpath) != 0) { char* newnormpath = fb_strdup(normpath); successful = dir->LoadDirectory(newnormpath); if (successful) { delete [] lastpath; lastpath = newnormpath; UpdateStrings(); } else { delete [] newnormpath; } } return successful; } const char* FileBrowser::ValidDirectories(const char* path) { return dir->ValidDirectories(path); } const char* FileBrowser::Normalize(const char* path) { return dir->Normalize(path); } const char* FileBrowser::Path(int index) { const char* s = StringBrowser::String(index); return (s == nil ) ? nil : Normalize(Concat(lastpath, s)); } bool FileBrowser::Acceptable(const char* name) { bool dir1 = IsADirectory(name); int m = dir1 ? directory_mode : mode; Regexp* r = dir1 ? directory_regexp : regexp; bool mode_ok, name_ok; if (m != 0) { struct stat st; mode_ok = stat((char*)name, &st) == 0 && (st.st_mode & m) != 0; } else { mode_ok = true; } if (r != nil) { name_ok = r->Match(name, strlen(name), 0) >= 0; } else { name_ok = true; } return mode_ok && name_ok; } void FileBrowser::Update() { Perspective orig_p = *perspective; RereadDirectory(); UpdateStrings(); Adjust(orig_p); } void FileBrowser::UpdateStrings() { Clear(); for (int i = 0; i < dir->Count(); i++) { const char* name = dir->File(i); if (Acceptable(Concat(lastpath, name))) { if (dir->IsADirectory(Concat(lastpath, name))) { char buf[MAXPATHLEN+1]; strcpy(buf, name); strcat(buf, "/"); Append(buf); } else { Append(name); } } } } void FileBrowser::RereadDirectory() { dir->LoadDirectory(lastpath); } void FileBrowser::SetTextFilter(const char* r) { delete regexp; if (r != nil) { regexp = new Regexp(r); } else { regexp = nil; } } void FileBrowser::SetDirectoryTextFilter(const char* r) { delete directory_regexp; if (r != nil) { directory_regexp = new Regexp(r); } else { directory_regexp = nil; } } void FileBrowser::SetModeFilter(int value) { mode = value; } void FileBrowser::SetDirectoryModeFilter(int value) { directory_mode = value; } neuron-7.6.3/src/lib/IV-2_6/filechooser.cpp000066400000000000000000000126221340731477100203140ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include FileChooser::FileChooser( const char* t, const char* subt, const char* d, int r, int c, const char* acceptLabel, Alignment a ) : StringChooser(new ButtonState, a) { FileBrowser* fb = new FileBrowser(state, d, r, c); StringChooser::Init(new StringEditor(state, fb->GetDirectory()), fb); Init(t, subt); Insert(Interior(acceptLabel)); } FileChooser::FileChooser( const char* name, const char* t, const char* subt, const char* d, int r, int c, const char* acceptLabel, Alignment a ) : StringChooser(new ButtonState, a) { SetInstance(name); FileBrowser* fb = new FileBrowser(state, d, r, c); StringChooser::Init(new StringEditor(state, fb->GetDirectory()), fb); Init(t, subt); Insert(Interior(acceptLabel)); } FileChooser::FileChooser( ButtonState* bs, const char* d, int r, int c, Alignment a ) : StringChooser(bs, a) { FileBrowser* fb = new FileBrowser(state, d, r, c); StringChooser::Init(new StringEditor(state, fb->GetDirectory()), fb); } FileChooser::FileChooser( ButtonState* bs, Alignment a ) : StringChooser(bs, a) { } FileChooser::~FileChooser() { } void FileChooser::Init(const char* t, const char* subt) { if (*t == '\0') { title = new MarginFrame(new VGlue(0, 0)); } else { title = new MarginFrame(new class Message(t)); } if (*subt == '\0') { subtitle = new MarginFrame(new VGlue(0, 0)); } else { subtitle = new MarginFrame(new class Message(subt)); } } void FileChooser::SelectFile() { const char* path = _sedit->Text(); int left = strlen(browser()->ValidDirectories(path)); int right = strlen(path); Select(left, right); } void FileChooser::Update () { _browser->Update(); } void FileChooser::UpdateEditor() { int index = browser()->Selection(); if (index >= 0) { _sedit->Message(browser()->Path(index)); browser()->UnselectAll(); } else { _sedit->Message(browser()->Normalize(_sedit->Text())); } SelectFile(); } void FileChooser::UpdateBrowser() { browser()->SetDirectory(Choice()); } bool FileChooser::Accept() { bool accepted, dirSelected; do { accepted = StringChooser::Accept(); dirSelected = browser()->IsADirectory(Choice()); } while (accepted && dirSelected); return accepted; } static void ChangeMsg (const char* name, MarginFrame* frame) { Interactor* msg; if (*name == '\0') { msg = new VGlue(0, 0); } else { msg = new Message(name); } frame->Insert(msg); frame->Change(msg); } void FileChooser::SetTitle(const char* name) { ChangeMsg(name, title); } void FileChooser::SetSubtitle(const char* name) { ChangeMsg(name, subtitle); } Interactor* FileChooser::AddScroller(Interactor* i) { return new HBox( new MarginFrame(i, 2), new VBorder, new VScrollBar(i) ); } Interactor* FileChooser::Interior(const char* acptLbl) { const int space = Math::round(.5*cm); VBox* titleblock = new VBox( new HBox(title, new HGlue), new HBox(subtitle, new HGlue) ); return new MarginFrame( new VBox( titleblock, new VGlue(space, 0), new Frame(new MarginFrame(_sedit, 2)), new VGlue(space, 0), new Frame(AddScroller(browser())), new VGlue(space, 0), new HBox( new VGlue(space, 0), new HGlue, new PushButton("Cancel", state, '\007'), new HGlue(space, 0), new PushButton(acptLbl, state, '\r') ) ), space, space/2, 0 ); } neuron-7.6.3/src/lib/IV-2_6/frame.cpp000066400000000000000000000240361340731477100171060ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * A frame surrounds another interactor, providing borders, title banners, etc. */ #include #include #include #include #include #include #include #include #include Frame::Frame(Interactor* i, int w) { Init(i, w, w, w, w); } Frame::Frame(const char* name, Interactor* i, int w) { SetInstance(name); Init(i, w, w, w, w); } Frame::Frame(Interactor* i, int l, int b, int r, int t) { Init(i, l, b, r, t); } Frame::Frame(const char* name, Interactor* i, int l, int b, int r, int t) { SetInstance(name); Init(i, l, b, r, t); } Frame::~Frame() { } void Frame::Init(Interactor* i, int l, int b, int r, int t) { SetClassName("Frame"); left = l; bottom = b; right = r; top = t; if (i != nil) { Insert(i); } } void Frame::Reconfig() { MonoScene::Reconfig(); shape->width += left + right; shape->height += bottom + top; } void Frame::Resize() { canvas->SetBackground(output->GetBgColor()); Place(interior(), left, bottom, xmax - right, ymax - top); } void Frame::Redraw(IntCoord x1, IntCoord y1, IntCoord x2, IntCoord y2) { register IntCoord r = xmax - right; register IntCoord t = ymax - top; if (x1 < left) { output->FillRect(canvas, 0, 0, left-1, t); } if (y1 < bottom) { output->FillRect(canvas, left, 0, xmax, bottom-1); } if (x2 > r) { output->FillRect(canvas, r+1, bottom, xmax, ymax); } if (y2 > t) { output->FillRect(canvas, 0, t+1, r, ymax); } } /* * A ShowFrame highlights/unhighlights when it gets enter/leave events. * These frames are generally only applicable to window manager or * similar functionality; they are not recommended for general use. */ ShowFrame::~ShowFrame() { } void ShowFrame::Init() { input = onoffEvents; input->Reference(); } void ShowFrame::Handle(Event& e) { if (e.eventType == EnterEvent) { InsideFrame(true); } else if (e.eventType == LeaveEvent) { InsideFrame(false); } else { HandleInput(e); } } void ShowFrame::HandleInput(Event& e) { interior()->Handle(e); } void ShowFrame::InsideFrame(bool) { /* default is to do nothing */ } /* * A title frame is a frame around a box containing * a banner, border, and the component. */ TitleFrame::TitleFrame(Banner* b, Interactor* i, int w) : ShowFrame(nil, w) { Init(b, i); } TitleFrame::TitleFrame( const char* name, Banner* b, Interactor* i, int w ) : ShowFrame(name, nil, w) { Init(b, i); } TitleFrame::~TitleFrame() { } void TitleFrame::Init(Banner* b, Interactor* i) { SetClassName("TitleFrame"); banner = b; if (i != nil) { Insert(i); } } Interactor* TitleFrame::Wrap(Interactor* i) { Scene* p = banner->Parent(); if (p != nil) { p->Remove(banner); } return new VBox(banner, new HBorder, i); } void TitleFrame::InsideFrame(bool b) { banner->highlight = b; banner->Draw(); } /* * A border frame draws an outline using a solid pattern when * it contains the input focus and using a gray pattern otherwise. */ BorderFrame::BorderFrame(Interactor* i, int w) : ShowFrame(i, w) { Init(); } BorderFrame::BorderFrame( const char* name, Interactor* i, int w ) : ShowFrame(name, i, w) { Init(); } BorderFrame::~BorderFrame() { } void BorderFrame::Init() { SetClassName("BorderFrame"); normal = false; } void BorderFrame::InsideFrame(bool b) { normal = b; Redraw(0, 0, xmax, ymax); } void BorderFrame::Redraw(IntCoord x1, IntCoord y1, IntCoord x2, IntCoord y2) { if (normal) { Frame::Redraw(x1, y1, x2, y2); } else { const Pattern* save = output->GetPattern(); Resource::ref(save); output->SetPattern(new Pattern(Pattern::gray)); Frame::Redraw(x1, y1, x2, y2); output->SetPattern(save); Resource::unref(save); } } /* * A shadow frame is a frame with a drop shadow. */ ShadowFrame::ShadowFrame(Interactor* i, int h, int v) { Init(i, h, v); } ShadowFrame::ShadowFrame( const char* name, Interactor* i, int h, int v ) : Frame(name) { Init(i, h, v); } ShadowFrame::~ShadowFrame() { } void ShadowFrame::Init(Interactor* i, int h, int v) { if (h > 0) { bottom += h; } else { top += -h; } if (v > 0) { right += v; } else { left += -v; } if (i != nil) { Insert(i); } } void ShadowFrame::Redraw(IntCoord x1, IntCoord y1, IntCoord x2, IntCoord y2) { register IntCoord r = xmax - right; register IntCoord t = ymax - top; register IntCoord v = bottom + top - 2; register IntCoord h = left + right - 2; /* borders */ if (x1 < left) { output->FillRect(canvas, left-1, bottom-1, left-1, t); } if (y1 < bottom) { output->FillRect(canvas, left, bottom-1, r+1, bottom-1); } if (x2 > r) { output->FillRect(canvas, r+1, bottom, r+1, t+1); } if (y2 > t) { output->FillRect(canvas, left-1, t+1, r, t+1); } /* shadows */ if (left > 1 && x1 < left-1) { output->FillRect(canvas, 0, v, left-2, ymax-v); } if (bottom > 1 && y1 < bottom-1) { output->FillRect(canvas, h, 0, xmax-h, bottom-2); } if (right > 1 && x2 > r+1) { output->FillRect(canvas, r+2, v, xmax, ymax-v); } if (top > 1 && y2 > t+1) { output->FillRect(canvas, h, t+2, xmax-h, ymax); } /* corner */ if (left > 1 && bottom > 1 && x1 < left-1 && y1 < bottom-1) { output->FillRect(canvas, 0, 0, h - 1, v - 1); } else if (left > 1 && top > 1 && x1 < left-1 && y2 > t+1) { output->FillRect(canvas, 0, ymax - v + 1, h - 1, ymax); } else if (right > 1 && bottom > 1 && x2 > r+1 && y1 < bottom-1) { output->FillRect(canvas, xmax - h + 1, 0, xmax, v - 1); } else if (right > 1 && top > 1 && x1 > r+1 && y2 > t+1) { output->FillRect(canvas, xmax - h + 1, ymax - v + 1, xmax, ymax); } } /* * A margin frame surrounds its component with horizontal and vertical * glue. */ MarginFrame::MarginFrame(Interactor* i, int margin) : Frame(i, 0) { Init(margin, 0, 0, margin, 0, 0); } MarginFrame::MarginFrame( const char* name, Interactor* i, int margin ) : Frame(name, i, 0) { Init(margin, 0, 0, margin, 0, 0); } MarginFrame::MarginFrame( Interactor* i, int margin, int shrink, int stretch ) : Frame(i, 0) { Init(margin, shrink, stretch, margin, shrink, stretch); } MarginFrame::MarginFrame( const char* name, Interactor* i, int margin, int shrink, int stretch ) : Frame(name, i, 0) { Init(margin, shrink, stretch, margin, shrink, stretch); } MarginFrame::MarginFrame( Interactor* i, int hmargin1, int vmargin1 ) : Frame(i, 0) { Init(hmargin1, 0, 0, vmargin1, 0, 0); } MarginFrame::MarginFrame( const char* name, Interactor* i, int hmargin1, int vmargin1 ) : Frame(name, i, 0) { Init(hmargin1, 0, 0, vmargin1, 0, 0); } MarginFrame::MarginFrame( Interactor* i, int hmargin1, int hshrink1, int hstretch1, int vmargin1, int vshrink1, int vstretch1 ) : Frame(i, 0) { Init(hmargin1, hshrink1, hstretch1, vmargin1, vshrink1, vstretch1); } MarginFrame::MarginFrame( const char* name, Interactor* i, int hmargin1, int hshrink1, int hstretch1, int vmargin1, int vshrink1, int vstretch1 ) : Frame(name, i, 0) { Init(hmargin1, hshrink1, hstretch1, vmargin1, vshrink1, vstretch1); } MarginFrame::~MarginFrame() { } void MarginFrame::Init(int h, int hshr, int hstr, int v, int vshr, int vstr) { SetClassName("MarginFrame"); hmargin = h * 2; hshrink = hshr * 2; hstretch = hstr * 2; vmargin = v * 2; vshrink = vshr * 2; vstretch = vstr * 2; } void MarginFrame::Reconfig() { Frame::Reconfig(); shape->width += hmargin; shape->height += vmargin; shape->hshrink += hshrink; shape->hstretch += hstretch; shape->vshrink += vshrink; shape->vstretch += vstretch; } void MarginFrame::Resize() { canvas->SetBackground(output->GetBgColor()); IntCoord hextra = (xmax+1) - shape->width; IntCoord h = hmargin; if (hextra > 0 && shape->hstretch != 0) { h += int(float(hstretch) / float(shape->hstretch) * float(hextra)); } else if (hextra < 0 && shape->hshrink != 0) { h += int(float(hshrink) / float(shape->hshrink) * float(hextra)); } IntCoord vextra = (ymax+1) - shape->height; IntCoord v = vmargin; if (vextra > 0 && shape->vstretch != 0) { v += int(float(vstretch) / float(shape->vstretch) * float(vextra)); } else if (vextra < 0 && shape->vshrink != 0) { v += int(float(vshrink) / float(shape->vshrink) * float(vextra)); } Place(interior(), h/2, v/2, xmax-h/2, ymax-v/2); } void MarginFrame::Redraw(IntCoord, IntCoord, IntCoord, IntCoord) { } neuron-7.6.3/src/lib/IV-2_6/glue2_6.cpp000077500000000000000000000054531340731477100172640ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * All that's necessary for glue is to set up the shape and * redraw the background. */ #include #include #include Glue::Glue() { Init(); } Glue::Glue(const char* name) { SetInstance(name); Init(); } Glue::~Glue() { } void Glue::Init() { SetClassName("Glue"); } void Glue::Redraw(IntCoord, IntCoord, IntCoord, IntCoord) { /* * Don't do any drawing--assume that an ancestor will take care of it, * probably through Canvas::SetBackground. */ } HGlue::HGlue(int nat, int str) { Init(nat, nat, str); } HGlue::HGlue(const char* name, int nat, int str) : Glue(name) { Init(nat, nat, str); } HGlue::HGlue(int nat, int shr, int str) { Init(nat, shr, str); } HGlue::HGlue(const char* name, int nat, int shr, int str) : Glue(name) { Init(nat, shr, str); } HGlue::~HGlue() { } void HGlue::Init(int nat, int shr, int str) { SetClassName("HGlue"); shape->width = nat; shape->height = 0; shape->Rigid(shr, str, vfil, vfil); } VGlue::VGlue(int nat, int str) { Init(nat, nat, str); } VGlue::VGlue(const char* name, int nat, int str) : Glue(name) { Init(nat, nat, str); } VGlue::VGlue(int nat, int shr, int str) { Init(nat, shr, str); } VGlue::VGlue(const char* name, int nat, int shr, int str) : Glue(name) { Init(nat, shr, str); } VGlue::~VGlue() { } void VGlue::Init(int nat, int shr, int str) { SetClassName("VGlue"); shape->width = 0; shape->height = nat; shape->Rigid(hfil, hfil, shr, str); } neuron-7.6.3/src/lib/IV-2_6/interactor.cpp000066400000000000000000000330541340731477100201660ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Implementation of the base class of interaction. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include Interactor::Interactor() { Init(); } Interactor::Interactor(const char* name) { Init(); SetInstance(name); } void Interactor::Init() { shape = new Shape; canvas = nil; window = nil; perspective = nil; xmax = 0; ymax = 0; input = nil; output = nil; classname = nil; instance = nil; style = new Style; Resource::ref(style); parent = nil; cursensor = nil; world = nil; insert_window = nil; managed_window = nil; cursor_ = nil; canvas_type_ = CanvasInputOutput; handler_ = new InteractorHandler(this); Resource::ref(handler_); ref(); } Interactor::~Interactor() { Resource::unref(input); Resource::unref(output); delete window; delete shape; Resource::unref(style); Resource::unref(handler_); } World* Interactor::GetWorld() const { return world; } void Interactor::Flush() { GetWorld()->Flush(); } void Interactor::Sync() { GetWorld()->Sync(); } /* * The implementation of Check must closely match the implementation * of Read because we want Check returning true to imply that a subsequent * Read will not block. */ bool Interactor::Check() { Event e; e.display(world->display()); e.target = nil; do { if (!e.pending()) { return false; } e.read(); } while (e.handler() == nil || e.target == nil); e.unread(); return true; } class InteractorHelper : public Interactor { public: InteractorHelper(); virtual ~InteractorHelper(); static InteractorHelper* instance(Handler*); virtual void Handle(Event&); private: static InteractorHelper* instance_; static Handler* handler_; }; InteractorHelper* InteractorHelper::instance_; Handler* InteractorHelper::handler_; InteractorHelper::InteractorHelper() { } InteractorHelper::~InteractorHelper() { } InteractorHelper* InteractorHelper::instance(Handler* h) { if (instance_ == nil) { instance_ = new InteractorHelper; } handler_ = h; return instance_; } void InteractorHelper::Handle(Event& e) { Handler* h = handler_; Resource::ref(h); h->event(e); Resource::unref(h); } void Interactor::Read(Event& e) { e.display(world->display()); e.target = nil; Handler* h = nil; while (!world->done()) { e.read(); h = e.handler(); Resource::ref(h); if (e.target != nil) { Resource::unref(h); break; } if (h != nil && !e.is_grabbing(h)) { e.GetInfo(); e.target = InteractorHelper::instance(h); break; } Resource::unref(h); } } bool Interactor::Read(long sec, long usec, Event& e) { e.display(world->display()); e.target = nil; while (!world->done() && e.read(sec, usec)) { Handler* h = e.handler(); if (e.target != nil) { return true; } if (h != nil && !e.is_grabbing(h)) { e.GetInfo(); e.target = InteractorHelper::instance(h); return true; } } return false; } void Interactor::UnRead(Event& e) { e.unread(); } void Interactor::Run() { Event e; do { Read(e); if (world->done()) { break; } e.target->Handle(e); } while (e.target != nil); } void Interactor::QuitRunning(Event& e) { e.target = nil; if (world != nil) { world->quit(); } } /* * Set (x,y) for a given alignment of a shape within a canvas. */ void Interactor::Align( Alignment a, int width, int height, IntCoord& l, IntCoord& b ) const { switch (a) { case Left: case TopLeft: case CenterLeft: case BottomLeft: l = 0; break; case TopCenter: case Center: case BottomCenter: case HorizCenter: l = (xmax + 1 - width) / 2; break; case Right: case TopRight: case CenterRight: case BottomRight: l = xmax + 1 - width; break; case Bottom: case Top: case VertCenter: /* leave unchanged */ break; } switch (a) { case Bottom: case BottomLeft: case BottomCenter: case BottomRight: b = 0; break; case CenterLeft: case Center: case CenterRight: case VertCenter: b = (ymax + 1 - height) / 2; break; case Top: case TopLeft: case TopCenter: case TopRight: b = ymax + 1 - height; break; case Left: case Right: case HorizCenter: /* leave unchanged */ break; } } void Interactor::Adjust(Perspective&) { /* default is to ignore */ } void Interactor::Update() { /* default is to ignore */ } /* * Start a configuration traversal of an interactor hierarchy, * assigning parents, output painters, and calling Reconfig * for each interactor. * * This routine only works correctly when "s" is a world. * In any other case, it correctly assigns parents but does not * set up the property path for attribute lookup. It should go up * from "s" to the world, then come down pushing property directories * in the same manner as DoConfig. Instead of passing rootReversed * to DoConfig, it should compute "reverseVideo" for "s" and * pass whether it is on or not. */ void Interactor::Config(Scene* s) { if (parent != s) { if (parent != nil) { parent->Remove(this); } parent = s; /* cast to workaround DEC C++ compiler bug */ world = ((Interactor*)s)->world; DoConfig(false); } } void Interactor::Config(World* w) { if (parent != nil) { parent->Remove(this); parent = nil; } world = w; Resource::unref(output); output = nil; DoConfig(false); } /* * Configure an interactor. This implies first configuring * all of its children, then calling the Reconfig virtual. * We automatically setup the interactor's painter and check * for any local properties before calling Reconfig. * * DoConfig is passed a flag indicating whether this interactor's * parent painter has had its foreground and background colors reversed. * We copy this into a local that DefaultConfig will modify * if a reverseVideo attribute is specified that swaps the colors. * A swap occurs if either reversed is false and reverseVideo:on is found * or reversed is true and reverseVideo:off is found. */ void Interactor::DoConfig(bool parentReversed) { bool reversed = parentReversed; if (parent != nil) { /* cast to workaround DEC C++ compiler bug */ output = ((Interactor*)parent)->output; } DefaultConfig(reversed); Resource::ref(output); Interactor* children[100]; Interactor** a; int n; GetComponents(children, sizeof(children) / sizeof(Interactor*), a, n); if (n > 0) { for (Interactor** ii = a; ii < &a[n]; ii++) { Interactor* i = *ii; i->parent = (Scene*)this; i->world = world; i->DoConfig(reversed); } if (a != children) { delete a; } } Reconfig(); } /* * Setup an interactor's painter. If the style hasn't changed from * its parent, then just use the parent's painter. */ void Interactor::DefaultConfig(bool& reversed) { if (parent == nil) { world->display()->style()->append(style); } else { /* cast to workaround DEC C++ compiler bug */ ((Interactor*)parent)->style->append(style); } const Font* f = nil; const Color* fg = nil; const Color* bg = nil; Display* d = world->display(); String v; if (style->find_attribute("font", v) || style->find_attribute("Font", v)) { f = Font::lookup(v); } if (style->find_attribute("foreground", v) || style->find_attribute("Foreground", v) ) { fg = Color::lookup(d, v); } if (style->find_attribute("background", v) || style->find_attribute("Background", v) ) { bg = Color::lookup(d, v); } if (reversed) { const Color* c = fg; fg = bg; bg = c; } bool swap_colors = false; String rv; if (style->find_attribute("reverseVideo", rv)) { if (rv.case_insensitive_equal("on")) { if (!reversed) { swap_colors = true; reversed = true; } } else if (rv.case_insensitive_equal("off")) { if (reversed) { swap_colors = true; reversed = false; } } else { /* error message? */ } } if (output == nil) { output = new Painter; } else if (!swap_colors && f == output->GetFont() && fg == output->GetFgColor() && bg == output->GetBgColor() ) { return; } else { output = new Painter(output); } if (f != nil) { output->SetFont(f); } if (swap_colors) { const Color* c = fg; fg = bg; bg = c; } output->SetColors(fg, bg); } /* * Retrieve an attribute value using the interactor's style. */ const char* Interactor::GetAttribute(const char* name) const { String v; if (style->find_attribute(name, v) || ( style->parent() == nil && World::current()->display()->style()->find_attribute(name, v) ) ) { return v.string(); } return nil; } /* * Short-hand for testing if an attribute is "on" or "true". */ bool Interactor::AttributeIsSet(const char* name) const { String v; return ( style->value_is_on(name) || ( style->parent() == nil && !style->find_attribute(name, v) && World::current()->display()->style()->value_is_on(name) ) ); } /* * Given (x,y) relative to this, translate them to (x',y') that are * relative to the interactor "rel". If "rel" is nil, then make * (x',y') relative to the screen. */ void Interactor::GetRelative(IntCoord& x, IntCoord& y, Interactor* rel) const { /* make (x,y) screen-relative */ IntCoord left, bottom; GetPosition(left, bottom); x += left; y += bottom; if (rel != nil) { /* subtract position of other interactor */ IntCoord rel_left, rel_bottom; rel->GetPosition(rel_left, rel_bottom); x -= rel_left; y -= rel_bottom; } } /* * Return coordinates relative to the world. The given world * isn't relevant; it only makes sense for backward compatibility * (for the days when World was a subclass of Scene). */ void Interactor::GetRelative(IntCoord& x, IntCoord& y, World*) const { IntCoord left, bottom; GetPosition(left, bottom); x += left; y += bottom; } void Interactor::Orphan() { delete window; window = nil; canvas = nil; } void Interactor::GetComponents(Interactor**, int, Interactor**&, int& n) { n = 0; } void Interactor::Draw() { if (canvas != nil && canvas->status() != Canvas::unmapped) { Redraw(0, 0, xmax, ymax); } } void Interactor::Activate() { } void Interactor::Deactivate() { } void Interactor::Handle(Event&) { } void Interactor::Highlight(bool) { } void Interactor::Reconfig() { } void Interactor::Redraw(IntCoord, IntCoord, IntCoord, IntCoord) { } void Interactor::Resize() { } /* * Default is to redraw each area separately. */ void Interactor::RedrawList( int n, IntCoord left[], IntCoord bottom[], IntCoord right[], IntCoord top[] ) { register int i; for (i = 0; i < n; i++) { Redraw(left[i], bottom[i], right[i], top[i]); } } /* * Default is to accept a new shape completely and * notify the parent (if set). */ void Interactor::Reshape(Shape& ns) { *shape = ns; if (parent != nil) { parent->Change(this); } } void Interactor::SetClassName(const char* s) { if (s != nil) { style->alias(String(s)); } classname = s; } const char* Interactor::GetClassName() const { return classname; } void Interactor::SetInstance(const char* s) { if (s != nil) { style->name(String(s)); } instance = s; } const char* Interactor::GetInstance() const { return instance; } void Interactor::SetCursor(Cursor* c) { cursor_ = c; if (canvas != nil) { window->cursor(c); } } Cursor* Interactor::GetCursor() const { return cursor_; } Canvas* Interactor::GetCanvas() const { return canvas; } /* * Set the type of canvas for save under, backing store, etc. * This operation has no effect until the next time the canvas * is explicitly mapped. */ void Interactor::SetCanvasType(CanvasType ct) { canvas_type_ = ct; } CanvasType Interactor::GetCanvasType() const { return canvas_type_; } ManagedWindow* Interactor::GetTopLevelWindow() const { return managed_window; } neuron-7.6.3/src/lib/IV-2_6/matcheditor.cpp000066400000000000000000000057611340731477100203230ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * MatchEditor - StringEditor with pattern matching */ #include #include #include #include #include #include MatchEditor::MatchEditor ( ButtonState* s, const char* sample1, const char* done1 ) : StringEditor(s, sample1, done1) { Init(); } MatchEditor::MatchEditor ( const char* name, ButtonState* s, const char* sample1, const char* done1 ) : StringEditor(name, s, sample1, done1) { Init(); } MatchEditor::~MatchEditor () { } void MatchEditor::Init () { SetClassName("MatchEditor"); Match("%[]", true); } void MatchEditor::Match (const char* p, bool m) { char* pp; for (pp = pattern; *p != '\0'; ++p, ++pp) { *pp = *p; if (*p == '%') { ++p; ++pp; if (*p != '%' && *p != '*') { *pp = '*'; ++pp; } *pp = *p; } } *pp = '\0'; strcat(pattern, "%*c"); /* workaround bug in Sparc sscanf */ match_on_keystroke = m; } bool MatchEditor::HandleChar (char c) { bool done1 = StringEditor::HandleChar(c); if (done1 || (!iscntrl(c) && match_on_keystroke)) { char buf[1000]; int length = text->Length(); strncpy(buf, text->Text(), length); while (length > 0) { buf[length] = '\0'; if (sscanf(buf, "%s", pattern) == EOF) { break; } --length; } if (length != text->Length()) { GetWorld()->RingBell(1); Select(length, text->Length()); } } if (done1 && left == right) { return true; } else { return false; } } neuron-7.6.3/src/lib/IV-2_6/menu2_6.cpp000066400000000000000000000170611340731477100172670ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Implementation of common menus. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include /** class MenuItem **/ MenuItem::MenuItem(Interactor* i) : Control(i) { Init(); } MenuItem::MenuItem(const char* name, Interactor* i) : Control(name, i) { Init(); } MenuItem::MenuItem( const char* str, Alignment al ) : Control(new Message(str, al, 2, hfil, 0)) { Init(); } MenuItem::MenuItem( const char* name, const char* str, Alignment al ) : Control(name, new Message(str, al, 2, hfil, 0)) { Init(); } MenuItem::~MenuItem() { } void MenuItem::Init() { SetClassName("MenuItem"); } void MenuItem::Busy() { RootControl()->Highlight(true); } void MenuItem::Done() { RootControl()->Highlight(false); } /** class MenuShadow **/ class MenuShadow : public MonoScene { public: static Pattern* halftone; int depth_; MenuShadow(Interactor*, int depth = 4); virtual ~MenuShadow(); virtual void Reconfig(); virtual void Resize(); virtual void Redraw(IntCoord, IntCoord, IntCoord, IntCoord); }; Pattern* MenuShadow::halftone; MenuShadow::MenuShadow(Interactor* i, int d) { SetClassName("MenuShadow"); depth_ = d; if (halftone == nil) { halftone = new Pattern(Pattern::gray); halftone->ref(); } if (i != nil) { Insert(new Frame(i)); } } MenuShadow::~MenuShadow() { } void MenuShadow::Reconfig() { MonoScene::Reconfig(); const char* d = GetAttribute("depth"); if (d != nil) { depth_ = atoi(d); } shape->width += depth_; shape->height += depth_; } void MenuShadow::Resize() { if (interior() != nil) { Place(interior(), 0, depth_, xmax - depth_, ymax); } } void MenuShadow::Redraw(IntCoord x1, IntCoord y1, IntCoord x2, IntCoord y2) { if (x2 >= depth_ && y1 <= ymax - depth_) { const Pattern* p = output->GetPattern(); Resource::ref(p); bool b = output->BgFilled(); output->SetPattern(halftone); output->FillBg(false); IntCoord left = Math::max(x1, depth_); IntCoord top = Math::min(y2, ymax - depth_); output->FillRect(canvas, left, y1, x2, top); output->FillBg(b); output->SetPattern(p); Resource::unref(p); } } /** class Menu **/ Menu::Menu(Interactor* i) : Control(i) { Init(); } Menu::Menu(const char* name, Interactor* i) : Control(name, i) { Init(); } void Menu::Init() { SetClassName("Menu"); state_ = new ControlState; state_->Reference(); scene_ = new VBox; body_ = new MenuShadow(scene_); depth_ = 3; align_ = BottomLeft; world_ = nil; rel_x_ = 0; rel_y_ = 0; ins_x_ = 0; ins_y_ = 0; } Menu::~Menu() { delete body_; Unref(state_); } void Menu::SetAlign(Alignment a) { align_ = a; } void Menu::SetDepth(int d) { depth_ = d; } void Menu::SetBodyState(ControlState* s) { Unref(state_); state_ = s; s->Reference(); } void Menu::SetScene(Scene* s) { delete body_; scene_ = s; body_ = nil; for (Scene* p = scene_; p != nil; p = p->Parent()) { body_ = p; } } void Menu::Include(Control* c) { scene_->Insert(c); c->SetState(GetBodyState()); Reparent(c, this); } void Menu::Reconfig() { Control::Reconfig(); world_ = GetWorld(); Setup(); } void Menu::Setup() { body_->Config(world_); Shape* s = body_->GetShape(); rel_x_ = s->width / 2; rel_y_ = s->height / 2; } void Menu::Popup(Event& e) { if (Enabled()) { World* w; IntCoord wx, wy; e.GetAbsolute(w, wx, wy); if (w != world_) { world_ = w; Setup(); } InsertBody(wx - rel_x_, wy - rel_y_); State()->Selection(this); } } void Menu::Leave() { } void Menu::Open() { IntCoord x, y; Align(align_, 0, 0, x, y); GetRelative(x, y); InsertBody(x, y - body_->GetShape()->height); } void Menu::InsertBody(IntCoord x, IntCoord y) { ins_x_ = x; ins_y_ = y; world_->InsertPopup(body_, x, y); State()->Push(state_); state_->Activate(); world_->Flush(); } void Menu::Close() { if (body_->GetCanvas() != nil) { Control* action = state_->Action(); state_->Action(nil); if (action != nil) { action->Align(Center, 0, 0, rel_x_, rel_y_); action->GetRelative(rel_x_, rel_y_, body_); } } state_->Pop(); world_->Remove(body_); world_->Flush(); } /** class MenuBar **/ MenuBar::MenuBar() { Init(); } MenuBar::MenuBar(const char* name) { SetInstance(name); Init(); } void MenuBar::Init() { SetClassName("MenuBar"); state_ = new ControlState; state_->Reference(); } MenuBar::~MenuBar() { Unref(state_); } void MenuBar::Include(Control* c) { Insert(c); c->SetState(state_); } /** class PulldownMenu **/ PulldownMenu::PulldownMenu(Interactor* i) : Menu(i) { Init(); } PulldownMenu::PulldownMenu( const char* name, Interactor* i ) : Menu(name, i) { Init(); } PulldownMenu::PulldownMenu( const char* str ) : Menu(str, new Message(str, Center, 2)) { Init(); } PulldownMenu::PulldownMenu( const char* name, const char* str ) : Menu(name, new Message(str, Center, 2)) { Init(); } PulldownMenu::~PulldownMenu() { } void PulldownMenu::Init() { SetClassName("PulldownMenu"); SetAlign(BottomLeft); } /** class PullrightMenu **/ PullrightMenu::PullrightMenu(Interactor* i) : Menu(i) { Init(); } PullrightMenu::PullrightMenu( const char* name, Interactor* i ) : Menu(name, i) { Init(); } PullrightMenu::PullrightMenu( const char* str ) : Menu(str, new Message(str, Left, 2)) { Init(); } PullrightMenu::PullrightMenu( const char* name, const char* str ) : Menu(name, new Message(str, Left, 2)) { Init(); } PullrightMenu::~PullrightMenu() { } void PullrightMenu::Init() { SetClassName("PullrightMenu"); SetAlign(TopRight); } /** class PopupMenu **/ PopupMenu::PopupMenu() : Menu((Interactor*)nil) { Init(); } PopupMenu::PopupMenu(const char* name) : Menu(name, (Interactor*)nil) { Init(); } PopupMenu::~PopupMenu() { } void PopupMenu::Init() { SetClassName("PopupMenu"); SetState(new ControlState); SetAlign(Center); } neuron-7.6.3/src/lib/IV-2_6/message.cpp000066400000000000000000000063001340731477100174320ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Message class implementation. */ #include #include #include #include #include #include Message::Message(const char* msg, Alignment al, int pad1, int hstr, int vstr) { Init(msg, al, pad1, hstr, vstr); } Message::Message( const char* name, const char* msg, Alignment al, int pad1, int hstr, int vstr ) : Interactor(name) { Init(msg, al, pad1, hstr, vstr); } void Message::Init (const char* t, Alignment a, int p, int hstr, int vstr) { SetClassName("Message"); if (t == nil) { text = nil; } else { text = new char[strlen(t)+1]; strcpy(text, t); } alignment = a; pad = p; shape->hstretch = hstr; shape->vstretch = vstr; highlighted = false; } Message::~Message() { delete [] text; } void Message::Reconfig () { const char* a = GetAttribute("text"); if (a != nil) { delete [] text; text = new char[strlen(a)+1]; strcpy(text, a); } a = GetAttribute("padding"); if (a != nil) { pad = atoi(a); } const Font* f = output->GetFont(); shape->width = pad + f->Width(text) + pad; shape->height = pad + f->Height() + pad; shape->hshrink = pad + pad; shape->vshrink = pad + pad; } void Message::Realign (Alignment a) { alignment = a; Draw(); } void Message::Redraw (IntCoord l, IntCoord b, IntCoord r, IntCoord t) { IntCoord x = 0, y = 0; Align(alignment, shape->width, shape->height, x, y); output->Clip(canvas, l, b, r, t); if (highlighted) { output->SetColors(output->GetBgColor(), output->GetFgColor()); } output->ClearRect(canvas, l, b, r, t); output->Text(canvas, text, x + pad, y + pad); if (highlighted) { output->SetColors(output->GetBgColor(), output->GetFgColor()); } output->NoClip(); } void Message::Highlight (bool b) { if (highlighted != b) { highlighted = b; Draw(); } } neuron-7.6.3/src/lib/IV-2_6/painter.cpp000066400000000000000000000320371340731477100174560ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Graphics primitives. */ #include #include #include #include #include #include #include #include #include #include #include #include /* * For reasons of caching, it is important that the attributes * are set to nil (or 0) before being set to their default values. * Also, it is important that the colors are set before the fill pattern. */ void Painter::Init() { foreground = nil; background = nil; pattern = nil; br = nil; font = nil; style = 0; matrix = nil; World* w = World::current(); SetColors(w->foreground(), w->background()); SetPattern(new Pattern); FillBg(true); SetBrush(new Brush(0xffff, 0)); SetFont(w->font()); SetStyle(Plain); SetOrigin(0, 0); MoveTo(0, 0); } void Painter::Copy(Painter* copy) { foreground = nil; background = nil; pattern = nil; br = nil; font = nil; style = 0; matrix = nil; SetColors(copy->foreground, copy->background); SetPattern(copy->pattern); SetBrush(copy->br); SetFont(copy->font); SetStyle(copy->style); SetTransformer(copy->matrix); SetOrigin(copy->xoff, copy->yoff); MoveTo(copy->curx, copy->cury); } const Color* Painter::GetFgColor() const { return foreground; } const Color* Painter::GetBgColor() const { return background; } const Pattern* Painter::GetPattern() const { return pattern; } const Brush* Painter::GetBrush() const { return br; } const Font* Painter::GetFont() const { return font; } void Painter::SetStyle(int s) { style = s; } int Painter::GetStyle() const { return style; } void Painter::SetTransformer(Transformer *t) { if (matrix != t) { Unref(matrix); matrix = t; if (matrix != nil) { matrix->Reference(); } } } Transformer* Painter::GetTransformer() const { return matrix; } void Painter::MoveTo(int x, int y) { curx = x; cury = y; } void Painter::GetPosition(int& x, int& y) const { x = curx; y = cury; } void Painter::SetOrigin(int x0, int y0) { xoff = x0; yoff = y0; } void Painter::GetOrigin(int& x0, int& y0) const { x0 = xoff; y0 = yoff; } void Painter::Translate(float dx, float dy) { if (dx != 0.0 || dy != 0.0) { if (matrix == nil) { matrix = new Transformer; } matrix->Translate(dx, dy); } } void Painter::Scale(float sx, float sy) { if (sx != 1.0 || sy != 1.0) { if (matrix == nil) { matrix = new Transformer; } matrix->Scale(sx, sy); } } void Painter::Rotate(float angle) { if (angle - int(angle) != 0.0 || int(angle) % 360 != 0) { if (matrix == nil) { matrix = new Transformer; } matrix->Rotate(angle); } } void Painter::CurveTo(Canvas* c, IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1, IntCoord x2, IntCoord y2 ) { Curve(c, curx, cury, x0, y0, x1, y1, x2, y2); curx = x2; cury = y2; } void Painter::Text(Canvas* c, const char* s) { int len = strlen(s); Text(c, s, len, curx, cury); curx += font->Width(s, len); } void Painter::Text(Canvas* c, const char* s, int len) { Text(c, s, len, curx, cury); curx += font->Width(s, len); } void Painter::Text(Canvas* c, const char* s, IntCoord x, IntCoord y) { Text(c, s, strlen(s), x, y); } /* * Spline drawing. */ const int INITBUFSIZE = 100; const double SMOOTHNESS = 1.0; static int llsize = 0; static int llcount = 0; static IntCoord* llx; static IntCoord* lly; static void GrowBufs(IntCoord*& b1, IntCoord*& b2, int& cur) { IntCoord* newb1; IntCoord* newb2; int newsize; if (cur == 0) { cur = INITBUFSIZE; b1 = new IntCoord[INITBUFSIZE]; b2 = new IntCoord[INITBUFSIZE]; } else { newsize = cur * 2; newb1 = new IntCoord[newsize]; newb2 = new IntCoord[newsize]; Memory::copy(b1, newb1, cur * sizeof(IntCoord)); Memory::copy(b2, newb2, cur * sizeof(IntCoord)); delete [] b1; delete [] b2; b1 = newb1; b2 = newb2; cur = newsize; } } inline void Midpoint( double x0, double y0, double x1, double y1, double& mx, double& my ) { mx = (x0 + x1) / 2.0; my = (y0 + y1) / 2.0; } inline void ThirdPoint( double x0, double y0, double x1, double y1, double& tx, double& ty ) { tx = (2*x0 + x1) / 3.0; ty = (2*y0 + y1) / 3.0; } inline bool CanApproxWithLine( double x0, double y0, double x2, double y2, double x3, double y3 ) { double triangleArea, sideSquared, dx, dy; triangleArea = x0*y2 - x2*y0 + x2*y3 - x3*y2 + x3*y0 - x0*y3; triangleArea *= triangleArea; // actually 4 times the area dx = x3 - x0; dy = y3 - y0; sideSquared = dx*dx + dy*dy; return triangleArea <= SMOOTHNESS * sideSquared; } inline void AddLine(double x0, double y0, double x1, double y1) { if (llcount >= llsize) { GrowBufs(llx, lly, llsize); } if (llcount == 0) { llx[llcount] = Math::round(x0); lly[llcount] = Math::round(y0); ++llcount; } llx[llcount] = Math::round(x1); lly[llcount] = Math::round(y1); ++llcount; } static void AddBezierCurve( double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3 ) { double midx01, midx12, midx23, midlsegx, midrsegx, cx; double midy01, midy12, midy23, midlsegy, midrsegy, cy; Midpoint(x0, y0, x1, y1, midx01, midy01); Midpoint(x1, y1, x2, y2, midx12, midy12); Midpoint(x2, y2, x3, y3, midx23, midy23); Midpoint(midx01, midy01, midx12, midy12, midlsegx, midlsegy); Midpoint(midx12, midy12, midx23, midy23, midrsegx, midrsegy); Midpoint(midlsegx, midlsegy, midrsegx, midrsegy, cx, cy); if (CanApproxWithLine(x0, y0, midlsegx, midlsegy, cx, cy)) { AddLine(x0, y0, cx, cy); } else if ( (midx01 != x1) || (midy01 != y1) || (midlsegx != x2) || (midlsegy != y2) || (cx != x3) || (cy != y3) ) { AddBezierCurve( x0, y0, midx01, midy01, midlsegx, midlsegy, cx, cy ); } if (CanApproxWithLine(cx, cy, midx23, midy23, x3, y3)) { AddLine(cx, cy, x3, y3); } else if ( (cx != x0) || (cy != y0) || (midrsegx != x1) || (midrsegy != y1) || (midx23 != x2) || (midy23 != y2) ) { AddBezierCurve( cx, cy, midrsegx, midrsegy, midx23, midy23, x3, y3 ); } } static void CalcBSpline( IntCoord cminus1x, IntCoord cminus1y, IntCoord cx, IntCoord cy, IntCoord cplus1x, IntCoord cplus1y, IntCoord cplus2x, IntCoord cplus2y ) { double p0x, p1x, p2x, p3x, tempx, p0y, p1y, p2y, p3y, tempy; ThirdPoint( double(cx), double(cy), double(cplus1x), double(cplus1y), p1x, p1y ); ThirdPoint( double(cplus1x), double(cplus1y), double(cx), double(cy), p2x, p2y ); ThirdPoint( double(cx), double(cy), double(cminus1x), double(cminus1y), tempx, tempy ); Midpoint(tempx, tempy, p1x, p1y, p0x, p0y); ThirdPoint( double(cplus1x), double(cplus1y), double(cplus2x), double(cplus2y), tempx, tempy ); Midpoint(tempx, tempy, p2x, p2y, p3x, p3y); AddBezierCurve(p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y); } inline void CreateOpenLineList(IntCoord *cpx, IntCoord *cpy, int cpcount) { int cpi; llcount = 0; CalcBSpline( cpx[0], cpy[0], cpx[0], cpy[0], cpx[0], cpy[0], cpx[1], cpy[1] ); CalcBSpline( cpx[0], cpy[0], cpx[0], cpy[0], cpx[1], cpy[1], cpx[2], cpy[2] ); for (cpi = 1; cpi < cpcount - 2; ++cpi) { CalcBSpline( cpx[cpi - 1], cpy[cpi - 1], cpx[cpi], cpy[cpi], cpx[cpi + 1], cpy[cpi + 1], cpx[cpi + 2], cpy[cpi + 2] ); } CalcBSpline( cpx[cpi - 1], cpy[cpi - 1], cpx[cpi], cpy[cpi], cpx[cpi + 1], cpy[cpi + 1], cpx[cpi + 1], cpy[cpi + 1] ); CalcBSpline( cpx[cpi], cpy[cpi], cpx[cpi + 1], cpy[cpi + 1], cpx[cpi + 1], cpy[cpi + 1], cpx[cpi + 1], cpy[cpi + 1] ); } inline void CreateClosedLineList(IntCoord *cpx, IntCoord *cpy, int cpcount) { int cpi; llcount = 0; CalcBSpline( cpx[cpcount - 1], cpy[cpcount - 1], cpx[0], cpy[0], cpx[1], cpy[1], cpx[2], cpy[2] ); for (cpi = 1; cpi < cpcount - 2; ++cpi) { CalcBSpline( cpx[cpi - 1], cpy[cpi - 1], cpx[cpi], cpy[cpi], cpx[cpi + 1], cpy[cpi + 1], cpx[cpi + 2], cpy[cpi + 2] ); } CalcBSpline( cpx[cpi - 1], cpy[cpi - 1], cpx[cpi], cpy[cpi], cpx[cpi + 1], cpy[cpi + 1], cpx[0], cpy[0] ); CalcBSpline( cpx[cpi], cpy[cpi], cpx[cpi + 1], cpy[cpi + 1], cpx[0], cpy[0], cpx[1], cpy[1] ); } static int bufsize = 0; static IntCoord* bufx, * bufy; static void CheckBufs(IntCoord*& b1, IntCoord*& b2, int& cur, int desired) { if (cur < desired) { if (cur == 0) { cur = Math::max(INITBUFSIZE, desired); } else { delete [] b1; delete [] b2; cur = Math::max(cur * 2, desired); } b1 = new IntCoord[cur]; b2 = new IntCoord[cur]; } } void Painter::Curve( Canvas* c, IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1, IntCoord x2, IntCoord y2, IntCoord x3, IntCoord y3 ) { IntCoord tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3; llcount = 0; Map(c, x0, y0, tx0, ty0); Map(c, x1, y1, tx1, ty1); Map(c, x2, y2, tx2, ty2); Map(c, x3, y3, tx3, ty3); AddBezierCurve(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3); MultiLineNoMap(c, llx, lly, llcount); } void Painter::BSpline(Canvas* c, IntCoord x[], IntCoord y[], int count) { CheckBufs(bufx, bufy, bufsize, count); MapList(c, x, y, count, bufx, bufy); if (count < 3) { MultiLineNoMap(c, bufx, bufy, count); } else { CreateOpenLineList(bufx, bufy, count); MultiLineNoMap(c, llx, lly, llcount); } } void Painter::ClosedBSpline(Canvas* c, IntCoord x[], IntCoord y[], int count) { CheckBufs(bufx, bufy, bufsize, count); MapList(c, x, y, count, bufx, bufy); if (count < 3) { MultiLineNoMap(c, bufx, bufy, count); } else { CreateClosedLineList(bufx, bufy, count); MultiLineNoMap(c, llx, lly, llcount); } } void Painter::FillBSpline(Canvas* c, IntCoord x[], IntCoord y[], int count) { CheckBufs(bufx, bufy, bufsize, count); MapList(c, x, y, count, bufx, bufy); if (count < 3) { FillPolygonNoMap(c, bufx, bufy, count); } else { CreateClosedLineList(bufx, bufy, count); FillPolygonNoMap(c, llx, lly, llcount); } } void Painter::Map(Canvas* c, IntCoord x, IntCoord y, short& sx, short& sy) { IntCoord cx, cy; Map(c, x, y, cx, cy); sx = short(cx); sy = short(cy); } const float axis = 0.42; const float seen = 1.025; void Painter::Ellipse(Canvas* c, IntCoord cx, IntCoord cy, int r1, int r2) { float px1, py1, px2, py2, x[8], y[8]; px1 = float(r1)*axis; py1 = float(r2)*axis; px2 = float(r1)*seen; py2 = float(r2)*seen; x[0] = cx + px1; y[0] = cy + py2; x[1] = cx - px1; y[1] = y[0]; x[2] = cx - px2; y[2] = cy + py1; x[3] = x[2]; y[3] = cy - py1; x[4] = x[1]; y[4] = cy - py2; x[5] = x[0]; y[5] = y[4]; x[6] = cx + px2; y[6] = y[3]; x[7] = x[6]; y[7] = y[2]; CheckBufs(bufx, bufy, bufsize, 8); MapList(c, (float*) x, (float*) y, 8, bufx, bufy); CreateClosedLineList(bufx, bufy, 8); MultiLineNoMap(c, llx, lly, llcount); } void Painter::FillEllipse( Canvas* c, IntCoord cx, IntCoord cy, int r1, int r2 ) { float px1, py1, px2, py2, x[8], y[8]; px1 = float(r1)*axis; py1 = float(r2)*axis; px2 = float(r1)*seen; py2 = float(r2)*seen; x[0] = cx + px1; y[0] = cy + py2; x[1] = cx - px1; y[1] = y[0]; x[2] = cx - px2; y[2] = cy + py1; x[3] = x[2]; y[3] = cy - py1; x[4] = x[1]; y[4] = cy - py2; x[5] = x[0]; y[5] = y[4]; x[6] = cx + px2; y[6] = y[3]; x[7] = x[6]; y[7] = y[2]; CheckBufs(bufx, bufy, bufsize, 8); MapList(c, (float*) x, (float*) y, 8, bufx, bufy); CreateClosedLineList(bufx, bufy, 8); FillPolygonNoMap(c, llx, lly, llcount); } neuron-7.6.3/src/lib/IV-2_6/panner2_6.cpp000066400000000000000000000232621340731477100176060ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Panner implementation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include Panner::Panner (Interactor* i, int size1) { Init(i, size1); } Panner::Panner (const char* name, Interactor* i, int size1) { SetInstance(name); Init(i, size1); } Panner::~Panner() { } /* 0.3 second delay for auto-repeat */ static int DELAY = 3; void Panner::Init (Interactor* i, int n) { SetClassName("Panner"); size = n; adjusters = new HBox( new HGlue, new VBox( new VGlue, new UpMover(i, DELAY), new HBox( new HGlue, new LeftMover(i, DELAY), new HGlue, new RightMover(i, DELAY), new HGlue ), new DownMover(i, DELAY), new VGlue ), new HGlue, new VBox( new VGlue(2), new Enlarger(i), new VGlue(4), new Reducer(i), new VGlue(2) ), new HGlue ); slider = new Slider(i); Insert( new VBox(adjusters, new HBorder, slider) ); } void Panner::Reconfig () { MonoScene::Reconfig(); Shape a = *adjusters->GetShape(); if (a.vstretch != 0 || a.vshrink != a.height / 3) { if (size != 0) { a.width = size; a.hshrink = a.hstretch = 0; } a.vstretch = 0; a.vshrink = a.height/3; adjusters->Reshape(a); } Shape* s = slider->GetShape(); if (s->width != a.width) { slider->Reshape(a); } } static const int MIN_SLIDER_HT = 20; enum MoveType { MOVE_HORIZ, MOVE_VERT, MOVE_UNDEF }; Slider::Slider (Interactor* i) { Init(i); } Slider::Slider (const char* name, Interactor* i) { SetInstance(name); Init(i); } void Slider::Init (Interactor* i) { SetClassName("Slider"); interactor = i; view = i->GetPerspective(); view->Attach(this); shown = new Perspective; constrained = false; moveType = MOVE_UNDEF; *shown = *view; shape->vstretch = shape->vshrink = 0; prevl = prevb = prevr = prevt = 0; input = new Sensor(updownEvents); } void Slider::Reconfig () { Painter* p = new Painter(output); p->Reference(); Unref(output); output = p; const char* attrib = GetAttribute("syncScroll"); syncScroll = attrib != nil && (strcmp(attrib, "true") == 0 || strcmp(attrib, "on") == 0); } void Slider::Reshape (Shape& ns) { if (shown->width == 0) { *shape = ns; } else { shape->width = (canvas == nil) ? ns.width : xmax + 1; float aspect = float(shown->height) / float(shown->width); int h = Math::round(aspect * float(shape->width)); if (h != shape->height) { shape->height = h; Scene* p = Parent(); if (p != nil) { p->Change(this); } } } } void Slider::Draw () { if (canvas != nil) { output->SetPattern(new Pattern(Pattern::lightgray)); output->FillRect(canvas, 0, 0, xmax, ymax); output->SetPattern(new Pattern(int(Pattern::clear))); output->FillRect(canvas, left, bottom, right, top); output->SetPattern(new Pattern(Pattern::solid)); output->Rect(canvas, left, bottom, right, top); output->Line(canvas, left+1, bottom-1, right+1, bottom-1); output->Line(canvas, right+1, bottom-1, right+1, top-1); prevl = left; prevb = bottom; prevr = right; prevt = top; } } void Slider::Redraw ( IntCoord left1, IntCoord bottom1, IntCoord right1, IntCoord top1 ) { output->Clip(canvas, left1, bottom1, right1, top1); Draw(); output->NoClip(); } inline IntCoord Slider::ViewX (IntCoord x) { return Math::round(float(x) * float(shown->width) / float(xmax)); } inline IntCoord Slider::ViewY (IntCoord y) { return Math::round(float(y) * float(shown->height) / float(ymax)); } inline IntCoord Slider::SliderX (IntCoord x) { return Math::round(float(x) * float(xmax) / float(shown->width)); } inline IntCoord Slider::SliderY (IntCoord y) { return Math::round(float(y) * float(ymax) / float(shown->height)); } void Slider::Move (IntCoord dx, IntCoord dy) { shown->curx += dx; shown->cury += dy; } bool Slider::Inside (Event& e) { return e.x > left && e.x < right && e.y > bottom && e.y < top; } void Slider::CalcLimits (Event& e) { llim = e.x - Math::max(0, left); blim = e.y - Math::max(0, bottom); rlim = e.x + Math::max(0, xmax - right); tlim = e.y + Math::max(0, ymax - top); constrained = e.shift; moveType = MOVE_UNDEF; origx = e.x; origy = e.y; } static int CONSTRAIN_THRESH = 2; // difference between x and y movement needed to decide which direction // is constrained void Slider::Constrain (Event& e) { IntCoord dx, dy; if (constrained && moveType == MOVE_UNDEF) { dx = Math::abs(e.x - origx); dy = Math::abs(e.y - origy); if (Math::abs(dx - dy) < CONSTRAIN_THRESH) { e.x = origx; e.y = origy; } else if (dx > dy) { moveType = MOVE_HORIZ; } else { moveType = MOVE_VERT; } } if (!constrained) { e.x = Math::min(Math::max(e.x, llim), rlim); e.y = Math::min(Math::max(e.y, blim), tlim); } else if (moveType == MOVE_HORIZ) { e.x = Math::min(Math::max(e.x, llim), rlim); e.y = origy; } else if (moveType == MOVE_VERT) { e.x = origx; e.y = Math::min(Math::max(e.y, blim), tlim); } } void Slider::Slide (Event& e) { IntCoord newleft, newbot, dummy; bool control = e.control; Listen(allEvents); SlidingRect r(output, canvas, left, bottom, right, top, e.x, e.y); CalcLimits(e); do { switch (e.eventType) { case MotionEvent: e.target->GetRelative(e.x, e.y, this); Constrain(e); r.Track(e.x, e.y); if ((syncScroll && !control) || (!syncScroll && control)) { r.Erase(); r.GetCurrent(newleft, newbot, dummy, dummy); Move(ViewX(newleft - left), ViewY(newbot - bottom)); interactor->Adjust(*shown); } break; default: break; } Read(e); } while (e.eventType != UpEvent); r.GetCurrent(newleft, newbot, dummy, dummy); Move(ViewX(newleft - left), ViewY(newbot - bottom)); Listen(input); } void Slider::Jump (Event& e) { register Perspective* s = shown; IntCoord dx, dy; if (e.button == RIGHTMOUSE) { dx = ViewX(e.x) - s->curx - s->curwidth/2; dy = ViewY(e.y) - s->cury - s->curheight/2; } else { if (e.button == LEFTMOUSE) { dx = s->sx; dy = s->sy; } else { dx = s->lx; dy = s->ly; } if (e.x < left) { dx = -dx; } else if (e.x < right) { dx = 0; } if (e.y < bottom) { dy = -dy; } else if (e.y < top) { dy = 0; } } dx = Math::min( Math::max(s->x0 - s->curx, dx), s->x0 + s->width - s->curx - s->curwidth ); dy = Math::min( Math::max(s->y0 - s->cury, dy), s->y0 + s->height - s->cury - s->curheight ); Move(dx, dy); } void Slider::Handle (Event& e) { if (e.eventType == DownEvent) { if (Inside(e)) { Slide(e); } else { Jump(e); } interactor->Adjust(*shown); } } static const int MIN_SIZE = 2; void Slider::SizeKnob () { register Perspective* s = shown; if (canvas != nil) { left = SliderX(s->curx - s->x0); bottom = SliderY(s->cury - s->y0); right = left + Math::max(SliderX(s->curwidth), MIN_SIZE); top = bottom + Math::max(SliderY(s->curheight), MIN_SIZE); } } void Slider::Update () { register Perspective* p = shown; int h, oldwidth, oldheight; float aspect; Scene* s; Shape ns; oldwidth = p->width; oldheight = p->height; *p = *view; aspect = float(p->height) / float(p->width); SizeKnob(); if (p->width != oldwidth || p->height != oldheight) { h = Math::round(aspect * float(shape->width)); if (h == shape->height) { Draw(); } else { shape->height = h; if ((s = Parent()) != nil) { s->Change(this); } } } else if ( prevl != left || prevb != bottom || prevr != right || prevt != top ) { Draw(); } } void Slider::Resize () { int w = xmax + 1; if (shape->width != w) { Shape ns = *shape; ns.width = w; Reshape(ns); } SizeKnob(); } Slider::~Slider () { view->Detach(this); Unref(shown); } neuron-7.6.3/src/lib/IV-2_6/perspective.cpp000066400000000000000000000075231340731477100203470ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Perspective definition. */ #include #include class ViewList { public: Interactor* view; ViewList* next; ViewList (Interactor* i) { view = i; next = nil; } }; Perspective::Perspective() { views = nil; x0 = 0; y0 = 0; width = 0; height = 0; curx = 0; cury = 0; curwidth = 0; curheight = 0; sx = 0; sy = 0; lx = 0; ly = 0; Reference(); } Perspective::Perspective(Perspective& p) { views = nil; x0 = p.x0; y0 = p.y0; width = p.width; height = p.height; curx = p.curx; cury = p.cury; curwidth = p.curwidth; curheight = p.curheight; sx = p.sx; sy = p.sy; lx = p.lx; ly = p.ly; Reference(); } Perspective::~Perspective() { register ViewList* e; register ViewList* next; for (e = views; e != nil; e = next) { next = e->next; delete e; } } void Perspective::Init( IntCoord ix0, IntCoord iy0, IntCoord iwidth, IntCoord iheight ) { x0 = ix0; y0 = iy0; width = iwidth; height = iheight; curx = x0; cury = y0; } void Perspective::Attach(Interactor* i) { register ViewList* e; e = new ViewList(i); e->next = views; views = e; Reference(); } void Perspective::Detach(Interactor* i) { register ViewList* e; register ViewList* prev; prev = nil; for (e = views; e != nil; e = e->next) { if (e->view == i) { if (prev == nil) { views = e->next; } else { prev->next = e->next; } e->view = nil; e->next = nil; delete e; Unreference(); break; } prev = e; } } void Perspective::Update() { register ViewList* e; for (e = views; e != nil; e = e->next) { e->view->Update(); } } bool Perspective::operator ==(Perspective& p) { return x0 == p.x0 && y0 == p.y0 && width == p.width && height == p.height && curx == p.curx && cury == p.cury && curwidth == p.curwidth && curheight == p.curheight && sx == p.sx && sy == p.sy && lx == p.lx && ly == p.ly; } bool Perspective::operator !=(Perspective& p) { return x0 != p.x0 || y0 != p.y0 || width != p.width || height != p.height || curx != p.curx || cury != p.cury || curwidth != p.curwidth || curheight != p.curheight || sx != p.sx || sy != p.sy || lx != p.lx || ly != p.ly; } Perspective& Perspective::operator =(Perspective& p) { x0 = p.x0; y0 = p.y0; width = p.width; height = p.height; curx = p.curx; cury = p.cury; curwidth = p.curwidth; curheight = p.curheight; sx = p.sx; sy = p.sy; lx = p.lx; ly = p.ly; return *this; } neuron-7.6.3/src/lib/IV-2_6/rubband.cpp000077500000000000000000000055301340731477100174320ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Rubberbanding primitives. */ #include #include #include static float DEGS_PER_RAD = 180.0 / M_PI; float Rubberband::Angle (IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1) { float dx, dy, angle; dx = float(x1 - x0); dy = float(y1 - y0); if (dx != 0) { angle = DEGS_PER_RAD * atan(dy/dx); } else if (dy < 0) { angle = -90; } else { angle = 90; } if (dx < 0) { angle += 180; } return angle; } float Rubberband::Distance( IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1 ) { float dx = x0 - x1; float dy = y0 - y1; return sqrt(dx*dx + dy*dy); } Rubberband::Rubberband (Painter* p, Canvas* c, IntCoord x, IntCoord y) { if (p == nil) { output = nil; } else { output = new Painter(p); output->Reference(); output->Begin_xor(); } canvas = c; drawn = false; offx = x; offy = y; } void Rubberband::Draw () { /* shouldn't be called */ } void Rubberband::Redraw () { drawn = false; Draw(); } void Rubberband::Erase () { if (drawn) { drawn = false; Draw(); drawn = false; } } void Rubberband::Track (IntCoord x, IntCoord y) { if (x != trackx || y != tracky) { Erase(); trackx = x; tracky = y; Draw(); } } Rubberband::~Rubberband () { Unref(output); } void Rubberband::SetPainter (Painter* p) { if (p != output) { p->Reference(); Unref(output); output = p; output->Begin_xor(); } } void Rubberband::SetCanvas (Canvas* c) { canvas = c; } neuron-7.6.3/src/lib/IV-2_6/rubcurve.cpp000077500000000000000000000370641340731477100176610ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Rubberbanding curves. */ #include #include #include #include #include #include RubberEllipse::RubberEllipse( Painter* p, Canvas* c, IntCoord cx, IntCoord cy, IntCoord rx, IntCoord ry, IntCoord off_x, IntCoord off_y ) : Rubberband(p, c, off_x, off_y) { centerx = cx; centery = cy; radiusx = rx; radiusy = ry; trackx = rx; tracky = ry; } void RubberEllipse::GetOriginal( IntCoord& cx, IntCoord& cy, IntCoord& rx, IntCoord& ry ) { cx = centerx; cy = centery; rx = radiusx; ry = radiusy; } void RubberEllipse::GetCurrent( IntCoord& cx, IntCoord& cy, IntCoord& rx, IntCoord& ry ) { cx = centerx; cy = centery; rx = trackx; ry = tracky; } void RubberEllipse::OriginalRadii(int& xr, int& yr) { xr = abs(radiusx - centerx); yr = abs(radiusy - centery); } void RubberEllipse::CurrentRadii(int& xr, int& yr) { xr = abs(trackx - centerx); yr = abs(tracky - centery); } void RubberEllipse::Draw() { IntCoord cx, cy, rx, ry, xr, yr; if (!drawn) { GetCurrent(cx, cy, rx, ry); CurrentRadii(xr, yr); output->Ellipse(canvas, cx+offx, cy+offy, xr, yr); drawn = true; } } /**************************************************************************/ SlidingEllipse::SlidingEllipse( Painter* p, Canvas* c, IntCoord cx, IntCoord cy, IntCoord xr, IntCoord yr, IntCoord rfx, IntCoord rfy, IntCoord off_x, IntCoord off_y ) : RubberEllipse(p, c, cx, cy, xr, yr, off_x, off_y) { refx = trackx = rfx; refy = tracky = rfy; } void SlidingEllipse::GetCurrent( IntCoord& cx, IntCoord& cy, IntCoord& xr, IntCoord& yr ) { IntCoord dx = trackx - refx; IntCoord dy = tracky - refy; cx = centerx + dx; cy = centery + dy; xr = radiusx; yr = radiusy; } void SlidingEllipse::OriginalRadii(int& xr, int& yr) { xr = radiusx; yr = radiusy; } void SlidingEllipse::CurrentRadii(int& xr, int& yr) { xr = radiusx; yr = radiusy; } /*****************************************************************************/ RubberCircle::RubberCircle( Painter* p, Canvas* c, IntCoord cx, IntCoord cy, IntCoord rx, IntCoord ry, IntCoord off_x, IntCoord off_y ) : RubberEllipse(p, c, cx, cy, rx, ry, off_x, off_y) { /* nothing else to do */ } void RubberCircle::OriginalRadii(int& xr, int& yr) { IntCoord dx = radiusx - centerx; IntCoord dy = radiusy - centery; int radius = Math::round(sqrt(double(dx*dx + dy*dy))); xr = radius; yr = radius; } void RubberCircle::CurrentRadii(int& xr, int& yr) { IntCoord dx = trackx - centerx; IntCoord dy = tracky - centery; int radius = Math::round(sqrt(double(dx*dx + dy*dy))); xr = radius; yr = radius; } void RubberCircle::Draw() { int radius; if (!drawn) { CurrentRadii(radius, radius); output->Circle(canvas, centerx + offx, centery + offy, radius); drawn = true; } } /*****************************************************************************/ void RubberPointList::Copy( IntCoord* x1, IntCoord* y1, int n, IntCoord*& nx, IntCoord*& ny ) { nx = new IntCoord[n]; ny = new IntCoord[n]; Memory::copy(x1, nx, n*sizeof(IntCoord)); Memory::copy(y1, ny, n*sizeof(IntCoord)); } RubberPointList::RubberPointList( Painter* p, Canvas* c, IntCoord px[], IntCoord py[], int n, IntCoord off_x, IntCoord off_y ) : Rubberband(p, c, off_x, off_y) { Copy(px, py, n, x, y); count = n; } RubberPointList::~RubberPointList() { delete [] x; delete [] y; } /*****************************************************************************/ RubberVertex::RubberVertex( Painter* p, Canvas* c, IntCoord px[], IntCoord py[], int n, int pt, IntCoord off_x, IntCoord off_y ) : RubberPointList(p, c, px, py, n, off_x, off_y) { rubberPt = pt; trackx = x[rubberPt]; tracky = y[rubberPt]; } void RubberVertex::GetOriginal(IntCoord*& px, IntCoord*& py, int& n, int& pt) { Copy(x, y, count, px, py); n = count; pt = rubberPt; } void RubberVertex::GetCurrent(IntCoord*& px, IntCoord*& py, int& n, int& pt) { Copy(x, y, count, px, py); n = count; pt = rubberPt; px[rubberPt] = trackx; py[rubberPt] = tracky; } void RubberVertex::DrawSplineSection( Painter* p, Canvas* c, IntCoord x1[], IntCoord y1[] ) { double twicex1, twicex2, p0x, p1x, p2x, p3x, tempx; double twicey1, twicey2, p0y, p1y, p2y, p3y, tempy; twicex1 = 2.0*double(x1[1]); twicey1 = 2.0*double(y1[1]); twicex2 = 2.0*double(x1[2]); twicey2 = 2.0*double(y1[2]); p1x = (twicex1 + double(x1[2])) / 3.0; p1y = (twicey1 + double(y1[2])) / 3.0; p2x = (twicex2 + double(x1[1])) / 3.0; p2y = (twicey2 + double(y1[1])) / 3.0; tempx = (twicex1 + double(x1[0])) / 3.0; tempy = (twicey1 + double(y1[0])) / 3.0; p0x = (tempx + p1x) / 2.0; p0y = (tempy + p1y) / 2.0; tempx = (twicex2 + double(x1[3])) / 3.0; tempy = (twicey2 + double(y1[3])) / 3.0; p3x = (tempx + p2x) / 2.0; p3y = (tempy + p2y) / 2.0; p->Curve(c, Math::round(p0x)+offx, Math::round(p0y)+offy, Math::round(p1x)+offx, Math::round(p1y)+offy, Math::round(p2x)+offx, Math::round(p2y)+offy, Math::round(p3x)+offx, Math::round(p3y)+offy ); } /*****************************************************************************/ RubberHandles::RubberHandles( Painter* p, Canvas* c, IntCoord px[], IntCoord py[], int n, int pt, int size, IntCoord off_x, IntCoord off_y ) : RubberVertex(p, c, px, py, n, pt, off_x, off_y) { d = size / 2; } void RubberHandles::Draw() { register int i; if (x == nil || y == nil) { return; } if (!drawn) { for (i = 0; i < count; ++i) { if (i == rubberPt) { output->FillRect(canvas, trackx - d + offx, tracky - d + offy, trackx + d + offx, tracky + d + offy ); } else { output->FillRect(canvas, x[i] - d + offx, y[i] - d + offy, x[i] + d + offx, y[i] + d + offy ); } } drawn = true; } } void RubberHandles::Track(IntCoord x1, IntCoord y1) { if (x1 != trackx || y1 != tracky) { if (drawn) { /* erase */ output->FillRect(canvas, trackx - d + offx, tracky - d + offy, trackx + d + offx, tracky + d + offy ); } trackx = x1; tracky = y1; output->FillRect(canvas, trackx - d + offx, tracky - d + offy, trackx + d + offx, tracky + d + offy ); drawn = true; } } /*****************************************************************************/ RubberSpline::RubberSpline( Painter* p, Canvas* c, IntCoord px[], IntCoord py[], int n, int pt, IntCoord off_x, IntCoord off_y ) : RubberVertex(p, c, px, py, n, pt, off_x, off_y) { /* nothing else to do */ } void RubberSpline::Draw() { register int i, j; IntCoord sx[7], sy[7]; if (x == nil || y == nil) { return; } if (!drawn) { for (i = -3; i <= 3; ++i) { j = Math::min(Math::max(rubberPt + i, 0), count - 1); if (j == rubberPt) { sx[i + 3] = trackx; sy[i + 3] = tracky; } else { sx[i + 3] = x[j]; sy[i + 3] = y[j]; } } DrawSplineSection(output, canvas, sx, sy); DrawSplineSection(output, canvas, &sx[1], &sy[1]); DrawSplineSection(output, canvas, &sx[2], &sy[2]); DrawSplineSection(output, canvas, &sx[3], &sy[3]); drawn = true; } } /*****************************************************************************/ RubberClosedSpline::RubberClosedSpline( Painter* p, Canvas* c, IntCoord px[], IntCoord py[], int n, int pt, IntCoord off_x, IntCoord off_y ) : RubberVertex(p, c, px, py, n, pt, off_x, off_y) { /* nothing else to do */ } void RubberClosedSpline::Draw() { register int i, j; IntCoord sx[7], sy[7]; if (x == nil || y == nil) { return; } if (!drawn) { if (count > 2) { for (i = -3; i <= 3; ++i) { j = (rubberPt + count + i) % count; if (j == rubberPt) { sx[i + 3] = trackx; sy[i + 3] = tracky; } else { sx[i + 3] = x[j]; sy[i + 3] = y[j]; } } DrawSplineSection(output, canvas, sx, sy); DrawSplineSection(output, canvas, &sx[1], &sy[1]); DrawSplineSection(output, canvas, &sx[2], &sy[2]); if (count > 3) { DrawSplineSection(output, canvas, &sx[3], &sy[3]); } } else { i = 1 - rubberPt; output->Line(canvas, x[i], y[i], trackx, tracky); } drawn = true; } } /*****************************************************************************/ SlidingPointList::SlidingPointList( Painter* p, Canvas* c, IntCoord px[], IntCoord py[], int n, IntCoord rfx, IntCoord rfy, IntCoord off_x, IntCoord off_y ) : RubberPointList(p, c, px, py, n, off_x, off_y) { refx = rfx; refy = rfy; trackx = rfx; tracky = rfy; } void SlidingPointList::GetOriginal(IntCoord*& px, IntCoord*& py, int& n) { register int i; register IntCoord dx = trackx - refx; register IntCoord dy = tracky - refy; px = new IntCoord[count]; py = new IntCoord[count]; n = this->count; for (i = 0; i < count; i++) { px[i] = x[i] - dx; py[i] = y[i] - dy; } } void SlidingPointList::GetCurrent(IntCoord*& px, IntCoord*& py, int& n) { Copy(x, y, count, px, py); n = count; } void SlidingPointList::Draw() { if (x == nil || y == nil) { return; } if (!drawn) { if (offx == 0 && offy == 0) { output->MultiPoint(canvas, x, y, count); } else { register IntCoord* ox = new IntCoord[count]; register IntCoord* oy = new IntCoord[count]; for (register int i = 0; i < count; i++) { ox[i] = x[i] + offx; oy[i] = y[i] + offy; } output->MultiPoint(canvas, ox, oy, count); delete [] ox; delete [] oy; } drawn = true; } } void SlidingPointList::Track(IntCoord x0, IntCoord y0) { register int i; register IntCoord dx, dy; if (x0 != trackx || y0 != tracky) { Erase(); dx = x0 - trackx; dy = y0 - tracky; for (i = 0; i < count; i++) { x[i] += dx; y[i] += dy; } trackx = x0; tracky = y0; Draw(); } } /*****************************************************************************/ SlidingLineList::SlidingLineList( Painter* p, Canvas* c, IntCoord px[], IntCoord py[], int n, IntCoord rfx, IntCoord rfy, IntCoord off_x, IntCoord off_y ) : SlidingPointList(p, c, px, py, n, rfx, rfy, off_x, off_y) { } void SlidingLineList::Draw() { if (x == nil || y == nil) { return; } if (!drawn) { if (offx == 0 && offy == 0) { output->MultiLine(canvas, x, y, count); } else { register IntCoord* ox = new IntCoord[count]; register IntCoord* oy = new IntCoord[count]; for (register int i = 0; i < count; i++) { ox[i] = x[i] + offx; oy[i] = y[i] + offy; } output->MultiLine(canvas, ox, oy, count); delete [] ox; delete [] oy; } drawn = true; } } /**************************************************************************/ static void Bounds(IntCoord c[], int n, IntCoord& lower, IntCoord& upper) { lower = upper = c[0]; for (int i = 1; i < n; ++i) { lower = Math::min(lower, c[i]); upper = Math::max(upper, c[i]); } } ScalingLineList::ScalingLineList( Painter* p, Canvas* c, IntCoord px[], IntCoord py[], int n, IntCoord cx, IntCoord cy, IntCoord off_x, IntCoord off_y ) : RubberPointList(p, c, px, py, n, off_x, off_y) { Copy(px, py, n, newx, newy); centerx = cx; centery = cy; IntCoord l, b, r, t; Bounds(px, n, l, r); Bounds(py, n, b, t); width = r - l; height = b - t; } ScalingLineList::~ScalingLineList() { delete [] newx; delete [] newy; } void ScalingLineList::Update() { float factor = CurrentScaling(); for (int i = 0; i < count; ++i) { newx[i] = Math::round(float(x[i] - centerx)*factor) + centerx; newy[i] = Math::round(float(y[i] - centery)*factor) + centery; } } void ScalingLineList::GetOriginal(IntCoord*& px, IntCoord*& py, int& n) { Copy(x, y, count, px, py); n = count; } void ScalingLineList::GetCurrent(IntCoord*& px, IntCoord*& py, int& n) { Copy(newx, newy, count, px, py); n = count; } float ScalingLineList::CurrentScaling() { IntCoord dx = abs(trackx - centerx); IntCoord dy = abs(tracky - centery); double factor = 1; if (width != 0 && dx > dy) { factor = double(2 * dx) / double(width); } else if (height != 0) { factor = double(2 * dy) / double(height); } return factor; } void ScalingLineList::Track(IntCoord x1, IntCoord y1) { if (x1 != trackx || y1 != tracky) { Erase(); trackx = x1; tracky = y1; Update(); Draw(); } } void ScalingLineList::Draw() { if (!drawn) { output->MultiLine(canvas, newx, newy, count); drawn = true; } } /**************************************************************************/ RotatingLineList::RotatingLineList( Painter* p, Canvas* c, IntCoord px[], IntCoord py[], int n, IntCoord cx, IntCoord cy, IntCoord rfx, IntCoord rfy, IntCoord off_x, IntCoord off_y ) : RubberPointList(p, c, px, py, n, off_x, off_y) { Copy(px, py, n, newx, newy); centerx = cx; centery = cy; refx = rfx; refy = rfy; } RotatingLineList::~RotatingLineList() { delete [] newx; delete [] newy; } void RotatingLineList::Update() { float angle = (CurrentAngle() - OriginalAngle()) * M_PI/180.0; float cosine = cos(angle); float sine = sin(angle); float tx, ty; for (int i = 0; i < count; ++i) { tx = float(x[i] - centerx); ty = float(y[i] - centery); newx[i] = Math::round(cosine*tx - sine*ty) + centerx; newy[i] = Math::round(sine*tx + cosine*ty) + centery; } } void RotatingLineList::GetOriginal(IntCoord*& px, IntCoord*& py, int& n) { Copy(x, y, count, px, py); n = count; } void RotatingLineList::GetCurrent(IntCoord*& px, IntCoord*& py, int& n) { Copy(newx, newy, count, px, py); n = count; } float RotatingLineList::OriginalAngle() { return Angle(centerx, centery, refx, refy); } float RotatingLineList::CurrentAngle() { return Angle(centerx, centery, trackx, tracky); } void RotatingLineList::Track(IntCoord x1, IntCoord y1) { if (x1 != trackx || y1 != tracky) { Erase(); trackx = x1; tracky = y1; Update(); Draw(); } } void RotatingLineList::Draw() { if (!drawn) { output->MultiLine(canvas, newx, newy, count); drawn = true; } } neuron-7.6.3/src/lib/IV-2_6/rubgroup.cpp000066400000000000000000000117211340731477100176560ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * RubberGroup implementation. */ #include class RubberList { private: RubberList* next; RubberList* prev; public: Rubberband* rub; RubberList(Rubberband* =nil); ~RubberList(); void Append(Rubberband*); void Prepend(Rubberband*); void Delete(RubberList*); RubberList* Find(Rubberband*); RubberList* Next() { return next; } RubberList* Prev() { return prev; } RubberList* End() { return this; } bool IsEmpty() { return next == this; } }; RubberList::RubberList(Rubberband* r) { rub = r; next = this; prev = this; } RubberList::~RubberList() { RubberList* doomed; while (next != this) { doomed = next; next = doomed->next; doomed->next = doomed; delete doomed; } if (rub != nil) { delete rub; } } void RubberList::Append(Rubberband* b) { RubberList* cur = new RubberList(b); cur->next = this; cur->prev = prev; prev->next = cur; prev = cur; } void RubberList::Prepend(Rubberband* b) { RubberList* cur = new RubberList(b); cur->next = next; cur->prev = this; next->prev = cur; next = cur; } void RubberList::Delete(RubberList* elem) { elem->prev->next = elem->next; elem->next->prev = elem->prev; elem->next = elem; delete elem; } RubberList* RubberList::Find(Rubberband* target) { RubberList* r; for (r = Next(); r != this; r = r->Next()) { if (r->rub == target) { return r; } } return nil; } /*****************************************************************************/ RubberGroup::RubberGroup(Painter* p, Canvas* c) : Rubberband(p, c, 0, 0) { rlist = cur = new RubberList; } void RubberGroup::Draw() { for (RubberList* r = rlist->Next(); r != rlist->End(); r = r->Next()) { r->rub->Draw(); } } void RubberGroup::Erase() { for (RubberList* r = rlist->Next(); r != rlist->End(); r = r->Next()) { r->rub->Erase(); } } void RubberGroup::Track(IntCoord x, IntCoord y) { for (RubberList* r = rlist->Next(); r != rlist->End(); r = r->Next()) { r->rub->Track(x, y); } } RubberGroup::~RubberGroup() { delete rlist; } void RubberGroup::SetPainter(Painter* p) { Rubberband::SetPainter(p); for (RubberList* r = rlist->Next(); r != rlist->End(); r = r->Next()) { r->rub->SetPainter(p); } } void RubberGroup::SetCanvas(Canvas* c) { Rubberband::SetCanvas(c); for (RubberList* r = rlist->Next(); r != rlist->End(); r = r->Next()) { r->rub->SetCanvas(c); } } void RubberGroup::Append( Rubberband* r1, Rubberband* r2, Rubberband* r3, Rubberband* r4 ) { rlist->Append(r1); if (r2 != nil) { rlist->Append(r2); if (r3 != nil) { rlist->Append(r3); if (r4 != nil) { rlist->Append(r4); } } } } void RubberGroup::Remove(Rubberband* target) { RubberList* r = rlist->Find(target); if (r != nil) { cur = cur->Next(); rlist->Delete(r); } } void RubberGroup::RemoveCur() { RubberList* doomed = cur; if (!AtEnd()) { cur = cur->Next(); rlist->Delete(doomed); } } void RubberGroup::SetCurrent(Rubberband* target) { RubberList* r = rlist->Find(target); if (r != nil) { cur = r; } } Rubberband* RubberGroup::GetCurrent() { return cur->rub; } Rubberband* RubberGroup::First() { cur = rlist->Next(); return cur->rub; } Rubberband* RubberGroup::Last() { cur = rlist->Prev(); return cur->rub; } Rubberband* RubberGroup::Next() { cur = cur->Next(); return cur->rub; } Rubberband* RubberGroup::Prev() { cur = cur->Prev(); return cur->rub; } bool RubberGroup::AtEnd() { return cur == rlist; } bool RubberGroup::IsEmpty() { return rlist->IsEmpty(); } neuron-7.6.3/src/lib/IV-2_6/rubline.cpp000077500000000000000000000142501340731477100174540ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Rubberbanding lines. */ #include #include #include #include #include RubberLine::RubberLine( Painter* p, Canvas* c, IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1, IntCoord offx1, IntCoord offy1 ) : Rubberband(p, c, offx1, offy1) { fixedx = x0; fixedy = y0; movingx = x1; movingy = y1; trackx = x1; tracky = y1; } void RubberLine::GetOriginal( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ) { x0 = fixedx; y0 = fixedy; x1 = movingx; y1 = movingy; } void RubberLine::GetCurrent( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ) { x0 = fixedx; y0 = fixedy; x1 = trackx; y1 = tracky; } void RubberLine::Draw() { IntCoord x0, y0, x1, y1; if (!drawn) { GetCurrent(x0, y0, x1, y1); output->Line(canvas, x0+offx, y0+offy, x1+offx, y1+offy); drawn = true; } } /*****************************************************************************/ RubberAxis::RubberAxis( Painter* p, Canvas* c, IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1, IntCoord offx1, IntCoord offy1 ) : RubberLine(p, c, x0, y0, x1, y1, offx1, offy1) { /* nothing else to do */ } void RubberAxis::GetCurrent( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ) { x0 = fixedx; y0 = fixedy; if (abs(fixedx - trackx) < abs(fixedy - tracky)) { x1 = fixedx; y1 = tracky; } else { x1 = trackx; y1 = fixedy; } } /*****************************************************************************/ SlidingLine::SlidingLine( Painter* p, Canvas* c, IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1, IntCoord rfx, IntCoord rfy, IntCoord offx1, IntCoord offy1 ) : RubberLine(p, c, x0, y0, x1, y1, offx1, offy1) { refx = rfx; refy = rfy; trackx = rfx; tracky = rfy; } void SlidingLine::GetCurrent( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ) { IntCoord dx = trackx - refx; IntCoord dy = tracky - refy; x0 = fixedx + dx; y0 = fixedy + dy; x1 = movingx + dx; y1 = movingy + dy; } /*****************************************************************************/ ScalingLine::ScalingLine( Painter* p, Canvas* c, IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1, IntCoord cx, IntCoord cy, IntCoord offx1, IntCoord offy1 ) : RubberLine(p, c, x0, y0, x1, y1, offx1, offy1) { centerx = cx; centery = cy; width = abs(x0 - x1); height = abs(y0 - y1); } void ScalingLine::GetCurrent( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ) { double factor = CurrentScaling(); x0 = Math::round(double(fixedx - centerx) * factor) + centerx; y0 = Math::round(double(fixedy - centery) * factor) + centery; x1 = Math::round(double(movingx - centerx) * factor) + centerx; y1 = Math::round(double(movingy - centery) * factor) + centery; } float ScalingLine::CurrentScaling() { IntCoord dx, dy; double factor = 1; dx = abs(trackx - centerx); dy = abs(tracky - centery); if (width != 0 && dx > dy) { factor = double(2 * dx) / double(width); } else if (height != 0) { factor = double(2 * dy) / double(height); } return factor; } /*****************************************************************************/ void RotatingLine::Transform( IntCoord& x, IntCoord& y, double a0, double a1, double b0, double b1, double c0, double c1 ) { double tx, ty; tx = double(x); ty = double(y); x = Math::round(a0*tx + b0*ty + c0); y = Math::round(a1*tx + b1*ty + c1); } RotatingLine::RotatingLine( Painter* p, Canvas* c, IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1, IntCoord cx, IntCoord cy, IntCoord rfx, IntCoord rfy, IntCoord offx1, IntCoord offy1 ) : RubberLine(p, c, x0, y0, x1, y1, offx1, offy1) { centerx = cx; centery = cy; refx = rfx; refy = rfy; } void RotatingLine::GetCurrent( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ) { double sin, cos, hprod, dx1, dy1, dx2, dy2; x0 = fixedx - centerx; y0 = fixedy - centery; x1 = movingx - centerx; y1 = movingy - centery; dx1 = double(refx - centerx); dy1 = double(refy - centery); dx2 = double(trackx - centerx); dy2 = double(tracky - centery); hprod = sqrt((dx1*dx1 + dy1*dy1) * (dx2*dx2 + dy2*dy2)); if (hprod != 0.0) { cos = (dx1*dx2 + dy1*dy2) / hprod; sin = (dx1*dy2 - dx2*dy1) / hprod; Transform(x0, y0, cos, sin, -sin, cos, 0.0, 0.0); Transform(x1, y1, cos, sin, -sin, cos, 0.0, 0.0); } x0 += centerx; y0 += centery; x1 += centerx; y1 += centery; } float RotatingLine::OriginalAngle() { IntCoord x0, y0, x1, y1; GetOriginal(x0, y0, x1, y1); return Angle(x0, y0, x1, y1); } float RotatingLine::CurrentAngle() { IntCoord x0, y0, x1, y1; GetCurrent(x0, y0, x1, y1); return Angle(x0, y0, x1, y1); } neuron-7.6.3/src/lib/IV-2_6/rubrect.cpp000077500000000000000000000205731340731477100174670ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Rubberbanding rectangles. */ #include #include #include #include #include #ifdef HAVE_UNISTD_H #include #else #include #endif RubberRect::RubberRect( Painter* p, Canvas* c, IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1, IntCoord offx1, IntCoord offy1 ) : Rubberband(p, c, offx1, offy1) { fixedx = x0; fixedy = y0; movingx = x1; movingy = y1; trackx = x1; tracky = y1; } void RubberRect::GetOriginal( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ) { x0 = fixedx; y0 = fixedy; x1 = movingx; y1 = movingy; } void RubberRect::GetCurrent( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ) { x0 = fixedx; y0 = fixedy; x1 = trackx; y1 = tracky; } void RubberRect::Draw() { IntCoord x0, y0, x1, y1; if (!drawn) { GetCurrent(x0, y0, x1, y1); if (x0 == x1 || y0 == y1) { output->Line(canvas, x0+offx, y0+offy, x1+offx, y1+offy); } else { output->Rect(canvas, x0+offx, y0+offy, x1+offx, y1+offy); } drawn = true; } } RubberSquare::RubberSquare( Painter* p, Canvas* c, IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1, IntCoord offx1, IntCoord offy1 ) : RubberRect(p, c, x0, y0, x1, y1, offx1, offy1) { } void RubberSquare::GetCurrent( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ) { x0 = fixedx; y0 = fixedy; IntCoord dx = abs(trackx - x0); IntCoord dy = abs(tracky - y0); if (dx > dy) { x1 = trackx; y1 = (tracky > y0) ? y0 + dx : y0 - dx; } else { x1 = (trackx > x0) ? x0 + dy : x0 - dy; y1 = tracky; } } SlidingRect::SlidingRect( Painter* p, Canvas* c, IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1, IntCoord rfx, IntCoord rfy, IntCoord offx1, IntCoord offy1 ) : RubberRect(p, c, x0, y0, x1, y1, offx1, offy1) { refx = rfx; refy = rfy; trackx = rfx; tracky = rfy; } void SlidingRect::GetCurrent( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ) { IntCoord dx, dy; dx = trackx - refx; dy = tracky - refy; x0 = fixedx + dx; y0 = fixedy + dy; x1 = movingx + dx; y1 = movingy + dy; } StretchingRect::StretchingRect( Painter* p, Canvas* c, IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1, Side s, IntCoord offx1, IntCoord offy1 ) : RubberRect(p, c, x0, y0, x1, y1, offx1, offy1) { side = s; } void StretchingRect::GetCurrent( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ) { x0 = fixedx; y0 = fixedy; x1 = movingx; y1 = movingy; switch (side) { case LeftSide: x0 = trackx; break; case RightSide: x1 = trackx; break; case BottomSide: y0 = tracky; break; case TopSide: y1 = tracky; break; } } float StretchingRect::CurrentStretching() { IntCoord l, b, r, t; GetOriginal(l, b, r, t); IntCoord nl, nb, nr, nt; GetCurrent(nl, nb, nr, nt); float nsz = 0; float osz = 0; switch (side) { case LeftSide: case RightSide: nsz = nr - nl + 1; osz = r - l + 1; break; case BottomSide: case TopSide: nsz = nt - nb + 1; osz = t - b + 1; break; } if (osz == 0) { #if defined(MAXFLOAT) return MAXFLOAT; #else #if defined(FLT_MAX) return FLT_MAX; #else return HUGE; #endif #endif } else { return nsz / osz; } } ScalingRect::ScalingRect( Painter* p, Canvas* c, IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1, IntCoord cx, IntCoord cy, IntCoord offx1, IntCoord offy1 ) : RubberRect(p, c, x0, y0, x1, y1, offx1, offy1) { centerx = cx; centery = cy; width = abs(x0 - x1); height = abs(y0 - y1); } void ScalingRect::GetCurrent( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ) { double factor = CurrentScaling(); x0 = Math::round(double(fixedx - centerx) * factor) + centerx; y0 = Math::round(double(fixedy - centery) * factor) + centery; x1 = Math::round(double(movingx - centerx) * factor) + centerx; y1 = Math::round(double(movingy - centery) * factor) + centery; } float ScalingRect::CurrentScaling() { IntCoord dx, dy; double factor = 1; dx = abs(trackx - centerx); dy = abs(tracky - centery); if (width != 0 && dx > dy) { factor = double(2 * dx) / double(width); } else if (height != 0) { factor = double(2 * dy) / double(height); } return factor; } void RotatingRect::Transform( IntCoord& x, IntCoord& y, double a0, double a1, double b0, double b1, double c0, double c1 ) { double tx, ty; tx = double(x); ty = double(y); x = Math::round(a0*tx + b0*ty + c0); y = Math::round(a1*tx + b1*ty + c1); } RotatingRect::RotatingRect( Painter* p, Canvas* c, IntCoord x0, IntCoord y0, IntCoord x1, IntCoord y1, IntCoord cx, IntCoord cy, IntCoord rfx, IntCoord rfy, IntCoord offx1, IntCoord offy1 ) : Rubberband(p, c, offx1, offy1) { left = x0; bottom = y0; right = x1; top = y1; centerx = cx; centery = cy; trackx = cx; tracky = cy; refx = rfx; refy = rfy; } void RotatingRect::GetOriginal( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ) { x0 = left; y0 = bottom; x1 = right; y1 = top; } void RotatingRect::GetCurrent( IntCoord& leftbotx, IntCoord& leftboty, IntCoord& rightbotx, IntCoord& rightboty, IntCoord& righttopx, IntCoord& righttopy, IntCoord& lefttopx, IntCoord& lefttopy ) { double sin, cos, hprod, dx1, dy1, dx2, dy2; leftbotx = lefttopx = left - centerx; leftboty = rightboty = bottom - centery; rightbotx = righttopx = right - centerx; lefttopy = righttopy = top - centery; dx1 = double(refx - centerx); dy1 = double(refy - centery); dx2 = double(trackx - centerx); dy2 = double(tracky - centery); hprod = sqrt((dx1*dx1 + dy1*dy1) * (dx2*dx2 + dy2*dy2)); if (hprod != 0.0) { cos = (dx1*dx2 + dy1*dy2) / hprod; sin = (dx1*dy2 - dx2*dy1) / hprod; Transform(leftbotx, leftboty, cos, sin, -sin, cos, 0.0, 0.0); Transform(rightbotx, rightboty, cos, sin, -sin, cos, 0.0, 0.0); Transform(righttopx, righttopy, cos, sin, -sin, cos, 0.0, 0.0); Transform(lefttopx, lefttopy, cos, sin, -sin, cos, 0.0, 0.0); } leftbotx += centerx; leftboty += centery; rightbotx += centerx; rightboty += centery; righttopx += centerx; righttopy += centery; lefttopx += centerx; lefttopy += centery; } float RotatingRect::CurrentAngle() { IntCoord x0, y0, x1, y1, dummy; GetCurrent(x0, y0, x1, y1, dummy, dummy, dummy, dummy); return Angle(x0, y0, x1, y1); } void RotatingRect::Draw() { IntCoord x[5], y[5]; if (!drawn) { GetCurrent(x[0], y[0], x[1], y[1], x[2], y[2], x[3], y[3]); if ((x[0] == x[1] && y[1] != y[2]) || (y[0] == y[1] && x[1] != x[2]) || (x[1] == x[2] && y[1] == y[2]) ) { output->Line(canvas, x[0]+offx, y[0]+offy, x[2]+offx, y[2]+offy); } else { for (int i = 0; i < 4; ++i) { x[i] += offx; y[i] += offy; } x[4] = x[0]; y[4] = y[0]; output->MultiLine(canvas, x, y, 5); } drawn = true; } } neuron-7.6.3/src/lib/IV-2_6/rubverts.cpp000066400000000000000000000141241340731477100176650ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Implementation of GrowingVertices and derived classes. */ #include #include #include #include #include GrowingVertices::GrowingVertices( Painter* p, Canvas* c, IntCoord px[], IntCoord py[], int n, int pt, int handleSize1 ) : Rubberband(p, c, 0, 0) { pt = (pt < 0) ? n : pt; Init(px, py, n, pt, handleSize1); } void GrowingVertices::Init ( IntCoord px[], IntCoord py[], int n, int pt, int h ) { origbufsize = count = n; bufsize = Math::max(2*n, 50); origPt = curPt = pt; x = new IntCoord[bufsize]; y = new IntCoord[bufsize]; trackx = px[n-1]; tracky = py[n-1]; handleSize = h; Memory::copy(px, x, n*sizeof(IntCoord)); Memory::copy(py, y, n*sizeof(IntCoord)); } GrowingVertices::~GrowingVertices() { delete [] x; delete [] y; } void GrowingVertices::GetOriginal( IntCoord*& px, IntCoord*& py, int& n, int& pt ) { Copy(x, y, origbufsize, px, py); n = origbufsize; pt = origPt; } void GrowingVertices::GetCurrent( IntCoord*& px, IntCoord*& py, int& n, int& pt ) { Copy(x, y, count, px, py); n = count; pt = curPt; } void GrowingVertices::CheckBufs() { if (count + 1 >= bufsize) { bufsize *= 2; IntCoord* nx = new IntCoord[bufsize]; IntCoord* ny = new IntCoord[bufsize]; Memory::copy(x, nx, count*sizeof(IntCoord)); Memory::copy(y, ny, count*sizeof(IntCoord)); delete [] x; delete [] y; x = nx; y = ny; } } void GrowingVertices::Copy( IntCoord* x1, IntCoord* y1, int n, IntCoord*& nx, IntCoord*& ny ) { nx = new IntCoord[n]; ny = new IntCoord[n]; Memory::copy(x1, nx, n*sizeof(IntCoord)); Memory::copy(y1, ny, n*sizeof(IntCoord)); } void GrowingVertices::Draw() { if (!drawn) { x[curPt] = trackx; y[curPt] = tracky; DrawVertices(x, y, Math::max(curPt+1, count)); DrawHandles(); drawn = true; } } void GrowingVertices::DrawVertices(IntCoord*, IntCoord*, int) { } void GrowingVertices::DrawHandles () { if (handleSize > 0) { int d = handleSize/2; for (int i = 0; i < count; ++i) { if (i != curPt) { output->FillRect( canvas, x[i] - d, y[i] - d, x[i] + d, y[i] + d ); } } } } void GrowingVertices::AddVertex (IntCoord vx, IntCoord vy) { bool wasDrawn = drawn; Erase(); ++curPt; for (int i = count; i > curPt; --i) { x[i] = x[i-1]; y[i] = y[i-1]; } x[curPt] = vx; y[curPt] = vy; ++count; CheckBufs(); if (wasDrawn) { Draw(); } } void GrowingVertices::RemoveVertex () { bool wasDrawn = drawn; Erase(); count = Math::max(0, count-1); curPt = Math::max(0, curPt-1); for (int i = curPt; i < count; ++i) { x[i] = x[i+1]; y[i] = y[i+1]; } if (wasDrawn) { Draw(); } } void GrowingVertices::AppendVertex (IntCoord vx, IntCoord vy) { curPt = count; AddVertex(vx, vy); } void GrowingVertices::GetOriginal(IntCoord*& px, IntCoord*& py, int& n) { Copy(x, y, origbufsize, px, py); n = origbufsize; } void GrowingVertices::GetCurrent(IntCoord*& px, IntCoord*& py, int& n) { Copy(x, y, count, px, py); n = count; } /*****************************************************************************/ GrowingMultiLine::GrowingMultiLine( Painter* p, Canvas* c, IntCoord px[], IntCoord py[], int n, int pt, int handleSize1 ) : GrowingVertices(p, c, px, py, n, pt, handleSize1) { } void GrowingMultiLine::DrawVertices(IntCoord* x1, IntCoord* y1, int n) { output->MultiLine(canvas, x1, y1, n); } /*****************************************************************************/ GrowingPolygon::GrowingPolygon( Painter* p, Canvas* c, IntCoord px[], IntCoord py[], int n, int pt, int handleSize1 ) : GrowingVertices(p, c, px, py, n, pt, handleSize1) { } void GrowingPolygon::DrawVertices(IntCoord* x1, IntCoord* y1, int n) { if (n == 2) { output->Line(canvas, x1[0], y1[0], x1[1], y1[1]); } else { output->Polygon(canvas, x1, y1, n); } } /*****************************************************************************/ GrowingBSpline::GrowingBSpline( Painter* p, Canvas* c, IntCoord px[], IntCoord py[], int n, int pt, int handleSize1 ) : GrowingVertices(p, c, px, py, n, pt, handleSize1) { } void GrowingBSpline::DrawVertices(IntCoord* x1, IntCoord* y1, int n) { output->BSpline(canvas, x1, y1, n); } /*****************************************************************************/ GrowingClosedBSpline::GrowingClosedBSpline( Painter* p, Canvas* c, IntCoord px[], IntCoord py[], int n, int pt, int handleSize1 ) : GrowingVertices(p, c, px, py, n, pt, handleSize1) { } void GrowingClosedBSpline::DrawVertices(IntCoord* x1, IntCoord* y1, int n) { output->ClosedBSpline(canvas, x1, y1, n); } neuron-7.6.3/src/lib/IV-2_6/scene.cpp000066400000000000000000000140031340731477100171020ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Base composite interactor. */ #include #include #include #include #include #include #include Scene::Scene() { propagate = true; } Scene::~Scene() { } void Scene::Insert(Interactor* component) { Interactor* i = Wrap(component); PrepareToInsert(i); IntCoord left, bottom; DoInsert(i, false, left, bottom); } void Scene::Insert(Interactor* component, IntCoord x, IntCoord y, Alignment a) { Interactor* i = Wrap(component); PrepareToInsert(i); IntCoord ax = x, ay = y; DoAlign(i, a, ax, ay); DoInsert(i, true, ax, ay); } void Scene::PrepareToInsert(Interactor* i) { if (parent != nil || (canvas != nil && canvas->status() == Canvas::mapped) ) { i->Config(this); } } void Scene::DoAlign(Interactor* i, Alignment a, IntCoord& x, IntCoord& y) { switch (a) { case TopLeft: case CenterLeft: case BottomLeft: /* nothing to do */ break; case TopCenter: case Center: case BottomCenter: x -= i->shape->width/2; break; case TopRight: case CenterRight: case BottomRight: x -= i->shape->width; break; } switch (a) { case BottomLeft: case BottomCenter: case BottomRight: /* nothing to do */ break; case CenterLeft: case Center: case CenterRight: y -= i->shape->height/2; break; case TopLeft: case TopCenter: case TopRight: y -= i->shape->height; break; } } void Scene::Change(Interactor* i) { if (propagate) { DoChange(i); if (parent == nil) { if (world != nil) { world->Change(this); } } else { parent->Change(this); } } else if (canvas != nil) { Resize(); } } void Scene::Remove(Interactor* i) { DoRemove(i); i->parent = nil; if (i->canvas != nil) { Unmap(i); i->Orphan(); } } void Scene::Orphan() { Interactor* children[100]; Interactor** a; int n; GetComponents(children, sizeof(children) / sizeof(Interactor*), a, n); if (n > 0) { for (register int i = 0; i < n; i++) { a[i]->Orphan(); } if (a != children) { delete a; } } Interactor::Orphan(); } void Scene::Raise(Interactor* i) { DoRaise(i); Window* w = i->window; if (w != nil) { w->raise(); } } void Scene::Lower(Interactor* i) { DoLower(i); Window* w = i->window; if (w != nil) { w->lower(); } } void Scene::DoInsert(Interactor*, bool, IntCoord&, IntCoord&) { } void Scene::DoChange(Interactor*) { } void Scene::DoRemove(Interactor*) { } void Scene::DoRaise(Interactor*) { } void Scene::DoLower(Interactor*) { } void Scene::DoMove(Interactor*, IntCoord&, IntCoord&) { } /* * Wrap is called to put any desired layer around an interactor * that is inserted into a scene. The default is to simply * return the interactor as is. */ Interactor* Scene::Wrap(Interactor* i) { return i; } void Scene::Propagate(bool b) { propagate = b; } /* * Highlight a scene by highlighting each components. */ void Scene::Highlight(bool b) { Interactor* children[100]; Interactor** a; int n; GetComponents(children, sizeof(children) / sizeof(Interactor*), a, n); if (n > 0) { for (register int index = 0; index < n; index++) { a[index]->Highlight(b); } if (a != children) { delete a; } } } /* * A common case is a scene with a single subcomponent. This construct * occurs when one interactor is defined in terms of another, e.g., * a menu is built out of a frame around a box. The reason a MonoScene * is preferred over subclassing is that it simplies implementing the virtuals. * In the menu example, menus can handle events independently of frames. */ MonoScene::MonoScene() { interior_ = nil; } MonoScene::~MonoScene() { delete interior_; } void MonoScene::DoInsert(Interactor* i, bool, IntCoord&, IntCoord&) { delete interior_; interior_ = i; } void MonoScene::DoChange(Interactor*) { if (output != nil) { Reconfig(); } } void MonoScene::DoRemove(Interactor*) { interior_ = nil; } void MonoScene::Reconfig() { if (interior_ != nil) { *shape = *interior_->GetShape(); } } void MonoScene::Resize() { if (output != nil && GetCanvasType() != CanvasInputOnly) { canvas->SetBackground(output->GetBgColor()); } if (interior_ != nil) { Place(interior_, 0, 0, xmax, ymax); } } void MonoScene::Draw() { Scene::Draw(); if (interior_ != nil) { interior_->Draw(); } } void MonoScene::GetComponents( Interactor** c, int nc, Interactor**& a, int& n ) { if (interior_ == nil) { n = 0; } else if (nc > 0) { n = 1; a = c; a[0] = interior_; } else { n = 1; a = new Interactor*[1]; a[0] = interior_; } } neuron-7.6.3/src/lib/IV-2_6/scrollbar2_6.cpp000077500000000000000000000055701340731477100203130ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * ScrollBar -- general scrolling interface */ #include #include #include #include #include #include /* half-second autorepeat delay on movers */ static const int DELAY = 5; ScrollBar::ScrollBar(Interactor* i, int n) { interactor = i; size = n; } ScrollBar::ScrollBar(const char* name, Interactor* i, int n) { SetInstance(name); interactor = i; size = n; } ScrollBar::~ScrollBar() { } void ScrollBar::Use(Interactor* i) { Insert(i); MonoScene::Reconfig(); } HScrollBar::HScrollBar(Interactor* i, int n) : ScrollBar(i, n) { Init(); } HScrollBar::HScrollBar( const char* name, Interactor* i, int n ) : ScrollBar(name, i, n) { Init(); } HScrollBar::~HScrollBar() { } void HScrollBar::Init() { SetClassName("HScrollBar"); } void HScrollBar::Reconfig() { Interactor* i = new HBox( new LeftMover(interactor, DELAY), new VBorder, new HScroller(interactor, size), new VBorder, new RightMover(interactor, DELAY) ); Use(i); } VScrollBar::VScrollBar(Interactor* i, int n) : ScrollBar(i, n) { Init(); } VScrollBar::VScrollBar( const char* name, Interactor* i, int n ) : ScrollBar(name, i, n) { Init(); } VScrollBar::~VScrollBar() { } void VScrollBar::Init () { SetClassName("VScrollBar"); } void VScrollBar::Reconfig() { Interactor* i = new VBox( new UpMover(interactor, DELAY), new HBorder, new VScroller(interactor, size), new HBorder, new DownMover(interactor, DELAY) ); Use(i); } neuron-7.6.3/src/lib/IV-2_6/scroller2_6.cpp000066400000000000000000000271101340731477100201440ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Scrolling implementation. */ #include #include #include #include #include #include #include #include #include static const int inset = 1; /* space between scroller canvas and bar */ static inline int DefaultSize() { return Math::round(0.20*inch); } Scroller::Scroller(Interactor* i, int n) { interactor = i; size = n; Init(); } Scroller::Scroller(const char* name, Interactor* i, int n) { SetInstance(name); interactor = i; size = n; Init(); } void Scroller::Init() { view = interactor->GetPerspective(); view->Attach(this); shown = new Perspective; shape->Rigid(); input = new Sensor; input->Catch(DownEvent); input->Catch(UpEvent); input->Catch(MotionEvent); } Scroller::~Scroller() { view->Detach(this); Resource::unref(shown); } void Scroller::MakeBackground() { Painter* bg = new Painter(output); bg->ref(); Resource::unref(output); output = bg; static Pattern* pat; if (pat == nil) { pat = new Pattern(Pattern::lightgray); pat->Reference(); } output->SetPattern(pat); } void Scroller::Resize() { *shown = *view; } inline void Scroller::Background( IntCoord x1, IntCoord y1, IntCoord x2, IntCoord y2 ) { output->FillRect(canvas, x1, y1, x2, y2); } HScroller::HScroller(Interactor* i, int n) : Scroller(i, n) { Init(); } HScroller::HScroller( const char* name, Interactor* i, int n ) : Scroller(name, i, n) { Init(); } HScroller::~HScroller() { } void HScroller::Init() { SetClassName("HScroller"); } void HScroller::Reconfig() { if (size == 0) { shape->height = DefaultSize(); } else { shape->height = size; } shape->hstretch = hfil; shape->hshrink = 0; MakeBackground(); syncScroll = AttributeIsSet("syncScroll"); } VScroller::VScroller(Interactor* i, int n) : Scroller(i, n) { Init(); } VScroller::VScroller( const char* name, Interactor* i, int n ) : Scroller(name, i, n) { Init(); } VScroller::~VScroller() { } void VScroller::Init() { SetClassName("VScroller"); } void VScroller::Reconfig() { if (size == 0) { shape->width = DefaultSize(); } else { shape->width = size; } shape->vstretch = vfil; shape->vshrink = 0; MakeBackground(); syncScroll = AttributeIsSet("syncScroll"); } void HScroller::GetBarInfo( register Perspective* s, IntCoord& left, int& width ) { IntCoord maxwidth = xmax + 1; if (s->width == 0) { scale = 1.0; left = -1; width = maxwidth + 2; } else { scale = double(maxwidth) / double(s->width); if (Math::equal(scale, double(0.0), double(1e-6))) { scale = 1.0; } left = Math::round(double(s->curx - s->x0) * scale); width = Math::max(Math::round(double(s->curwidth) * scale), 5); } } void VScroller::GetBarInfo( register Perspective* s, IntCoord& bot, int& height ) { IntCoord maxheight = ymax + 1; if (s->height == 0) { scale = 1.0; bot = -1; height = maxheight + 2; } else { scale = double(maxheight) / double(s->height); if (Math::equal(scale, double(0.0), double(1e-6))) { scale = 1.0; } bot = Math::round(double(s->cury - s->y0) * scale); height = Math::max(Math::round(double(s->curheight) * scale), 5); } } inline void HScroller::Bar(IntCoord x, int width) { output->ClearRect(canvas, x, inset+1, x+width-1, ymax-inset-1); } inline void VScroller::Bar(IntCoord y, int height) { output->ClearRect(canvas, inset+1, y, xmax-inset-1, y+height-1); } inline void HScroller::Outline(IntCoord x, int width) { output->Rect(canvas, x, inset, x+width-1, ymax-inset); } inline void VScroller::Outline(IntCoord y, int height) { output->Rect(canvas, inset, y, xmax-inset, y+height-1); } inline void HScroller::Border(IntCoord x) { output->Line(canvas, x, inset, x, ymax-inset); } inline void VScroller::Border(IntCoord y) { output->Line(canvas, inset, y, xmax-inset, y); } inline void HScroller::Sides(IntCoord x1, IntCoord x2) { output->Line(canvas, x1, inset, x2, inset); output->Line(canvas, x1, ymax-inset, x2, ymax-inset); } inline void VScroller::Sides(IntCoord y1, IntCoord y2) { output->Line(canvas, inset, y1, inset, y2); output->Line(canvas, xmax-inset, y1, xmax-inset, y2); } void HScroller::Redraw(IntCoord x1, IntCoord y1, IntCoord x2, IntCoord y2) { IntCoord left; int width; Background(x1, y1, x2, y2); GetBarInfo(shown, left, width); Bar(left, width); Outline(left, width); } void VScroller::Redraw(IntCoord x1, IntCoord y1, IntCoord x2, IntCoord y2) { IntCoord bot; int height; Background(x1, y1, x2, y2); GetBarInfo(shown, bot, height); Bar(bot, height); Outline(bot, height); } void HScroller::Handle(Event& e) { if (e.eventType == DownEvent) { Perspective s = *view; bool syncing = (syncScroll && !e.control) || (!syncScroll && e.control); IntCoord nx = Slide(e); if (!syncing) { s.curx = nx; interactor->Adjust(s); } } } void VScroller::Handle(Event& e) { if (e.eventType == DownEvent) { Perspective s = *view; bool syncing = (syncScroll && !e.control) || (!syncScroll && e.control); IntCoord ny = Slide(e); if (!syncing) { s.cury = ny; interactor->Adjust(s); } } } IntCoord HScroller::Slide(register Event& e) { IntCoord x1, y1, x2, y2; IntCoord oldx, minx, maxx; int width, w; Perspective s; s = *view; GetBarInfo(shown, oldx, width); if (e.x < oldx) { x1 = Math::max(0, e.x - width/2); } else if (e.x > oldx + width) { x1 = Math::min(e.x - width/2, xmax - width + 1); } else { x1 = oldx; } x2 = x1 + width - 1; minx = Math::min(oldx, 0); maxx = Math::max(xmax + 1, oldx + width) - width; w = e.x - x1; bool syncing = (syncScroll && !e.control) || (!syncScroll && e.control); SlidingRect r(output, canvas, x1+1, inset+1, x2-1, ymax-inset-1, e.x, 0); r.Draw(); for (;;) { switch (e.eventType) { case UpEvent: case DownEvent: case MotionEvent: if (e.target != this) { e.target->GetRelative(e.x, e.y, this); } r.Track(Math::max(minx + w, Math::min(maxx + w, e.x)), 0); if (syncing) { r.Erase(); r.GetCurrent(x1, y1, x2, y2); s.curx = shown->x0 + Math::round(double(x1-1) / scale); interactor->Adjust(s); } break; } if (e.eventType == UpEvent) { break; } Read(e); } r.GetCurrent(x1, y1, x2, y2); r.Erase(); return shown->x0 + Math::round(double(x1-1) / scale); } IntCoord VScroller::Slide(register Event& e) { IntCoord x1, y1, x2, y2; IntCoord oldy, miny, maxy; int height, h; Perspective s; s = *view; GetBarInfo(shown, oldy, height); if (e.y < oldy) { y1 = Math::max(0, e.y - height/2); } else if (e.y > oldy + height) { y1 = Math::min(e.y - height/2, ymax - height + 1); } else { y1 = oldy; } y2 = y1 + height - 1; miny = Math::min(oldy, 0); maxy = Math::max(ymax + 1, oldy + height) - height; h = e.y - y1; bool syncing = (syncScroll && !e.control) || (!syncScroll && e.control); SlidingRect r(output, canvas, inset+1, y1+1, xmax-inset-1, y2-1, 0, e.y ); r.Draw(); for (;;) { switch (e.eventType) { case UpEvent: case DownEvent: case MotionEvent: if (e.target != this) { e.target->GetRelative(e.x, e.y, this); } r.Track(0, Math::max(miny + h, Math::min(maxy + h, e.y))); if (syncing) { r.Erase(); r.GetCurrent(x1, y1, x2, y2); s.cury = shown->y0 + Math::round(double(y1-1) / scale); interactor->Adjust(s); } break; } if (e.eventType == UpEvent) { break; } Read(e); } r.GetCurrent(x1, y1, x2, y2); r.Erase(); return shown->y0 + Math::round(double(y1-1) / scale); } void HScroller::Update() { IntCoord oldleft, oldright, newleft, newright; int oldwidth, newwidth; Perspective* p; if (canvas == nil) { return; } p = view; GetBarInfo(shown, oldleft, oldwidth); GetBarInfo(p, newleft, newwidth); if (oldleft != newleft || oldwidth != newwidth) { oldright = oldleft+oldwidth-1; newright = newleft+newwidth-1; if (oldright >= newleft && newright >= oldleft) { if (oldright > newright) { Background(newright+1, inset, oldright, ymax-inset); Border(newright); } else if (oldright < newright) { Bar(oldright, newright-oldright); Sides(oldright, newright); Border(newright); } if (oldleft > newleft) { Bar(newleft+1, oldleft-newleft); Sides(newleft, oldleft); Border(newleft); } else if (oldleft < newleft) { Background(oldleft, inset, newleft-1, ymax-inset); Border(newleft); } } else { Background(oldleft, inset, oldright, ymax-inset); Bar(newleft, newwidth); Outline(newleft, newwidth); } } *shown = *p; } void VScroller::Update() { IntCoord oldbottom, oldtop, newbottom, newtop; int oldheight, newheight; Perspective* p; if (canvas == nil) { return; } p = view; GetBarInfo(shown, oldbottom, oldheight); GetBarInfo(p, newbottom, newheight); if (oldbottom != newbottom || oldheight != newheight) { oldtop = oldbottom+oldheight-1; newtop = newbottom+newheight-1; if (oldtop >= newbottom && newtop >= oldbottom) { if (oldtop > newtop) { Background(inset, newtop+1, xmax-inset, oldtop); Border(newtop); } else if (oldtop < newtop) { Bar(oldtop, newtop-oldtop); Sides(oldtop, newtop); Border(newtop); } if (oldbottom > newbottom) { Bar(newbottom+1, oldbottom-newbottom); Sides(newbottom, oldbottom); Border(newbottom); } else if (oldbottom < newbottom) { Background(inset, oldbottom, xmax-inset, newbottom-1); Border(newbottom); } } else { Background(inset, oldbottom, xmax-inset, oldtop); Bar(newbottom, newheight); Outline(newbottom, newheight); } } *shown = *p; } neuron-7.6.3/src/lib/IV-2_6/sensor.cpp000077500000000000000000000112471340731477100173300ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Implementation of input interest handling. */ #include extern unsigned long motionmask, keymask, entermask, leavemask, focusmask, upmask, downmask, initmask; Sensor::Sensor() { mask = initmask; for (register int i = 0; i < 8; i++) { down[i] = 0; up[i] = 0; } ref(); } Sensor::Sensor(const Sensor& s) { *this = s; ref(); } Sensor::Sensor(const Sensor* s) { *this = *s; ref(); } Sensor::~Sensor() { } Sensor& Sensor::operator =(register const Sensor& s) { mask = s.mask; for (register int i = 0; i < 8; i++) { down[i] = s.down[i]; up[i] = s.up[i]; } return *this; } Sensor* allEvents; Sensor* onoffEvents; Sensor* updownEvents; Sensor* noEvents; void Sensor::init() { allEvents = new Sensor; allEvents->Catch(MotionEvent); allEvents->Catch(DownEvent); allEvents->Catch(UpEvent); allEvents->Catch(KeyEvent); allEvents->Catch(EnterEvent); allEvents->Catch(LeaveEvent); onoffEvents = new Sensor; onoffEvents->Catch(EnterEvent); onoffEvents->Catch(LeaveEvent); updownEvents = new Sensor; updownEvents->Catch(UpEvent); updownEvents->Catch(DownEvent); noEvents = new Sensor; } void Sensor::Catch(EventType t) { register int i; switch (t) { case MotionEvent: mask |= motionmask; break; case DownEvent: mask |= downmask; SetMouseButtons(down); break; case UpEvent: mask |= upmask; SetMouseButtons(up); break; case KeyEvent: mask |= keymask; down[0] |= 0xfffffff8; for (i = 1; i < 8; i++) { down[i] = 0xffffffff; } break; case EnterEvent: mask |= entermask; break; case LeaveEvent: mask |= leavemask; break; case FocusInEvent: case FocusOutEvent: mask |= focusmask; break; } } void Sensor::CatchButton(EventType t, int b) { switch (t) { case DownEvent: mask |= downmask; SetButton(down, b); break; case UpEvent: mask |= upmask; SetButton(up, b); break; case KeyEvent: mask |= keymask; SetButton(down, b); break; default: /* ignore */ break; } } void Sensor::Ignore(EventType t) { register int i; switch (t) { case MotionEvent: mask &= ~motionmask; break; case DownEvent: ClearMouseButtons(down); if (!MouseButtons(up)) { mask &= ~downmask; } break; case UpEvent: ClearMouseButtons(up); if (!MouseButtons(down)) { mask &= ~upmask; } break; case KeyEvent: down[0] &= ~0xfffffff8; for (i = 1; i < 8; i++) { down[i] = 0; } mask &= ~keymask; break; case EnterEvent: mask &= ~entermask; break; case LeaveEvent: mask &= ~leavemask; break; case FocusInEvent: case FocusOutEvent: mask &= ~focusmask; break; } } void Sensor::IgnoreButton(EventType t, int b) { register int i; switch (t) { case DownEvent: ClearButton(down, b); if (!MouseButtons(down) && !MouseButtons(up)) { mask &= ~downmask; } break; case UpEvent: ClearButton(up, b); if (!MouseButtons(up) && !MouseButtons(down)) { mask &= ~upmask; } break; case KeyEvent: ClearButton(down, b); if ((down[0] & 0xfffffff8) == 0) { mask &= ~keymask; for (i = 1; i < 8; i++) { if (down[i] != 0) { mask |= keymask; break; } } } break; default: /* ignore */ break; } } neuron-7.6.3/src/lib/IV-2_6/shape.cpp000066400000000000000000000036521340731477100171150ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Shape constructors */ #include Shape::Shape () { SetUndefined(); Rigid(hfil, hfil, vfil, vfil); aspect = 0; hunits = 1; vunits = 1; } Shape::~Shape () { /* nothing to do for now */ } void Shape::Square (int side) { width = side; height = side; Rigid(); aspect = 1; } void Shape::Rect (int w, int h) { width = w; height = h; Rigid(); } void Shape::Rigid (int hshr, int hstr, int vshr, int vstr) { hshrink = hshr; hstretch = hstr; vshrink = vshr; vstretch = vstr; } void Shape::SetUndefined () { width = 0; height = 0; } bool Shape::Defined () { return width != 0; } neuron-7.6.3/src/lib/IV-2_6/strbrowser.cpp000066400000000000000000000454011340731477100202270ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * StringBrowser implementation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include StringBrowser::StringBrowser ( ButtonState* bs, int r, int c, bool u, int h, const char* d ) { Init(bs, r, c, u, h, d); } StringBrowser::StringBrowser ( const char* name, ButtonState* bs, int r, int c, bool u, int h, const char* d ) { SetInstance(name); Init(bs, r, c, u, h, d); } void StringBrowser::Init ( ButtonState* bs, int r, int c, bool u, int h, const char* d ) { const int defaultSize = 256; SetClassName("StringBrowser"); input = new Sensor; input->Catch(DownEvent); input->Catch(KeyEvent); strbufsize = selbufsize = defaultSize; strbuf = new char*[strbufsize]; selbuf = new char*[selbufsize]; strcount = selcount = 0; display = nil; lineheight = 0; rows = r; columns = c; uniqueSel = u; singleClick = false; highlight = h; lastx = lasty = -1; subject = bs; Resource::ref(subject); done = d; perspective = new Perspective; InitTextDisplay(); } void StringBrowser::InitTextDisplay () { delete display; display = new TextDisplay; display->Draw(output, canvas); display->CaretStyle(NoCaret); for (int i = 0; i < strcount; ++i) { display->ReplaceText(i, strbuf[i], strlen(strbuf[i])); } if (canvas != nil) { output->ClearRect(canvas, 0, 0, xmax, ymax); } } StringBrowser::~StringBrowser () { Clear(); delete [] strbuf; delete [] selbuf; delete display; Resource::unref(subject); Resource::unref(perspective); } static void BufCheck (char**& buf, int& bufsize, int count, int index) { char** newbuf; if (index >= bufsize) { bufsize = (index+1) * 2; newbuf = new char*[bufsize]; Memory::copy(buf, newbuf, count*sizeof(char*)); delete [] buf; buf = newbuf; } } static void BufInsert ( const char* s, int index, char**& buf, int& bufsize, int& count ) { char** spot; index = (index < 0) ? count : index; if (index < count) { BufCheck(buf, bufsize, count, count+1); spot = &buf[index]; Memory::copy(spot, spot+1, (count - index)*sizeof(char*)); } else { BufCheck(buf, bufsize, count, index); spot = &buf[index]; } *spot = (char*)s; ++count; } static void BufRemove (int index, char** buf, int& count) { if (index < --count) { char** spot = &buf[index]; Memory::copy(spot+1, spot, (count - index)*sizeof(char*)); } } static int BufFind ( int index, char** srcbuf, int srccount, char** dstbuf, int dstcount ) { if (0 <= index && index < srccount) { const char* s = srcbuf[index]; if (s != nil) { for (int i = 0; i < dstcount; ++i) { if (dstbuf[i] == s) { return i; } } } } return -1; } void StringBrowser::Insert (const char* s, int index) { display->Draw(output, canvas); register Perspective* p = perspective; char* copy = new char[strlen(s)+1]; strcpy(copy, s); BufInsert(copy, index, strbuf, strbufsize, strcount); if (output != nil) { p->width = Math::max(p->width, output->GetFont()->Width(s)); } p->height += lineheight; p->cury += lineheight; p->Update(); if (index < strcount-1) { display->InsertLinesAfter(index-1, 1); } display->ReplaceText(index, s, strlen(s)); } void StringBrowser::Replace (const char* s, int index) { if (index < strcount) { display->Draw(output, canvas); register Perspective* p = perspective; char* old_string = String(index); delete [] old_string; char* copy = new char[strlen(s)+1]; strcpy(copy, s); strbuf[index] = copy; if (output != nil) { p->width = Math::max(p->width, output->GetFont()->Width(s)); } p->Update(); display->ReplaceText(index, s, strlen(s)); } } void StringBrowser::Remove (int index) { if (0 <= index && index < strcount) { display->Draw(output, canvas); register Perspective* p = perspective; char* string = String(index); if ( output != nil && p->width > columns * shape->hunits && p->width == output->GetFont()->Width(string) ) { UpdateWidth(); } Unselect(index); delete [] string; BufRemove(index, strbuf, strcount); p->height -= lineheight; p->cury -= lineheight; p->Update(); display->DeleteLinesAfter(index-1, 1); } } int StringBrowser::Index (const char* s) { for (int i = 0; i < strcount; ++i) { if (strcmp(s, strbuf[i]) == 0) { return i; } } return -1; } char* StringBrowser::String (int index) { return (0 <= index && index < strcount) ? strbuf[index] : nil; } void StringBrowser::Clear () { for (int i = 0; i < strcount; ++i) { delete [] strbuf[i]; } strcount = selcount = 0; InitTextDisplay(); Perspective np; *perspective = np; Resize(); } void StringBrowser::Select (int index) { if (index < strcount && !Selected(index)) { BufInsert(String(index), selcount, selbuf, selbufsize, selcount); display->Draw(output, canvas); display->Style(index, 0, index+1, -1, highlight); } } void StringBrowser::Unselect (int index) { int selindex; if (index < strcount && (selindex = SelectionIndex(index)) >= 0) { BufRemove(selindex, selbuf, selcount); display->Draw(output, canvas); display->Style(index, 0, index+1, -1, Plain); } } int StringBrowser::Selection (int selindex) { return BufFind(selindex, selbuf, selcount, strbuf, strcount); } int StringBrowser::SelectionIndex (int index) { return BufFind(index, strbuf, strcount, selbuf, selcount); } void StringBrowser::Browse () { Event e; e.target = nil; e.eventType = EnterEvent; Handle(e); } bool StringBrowser::HandleDownEvent (Event& e) { bool done1 = true; if (e.target == this) { if (e.button == LEFTMOUSE) { done1 = LeftButtonDown(e); } else if (e.button == MIDDLEMOUSE) { GrabScroll(e); } else if (e.button == RIGHTMOUSE) { RateScroll(e); } } else { UnRead(e); } return done1; } bool StringBrowser::HandleKeyEvent (Event& e) { bool done1 = false; if (e.len != 0) { done1 = HandleChar(e.keystring[0]); } return done1; } void StringBrowser::Handle (Event& e) { if (e.eventType == KeyEvent) { HandleKeyEvent(e); } else { bool done1 = false; do { switch (e.eventType) { case DownEvent: done1 = HandleDownEvent(e); break; case KeyEvent: done1 = HandleKeyEvent(e); break; } if (!done1) { Read(e); } } while (!done1); } } bool StringBrowser::HandleChar (char c) { int index = Selection(); int i; switch (c) { case SBFirstString: ScrollTo(0); break; case SBLastString: ScrollTo(strcount-1); break; case SBScrollDown: ScrollBy(1); break; case SBScrollUp: ScrollBy(-1); break; case SBSelectAll: if (!uniqueSel) { SelectAll(); } break; case SBUnselectAll: case SBUnselectAllAlt: UnselectAll(); break; case SBSelectPreviousString: UnselectAll(); index = Math::max(0, Math::min(--index, strcount-1)); Select(index); ScrollTo(index); break; case SBSelectNextString: UnselectAll(); index = Math::max(0, Math::min(++index, strcount-1)); Select(index); ScrollTo(index); break; case SBSelectTopString: UnselectAll(); index = Math::max(0, Locate(0, ymax)); Select(index); break; case SBSelectBottomString: UnselectAll(); index = Math::min(Locate(0, 0), strcount-1); Select(index); break; case SBPageDown: ScrollBy((ymax+1) / lineheight); break; case SBPageUp: ScrollBy(-(ymax+1) / lineheight); break; case SBHalfPageDown: ScrollBy((ymax+1) / lineheight / 2); break; case SBHalfPageUp: ScrollBy(-(ymax+1) / lineheight / 2); break; default: for (i = 0; done[i] != '\0'; i++) { if (c == done[i]) { subject->SetValue(c); return true; } } break; } return false; } void StringBrowser::Adjust (Perspective& np) { register Perspective* p = perspective; float scale = (np.height == 0) ? 1 : float(p->height) / float(np.height); int x = p->x0 + int((np.curx - np.x0) * scale); int y = p->y0 + int((np.cury - np.y0) * scale); ScrollTo(x, y); } static Cursor* handCursor; static Cursor* upCursor; static Cursor* dnCursor; void StringBrowser::Reconfig () { if (handCursor == nil) { handCursor = new Cursor( new Bitmap( hand_bits, hand_width, hand_height, hand_x_hot, hand_y_hot ), new Bitmap(hand_mask_bits, hand_mask_width, hand_mask_height), output->GetFgColor(), output->GetBgColor() ); upCursor = new Cursor( new Bitmap( ufast_bits, ufast_width, ufast_height, ufast_x_hot, ufast_y_hot ), new Bitmap(ufast_mask_bits, ufast_mask_width, ufast_mask_height), output->GetFgColor(), output->GetBgColor() ); dnCursor = new Cursor( new Bitmap( dfast_bits, dfast_width, dfast_height, dfast_x_hot, dfast_y_hot ), new Bitmap(dfast_mask_bits, dfast_mask_width, dfast_mask_height), output->GetFgColor(), output->GetBgColor() ); } const Font* f = output->GetFont(); shape->hunits = f->Width("n"); shape->vunits = f->Height(); lineheight = shape->vunits; shape->Rect(shape->hunits*columns, shape->vunits*rows); shape->Rigid(hfil, hfil, shape->height - lineheight, vfil); singleClick = AttributeIsSet("singleClick"); const char* attrib = GetAttribute("clickDelay"); clickDelay = (attrib == nil) ? 250 : atoi(attrib); } void StringBrowser::UpdateWidth () { if (output != nil) { Perspective* p = perspective; const Font* f = output->GetFont(); p->width = columns * shape->hunits; for (int i = 0; i < Count(); ++i) { const char* s = String(i); p->width = Math::max(p->width, f->Width(s)); } } } void StringBrowser::InitPerspective (bool scroll_to_top) { register Perspective* p = perspective; int old_top = p->height - p->cury - p->curheight; p->lx = p->curwidth = xmax+1; p->ly = p->curheight = ymax+1; p->sx = shape->hunits; p->sy = lineheight; p->height = Count() * lineheight; UpdateWidth(); if (scroll_to_top) { p->curx = 0; p->cury = p->height - p->curheight; } else { p->cury = p->height - p->curheight - old_top; } p->Update(); } void StringBrowser::Resize () { InitPerspective(perspective->curwidth == 0); if (lineheight != 0) { display->Draw(output, canvas); display->LineHeight(lineheight); display->Resize(0, -lineheight, xmax, ymax); } } void StringBrowser::Redraw (IntCoord l, IntCoord b, IntCoord r, IntCoord t) { display->Draw(output, canvas); display->Redraw(l, b, r, t); } void StringBrowser::Select (int dot, int mark) { for (int i = Math::min(dot, mark); i <= Math::max(dot, mark); ++i) { Select(i); } } void StringBrowser::SelectAll () { selcount = 0; for (int i = 0; i < strcount; ++i) { BufInsert(strbuf[i], i, selbuf, selbufsize, selcount); } display->Draw(output, canvas); display->Style(0, 0, strcount, -1, highlight); } void StringBrowser::Unselect (int dot, int mark) { for (int i = Math::min(dot, mark); i <= Math::max(dot, mark); ++i) { Unselect(i); } } void StringBrowser::UnselectAll () { selcount = 0; display->Draw(output, canvas); display->Style(0, 0, strcount, 0, Plain); } void StringBrowser::ScrollBy (int dx, int dy) { register Perspective* p = perspective; ScrollTo(p->curx + dx, p->cury + dy); } void StringBrowser::ScrollBy (int lines) { ScrollBy(0, -lines*lineheight); } void StringBrowser::ScrollTo (int x, int y) { register Perspective* p = perspective; int minx = 0; int maxx = Math::max(minx, p->width - p->curwidth/2); int maxy = p->height - p->curheight; int miny = Math::min(maxy, 1-lineheight); p->curx = Math::max(minx, Math::min(x, maxx)); p->cury = Math::max(miny, Math::min(y, maxy)); p->Update(); int topmargin = p->height - p->curheight - p->cury; int line = (lineheight == 0) ? 0 : topmargin / lineheight; display->Draw(output, canvas); display->Scroll(line, -p->curx, ymax); } void StringBrowser::ScrollTo (int index) { register Perspective* p = perspective; IntCoord y0 = p->y0 + p->cury; IntCoord y = p->height - (index+1)*lineheight - y0; if (y > ymax) { ScrollTo(0, y0 - (ymax-y)); } else if (y < 0) { y -= (p->curheight % lineheight == 0) ? 0 : lineheight; ScrollTo(0, y0 - (-y)); } } void StringBrowser::ScrollToView (IntCoord x, IntCoord y) { IntCoord dx = x < 0 ? x : x > xmax ? x - xmax : 0; IntCoord dy = y < 0 ? y : y > ymax ? y - ymax : 0; if (dx != 0 || dy != 0) { ScrollTo(perspective->curx + dx, perspective->cury + dy); } } int StringBrowser::Locate (IntCoord, IntCoord y) { register Perspective* p = perspective; y = Math::max(p->curheight % lineheight, Math::min(y, p->curheight-1)); return display->LineNumber(y); } void StringBrowser::Note (Event& e) { lasttime = e.timestamp; lastx = e.x; lasty = e.y; } bool StringBrowser::DoubleClicked (Event& e) { if (e.eventType != DownEvent) { return false; } const int distThresh = 4; int time = abs(int(e.timestamp - lasttime)); int dist = abs(e.x - lastx) + abs(e.y - lasty); return time < clickDelay && dist < distThresh; } void StringBrowser::UpdateSelection (int d, int m, int style1) { int oldl = Math::min(lastdot, lastmark); int oldr = Math::max(lastdot, lastmark); int newl = Math::min(d, m); int newr = Math::max(d, m); if (newr < oldl || newl > oldr) { // no overlap if (style1 == highlight) { Unselect(oldl, oldr); } if (style1 == highlight) { Select(newl, newr); } else { Unselect(newl, newr); } } else { // overlap if (newl < oldl) { if (style1 == highlight) { Select(newl, oldl); } else { Unselect(newl, oldl); } } else if (newl > oldl) { if (style1 == highlight) { Unselect(oldl, newl-1); } } if (newr > oldr) { if (style1 == highlight) { Select(oldr, newr); } else { Unselect(oldr, newr); } } else if (newr < oldr) { if (style1 == highlight) { Unselect(newr+1, oldr); } } } lastdot = d; lastmark = m; } bool StringBrowser::LeftButtonDown (Event& e) { bool status = false; if (DoubleClicked(e)) { subject->SetValue(done[0]); status = true; } else if (uniqueSel) { if (Selections() == 0) { Select(Locate(e.x, e.y)); } else { Unselect(Selection()); if (!e.shift) { Select(Locate(e.x, e.y)); } } } else { lastdot = lastmark = Locate(e.x, e.y); if (Selected(lastdot) && e.shift) { Unselect(lastdot); do { ScrollToView(e.x, e.y); UpdateSelection(lastdot, Locate(e.x, e.y), Plain); Poll(e); } while (e.leftmouse); } else { if (!e.shift) { UnselectAll(); } Select(lastdot); do { ScrollToView(e.x, e.y); UpdateSelection(lastdot, Locate(e.x, e.y), highlight); Poll(e); } while (e.leftmouse); } } Note(e); if (singleClick) { subject->SetValue(done[0]); status = true; } return status; } void StringBrowser::GrabScroll (Event& e) { int y = e.y; Cursor* origCursor = GetCursor(); SetCursor(handCursor); do { ScrollBy(0, y - e.y); y = e.y; Poll(e); } while (e.middlemouse); SetCursor(origCursor); } void StringBrowser::RateScroll (Event& e) { Cursor* origCursor = GetCursor(); int y = e.y; do { ScrollBy(0, e.y - y); if (e.y - y < 0) { SetCursor(dnCursor); } else { SetCursor(upCursor); } Poll(e); } while (e.rightmouse); SetCursor(origCursor); } neuron-7.6.3/src/lib/IV-2_6/strchooser.cpp000066400000000000000000000107331340731477100202060ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * StringChooser implementation. */ #include #include #include #include #include #include #include #include #include StringChooser::StringChooser( ButtonState* bs, int r, int c, const char* s, Alignment a ) : Dialog(bs, nil, a) { Init(new StringEditor(bs, s), new StringBrowser(bs, r, c)); } StringChooser::StringChooser( const char* name, ButtonState* bs, int r, int c, const char* s, Alignment a ) : Dialog(name, bs, nil, a) { Init(new StringEditor(bs, s), new StringBrowser(bs, r, c)); } StringChooser::StringChooser( ButtonState* bs, Alignment a ) : Dialog(bs, nil, a) { } StringChooser::~StringChooser() { } void StringChooser::Init(StringEditor* se, StringBrowser* sb) { input = new Sensor; input->Catch(KeyEvent); _sedit = se; _browser = sb; _focus = _sedit; } void StringChooser::Select(int index) { if (index < 0) { _sedit->Select(strlen(_sedit->Text())); } else { _sedit->Select(index); } } void StringChooser::Select(int left, int right) { _sedit->Select(left, right); } void StringChooser::SelectMessage() { _sedit->Select(0, strlen(_sedit->Text())); } void StringChooser::Message(const char* msg) { _sedit->Message(msg); } const char* StringChooser::Choice() { return _sedit->Text(); } void StringChooser::Forward(Event& e) { IntCoord x = e.x, y = e.y; e.target->GetRelative(x, y, this); if (x >= 0 && y >= 0 && x <= xmax && y <= ymax) { e.target->Handle(e); } } bool StringChooser::Accept() { Event e; int v = 0; _focus = _sedit; state->SetValue(v); World* world = GetWorld(); HandleFocus(); state->GetValue(v); while (!world->done() && (v == 0 || v == '\t')) { if (v == '\t') { UpdateEditor(); UpdateBrowser(); SwitchFocus(); HandleFocus(); } else { Read(e); if (e.target != _focus && CanFocus(e.target)) { SwitchFocus(); } Forward(e); } state->GetValue(v); } bool accepted = v == '\r'; if (accepted) { UpdateEditor(); UpdateBrowser(); } return accepted; } void StringChooser::Handle(Event& e) { _focus->Handle(e); } void StringChooser::SwitchFocus() { if (_focus == _sedit) { _focus = _browser; Select(); state->SetValue(0); } else if (_focus == _browser) { _focus = _sedit; _browser->UnselectAll(); state->SetValue(0); } } bool StringChooser::CanFocus(Interactor* i) { return i == _sedit || i == _browser; } void StringChooser::HandleFocus() { if (_focus == _sedit) { _sedit->Edit(); } else if (_focus == _browser) { _browser->Browse(); } } void StringChooser::UpdateEditor() { int index = _browser->Selection(); if (index >= 0) { _sedit->Message(_browser->String(index)); SelectMessage(); } } void StringChooser::UpdateBrowser() { _browser->UnselectAll(); } neuron-7.6.3/src/lib/IV-2_6/streditor.cpp000066400000000000000000000256161340731477100200400ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * StringEditor - interactive editor for character strings */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static const int BUFFERSIZE = 1000; StringEditor::StringEditor ( ButtonState* s, const char* samp, const char* done1 ) { Init(s, samp, done1); } StringEditor::StringEditor ( const char* name, ButtonState* s, const char* samp, const char* done1 ) { SetInstance(name); Init(s, samp, done1); } void StringEditor::Init (ButtonState* s, const char* samp, const char* d) { SetClassName("StringEditor"); sample = strcpy(new char[strlen(samp) + 1], samp); size = BUFFERSIZE; buffer = new char[size]; text = new TextBuffer(buffer, 0, size); left = 0; right = 0; subject = s; if (subject != nil) { subject->Attach(this); } done = strcpy(new char[strlen(d) + 1], d); display = new TextDisplay(); display->CaretStyle(NoCaret); input = new Sensor(); input->Catch(KeyEvent); input->Catch(DownEvent); Message(sample); } StringEditor::~StringEditor () { if (subject != nil) { subject->Detach(this); } delete text; delete [] sample; delete [] done; delete [] buffer; delete display; } static Cursor* handCursor; static Cursor* leftCursor; static Cursor* rightCursor; void StringEditor::Reconfig () { if (handCursor == nil) { handCursor = new Cursor( new Bitmap( hand_bits, hand_width, hand_height, hand_x_hot, hand_y_hot ), new Bitmap(hand_mask_bits, hand_mask_width, hand_mask_height), output->GetFgColor(), output->GetBgColor() ); leftCursor = new Cursor( new Bitmap( lfast_bits, lfast_width, lfast_height, lfast_x_hot, lfast_y_hot ), new Bitmap(lfast_mask_bits, lfast_mask_width, lfast_mask_height), output->GetFgColor(), output->GetBgColor() ); rightCursor = new Cursor( new Bitmap( rfast_bits, rfast_width, rfast_height, rfast_x_hot, rfast_y_hot ), new Bitmap(rfast_mask_bits, rfast_mask_width, rfast_mask_height), output->GetFgColor(), output->GetBgColor() ); } const Font* f = output->GetFont(); shape->Rect(f->Width(sample), f->Height()); shape->Rigid(hfil, hfil, 0, 0); display->LineHeight(f->Height()); } void StringEditor::Resize () { display->Draw(output, canvas); display->Resize(0, 0, xmax, ymax); Select(left, right); } void StringEditor::Redraw (IntCoord l, IntCoord b, IntCoord r, IntCoord t) { display->Draw(output, canvas); display->Redraw(l, b, r, t); } void StringEditor::Message (const char* t) { text->Delete(text->BeginningOfText(), text->Length()); text->Insert(0, t, strlen(t)); int bol = text->BeginningOfLine(0); int eol = text->EndOfLine(0); display->Draw(output, canvas); display->ReplaceText(0, text->Text(bol, eol), eol - bol); Select(eol); } void StringEditor::Select (int l) { Select(l, l); } void StringEditor::Select (int l, int r) { display->Draw(output, canvas); int origin = display->Left(0, 0); if (display->Left(0, r - 1) < 0) { origin += xmax/2 - display->Left(0, r - 1); } else if (display->Right(0, r + 1) > xmax) { origin += xmax/2 - display->Right(0, r + 1); } origin = Math::min( 0, Math::max(Math::min(0, xmax - display->Width()), origin) ); display->Scroll(0, origin, ymax); DoSelect(l, r); } void StringEditor::DoSelect (int l, int r) { display->Draw(output, canvas); if (l > r) { int tmp = r; r = l; l = tmp; } l = Math::max(l, text->BeginningOfLine(left)); r = Math::min(r, text->EndOfLine(right)); if (r < left || l > right) { if (right > left) { display->Style(0, left, 0, right-1, Plain); } if (r > l) { display->Style(0, l, 0, r-1, Reversed); } } else { if (l < left) { display->Style(0, l, 0, left-1, Reversed); } else if (l > left) { display->Style(0, left, 0, l-1, Plain); } if (r > right) { display->Style(0, right, 0, r-1, Reversed); } else if (r < right) { display->Style(0, r, 0, right-1, Plain); } } left = l; right = r; if (left == right) { display->Caret(0, left); } else { display->Caret(-1, 0); } } void StringEditor::Edit () { Event e; e.target = nil; e.eventType = EnterEvent; Handle(e); } void StringEditor::Edit (const char* t, int l, int r) { Message(t); Select(l, r); Edit(); } const char* StringEditor::Text () { return text->Text(); } bool StringEditor::HandleChar (char c) { if (strchr(done, c) != nil) { if (subject != nil) { subject->SetValue(c); } return true; } else { switch (c) { case SEBeginningOfLine: Select(text->BeginningOfLine(left)); break; case SEEndOfLine: Select(text->EndOfLine(right)); break; case SESelectAll: Select(text->BeginningOfText(), text->EndOfText()); break; case SESelectWord: Select( text->BeginningOfWord(text->PreviousCharacter(left)), right ); break; case SEPreviousCharacter: Select(text->PreviousCharacter(left)); break; case SENextCharacter: Select(text->NextCharacter(right)); break; case SEDeleteNextCharacter: if (left == right) { right = text->NextCharacter(right); } InsertText("", 0); break; case SEDeletePreviousCharacter: case SEDeletePreviousCharacterAlt: if (left == right) { left = text->PreviousCharacter(left); } InsertText("", 0); break; default: if (!iscntrl(c)) { InsertText(&c, 1); } break; } return false; } } void StringEditor::InsertText (const char* t, int len) { display->Draw(output, canvas); if (left != right) { text->Delete(left, right-left); display->DeleteText(0, left, right-left); } text->Insert(left, t, len); display->InsertText(0, left, t, len); int l = left; while (len > 0) { l = text->NextCharacter(l); --len; } Select(l); } void StringEditor::Handle (Event& e) { bool done1 = false; World* world1 = GetWorld(); display->Draw(output, canvas); display->CaretStyle(BarCaret); do { switch (e.eventType) { case KeyEvent: if (e.len != 0) { done1 = HandleChar(e.keystring[0]); } break; case DownEvent: if (e.target == this) { int origin = display->Left(0, 0); int width = display->Width(); if (e.button == LEFTMOUSE) { int start = display->LineIndex(0, e.x); do { if (e.x < 0) { origin = Math::min(0, origin - e.x); } else if (e.x > xmax) { origin = Math::max( xmax - width, origin - (e.x - xmax) ); } display->Scroll(0, origin, ymax); DoSelect(start, display->LineIndex(0, e.x)); Poll(e); } while (e.leftmouse); } else if (e.button == MIDDLEMOUSE) { Cursor* origCursor = GetCursor(); SetCursor(handCursor); int x = e.x; do { origin += e.x - x; origin = Math::min( 0, Math::max(Math::min(0, xmax - width), origin) ); display->Scroll(0, origin, ymax); x = e.x; Poll(e); } while (e.middlemouse); SetCursor(origCursor); } else if (e.button == RIGHTMOUSE) { Cursor* origCursor = GetCursor(); int x = e.x; do { origin += x - e.x; origin = Math::min( 0, Math::max(Math::min(0, xmax - width), origin) ); display->Scroll(0, origin, ymax); if (e.x - x < 0) { SetCursor(leftCursor); } else { SetCursor(rightCursor); } Poll(e); } while (e.rightmouse); SetCursor(origCursor); } } else { UnRead(e); done1 = true; } break; } if (!done1) { Read(e); } } while (!done1 && !world1->done()); display->CaretStyle(NoCaret); } neuron-7.6.3/src/lib/IV-2_6/subject.cpp000066400000000000000000000045171340731477100174550ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Implementation of subject base class. */ #include #include #include declarePtrList(ViewList,Interactor) implementPtrList(ViewList,Interactor) struct SubjectRep { private: friend class Subject; ViewList* views_; }; Subject::Subject() { rep_ = new SubjectRep; rep_->views_ = new ViewList; } Subject::~Subject() { delete rep_->views_; delete rep_; rep_ = nil; } void Subject::Attach(Interactor* v) { rep_->views_->append(v); ref(); } void Subject::Detach(Interactor* v) { ViewList& vl = *rep_->views_; for (unsigned int i = 0; i < vl.count(); i++) { if (vl.item(i) == v) { vl.remove(i); unref(); break; } } } void Subject::Notify() { ViewList& vl = *rep_->views_; for (unsigned int i = 0; i < vl.count(); i++) { vl.item(i)->Update(); } } bool Subject::IsView(Interactor* v) { ViewList& vl = *rep_->views_; for (unsigned int i = 0; i < vl.count(); i++) { if (vl.item(i) == v) { return true; } } return false; } neuron-7.6.3/src/lib/IV-2_6/textbuffer.cpp000066400000000000000000000210411340731477100201630ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TextBuffer - editable text buffer */ #include #include #include #include #include #include #include #include //#include static const char NEWLINE = '\012'; TextBuffer::TextBuffer (char* t, int l, int s) { text = t; length = l; size = s; Memory::zero(text + length, size - length); linecount = 1 + LinesBetween(0, length); lastline = 0; lastindex = 0; } TextBuffer::~TextBuffer() { /* side effect restores buffer to normal form */ Text(); } inline int limit (int l, int x, int h) { return (xh) ? h : x; } int TextBuffer::Search (Regexp* regexp, int index, int range, int stop) { int s = limit(0, stop, length); int i = limit(0, index, s); return regexp->Search(text, s, i, range); } int TextBuffer::BackwardSearch (Regexp* regexp, int index) { int i = limit(0, index, length); int r = regexp->Search(text, length, i, -i); if (r >= 0) { return regexp->BeginningOfMatch(); } else { return r; } } int TextBuffer::ForwardSearch (Regexp* regexp, int index) { int i = limit(0, index, length); int r = regexp->Search(text, length, i, length - i); if (r >= 0) { return regexp->EndOfMatch(); } else { return r; } } int TextBuffer::Match (Regexp* regexp, int index, int stop) { int s = limit(0, stop, length); int i = limit(0, index, s); return regexp->Match(text, length, i); } bool TextBuffer::BackwardMatch (Regexp* regexp, int index) { int i = limit(0, index, length); for (int j = i; j >= 0; --j) { if (regexp->Match(text, length, j) == i - j) { return true; } } return false; } bool TextBuffer::ForwardMatch (Regexp* regexp, int index) { int i = limit(0, index, length); return regexp->Match(text, length, i) >= 0; } int TextBuffer::Insert (int index, const char* string, int count) { if (index < 0 || index > length) { return 0; } else if (count < 0) { return Insert(index + count, string, -count); } else { count = Math::min(count, size - length); Memory::copy(text + index, text + index + count, length - index); Memory::copy(string, text + index, count); length += count; int newlines = (count == 1) ? (*string == NEWLINE) : LinesBetween(index, index + count); linecount += newlines; if (lastindex > index) { lastindex += count; lastline += newlines; } return count; } } int TextBuffer::Delete (int index, int count) { if (index < 0 || index > length) { return 0; } else if (count < 0) { return -Delete(index + count, -count); } else { count = Math::min(count, length - index); int oldlines = (count == 1) ? (text[index] == NEWLINE) : LinesBetween(index, index + count); if (lastindex > index + count) { lastindex -= count; lastline -= oldlines; } else if (lastindex >= index) { (void)LineNumber(index); } Memory::copy( text + index + count, text + index, length - (index+count) ); length -= count; Memory::zero(text + length, count); linecount -= oldlines; return count; } } int TextBuffer::Copy (int index, char* buffer, int count) { if (index < 0 || index > length) { return 0; } else if (count < 0) { return Copy(index + count, buffer, -count); } else { count = Math::min(count, length - index); Memory::copy(text + index, buffer, count); return count; } } int TextBuffer::Width () { int width = 0; int i = 0; while (i != length) { width = Math::max(width, EndOfLine(i) - i); i = BeginningOfNextLine(i); } return width; } int TextBuffer::LineIndex(int line) { int l = (line<0) ? 0 : (line>=linecount) ? linecount-1 : line; while (lastline > l) { --lastline; lastindex = BeginningOfLine(EndOfPreviousLine(lastindex)); } while (lastline < l) { ++lastline; lastindex = BeginningOfNextLine(lastindex); } if (line >= linecount) { return EndOfText(); } else { return lastindex; } } int TextBuffer::LinesBetween (int index1, int index2) { if (index1 == index2) { return 0; } else if (index1 > index2) { return -LinesBetween(index2, index1); } else { const char* start = Text(index1); const char* finish = Text(index2); const char* tt; int l = 0; while (start < finish) { tt = (char*)memchr((const void*)start, NEWLINE, finish - start); if (tt == nil) { break; } start = tt + 1; ++l; } return l; } } int TextBuffer::LineNumber (int index) { int l = LinesBetween(lastindex, index); lastline += l; lastindex = BeginningOfLine(index); return lastline; } int TextBuffer::LineOffset (int index) { return (index<0) ? 0 : (index>length) ? 0 : index-BeginningOfLine(index); } bool TextBuffer::IsBeginningOfLine (int index) { const char* t = Text(index); return t <= text || *(t-1) == NEWLINE; } int TextBuffer::BeginningOfLine (int index) { const char* t = Text(index); while (t > text && *(t-1) != NEWLINE) { --t; } return t - text; } int TextBuffer::BeginningOfNextLine (int index) { const char* t = Text(index); const char* e = text + length; t = (char*)memchr((const void*)t, NEWLINE, e - t); if (t == nil) { return length; } else { return t - text + 1; } } bool TextBuffer::IsEndOfLine (int index) { const char* t = Text(index); return t >= text + length || *t == NEWLINE; } int TextBuffer::EndOfLine (int index) { const char* t = Text(index); const char* e = text + length; if (t == e) { return length; } t = (char*)memchr((const void*)t, NEWLINE, e - t); if (t == nil) { return length; } else { return t - text; } } int TextBuffer::EndOfPreviousLine (int index) { const char* t = Text(index-1); while (t > text && *t != NEWLINE) { --t; } return t - text; } bool TextBuffer::IsBeginningOfWord (int index) { const char* t = Text(index); return t <= text || (!isalnum(*(t-1)) && isalnum(*t)); } int TextBuffer::BeginningOfWord (int index) { const char* t = Text(index); while (t > text && !(!isalnum(*(t-1)) && isalnum(*t))) { --t; } return t - text; } int TextBuffer::BeginningOfNextWord (int index) { const char* t = Text(index+1); while (t < text+length && !(!isalnum(*(t-1)) && isalnum(*t))) { ++t; } return t - text; } bool TextBuffer::IsEndOfWord (int index) { const char* t = Text(index); return t >= text+length || (isalnum(*(t-1)) && !isalnum(*t)); } int TextBuffer::EndOfWord (int index) { const char* t = Text(index); while (t < text+length && !(isalnum(*(t-1)) && !isalnum(*t))) { ++t; } return t - text; } int TextBuffer::EndOfPreviousWord (int index) { const char* t = Text(index-1); while (t > text && !(isalnum(*(t-1)) && !isalnum(*t))) { --t; } return t - text; } neuron-7.6.3/src/lib/IV-2_6/textdisplay.cpp000066400000000000000000000631311340731477100203650ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TextDisplay - basic text displaying */ #include #include #include #include #include #include #include #include #include class TextLine { public: TextLine(); ~TextLine(); void Style(TextDisplay*, int line, int first, int last, int style); void AddStyle(TextDisplay*, int line, int first, int last, int style); void RemoveStyle(TextDisplay*, int line, int first, int last, int style); void Insert(TextDisplay*, int line, int index, const char*, int count); void Delete(TextDisplay*, int line, int index, int count); void Replace(TextDisplay*, int line, const char*, int count); void Draw(TextDisplay*, int line, int first, int last); int Index(TextDisplay*, IntCoord x, bool between); IntCoord Offset(TextDisplay*, int index); private: void Size(int); char* text; char* attr; int size; int lastchar; char prefix; char postfix; }; TextDisplay::TextDisplay (bool a) { painter = nil; canvas = nil; autosized = a; xmin = 0; xmax = 0; ymax = 0; ymin = 0; x0 = 0; y0 = 0; width = -1; lineheight = 1; tabwidth = 0; firstline = 0; lastline = 0; topline = 0; bottomline = -1; widestline = 0; lines = nil; maxlines = 0; Size(firstline, lastline); CaretStyle(DefaultCaret); Caret(0, 0); } TextDisplay::~TextDisplay () { for (int i = firstline; i <= lastline; ++i) { delete Line(i, false); } delete [] lines; } void TextDisplay::Scroll (int line, IntCoord x, IntCoord y) { while (y < ymax) { line -= 1; y += lineheight; } while (y > ymax) { line += 1; y -= lineheight; } int xshift = x - Left(line, 0); x0 += xshift; int yshift = y - Top(line); y0 += yshift; topline = line; bottomline = line + (y - ymin + 1) / lineheight - 1; if (Interactor::ValidCanvas(canvas)) { if (yshift > 0) { painter->Copy( canvas, xmin, ymin, xmax, ymax - yshift, canvas, xmin, ymin + yshift ); IntCoord top = Top(topline); if (top < ymax) { Redraw(xmin, top+1, xmax, ymax); } Redraw(xmin, ymin, xmax, ymin+yshift-1); } else if (yshift < 0) { painter->Copy( canvas, xmin, ymin - yshift, xmax, ymax, canvas, xmin, ymin ); IntCoord bottom = Base(bottomline); if (bottom > ymin) { Redraw(xmin, ymin, xmax, bottom-1); } Redraw(xmin, ymax + yshift + 1, xmax, ymax); } if (xshift > 0) { painter->Copy( canvas, xmin, ymin, xmax - xshift, ymax, canvas, xmin + xshift, ymin ); Redraw(xmin, ymin, xmin+xshift-1, ymax); } else if (xshift < 0) { painter->Copy( canvas, xmin - xshift, ymin, xmax, ymax, canvas, xmin, ymin ); Redraw(xmax + xshift + 1, ymin, xmax, ymax); } } } void TextDisplay::Draw (Painter* p, Canvas* c) { painter = p; canvas = c; } void TextDisplay::LineHeight (IntCoord height) { lineheight = height; } void TextDisplay::TabWidth (IntCoord width) { tabwidth = width; } void TextDisplay::Resize (IntCoord xn, IntCoord yn, IntCoord xx, IntCoord yx) { xmin = xn; ymin = yn; xmax = xx; ymax = yx; bottomline = topline + (ymax+y0 - ymin + 1) / lineheight - 1; } void TextDisplay::Bounds (IntCoord& xn, IntCoord& yn, IntCoord& xx, IntCoord& yx) { xn = xmin; yn = ymin; xx = xmax; yx = ymax; } void TextDisplay::Redraw (IntCoord l, IntCoord b, IntCoord r, IntCoord t) { if (Interactor::ValidCanvas(canvas)) { int first = LineNumber(t); int last = LineNumber(b); for (int i = first; i <= last; ++i) { int begin = LineIndex(i, l, false); int end = LineIndex(i, r, false); TextLine* line = Line(i, false); if (line != nil) { line->Draw(this, i, begin, end); } else { IntCoord base = Base(i); IntCoord top = Top(i); painter->ClearRect( canvas, l, Math::max(base, b), r, Math::min(top, t) ); } if (caretline == i && caretindex >= begin && caretindex <= end) { ShowCaret(); } } } } void TextDisplay::Size (int first, int last) { if (last - first >= maxlines) { int newmaxlines = last - first + 10; TextLine** newlines = new TextLine* [newmaxlines]; Memory::zero(newlines, newmaxlines * sizeof(TextLine*)); Memory::copy(lines, newlines, maxlines * sizeof(TextLine*)); delete [] lines; lines = newlines; maxlines = newmaxlines; } if (first < firstline) { int count = firstline-first; Memory::copy( lines, lines+count, (lastline-firstline+1) * sizeof(TextLine*) ); Memory::zero(lines, count * sizeof(TextLine*)); } firstline = first; lastline = last; } TextLine* TextDisplay::Line (int line, bool create) { if (create) { Size(Math::min(firstline, line), Math::max(lastline, line)); } if (line < firstline || line > lastline) { return nil; } else { TextLine* l = lines[Index(line)]; if (l == nil && create) { l = new TextLine(); lines[Index(line)] = l; } return l; } } int TextDisplay::Index (int line) { return line - firstline; } void TextDisplay::InsertLinesAfter (int line, int count) { if (count > 0) { Size(Math::min(firstline, line), Math::max(lastline, line) + count); Memory::copy( lines + Index(line + 1), lines + Index(line + 1 + count), (lastline - line - count) * sizeof(TextLine*) ); Memory::zero(lines + Index(line+1), count * sizeof(TextLine*)); if (canvas != nil) { if (autosized) { ymin = Math::min(ymin, Base(lastline)); bottomline = topline + (ymax+y0 - ymin + 1) / lineheight - 1; } IntCoord y = Base(line) - 1; int shift = count * lineheight; painter->Copy( canvas, xmin, ymin + shift, xmax, y, canvas, xmin, ymin ); IntCoord bottom = Base(bottomline); if (bottom > ymin) { Redraw(xmin, ymin, xmax, bottom-1); } Redraw(xmin, y-shift+1, xmax, y); } } } void TextDisplay::InsertLinesBefore (int line, int count) { if (count > 0) { Size(Math::min(firstline, line) - count, Math::max(lastline, line)); Memory::copy( lines + Index(firstline + count), lines + Index(firstline), (line - firstline - count) * sizeof(TextLine*) ); Memory::zero(lines + Index(line - count), count * sizeof(TextLine*)); if (canvas != nil) { if (autosized) { ymax = Math::max(ymax, Top(firstline)); topline = bottomline - (ymax+y0 - ymin + 1) / lineheight + 1; } IntCoord y = Top(line) + 1; int shift = count * lineheight; painter->Copy( canvas, xmin, y, xmax, ymax-shift, canvas, xmin, y+shift ); IntCoord top = Top(topline); if (top < ymax) { Redraw(xmin, top, xmax, ymax); } Redraw(xmin, y, xmax, y+shift-1); } } } void TextDisplay::DeleteLinesAfter (int line, int count) { count = Math::min(count, lastline - line); if (count > 0) { Size(Math::min(firstline, line), Math::max(lastline, line)); for (int i = 0; i < count; ++i) { delete Line(line+i+1, false); } Memory::copy( lines + Index(line + 1 + count), lines + Index(line + 1), (lastline - line - count) * sizeof(TextLine*) ); Memory::zero( lines + Index(lastline - count + 1), count * sizeof(TextLine*) ); if (canvas != nil) { IntCoord y = Base(line) - 1; int shift = count * lineheight; painter->Copy( canvas, xmin, ymin, xmax, y-shift, canvas, xmin, ymin+shift ); Redraw(xmin, ymin, xmax, ymin+shift-1); } Size(firstline, lastline - count); } } void TextDisplay::DeleteLinesBefore (int line, int count) { count = Math::min(count, line - firstline); if (count > 0) { Size(Math::min(firstline, line), Math::max(lastline, line)); for (int i = 0; i < count; ++i) { delete Line(line-i-1, false); } Memory::copy( lines + Index(firstline), lines + Index(firstline + count), (line - firstline - count) * sizeof(TextLine*) ); Memory::zero(lines + Index(firstline), count * sizeof(TextLine*)); if (canvas != nil) { IntCoord y = Top(line) + 1; int shift = count * lineheight; painter->Copy( canvas, xmin, y+shift, xmax, ymax, canvas, xmin, y ); Redraw(xmin, ymax-shift+1, xmax, ymax); } Size(firstline + count, lastline); } } void TextDisplay::InsertText (int l, int i, const char* t, int c) { TextLine* line = Line(l, true); line->Insert(this, l, i, t, c); if (painter != nil && width != -1) { IntCoord w = line->Offset(this, 10000); if (w > width) { width = w; widestline = l; } } if (autosized) { IntCoord dw = Width() - (xmax - xmin); if (dw > 0) { xmax += dw; Redraw(xmax - dw + 1, ymin, xmax, ymax); } } if (l == caretline) { ShowCaret(); } } void TextDisplay::DeleteText (int l, int i, int c) { TextLine* line = Line(l, true); line->Delete(this, l, i, c); if (painter != nil && width != -1) { if (l == widestline) { IntCoord w = line->Offset(this, 10000); if (w < width) { width = -1; } } } if (l == caretline) { ShowCaret(); } } void TextDisplay::ReplaceText (int l, const char* t, int c) { TextLine* line = Line(l, true); line->Replace(this, l, t, c); if (painter != nil && width != -1) { IntCoord w = line->Offset(this, 10000); if (w > width) { width = w; widestline = l; } else if (l == widestline && w < width) { width = -1; } } if (autosized) { IntCoord dw = Width() - (xmax - xmin); if (dw > 0) { xmax += dw; Redraw(xmax - dw + 1, ymin, xmax, ymax); } } if (l == caretline) { ShowCaret(); } } void TextDisplay::Style (int l1, int i1, int l2, int i2, int style) { for (int l = l1; l <= l2; ++l) { int first = (l == l1) ? i1 : -10000; int last = (l == l2) ? i2 : 10000; Line(l, true)->Style(this, l, first, last, style); } if (l1 <= caretline && l2 >= caretline) { ShowCaret(); } } void TextDisplay::AddStyle (int l1, int i1, int l2, int i2, int style) { for (int l = l1; l <= l2; ++l) { int first = (l == l1) ? i1 : -10000; int last = (l == l2) ? i2 : 10000; Line(l, true)->AddStyle(this, l, first, last, style); } if (l1 <= caretline && l2 >= caretline) { ShowCaret(); } } void TextDisplay::RemoveStyle (int l1, int i1, int l2, int i2, int style) { for (int l = l1; l <= l2; ++l) { int first = (l == l1) ? i1 : -10000; int last = (l == l2) ? i2 : 10000; Line(l, true)->RemoveStyle(this, l, first, last, style); } if (l1 <= caretline && l2 >= caretline) { ShowCaret(); } } void TextDisplay::CaretStyle (int style) { HideCaret(); caretstyle = style; ShowCaret(); } void TextDisplay::Caret (int line, int index) { HideCaret(); caretline = line; caretindex = index; ShowCaret(); } void TextDisplay::HideCaret () { if (Interactor::ValidCanvas(canvas) && caretline >= topline && caretline <= bottomline ) { TextLine* l = Line(caretline, true); l->Draw(this, caretline, caretindex-1, caretindex); } } void TextDisplay::ShowCaret () { if (Interactor::ValidCanvas(canvas) && caretline >= topline && caretline <= bottomline ) { IntCoord l = Left(caretline, caretindex); IntCoord r = Right(caretline, caretindex); IntCoord b = Base(caretline); IntCoord t = Top(caretline); if (l >= xmin && r <= xmax) { switch (caretstyle) { case NoCaret: break; case DefaultCaret: case BarCaret: painter->FillRect(canvas, l, b, l, t); break; case UnderscoreCaret: painter->FillRect(canvas, l, b, r, b+1); break; case OutlineCaret: painter->Rect(canvas, l, b, r, t); break; } } } } IntCoord TextDisplay::Width () { if (width < 0) { if (painter != nil) { width = 0; for (int i = firstline; i <= lastline; ++i) { TextLine* line = Line(i, false); if (line != nil) { width = Math::max(width, line->Offset(this, 10000)); } } } } return width; } IntCoord TextDisplay::Height () { return (lastline-firstline + 1) * lineheight; } int TextDisplay::LineNumber (IntCoord y) { IntCoord dy = ymax + y0 - y; if (dy >= 0) { return dy / lineheight; } else { return - ((-1 - dy) / lineheight + 1); } } int TextDisplay::LineIndex (int line, IntCoord x, bool between) { TextLine* l = Line(line, false); if (l == nil) { return 0; } else { return l->Index(this, x - (xmin + x0), between); } } IntCoord TextDisplay::Base (int line) { return ymax + y0 - line * lineheight - (lineheight - 1); } IntCoord TextDisplay::Top (int line) { return ymax + y0 - line * lineheight; } IntCoord TextDisplay::Left (int line, int index) { TextLine* l = Line(line, false); if (l == nil) { return xmin + x0; } else { return xmin + x0 + l->Offset(this, index); } } IntCoord TextDisplay::Right (int line, int index) { TextLine* l = Line(line, false); if (l == nil) { return xmin + x0; } else { return xmin + x0 + l->Offset(this, index+1) - 1; } } TextLine::TextLine () { size = 0; text = nil; attr = nil; prefix = 0; postfix = 0; lastchar = -1; Size(0); } TextLine::~TextLine () { delete [] text; delete [] attr; } IntCoord TextLine::Offset (TextDisplay* display, int index) { if (display->painter != nil) { const Font* f = display->painter->GetFont(); index = Math::max(0, Math::min(index, lastchar + 1)); int w = 0; int i = 0; int cw; while (i < index) { if (text[i] == '\t') { if (display->tabwidth > 0) { cw = display->tabwidth - w % display->tabwidth; } else { cw = 0; } } else { cw = f->Width(text+i, 1); } w += cw; ++i; } return w; } else { return 0; } } int TextLine::Index (TextDisplay* display, IntCoord x, bool between) { if (x < 0) { if (!between) { return -1; } else { return 0; } } else if (display->painter != nil) { const Font* f = display->painter->GetFont(); int i = 0; int w = 0; int cw = 0; while (i <= lastchar) { if (text[i] == '\t') { if (display->tabwidth > 0) { cw = display->tabwidth - w % display->tabwidth; } else { cw = 0; } } else { cw = f->Width(text+i, 1); } w += cw; if (w > x) { break; } ++i; } if ((between && i <= lastchar && x > w - cw/2) || (!between && x > w)) { return i+1; } else { return i; } } else { return 0; } } void TextLine::Size (int last) { if (last >= size) { int newsize = last<28 ? 28 : last<124 ? 124 : last<1020 ? 1020 : last; char* newtext = new char[newsize]; Memory::zero(newtext, newsize); Memory::copy(text, newtext, size); delete [] text; text = newtext; char* newattr = new char[newsize]; Memory::zero(newattr, newsize); Memory::copy(attr, newattr, size); delete [] attr; attr = newattr; size = newsize; } } void TextLine::Style ( TextDisplay* display, int line, int first, int last, int style ) { if (first < 0) { prefix = style; } if (last > lastchar) { postfix = style; } int f = Math::max(first, 0); int l = Math::min(last, lastchar); for (int i = f; i <= l; ++i) { attr[i] = style; } Draw(display, line, first, last); } void TextLine::AddStyle ( TextDisplay* display, int line, int first, int last, int style ) { if (first < 0) { prefix = prefix | style; } if (last > lastchar) { postfix = postfix | style; } int f = Math::max(first, 0); int l = Math::min(last, lastchar); for (int i = f; i <= l; ++i) { attr[i] = attr[i] | style; } Draw(display, line, first, last); } void TextLine::RemoveStyle ( TextDisplay* display, int line, int first, int last, int st ) { if (first < 0) { prefix = prefix & ~st; } if (last > lastchar) { postfix = postfix & ~st; } int f = Math::max(first, 0); int l = Math::min(last, lastchar); for (int i = f; i <= l; ++i) { attr[i] = attr[i] & ~st; } Draw(display, line, first, last); } void TextLine::Insert ( TextDisplay* display, int line, int index, const char* s, int count ) { IntCoord left, right; int shift; index = Math::max(0, index); Size(Math::max(index, size) + count); int src = index; int dst = index + count; int len = Math::max(0, lastchar - index + 1); lastchar += count; if (display->canvas != nil) { left = display->Left(line, index); right = display->Right(line, lastchar+1); } Memory::copy(text + src, text + dst, len); Memory::copy(attr + src, attr + dst, len); Memory::copy(s, text + src, count); Memory::zero(attr + src, count); if (display->canvas != nil) { const Font* f = display->painter->GetFont(); if (strchr(text+index, '\t') != nil) { Draw(display, line, index, lastchar+1); } else { shift = display->Left(line, index+count) - left; right = Math::min(right, display->xmax - shift); if (left <= right) { IntCoord bottom = display->Base(line); IntCoord top = bottom + f->Height() - 1; display->painter->Copy( display->canvas, left, bottom, right, top, display->canvas, left+shift, bottom ); } Draw(display, line, index, index+count-1); } } } void TextLine::Delete ( TextDisplay* display, int line, int index, int count ) { IntCoord left, right; int shift; Size(Math::max(lastchar, index)); count = Math::max(0, Math::min(count, lastchar-index+1)); int src = index + count; int dst = index; int len = lastchar - (index + count) + 1; if (display->canvas != nil) { left = display->Left(line, index + count); right = Math::min(display->Right(line, lastchar + 1), display->xmax); } Memory::copy(text + src, text + dst, len); Memory::copy(attr + src, attr + dst, len); Memory::zero(text + lastchar + 1 - count, count); Memory::zero(attr + lastchar + 1 - count, count); lastchar -= count; if (display->canvas != nil) { if (strchr(text+index, '\t') != nil) { Draw(display, line, index, lastchar+1); } else { shift = left - display->Left(line, index); IntCoord bottom = display->Base(line); IntCoord top = display->Top(line); if (left <= right) { display->painter->Copy( display->canvas, left, bottom, right, top, display->canvas, left-shift, bottom ); } if (shift > 0) { int last = display->LineIndex(line, right-shift+1, false); Draw(display, line, last, lastchar + 1); } } } } void TextLine::Replace ( TextDisplay* display, int line, const char* t, int c ) { delete [] text; text = nil; delete [] attr; attr = nil; size = 0; Size(c); prefix = 0; postfix = 0; lastchar = c - 1; Memory::copy(t, text, c); Memory::zero(attr, c); Draw(display, line, -1, lastchar+1); } void TextLine::Draw ( TextDisplay* display, int line, int first, int last ) { if (display->canvas != nil) { const Font* f = display->painter->GetFont(); IntCoord bottom = display->Base(line); IntCoord top = bottom + f->Height() - 1; if (line < display->topline || line > display->bottomline) { if (top >= display->ymin && bottom <= display->ymax) { display->painter->ClearRect( display->canvas, display->xmin, Math::max(display->ymin, bottom), display->xmax, Math::min(display->ymax, top) ); } } else { int start = Math::max( display->LineIndex(line, display->xmin-1, false) + 1, Math::max(0, first) ); int finish = Math::min( display->LineIndex(line, display->xmax+1, false) - 1, Math::min(lastchar, last) ); IntCoord left = display->Left(line, start); IntCoord right = display->Right(line, finish); if (start > first && left > display->xmin) { if ((start>0 ? attr[start-1] : prefix) & Reversed) { display->painter->FillRect( display->canvas, display->xmin, bottom, left-1, top ); } else { display->painter->ClearRect( display->canvas, display->xmin, bottom, left-1, top ); } } int done = start; display->painter->MoveTo(left, bottom); for (int i = start; i <= finish+1; ++i) { if (i==finish+1 || attr[i]!=attr[done] || text[i]=='\t') { if (done != i && text[done] == '\t') { IntCoord l, r, y; display->painter->GetPosition(l, y); r = display->Right(line, done); if (attr[done] & Reversed) { display->painter->FillRect( display->canvas, l, bottom, r, top ); } else { display->painter->ClearRect( display->canvas, l, bottom, r, top ); } display->painter->MoveTo(r+1, bottom); ++done; } if (done != i) { display->painter->SetStyle(attr[done]); display->painter->Text( display->canvas, text + done, i - done ); done = i; } } } display->painter->SetStyle(Plain); if (finish < last && right < display->xmax) { if ((finishpainter->FillRect( display->canvas, right+1, bottom, display->xmax, top ); } else { display->painter->ClearRect( display->canvas, right+1, bottom, display->xmax, top ); } } } } } neuron-7.6.3/src/lib/IV-2_6/texteditor.cpp000066400000000000000000000413111340731477100202020ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TextEditor - basic interactive editor for mulit-line text */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //#include #include /*****************************************************************************/ static void ScrollAlign (Alignment a, IntCoord& w, IntCoord& h) { switch (a) { case TopLeft: case CenterLeft: case BottomLeft: case Left: case Top: case Bottom: case VertCenter: w = 0; break; case TopCenter: case Center: case BottomCenter: case HorizCenter: w = w/2; break; } switch (a) { case CenterLeft: case Center: case CenterRight: case Left: case Right: case HorizCenter: case VertCenter: h = h/2; break; case BottomLeft: case BottomCenter: case BottomRight: case Bottom: h = 0; break; } } /*****************************************************************************/ TextEditor::TextEditor (int r, int c, int t, int h) { Init(r, c, t, h); } TextEditor::TextEditor (const char* name, int r, int c, int t, int h) { SetInstance(name); Init(r, c, t, h); } void TextEditor::Init (int r, int c, int t, int h) { SetClassName("TextEditor"); text = nil; dot = 0; mark = 0; shaperows = r; shapecolumns = c; scrollalign = Center; lineheight = 1; tabsize = t; highlight = h; display = nil; perspective = new Perspective(); } TextEditor::~TextEditor () { delete display; Unref(perspective); } static Cursor* handCursor; static Cursor* upCursor; static Cursor* dnCursor; void TextEditor::Reconfig () { if (handCursor == nil) { handCursor = new Cursor( new Bitmap( hand_bits, hand_width, hand_height, hand_x_hot, hand_y_hot ), new Bitmap(hand_mask_bits, hand_mask_width, hand_mask_height), output->GetFgColor(), output->GetBgColor() ); upCursor = new Cursor( new Bitmap( ufast_bits, ufast_width, ufast_height, ufast_x_hot, ufast_y_hot ), new Bitmap(ufast_mask_bits, ufast_mask_width, ufast_mask_height), output->GetFgColor(), output->GetBgColor() ); dnCursor = new Cursor( new Bitmap( dfast_bits, dfast_width, dfast_height, dfast_x_hot, dfast_y_hot ), new Bitmap(dfast_mask_bits, dfast_mask_width, dfast_mask_height), output->GetFgColor(), output->GetBgColor() ); } const Font* f = output->GetFont(); shape->hunits = f->Width("n"); shape->vunits = f->Height(); shape->Rect(shape->hunits*shapecolumns, shape->vunits*shaperows); shape->Rigid(hfil, hfil, vfil, vfil); lineheight = shape->vunits; display->LineHeight(lineheight); display->TabWidth(tabsize * shape->hunits); } void TextEditor::Resize () { if (canvas != nil) { display->Draw(output, canvas); display->Resize(0, 0, xmax, ymax); int topmargin = ( perspective->height - perspective->curheight - perspective->cury ); IntCoord height = ymax + 1; IntCoord width = xmax + 1; perspective->sy = shape->vunits; perspective->ly = height - shape->vunits; perspective->sx = shape->hunits; perspective->lx = width - shape->hunits; perspective->height = display->Height(); perspective->width = display->Width(); perspective->cury = perspective->height - topmargin - height; perspective->curheight = height; perspective->curwidth = width; perspective->Update(); } } void TextEditor::Redraw (IntCoord l, IntCoord b, IntCoord r, IntCoord t) { if (canvas != nil) { display->Draw(output, canvas); display->Redraw(l, b, r, t); } } void TextEditor::Adjust (Perspective& np) { float scale = float(perspective->height) / float(np.height); ScrollTo( perspective->x0 + int((np.curx - np.x0)*scale), perspective->y0 + int((np.cury - np.y0)*scale) ); np = *perspective; } void TextEditor::Edit (TextBuffer* t, int index) { delete display; display = new TextDisplay(); display->Draw(output, canvas); display->LineHeight(lineheight); display->TabWidth(tabsize * shape->hunits); text = t; int lines = text->Height(); for (int i = 0; i < lines; ++i) { int bol = text->LineIndex(i); int eol = text->EndOfLine(bol); display->ReplaceText(i, text->Text(bol, eol), eol - bol); } perspective->height = display->Height(); perspective->width = display->Width(); perspective->curheight = ymax + 1; perspective->curwidth = xmax + 1; perspective->cury = perspective->height - perspective->curheight; perspective->curx = 0; perspective->Update(); Canvas* c = canvas; canvas = nil; display->Resize(0, 0, xmax, ymax); Select(index); ScrollToSelection(true); canvas = c; display->Draw(output, canvas); display->Redraw(0, 0, xmax, ymax); } void TextEditor::InsertText (const char* s, int count) { count = text->Insert(dot, s, count); int sline = text->LineNumber(dot); int fline = text->LineNumber(dot + count); display->Draw(output, canvas); if (sline == fline) { int offset = text->LineOffset(dot); display->InsertText(sline, offset, text->Text(dot), count); } else { display->InsertLinesAfter(sline, fline-sline); for (int i = sline; i <= fline; ++i) { int bol = text->BeginningOfLine(text->LineIndex(i)); int eol = text->EndOfLine(bol); display->ReplaceText(i, text->Text(bol, eol), eol-bol); } } if (canvas != nil) { int width = display->Width(); int height = display->Height(); if (width != perspective->width || height != perspective->height) { perspective->cury += height - perspective->height; perspective->height = height; perspective->width = width; perspective->Update(); } } Select(dot + count); } void TextEditor::DeleteText (int count) { int start = dot; int finish = dot; int c = count; while (c > 0) { finish = text->NextCharacter(finish); --c; } while (c < 0) { start = text->PreviousCharacter(start); ++c; } count = finish - start; int sline = text->LineNumber(start); int fline = text->LineNumber(finish); text->Delete(start, count); display->Draw(output, canvas); if (sline == fline) { int offset = text->LineOffset(start); display->DeleteText(sline, offset, count); } else { int bol = text->BeginningOfLine(start); int eol = text->EndOfLine(start); display->DeleteLinesAfter(sline, fline-sline); display->ReplaceText(sline, text->Text(bol, eol), eol-bol); } if (canvas != nil) { int width = display->Width(); int height = display->Height(); if (width != perspective->width || height != perspective->height) { perspective->cury += height - perspective->height; perspective->height = height; perspective->width = width; perspective->Update(); } } Select(start); } void TextEditor::DeleteSelection () { if (mark != dot) { DeleteText(mark - dot); } } void TextEditor::BeginningOfSelection () { Select(Math::min(mark, dot)); } void TextEditor::EndOfSelection () { Select(Math::max(mark, dot)); } void TextEditor::BeginningOfWord () { if (dot != mark) { Select(Math::min(mark, dot)); } else { Select(text->BeginningOfWord(dot)); } } void TextEditor::EndOfWord () { if (dot != mark) { Select(Math::max(mark, dot)); } else { Select(text->EndOfWord(dot)); } } void TextEditor::BeginningOfLine () { if (dot != mark) { Select(Math::min(mark, dot)); } else { Select(text->BeginningOfLine(dot)); } } void TextEditor::EndOfLine () { if (dot != mark) { Select(Math::max(mark, dot)); } else { Select(text->EndOfLine(dot)); } } void TextEditor::BeginningOfText() { Select(text->BeginningOfText()); } void TextEditor::EndOfText() { Select(text->EndOfText()); } void TextEditor::ForwardCharacter (int count) { if (mark != dot) { Select(Math::max(mark, dot)); } else { int d = dot; while (count > 0) { d = text->NextCharacter(d); --count; } Select(d); } } void TextEditor::BackwardCharacter (int count) { if (dot != mark) { Select(Math::min(mark, dot)); } else { int d = dot; while (count > 0) { d = text->PreviousCharacter(d); --count; } Select(d); } } void TextEditor::ForwardLine (int count) { if (dot != mark) { Select(Math::max(mark, dot)); } else { int d = dot; while (count > 0) { d = text->BeginningOfNextLine(d); --count; } Select(d); } } void TextEditor::BackwardLine (int count) { if (dot != mark) { Select(Math::min(mark, dot)); } else { int d = dot; while (count > 0) { d = text->BeginningOfLine(text->EndOfPreviousLine(d)); --count; } Select(d); } } void TextEditor::ForwardWord (int count) { if (dot != mark) { Select(Math::max(mark, dot)); } else { int d = dot; while (count > 0) { d = text->BeginningOfNextWord(d); --count; } Select(d); } } void TextEditor::BackwardWord (int count) { if (dot != mark) { Select(Math::min(mark, dot)); } else { int d = dot; while (count > 0) { d = text->BeginningOfWord(text->EndOfPreviousWord(d)); --count; } Select(d); } } void TextEditor::ForwardPage (int count) { int pagesize = perspective->curheight / perspective->sy; ForwardLine(pagesize * count); } void TextEditor::BackwardPage (int count) { int pagesize = perspective->curheight / perspective->sy; BackwardLine(pagesize * count); } void TextEditor::ScrollToSelection (bool always) { display->Draw(output, canvas); int line = text->LineNumber(dot); int offset = text->LineOffset(dot); IntCoord l = display->Left(line, offset); IntCoord r = display->Right(line, offset); IntCoord b = display->Base(line); IntCoord t = display->Top(line); IntCoord tx = xmax - (r - l); IntCoord ty = ymax - (t - b); ScrollAlign(scrollalign, tx, ty); IntCoord dx = (always || l < 0 || r > xmax) ? l - tx : 0; IntCoord dy = (always || b < 0 || t > ymax) ? b - ty : 0; if (dx != 0 || dy != 0) { ScrollTo(perspective->curx + dx, perspective->cury + dy); } } void TextEditor::ScrollToView (IntCoord x, IntCoord y) { IntCoord dx = x < 0 ? x : x > xmax ? x - xmax : 0; IntCoord dy = y < 0 ? y : y > ymax ? y - ymax : 0; if (dx != 0 || dy != 0) { ScrollTo(perspective->curx + dx, perspective->cury + dy); } } void TextEditor::ScrollBy (int dx, int dy) { if (dx != 0 || dy != 0) { ScrollTo(perspective->curx + dx, perspective->cury + dy); } } void TextEditor::ScrollTo (int x, int y) { int maxy = perspective->height - perspective->curheight; int miny = Math::min(maxy, -perspective->curheight/2); perspective->cury = Math::max(miny, Math::min(y, maxy)); int minx = 0; int maxx = Math::max(minx, perspective->width - perspective->curwidth/2); perspective->curx = Math::max(minx, Math::min(x, maxx)); perspective->Update(); display->Scroll(0, - perspective->curx, ymax + perspective->height - (perspective->cury+perspective->curheight) ); } void TextEditor::Select (int d) { Select(d, d); } void TextEditor::SelectMore (int m) { Select(dot, m); } void TextEditor::SelectAll () { Select(text->EndOfText(), text->BeginningOfText()); } void TextEditor::Select (int d, int m) { int oldl = Math::min(dot, mark); int oldr = Math::max(dot, mark); int newl = Math::min(d, m); int newr = Math::max(d, m); display->Draw(output, canvas); if (oldl == oldr && newl != newr) { display->CaretStyle(NoCaret); } if (newr < oldl || newl > oldr) { if (oldr > oldl) { display->RemoveStyle( text->LineNumber(oldl), text->LineOffset(oldl), text->LineNumber(oldr-1), text->LineOffset(oldr-1), highlight ); } if (newr > newl) { display->AddStyle( text->LineNumber(newl), text->LineOffset(newl), text->LineNumber(newr-1), text->LineOffset(newr-1), highlight ); } } else { if (newl < oldl) { display->AddStyle( text->LineNumber(newl), text->LineOffset(newl), text->LineNumber(oldl-1), text->LineOffset(oldl-1), highlight ); } else if (newl > oldl) { display->RemoveStyle( text->LineNumber(oldl), text->LineOffset(oldl), text->LineNumber(newl-1), text->LineOffset(newl-1), highlight ); } if (newr > oldr) { display->AddStyle( text->LineNumber(oldr), text->LineOffset(oldr), text->LineNumber(newr-1), text->LineOffset(newr-1), highlight ); } else if (newr < oldr) { display->RemoveStyle( text->LineNumber(newr), text->LineOffset(newr), text->LineNumber(oldr-1), text->LineOffset(oldr-1), highlight ); } } if (oldl != oldr && newl == newr) { display->CaretStyle(BarCaret); } if (newl == newr) { display->Caret(text->LineNumber(newl), text->LineOffset(newl)); } dot = d; mark = m; } int TextEditor::Locate (IntCoord x, IntCoord y) { display->Draw(output, canvas); int line = display->LineNumber(y); int index = display->LineIndex(line, x); int l = text->LineIndex(line); int i = 0; while (i < index) { l = text->NextCharacter(l); i += 1; } return l; } void TextEditor::GrabScroll (Event& e) { e.target->GetRelative(e.x, e.y, this); int y = e.y; int x = e.x; Cursor* origCursor = GetCursor(); SetCursor(handCursor); do { ScrollBy(0, y - e.y); y = e.y; x = e.x; Poll(e); } while (e.middlemouse); SetCursor(origCursor); } void TextEditor::RateScroll (Event& e) { Cursor* origCursor = GetCursor(); e.target->GetRelative(e.x, e.y, this); int y = e.y; int x = e.x; do { ScrollBy(0, e.y - y); if (e.y - y < 0) { SetCursor(dnCursor); } else { SetCursor(upCursor); } Poll(e); } while (e.rightmouse); SetCursor(origCursor); } neuron-7.6.3/src/lib/IV-2_6/tform2_6.cpp000077500000000000000000000146531340731477100174610ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Implementation of transformation matrix operations. */ #include #include #include Transformer::Transformer(const Transformer* t) { if (t == nil) { identity_ = true; mat00 = mat11 = 1; mat01 = mat10 = mat20 = mat21 = 0; } else { mat00 = t->mat00; mat01 = t->mat01; mat10 = t->mat10; mat11 = t->mat11; mat20 = t->mat20; mat21 = t->mat21; update(); } ref(); } void Transformer::Transform(IntCoord& x, IntCoord& y) const { IntCoord tx = x; x = Math::round(tx*mat00 + y*mat10 + mat20); y = Math::round(tx*mat01 + y*mat11 + mat21); } void Transformer::InvTransform(IntCoord& tx, IntCoord& ty) const { float d = det(); float a = (float(tx) - mat20) / d; float b = (float(ty) - mat21) / d; tx = Math::round(a*mat11 - b*mat10); ty = Math::round(b*mat00 - a*mat01); } void Transformer::InvTransform( IntCoord tx, IntCoord ty, IntCoord& x, IntCoord& y ) const { float d = det(); float a = (float(tx) - mat20) / d; float b = (float(ty) - mat21) / d; x = Math::round(a*mat11 - b*mat10); y = Math::round(b*mat00 - a*mat01); } void Transformer::InvTransform(float tx, float ty, float& x, float& y) const { float d = det(); float a = (tx - mat20) / d; float b = (ty - mat21) / d; x = a*mat11 - b*mat10; y = b*mat00 - a*mat01; } void Transformer::TransformList(IntCoord x[], IntCoord y[], int n) const { register IntCoord* ox, * oy; IntCoord* lim; lim = &x[n]; for (ox = x, oy = y; ox < lim; ox++, oy++) { Transform(*ox, *oy); } } void Transformer::TransformList( IntCoord x[], IntCoord y[], int n, IntCoord tx[], IntCoord ty[] ) const { register IntCoord* ox, * oy, * nx, * ny; IntCoord* lim; lim = &x[n]; for (ox = x, oy = y, nx = tx, ny = ty; ox < lim; ox++, oy++, nx++, ny++) { Transform(*ox, *oy, *nx, *ny); } } void Transformer::InvTransformList(IntCoord tx[], IntCoord ty[], int n) const { register IntCoord* ox, * oy; IntCoord* lim; float a, b, d = det(); lim = &tx[n]; for (ox = tx, oy = ty; ox < lim; ox++, oy++) { a = (float(*ox) - mat20) / d; b = (float(*oy) - mat21) / d; *ox = Math::round(a*mat11 - b*mat10); *oy = Math::round(b*mat00 - a*mat01); } } void Transformer::InvTransformList( IntCoord tx[], IntCoord ty[], int n, IntCoord x[], IntCoord y[] ) const { register IntCoord* ox, * oy, * nx, * ny; IntCoord* lim; float a, b, d = det(); lim = &tx[n]; for (ox = tx, oy = ty, nx = x, ny = y; ox < lim; ox++, oy++, nx++, ny++) { a = (float(*ox) - mat20) / d; b = (float(*oy) - mat21) / d; *nx = Math::round(a*mat11 - b*mat10); *ny = Math::round(b*mat00 - a*mat01); } } void Transformer::TransformRect( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ) const { float tx00, ty00, tx10, ty10, tx11, ty11, tx01, ty01; Transform(float(x0), float(y0), tx00, ty00); Transform(float(x1), float(y0), tx10, ty10); Transform(float(x1), float(y1), tx11, ty11); Transform(float(x0), float(y1), tx01, ty01); x0 = Math::round(Math::min(tx00, tx01, tx10, tx11)); y0 = Math::round(Math::min(ty00, ty01, ty10, ty11)); x1 = Math::round(Math::max(tx00, tx01, tx10, tx11)); y1 = Math::round(Math::max(ty00, ty01, ty10, ty11)); } void Transformer::TransformRect( float& x0, float& y0, float& x1, float& y1 ) const { float tx00, ty00, tx10, ty10, tx11, ty11, tx01, ty01; Transform(x0, y0, tx00, ty00); Transform(x1, y0, tx10, ty10); Transform(x1, y1, tx11, ty11); Transform(x0, y1, tx01, ty01); x0 = Math::min(tx00, tx01, tx10, tx11); y0 = Math::min(ty00, ty01, ty10, ty11); x1 = Math::max(tx00, tx01, tx10, tx11); y1 = Math::max(ty00, ty01, ty10, ty11); } void Transformer::InvTransformRect( IntCoord& x0, IntCoord& y0, IntCoord& x1, IntCoord& y1 ) const { float tx00, ty00, tx10, ty10, tx11, ty11, tx01, ty01; InvTransform(float(x0), float(y0), tx00, ty00); InvTransform(float(x1), float(y0), tx10, ty10); InvTransform(float(x1), float(y1), tx11, ty11); InvTransform(float(x0), float(y1), tx01, ty01); x0 = Math::round(Math::min(tx00, tx01, tx10, tx11)); y0 = Math::round(Math::min(ty00, ty01, ty10, ty11)); x1 = Math::round(Math::max(tx00, tx01, tx10, tx11)); y1 = Math::round(Math::max(ty00, ty01, ty10, ty11)); } void Transformer::InvTransformRect( float& x0, float& y0, float& x1, float& y1 ) const { float tx00, ty00, tx10, ty10, tx11, ty11, tx01, ty01; InvTransform(x0, y0, tx00, ty00); InvTransform(x1, y0, tx10, ty10); InvTransform(x1, y1, tx11, ty11); InvTransform(x0, y1, tx01, ty01); x0 = Math::min(tx00, tx01, tx10, tx11); y0 = Math::min(ty00, ty01, ty10, ty11); x1 = Math::max(tx00, tx01, tx10, tx11); y1 = Math::max(ty00, ty01, ty10, ty11); } void Transformer::Transform( IntCoord x, IntCoord y, IntCoord& tx, IntCoord& ty ) const { tx = Math::round(x*mat00 + y*mat10 + mat20); ty = Math::round(x*mat01 + y*mat11 + mat21); } void Transformer::Transform(float x, float y, float& tx, float& ty) const { tx = x*mat00 + y*mat10 + mat20; ty = x*mat01 + y*mat11 + mat21; } neuron-7.6.3/src/lib/IV-2_6/tray.cpp000066400000000000000000001450631340731477100167770ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Tray implementation. */ #include #include #include #include #include #include inline float abs (float f) { return (f < 0) ? -f : f; } /*************************************************************************/ class TElement { public: TElement(Interactor*); TElement(TGlue*); TElement(); ~TElement(); float pos, sigma; /* ultimate values */ float nat, stretch, shrink; bool combinable; /* false for tray elements when calcing */ /* shape of tray having no background */ bool leftBotHalf; /* true if represents left/bottom of a */ /* pair of elems modelling an interactor */ Interactor* owner; TGlue* tglue; void HSetShape(); void VSetShape(); TElement* Series(TElement*); /* series combination */ TElement* Parallel(TElement*); /* parallel combination */ void Reverse(); void Limit(); }; TElement::TElement(Interactor* i) { owner = i; tglue = nil; pos = 0; sigma = 0; nat = 0.0; stretch = 0.0; shrink = 0.0; combinable = false; leftBotHalf = false; } TElement::TElement(TGlue* tg) { owner = nil; tglue = tg; Resource::ref(tglue); pos = 0; sigma = 0; nat = 0.0; stretch = 0.0; shrink = 0.0; combinable = false; leftBotHalf = false; } TElement::TElement() { owner = nil; tglue = nil; pos = 0; sigma = 0; nat = 0.0; stretch = 0.0; shrink = 0.0; combinable = false; leftBotHalf = false; } TElement::~TElement() { Resource::unref(tglue); } void TElement::HSetShape() { Shape* s; if (tglue == nil) { s = owner->GetShape(); nat = float(s->width)/2; stretch = float(s->hstretch)/2; shrink = float(s->hshrink)/2; } else { s = tglue->GetShape(); nat = s->width; stretch = s->hstretch; shrink = s->hshrink; } } void TElement::VSetShape() { Shape* s; if (tglue == nil) { s = owner->GetShape(); nat = float(s->height)/2; stretch = float(s->vstretch)/2; shrink = float(s->vshrink)/2; } else { s = tglue->GetShape(); nat = s->height; stretch = s->vstretch; shrink = s->vshrink; } } TElement* TElement::Series(TElement* e) { TElement* combo = new TElement; register TElement* c; combo->combinable = combinable || e->combinable; if (combinable && e->combinable) { combo->nat = nat + e->nat; combo->stretch = stretch + e->stretch; combo->shrink = shrink + e->shrink; } else if (combo->combinable) { c = combinable ? this : e; combo->nat = c->nat; combo->stretch = c->stretch; combo->shrink = c->shrink; } return combo; } TElement* TElement::Parallel(TElement* e) { TElement* combo = new TElement; register TElement* c; float emin, emax; emin = Math::max(nat - shrink, e->nat - e->shrink); emax = Math::min(nat + stretch, e->nat + e->stretch); combo->combinable = combinable || e->combinable; if (combinable && e->combinable) { combo->nat = Math::max(nat, e->nat); combo->stretch = Math::max(0, int(emax - combo->nat)); combo->shrink = Math::max(0, int(combo->nat - emin)); } else if (combo->combinable) { c = combinable ? this : e; combo->nat = c->nat; combo->stretch = c->stretch; combo->shrink = c->shrink; } return combo; } void TElement::Reverse() { float tmp; nat = -nat; tmp = stretch; stretch = shrink; shrink = tmp; sigma = -sigma; pos -= nat + sigma + 1; } void TElement::Limit() { sigma = Math::min(Math::max(-shrink, sigma), stretch); } /*************************************************************************/ class TList { public: ~TList(); protected: TList(void* = nil); void Append(TList*); void Prepend(TList*); void Remove(TList*); TList* First(); TList* Last(); TList* End(); TList* Next(); TList* Prev(); bool Empty(); void SetContents(void*); void* GetContents(); void Delete(void*); TList* Find(void*); private: void* object; TList* next; TList* prev; }; inline TList::TList(void* o) { next = this; prev = this; object = o; } inline TList* TList::First() { return next; } inline TList* TList::Last() { return prev; } inline TList* TList::End() { return this; } inline TList* TList::Next() { return next; } inline TList* TList::Prev() { return prev; } inline bool TList::Empty() { return next == this; } inline void TList::SetContents(void *o) { object = o; } inline void* TList::GetContents() { return object; } inline void TList::Append(TList* e) { prev->next = e; e->prev = prev; e->next = this; prev = e; } inline void TList::Prepend(TList* e) { next->prev = e; e->prev = this; e->next = next; next = e; } inline void TList::Remove(TList* e) { e->prev->next = e->next; e->next->prev = e->prev; e->next = e->prev = e; } TList::~TList() { TList* e; if (!Empty()) { e = First(); Remove(this); delete e; } } void TList::Delete(void* o) { register TList* e; e = Find(o); if (e != nil) { Remove(e); delete e; } } TList* TList::Find(void* o) { register TList* e; for (e = next; e != this; e = e->next) { if (e->GetContents() == o) { return e; } } return nil; } /*************************************************************************/ class TElementList : public TList { public: TElementList(TElement* = nil); TElementList* Copy(); bool Includes(TElement*); bool Includes(Interactor*, TElement*&); void Append(TElementList*); void Remove(TElementList*); TElementList* First(); TElementList* End(); TElementList* Next(); void Delete(TElement*); bool Empty(); bool OnlyOne(); bool OnlyTwo(); TElement* GetElem(); }; inline TElement* TElementList::GetElem() { return (TElement*) GetContents();} inline void TElementList::Append(TElementList* el) { TList::Append(el); } inline void TElementList::Remove(TElementList* el) { TList::Remove(el); } inline void TElementList::Delete(TElement* o) { TList::Delete(o); } inline bool TElementList::Includes(TElement* e) { return Find(e) != nil; } inline TElementList* TElementList::First() { return (TElementList*) TList::First(); } inline TElementList* TElementList::End() { return (TElementList*) TList::End(); } inline TElementList* TElementList::Next() { return (TElementList*) TList::Next(); } inline bool TElementList::Empty() { return TList::Empty(); } inline bool TElementList::OnlyOne() { return !Empty() && First()==Last(); } inline bool TElementList::OnlyTwo() { return !Empty() && !OnlyOne() && First()->Next() == Last(); } TElementList::TElementList(TElement* o) : TList(o) { } TElementList* TElementList::Copy() { register TElementList* t; TElementList* newlist = new TElementList; for (t = First(); t != End(); t = t->Next()) { newlist->Append(new TElementList(t->GetElem())); } return newlist; } bool TElementList::Includes(Interactor* i, TElement*& e) { register TElementList* t; for (t = First(); t != End(); t = t->Next()) { e = t->GetElem(); if (e->owner == i) { return true; } } return false; } /*************************************************************************/ class TTermination { public: Alignment alignment, toAttached; TElement* dangling, *attached; TTermination(Alignment, TElement*, Alignment, TElement*); }; TTermination::TTermination( Alignment a, TElement* d, Alignment to, TElement* e ) { alignment = a; dangling = d; toAttached = to; attached = e; } /*************************************************************************/ class TLoop { public: Alignment toAttached; TElement* looped, *attached; TLoop(TElement*, Alignment, TElement*); }; TLoop::TLoop(TElement* l, Alignment to, TElement* e) { looped = l; toAttached = to; attached = e; } /*************************************************************************/ class TNode { friend class TNodeList; public: TNode(TElementList* = nil, TElementList* = nil); TNode(Alignment, TElement*, Alignment = BottomLeft, TElement* = nil); ~TNode(); TNode* Copy(); void DeleteElements(); void Merge(TNode*); void Exclude(TElement*); bool Includes(TElement*); bool Includes(Alignment&, TElement*); bool Overlaps(TNode*); bool Empty(); bool Degenerate(TElement*&); bool Degenerate(Alignment&, TElement*&); bool Series(TElement*&, TElement*&); bool Stub(TElement*&); bool Loop(TElement*&); void SetPosition(float); float GetPosition(); private: TElementList* lbElems, *rtElems; float position; TElementList* LeftBottomElements(); TElementList* RightTopElements(); void DeleteElements(TElementList*); }; inline bool TNode::Includes(TElement* e) { Alignment dummy; return Includes(dummy, e); } inline bool TNode::Empty() { return lbElems->Empty() && rtElems->Empty(); } inline void TNode::SetPosition(float p) { position = p; } inline float TNode::GetPosition() { return position; } inline TElementList* TNode::LeftBottomElements() { return lbElems; } inline TElementList* TNode::RightTopElements() { return rtElems; } TNode::TNode(TElementList* l1, TElementList* l2) { lbElems = l1; rtElems = l2; position = 0; } TNode::TNode(Alignment a1, TElement* e1, Alignment a2, TElement* e2) { lbElems = new TElementList; rtElems = new TElementList; if (a1 == BottomLeft) { rtElems->Append(new TElementList(e1)); } else { lbElems->Append(new TElementList(e1)); } if (e2 != nil) { if (a2 == BottomLeft) { rtElems->Append(new TElementList(e2)); } else { lbElems->Append(new TElementList(e2)); } position = 0; } } TNode::~TNode() { delete lbElems; delete rtElems; } void TNode::DeleteElements() { register TElementList* t; for (t = lbElems->First(); t != lbElems->End(); t = t->Next()) { rtElems->Delete(t->GetElem()); } DeleteElements(lbElems); DeleteElements(rtElems); } void TNode::DeleteElements(TElementList* elems) { register TElementList* t; for (t = elems->First(); t != elems->End(); t = t->Next()) { delete t->GetElem(); } } TNode* TNode::Copy() { TNode* node = new TNode(lbElems->Copy(), rtElems->Copy()); node->SetPosition(GetPosition()); return node; } void TNode::Merge(TNode* n) { register TElementList* nelems, *next; TElementList* cur; nelems = n->lbElems; for (cur = nelems->First(); cur != nelems->End(); cur = next) { next = cur->Next(); nelems->Remove(cur); if (lbElems->Includes(cur->GetElem())) { delete cur; } else { lbElems->Append(cur); } } nelems = n->rtElems; for (cur = nelems->First(); cur != nelems->End(); cur = next) { next = cur->Next(); nelems->Remove(cur); if (rtElems->Includes(cur->GetElem())) { delete cur; } else { rtElems->Append(cur); } } } void TNode::Exclude(TElement* e) { lbElems->Delete(e); rtElems->Delete(e); } bool TNode::Includes(Alignment& a, TElement* e) { if (lbElems->Includes(e)) { a = TopRight; return true; } else if (rtElems->Includes(e)) { a = BottomLeft; return true; }; return false; } bool TNode::Overlaps(TNode* n) { register TElementList* nelems; register TElementList* cur; nelems = n->lbElems; for (cur = nelems->First(); cur != nelems->End(); cur = cur->Next()) { if (lbElems->Includes(cur->GetElem())) { return true; } } nelems = n->rtElems; for (cur = nelems->First(); cur != nelems->End(); cur = cur->Next()) { if (rtElems->Includes(cur->GetElem())) { return true; } } return false; } bool TNode::Degenerate(TElement*& e) { Alignment dummy; return Degenerate(dummy, e); } bool TNode::Degenerate(Alignment& a, TElement*& e) { if (!lbElems->Empty() && rtElems->Empty()) { if (lbElems->OnlyOne()) { e = lbElems->First()->GetElem(); a = TopRight; return true; } } else if (lbElems->Empty() && !rtElems->Empty()) { if (rtElems->OnlyOne()) { e = rtElems->First()->GetElem(); a = BottomLeft; return true; } } return false; } bool TNode::Series(TElement*& e1, TElement*& e2) { if ( !lbElems->Empty() && !rtElems->Empty() && lbElems->OnlyOne() && rtElems->OnlyOne() ) { e1 = lbElems->First()->GetElem(); e2 = rtElems->First()->GetElem(); if (e1 != e2) { return true; } } return false; } bool TNode::Stub(TElement*& e) { if (lbElems->OnlyTwo() && rtElems->Empty()) { e = lbElems->First()->GetElem(); return true; } else if (lbElems->Empty() && rtElems->OnlyTwo()) { e = rtElems->First()->GetElem(); return true; } return false; } bool TNode::Loop(TElement*& e) { register TElementList* cur; for (cur = lbElems->First(); cur != lbElems->End(); cur = cur->Next()) { e = cur->GetElem(); if (rtElems->Includes(e)) { return true; } } return false; } /*************************************************************************/ class TNodeList : public TList { public: TNodeList(TNode* = nil); TNodeList* Copy(); void Include(Alignment, TElement*, Alignment = BottomLeft, TElement* =nil); void Exclude(TElement*); bool Includes(TNode*); void Nodes(TElement*, TNode*&, TNode*&); TNode* Node(Alignment, TElement*); TNode* OtherNode(TElement*, TNode*); void AddMissingNodes(TElement*); void Append(TNodeList*); void Remove(TNodeList*); TNodeList* First(); TNodeList* End(); TNodeList* Next(); TNodeList* Last(); void Delete(TNode*); bool Empty(); bool OnlyOne(); TNode* GetNode(); bool Degenerate(TElement*&); bool FoundTermination(TTermination*&, TNode*, TNode*); bool FoundSeries(TElement*&, TElement*&, TNode*, TNode*); bool FoundStub(TElement*&); bool FoundParallel(TElement*&, TElement*&); bool FoundCrossover(TElement*&); bool FoundLoop(TLoop*&); void Reverse(TElement*); void RemoveTermination(TTermination*); void RemoveSeries(TElement*, TElement*, TElement*); void RemoveParallel(TElement*, TElement*, TElement*); void RemoveLoop(TLoop*); void ReplaceTermination(TTermination*); void ReplaceSeries(TElement*, TElement*, TElement*); void ReplaceParallel(TElement*, TElement*, TElement*); void ReplaceLoop(TLoop*); void ApplyToTermination(TTermination*); void ApplyToSeries(TElement*, TElement*, TElement*); void ApplyToParallel(TElement*, TElement*, TElement*); void ApplyToLoop(TLoop*); void FindElements(Interactor*, TElement*&, TElement*&); void FindElement(TGlue*, TElement*&); private: bool FoundParallel(TNode*, TElement*&, TElement*&); bool FoundParallel(TElementList*, TNode*, TElement*&, TElement*&); bool FoundCrossover(TNode*, TElement*&); void FindElements(TElementList*, Interactor*, TElement*&, TElement*&); void FindElement(TElementList*, TGlue*, TElement*&); Alignment Inverse(Alignment); void GetElemOtherThan(TElement*, TNode*, Alignment&, TElement*&); }; inline bool TNodeList::Includes(TNode* t) { return TList::Find(t) != nil; } inline TNode* TNodeList::GetNode() { return (TNode*) GetContents(); } inline bool TNodeList::FoundParallel( TNode* n, TElement*& e1, TElement*& e2 ) { return FoundParallel(n->LeftBottomElements(), n, e1, e2) || FoundParallel(n->RightTopElements(), n, e1, e2); } inline void TNodeList::Append(TNodeList* t) { TList::Append(t); } inline void TNodeList::Remove(TNodeList* t) { TList::Remove(t); } inline void TNodeList::Delete(TNode* o) { TList::Delete(o); } inline TNodeList* TNodeList::First() { return (TNodeList*) TList::First(); } inline TNodeList* TNodeList::End() { return (TNodeList*) TList::End(); } inline TNodeList* TNodeList::Next() { return (TNodeList*) TList::Next(); } inline TNodeList* TNodeList::Last() { return (TNodeList*) TList::Last(); } inline bool TNodeList::Empty() { return TList::Empty(); } inline bool TNodeList::OnlyOne() { return !Empty() && First() == Last(); } inline Alignment TNodeList::Inverse(Alignment a) { return (a == BottomLeft) ? TopRight : BottomLeft; } TNodeList::TNodeList(TNode* o) : TList(o) { } TNodeList* TNodeList::Copy() { register TNodeList* t; TNodeList* newlist = new TNodeList; TNode* node; for (t = First(); t != End(); t = t->Next()) { node = t->GetNode(); newlist->Append(new TNodeList(node->Copy())); } return newlist; } void TNodeList::Include( Alignment a1, TElement* e1, Alignment a2, TElement* e2 ) { register TNodeList* t; TNode pass1(a1, e1, a2, e2); TNode* node, *pass2; for (t = First(); t != End(); t = t->Next()) { node = t->GetNode(); if (node->Overlaps(&pass1)) { node->Merge(&pass1); pass2 = node; break; } } if (t == End()) { Append(new TNodeList(pass1.Copy())); } else { for (t = First(); t != End(); t = t->Next()) { node = t->GetNode(); if (node != pass2 && node->Overlaps(pass2)) { node->Merge(pass2); Delete(pass2); delete pass2; break; } } } } void TNodeList::Exclude(TElement* e) { register TNodeList* t, *next1; TNode* node; int n = 0; for (t = First(); t != End() && n <= 1; t = next1) { next1 = t->Next(); node = t->GetNode(); if (node->Includes(e)) { ++n; node->Exclude(e); if (node->Empty()) { Remove(t); delete t; } } } } bool TNodeList::Degenerate(TElement*& e) { TElement* alt; TNode* nfirst = First()->GetNode(); TNode* nlast = Last()->GetNode(); return First()->Next() == Last() && nfirst->Degenerate(e) && nlast->Degenerate(alt) && e == alt; } bool TNodeList::FoundTermination( TTermination*& term, TNode* lbMagic, TNode* rtMagic ) { register TNodeList* t; TElement* dangling, *attached; Alignment a, toAttached; TNode* degenTest, *attachment; for (t = First(); t != End(); t = t->Next()) { degenTest = t->GetNode(); if ( degenTest != lbMagic && degenTest != rtMagic && degenTest->Degenerate(a, dangling) ) { attachment = OtherNode(dangling, degenTest); GetElemOtherThan(dangling, attachment, toAttached, attached); if (attached != nil) { term = new TTermination(a, dangling, toAttached, attached); return true; } } } return false; } bool TNodeList::FoundSeries( TElement*& e1, TElement*& e2, TNode* lbMagic, TNode* rtMagic ) { register TNodeList* t; TNode* node; for (t = First(); t != End(); t = t->Next()) { node = t->GetNode(); if (node != lbMagic && node != rtMagic && node->Series(e1, e2)) { return true; } } return false; } bool TNodeList::FoundStub(TElement*& e) { register TNodeList* t; TNode* node; for (t = First(); t != End(); t = t->Next()) { node = t->GetNode(); if (node->Stub(e)) { return true; } } return false; } bool TNodeList::FoundParallel(TElement*& e1, TElement*& e2) { register TNodeList* t; TNode* node; for (t = First(); t != End(); t = t->Next()) { node = t->GetNode(); if (FoundParallel(node, e1, e2)) { return true; } } return false; } bool TNodeList::FoundParallel( TElementList* elems, TNode* n, TElement*& e1, TElement*& e2 ) { register TElementList* cur, *test; TNode* ncur, *ntest; for (cur = elems->First(); cur != elems->End(); cur = cur->Next()) { e1 = cur->GetElem(); ncur = OtherNode(e1, n); if (ncur != nil) { for ( test = cur->Next(); test != elems->End(); test = test->Next() ) { e2 = test->GetElem(); ntest = OtherNode(e2, n); if (ntest == ncur) { return true; } } } } return false; } bool TNodeList::FoundCrossover(TElement*& e) { register TNodeList* t; TNode* node; for (t = First(); t != End(); t = t->Next()) { node = t->GetNode(); if (FoundCrossover(node, e)) { return true; } } return false; } bool TNodeList::FoundLoop(TLoop*& loop) { register TNodeList* t; TElement* looped, *attached; Alignment toAttached; TNode* loopTest; for (t = First(); t != End(); t = t->Next()) { loopTest = t->GetNode(); if (loopTest->Loop(looped)) { GetElemOtherThan(looped, loopTest, toAttached, attached); loop = new TLoop(looped, toAttached, attached); return true; } } return false; } bool TNodeList::FoundCrossover(TNode* n, TElement*& e1) { TElementList* lbElems, *rtElems, *cur, *test; TElement* e2; TNode* ncur, *ntest; lbElems = n->LeftBottomElements(); rtElems = n->RightTopElements(); for (cur = lbElems->First(); cur != lbElems->End(); cur = cur->Next()) { e1 = cur->GetElem(); ncur = OtherNode(e1, n); if (ncur != nil) { for ( test = rtElems->First(); test != rtElems->End(); test = test->Next() ) { e2 = test->GetElem(); ntest = OtherNode(e2, n); if (ntest == ncur) { return true; } } } } return false; } TNode* TNodeList::OtherNode(TElement* e, TNode* n) { register TNodeList* t; TNode* ntest; for (t = First(); t != End(); t = t->Next()) { ntest = t->GetNode(); if (ntest != n && ntest->Includes(e)) { return ntest; } } return nil; } void TNodeList::RemoveTermination(TTermination* t) { TNode* degen, *attachment = Node(t->toAttached, t->attached); attachment->Exclude(t->dangling); degen = OtherNode(t->dangling, attachment); Delete(degen); delete degen; } void TNodeList::RemoveSeries(TElement* equiv, TElement* e1, TElement* e2) { TNode* n1lb, *n2lb, *n2rt; TNode eqlb(BottomLeft, equiv); TNode eqrt(TopRight, equiv); Nodes(e2, n2lb, n2rt); n1lb = OtherNode(e1, n2lb); if (n1lb == nil) { // check for ends tied together n1lb = n2rt; } else if (n2rt == nil) { n2rt = n1lb; } n1lb->Merge(&eqlb); n2rt->Merge(&eqrt); n1lb->Exclude(e1); n2rt->Exclude(e2); Delete(n2lb); delete n2lb; } void TNodeList::Reverse(TElement* e) { TNode* nlb, *nrt; TNode elb(BottomLeft, e); TNode ert(TopRight, e); Nodes(e, nlb, nrt); nlb->Exclude(e); nrt->Exclude(e); nlb->Merge(&ert); nrt->Merge(&elb); e->Reverse(); } void TNodeList::RemoveParallel(TElement* equiv, TElement* e1, TElement* e2) { TNode* n1lb, *n1rt; TNode eqlb(BottomLeft, equiv); TNode eqrt(TopRight, equiv); Nodes(e1, n1lb, n1rt); n1lb->Merge(&eqlb); n1rt->Merge(&eqrt); n1lb->Exclude(e1); n1lb->Exclude(e2); n1rt->Exclude(e1); n1rt->Exclude(e2); } void TNodeList::RemoveLoop(TLoop* l) { TNode* attachment; if (l->attached == nil) { // isolated loop attachment = OtherNode(l->looped, nil); Delete(attachment); delete attachment; } else { attachment = Node(l->toAttached, l->attached); attachment->Exclude(l->looped); } } void TNodeList::ReplaceTermination(TTermination* t) { TNode* degen, *attachment = Node(t->toAttached, t->attached); float apos; Alignment a = Inverse(t->alignment); TElement* e = t->dangling; TNode temp(a, e); attachment->Merge(&temp); apos = attachment->GetPosition(); degen = new TNode(t->alignment, t->dangling); if (t->alignment == BottomLeft) { degen->SetPosition(apos - t->dangling->nat - t->dangling->sigma); } else { degen->SetPosition(apos + t->dangling->nat + t->dangling->sigma); } Append(new TNodeList(degen)); } void TNodeList::ReplaceSeries(TElement* equiv, TElement* e1, TElement* e2) { TNode* eqlb, *eqrt, *nctr; Nodes(equiv, eqlb, eqrt); if (eqlb == nil) { // check for ends tied together eqlb = eqrt; } else if (eqrt == nil) { eqrt = eqlb; } TNode nlb(BottomLeft, e1); TNode nrt(TopRight, e2); eqlb->Merge(&nlb); eqrt->Merge(&nrt); eqlb->Exclude(equiv); eqrt->Exclude(equiv); nctr = new TNode(TopRight, e1, BottomLeft, e2); nctr->SetPosition(e2->pos); Append(new TNodeList(nctr)); } void TNodeList::ReplaceParallel( TElement* equiv, TElement* e1, TElement* e2 ) { TNode* eqlb, *eqrt; TNode nlb(BottomLeft, e1, BottomLeft, e2); TNode nrt(TopRight, e1, TopRight, e2); Nodes(equiv, eqlb, eqrt); eqlb->Merge(&nlb); eqrt->Merge(&nrt); eqlb->Exclude(equiv); eqrt->Exclude(equiv); } void TNodeList::ReplaceLoop(TLoop* l) { TNode* attachment; if (l->attached == nil) { attachment = new TNode(BottomLeft, l->looped, TopRight, l->looped); Append(new TNodeList(attachment)); } else { attachment = Node(l->toAttached, l->attached); TNode node(BottomLeft, l->looped, TopRight, l->looped); attachment->Merge(&node); } } void TNodeList::FindElements( Interactor* i, TElement*& lbElem, TElement*& rtElem ) { register TNodeList* nl; TNode* node; TElementList* el; lbElem = rtElem = nil; for ( nl = First(); nl != End() && (lbElem == nil || rtElem == nil); nl = nl->Next() ) { node = nl->GetNode(); el = node->LeftBottomElements(); FindElements(el, i, lbElem, rtElem); if (lbElem == nil || rtElem == nil) { el = node->RightTopElements(); FindElements(el, i, lbElem, rtElem); } } } void TNodeList::FindElement(TGlue* tg, TElement*& elem) { register TNodeList* nl; TNode* node; TElementList* el; elem = nil; for (nl = First(); nl != End() && elem == nil; nl = nl->Next()) { node = nl->GetNode(); el = node->LeftBottomElements(); FindElement(el, tg, elem); if (elem == nil) { el = node->RightTopElements(); FindElement(el, tg, elem); } } } void TNodeList::FindElements( TElementList* el, Interactor* i, TElement*& lbElem, TElement*& rtElem ) { register TElementList* cur; TElement* test; for ( cur = el->First(); cur != el->End() && (lbElem == nil || rtElem == nil); cur = cur->Next() ) { test = cur->GetElem(); if (test->owner == i) { if (test->leftBotHalf) { lbElem = test; } else { rtElem = test; } } } } void TNodeList::FindElement(TElementList* el, TGlue* tg, TElement*& elem) { register TElementList* cur; TElement* test; for (cur = el->First(); cur != el->End(); cur = cur->Next()) { test = cur->GetElem(); if (test->tglue == tg) { elem = test; return; } } } void TNodeList::Nodes(TElement* e, TNode*& nlb, TNode*& nrt) { register TNodeList* t; TNode* node; Alignment a; nlb = nrt = nil; for (t = First(); t != End() && (nlb==nil || nrt==nil); t = t->Next()) { node = t->GetNode(); if (node->Includes(a, e)) { if (a == BottomLeft) { /* node is below/left of element */ nlb = node; } else { nrt = node; } } } } TNode* TNodeList::Node(Alignment a, TElement* e) { register TNodeList* t; TNode* node; Alignment test; for (t = First(); t != End(); t = t->Next()) { node = t->GetNode(); if (node->Includes(test, e) && test == a) { return node; } } return nil; } void TNodeList::AddMissingNodes(TElement* e) { TNode* nlb, *nrt; TNodeList* lb, *rt; Nodes(e, nlb, nrt); if (nlb == nil) { nlb = new TNode(BottomLeft, e); nlb->SetPosition(e->pos); lb = new TNodeList(nlb); Append(lb); } if (nrt == nil) { nrt = new TNode(TopRight, e); nrt->SetPosition(e->pos + e->nat + e->sigma); rt = new TNodeList(nrt); Append(rt); } } void TNodeList::GetElemOtherThan( TElement* avoid, TNode* n, Alignment& a, TElement*& e ) { register TElementList* cur; TElementList* lbElems, *rtElems; lbElems = n->LeftBottomElements(); rtElems = n->RightTopElements(); for (cur = lbElems->First(); cur != lbElems->End(); cur = cur->Next()) { e = cur->GetElem(); if (e != avoid) { a = TopRight; return; } } for (cur = rtElems->First(); cur != rtElems->End(); cur = cur->Next()) { e = cur->GetElem(); if (e != avoid) { a = BottomLeft; return; } } e = nil; } void TNodeList::ApplyToTermination(TTermination* t) { TNode* n = Node(t->toAttached, t->attached); if (t->alignment == BottomLeft) { t->dangling->pos = n->GetPosition() - t->dangling->nat; } else { t->dangling->pos = n->GetPosition(); } t->dangling->sigma = 0; } void TNodeList::ApplyToSeries(TElement* equiv, TElement* e1, TElement* e2) { float d = equiv->nat + equiv->sigma - e1->nat - e2->nat; float s1, s2; if (d < 0) { s1 = e1->shrink; s2 = e2->shrink; } else { s1 = e1->stretch; s2 = e2->stretch; } if (s1 == 0 && s2 == 0) { e1->sigma = e2->sigma = 0; } else { e1->sigma = equiv->sigma * s1 / (s1 + s2); } e1->Limit(); e2->sigma = equiv->sigma - e1->sigma; e2->Limit(); e1->pos = equiv->pos; e2->pos = e1->pos + e1->nat + e1->sigma; } void TNodeList::ApplyToParallel(TElement* equiv, TElement* e1, TElement* e2) { e1->pos = e2->pos = equiv->pos; e1->sigma = equiv->nat + equiv->sigma - e1->nat; e2->sigma = equiv->nat + equiv->sigma - e2->nat; e1->Limit(); e2->Limit(); } void TNodeList::ApplyToLoop(TLoop* l) { TNode* n = Node(l->toAttached, l->attached); l->looped->pos = n->GetPosition(); l->looped->sigma = -l->looped->shrink; } /*************************************************************************/ class TSolver { public: TSolver(Tray*, Interactor*); ~TSolver(); void AddAlignment(Alignment, Interactor*, TGlue* = nil); void AddAlignment( Alignment, Interactor*, Alignment, Interactor*, TGlue* = nil ); void DeleteAlignmentsTo(Interactor*); void SetShape(Interactor*); void Solve(int, int); void CalcShape(Shape*); void GetPlacement(Interactor*, IntCoord&, IntCoord&, IntCoord&, IntCoord&); private: TNodeList* hnodes, *vnodes; TNode* lmagic, *rmagic, *bmagic, *tmagic; Tray* tray; Interactor* background; Interactor* BgFilter(Interactor*); void Solve( TNodeList*, TNode*, TNode*, int size, int& nat, int& shr, int& str ); void GetPlacement(TNodeList*, Interactor*, int, IntCoord&, IntCoord&); void HOrder(Alignment, Interactor*&, Interactor*&); void VOrder(Alignment, Interactor*&, Interactor*&); void HConvert(Interactor*, TElement*&, TElement*&); void HConvert(TGlue*, TElement*&); void VConvert(Interactor*, TElement*&, TElement*&); void VConvert(TGlue*, TElement*&); void HAddAlignment( Alignment, TElement*, TElement*, Alignment, TElement*, TElement*, TElement* ); void VAddAlignment( Alignment, TElement*, TElement*, Alignment, TElement*, TElement*, TElement* ); void Include( TNodeList*, Alignment, TElement*, Alignment, TElement*, TElement* ); void TrayNodes(TNodeList*, TNode*&, TNode*&); void UpdateMagicNodes(); void DeleteDanglingGlue(TNodeList*, TNode*); void DeleteNodesAndElements(TNodeList*); }; TSolver::TSolver(Tray* t, Interactor* bg) { hnodes = new TNodeList; vnodes = new TNodeList; tray = t; background = bg; lmagic = rmagic = bmagic = tmagic = nil; } TSolver::~TSolver() { DeleteNodesAndElements(hnodes); DeleteNodesAndElements(vnodes); delete hnodes; delete vnodes; } void TSolver::DeleteNodesAndElements(TNodeList* nodes) { TNode* merged; register TNodeList* t = nodes->First(); if (t == nodes->End()) { return; } merged = t->GetNode(); for (t = t->Next(); t != nodes->End(); t = t->Next()) { TNode* doomed = t->GetNode(); merged->Merge(doomed); delete doomed; } merged->DeleteElements(); delete merged; } inline bool HAlignment (Alignment a) { return a != Bottom && a != VertCenter && a != Top; } inline bool VAlignment (Alignment a) { return a != Left && a != HorizCenter && a != Right; } void TSolver::AddAlignment( Alignment a1, Interactor* i1, Alignment a2, Interactor* i2, TGlue* tg ) { TElement* e1l, *e1r, *e2l, *e2r, *e3; i1 = BgFilter(i1); i2 = BgFilter(i2); if (HAlignment(a1) && HAlignment(a2)) { HConvert(i1, e1l, e1r); HConvert(i2, e2l, e2r); HConvert(tg, e3); HAddAlignment(a1, e1l, e1r, a2, e2l, e2r, e3); } if (VAlignment(a1) && VAlignment(a2)) { VConvert(i1, e1l, e1r); VConvert(i2, e2l, e2r); VConvert(tg, e3); VAddAlignment(a1, e1l, e1r, a2, e2l, e2r, e3); } UpdateMagicNodes(); } void TSolver::AddAlignment(Alignment a, Interactor* i, TGlue* tg) { TElement* e1l, *e1r, *e2l, *e2r, *e3; Interactor* i1 = i; Interactor* i2 = tray; if (i == background || i == tray) { return; } if (HAlignment(a)) { HOrder(a, i1, i2); HConvert(i1, e1l, e1r); HConvert(i2, e2l, e2r); HConvert(tg, e3); HAddAlignment(a, e1l, e1r, a, e2l, e2r, e3); } if (VAlignment(a)) { VOrder(a, i1, i2); VConvert(i1, e1l, e1r); VConvert(i2, e2l, e2r); VConvert(tg, e3); VAddAlignment(a, e1l, e1r, a, e2l, e2r, e3); } UpdateMagicNodes(); } void TSolver::HOrder(Alignment a, Interactor*& i1, Interactor*& i2) { Interactor* i = (i1 == tray) ? i2 : i1; if (a == BottomRight || a == CenterRight || a == TopRight || a == Right) { i1 = i; i2 = tray; } else { i1 = tray; i2 = i; } } void TSolver::VOrder(Alignment a, Interactor*& i1, Interactor*& i2) { Interactor* i = (i1 == tray) ? i2 : i1; if (a == TopLeft || a == TopCenter || a == TopRight || a == Top) { i1 = i; i2 = tray; } else { i1 = tray; i2 = i; } } void TSolver::DeleteAlignmentsTo(Interactor* i) { TElement* e1, *e2; TNode* lb, *rt; i = BgFilter(i); hnodes->FindElements(i, e1, e2); if (e1 != nil) { lb = hnodes->Node(BottomLeft, e1); rt = hnodes->Node(TopRight, e2); hnodes->Exclude(e1); hnodes->Exclude(e2); delete e1; delete e2; DeleteDanglingGlue(hnodes, lb); DeleteDanglingGlue(hnodes, rt); } vnodes->FindElements(i, e1, e2); if (e1 != nil) { lb = vnodes->Node(BottomLeft, e1); rt = vnodes->Node(TopRight, e2); vnodes->Exclude(e1); vnodes->Exclude(e2); delete e1; delete e2; DeleteDanglingGlue(vnodes, lb); DeleteDanglingGlue(vnodes, rt); } } void TSolver::SetShape(Interactor* i) { TElement* lbElem, *rtElem; i = BgFilter(i); hnodes->FindElements(i, lbElem, rtElem); if (lbElem == nil) { return; } lbElem->HSetShape(); rtElem->HSetShape(); vnodes->FindElements(i, lbElem, rtElem); if (lbElem == nil) { return; } lbElem->VSetShape(); rtElem->VSetShape(); } void TSolver::Solve(int w, int h) { int dummy; if (lmagic != nil) { lmagic->SetPosition(0); rmagic->SetPosition(w); Solve(hnodes, lmagic, rmagic, w, dummy, dummy, dummy); } if (bmagic != nil) { bmagic->SetPosition(0); tmagic->SetPosition(h); Solve(vnodes, bmagic, tmagic, h, dummy, dummy, dummy); } } void TSolver::CalcShape(Shape* s) { TElement* ltray, *rtray, *btray, *ttray; hnodes->FindElements(tray, ltray, rtray); vnodes->FindElements(tray, btray, ttray); if (ltray != nil && lmagic != nil) { ltray->combinable = rtray->combinable = false; Solve(hnodes, lmagic, rmagic, 0, s->width, s->hshrink, s->hstretch); ltray->combinable = rtray->combinable = true; } if (btray != nil && bmagic != nil) { btray->combinable = ttray->combinable = false; Solve(vnodes, bmagic, tmagic, 0, s->height, s->vshrink, s->vstretch); btray->combinable = ttray->combinable = true; } } void TSolver::GetPlacement( Interactor* i, IntCoord& l, IntCoord& b, IntCoord& r, IntCoord& t ) { Shape* s = i->GetShape(); GetPlacement(hnodes, i, s->width, l, r); GetPlacement(vnodes, i, s->height, b, t); } void TSolver::GetPlacement( TNodeList* nodes, Interactor* i, int dfault, IntCoord& lb, IntCoord& rt ) { TElement* lbElem, *rtElem; nodes->FindElements(i, lbElem, rtElem); if (lbElem == nil) { lb = 0; rt = dfault - 1; } else { lb = Math::round(lbElem->pos); rt = Math::round( lbElem->pos + lbElem->nat + lbElem->sigma + rtElem->nat + rtElem->sigma - 1 ); } } void TSolver::Solve( TNodeList* nodes, TNode* lbMagic, TNode* rtMagic, int size, int& nat, int& shr, int& str ) { TElement* e1, *e2, *e3; TTermination* t; TLoop* l; TNode* n; if (nodes->Empty()) { /* no alignments; do nothing */ } else if (nodes->Degenerate(e1)) { nat = Math::round(e1->nat); shr = Math::round(e1->shrink); str = Math::round(e1->stretch); e1->pos = (lbMagic == nil) ? 0 : lbMagic->GetPosition(); e1->sigma = (rtMagic == nil) ? e1->nat : size - Math::round(e1->nat); e1->Limit(); } else if (nodes->FoundSeries(e1, e2, lbMagic, rtMagic)) { e3 = e1->Series(e2); nodes->RemoveSeries(e3, e1, e2); Solve(nodes, lbMagic, rtMagic, size, nat, shr, str); nodes->ApplyToSeries(e3, e1, e2); nodes->ReplaceSeries(e3, e1, e2); delete e3; } else if (nodes->FoundParallel(e1, e2)) { e3 = e1->Parallel(e2); nodes->RemoveParallel(e3, e1, e2); Solve(nodes, lbMagic, rtMagic, size, nat, shr, str); nodes->ApplyToParallel(e3, e1, e2); nodes->ReplaceParallel(e3, e1, e2); delete e3; } else if (nodes->FoundTermination(t, lbMagic, rtMagic)) { nodes->RemoveTermination(t); Solve(nodes, lbMagic, rtMagic, size, nat, shr, str); nodes->ApplyToTermination(t); nodes->ReplaceTermination(t); delete t; } else if (nodes->FoundStub(e1) || nodes->FoundCrossover(e1)) { nodes->Reverse(e1); Solve(nodes, lbMagic, rtMagic, size, nat, shr, str); nodes->Reverse(e1); } else if (nodes->FoundLoop(l)) { nodes->RemoveLoop(l); Solve(nodes, lbMagic, rtMagic, size, nat, shr, str); nodes->ApplyToLoop(l); nodes->ReplaceLoop(l); delete l; } else if (nodes->OnlyOne()) { n = nodes->First()->GetNode(); if (n != lbMagic && n != rtMagic) { n->SetPosition(0); } nat = str = shr = 0; } } void TSolver::HConvert(Interactor* i, TElement*& el, TElement*& er) { if (i == nil) { el = er = nil; } else { hnodes->FindElements(i, el, er); if (el == nil) { el = new TElement(i); el->combinable = true; el->leftBotHalf = true; el->HSetShape(); er = new TElement(i); er->combinable = true; er->leftBotHalf = false; er->HSetShape(); hnodes->Include(TopRight, el, BottomLeft, er); } } } void TSolver::HConvert(TGlue* tg, TElement*& e) { if (tg == nil) { e = nil; } else { hnodes->FindElement(tg, e); if (e == nil) { e = new TElement(tg); e->combinable = true; e->leftBotHalf = true; e->HSetShape(); } } } void TSolver::VConvert(Interactor* i, TElement*& eb, TElement*& et) { if (i == nil) { eb = et = nil; } else { vnodes->FindElements(i, eb, et); if (eb == nil) { eb = new TElement(i); eb->combinable = true; eb->leftBotHalf = true; eb->VSetShape(); et = new TElement(i); et->combinable = true; et->leftBotHalf = false; et->VSetShape(); vnodes->Include(TopRight, eb, BottomLeft, et); } } } void TSolver::VConvert(TGlue* tg, TElement*& e) { if (tg == nil) { e = nil; } else { vnodes->FindElement(tg, e); if (e == nil) { e = new TElement(tg); e->combinable = true; e->leftBotHalf = true; e->VSetShape(); } } } void TSolver::HAddAlignment( Alignment a1, TElement* e1l, TElement* e1r, Alignment a2, TElement* e2l, TElement* e2r, TElement* tg ) { TElement* e1, *e2; Alignment na1, na2; switch (a1) { case TopLeft: case CenterLeft: case BottomLeft: case Left: e1 = e1l; na1 = BottomLeft; break; case TopCenter: case Center: case BottomCenter: case HorizCenter: e1 = e1l; na1 = TopRight; break; case TopRight: case CenterRight: case BottomRight: case Right: e1 = e1r; na1 = TopRight; break; } switch (a2) { case TopLeft: case CenterLeft: case BottomLeft: case Left: e2 = e2l; na2 = BottomLeft; break; case TopCenter: case Center: case BottomCenter: case HorizCenter: e2 = e2l; na2 = TopRight; break; case TopRight: case CenterRight: case BottomRight: case Right: e2 = e2r; na2 = TopRight; break; } hnodes->AddMissingNodes(e1l); hnodes->AddMissingNodes(e1r); hnodes->AddMissingNodes(e2l); hnodes->AddMissingNodes(e2r); Include(hnodes, na1, e1, na2, e2, tg); } void TSolver::VAddAlignment( Alignment a1, TElement* e1b, TElement* e1t, Alignment a2, TElement* e2b, TElement* e2t, TElement* tg ) { TElement* e1, *e2; Alignment na1, na2; switch (a1) { case BottomLeft: case BottomCenter: case BottomRight: case Bottom: e1 = e1b; na1 = BottomLeft; break; case CenterLeft: case Center: case CenterRight: case VertCenter: e1 = e1b; na1 = TopRight; break; case TopLeft: case TopCenter: case TopRight: case Top: e1 = e1t; na1 = TopRight; break; } switch (a2) { case BottomLeft: case BottomCenter: case BottomRight: case Bottom: e2 = e2b; na2 = BottomLeft; break; case CenterLeft: case Center: case CenterRight: case VertCenter: e2 = e2b; na2 = TopRight; break; case TopLeft: case TopCenter: case TopRight: case Top: e2 = e2t; na2 = TopRight; break; } vnodes->AddMissingNodes(e1b); vnodes->AddMissingNodes(e1t); vnodes->AddMissingNodes(e2b); vnodes->AddMissingNodes(e2t); Include(vnodes, na1, e1, na2, e2, tg); } void TSolver::Include( TNodeList* nodes, Alignment na1, TElement* e1, Alignment na2, TElement* e2, TElement* tg ) { if (e1->owner == e2->owner && na1 == na2) { /* aligned a node to itself; do nothing */ } else if (tg == nil) { nodes->Include(na1, e1, na2, e2); } else if (na1 == BottomLeft && na2 == TopRight) { nodes->Include(BottomLeft, e1, TopRight, tg); nodes->Include(TopRight, e2, BottomLeft, tg); } else { nodes->Include(na1, e1, BottomLeft, tg); nodes->Include(na2, e2, TopRight, tg); } } void TSolver::TrayNodes(TNodeList* nodes, TNode*& nlb, TNode*& nrt) { TNode *ctr; TElement* elb, *ert; nodes->FindElements(tray, elb, ert); if (elb == nil) { nlb = nrt = nil; } else { nodes->Nodes(elb, nlb, ctr); nrt = nodes->OtherNode(ert, ctr); } } void TSolver::UpdateMagicNodes() { TrayNodes(hnodes, lmagic, rmagic); TrayNodes(vnodes, bmagic, tmagic); } void TSolver::DeleteDanglingGlue(TNodeList* nodes, TNode* n) { TElement* e; if (n->Degenerate(e) && e->tglue != nil) { nodes->Exclude(e); delete e; } } Interactor* TSolver::BgFilter(Interactor* i) { return (i == background) ? tray : i; } /*************************************************************************/ class TrayElement { public: Interactor* child; bool visible; TrayElement* next; }; /*************************************************************************/ TGlue::TGlue(int w, int h, int hstr, int vstr) { shape = new Shape; shape->width = w; shape->height = h; shape->hshrink = 0; shape->hstretch = hstr; shape->vshrink = 0; shape->vstretch = vstr; } TGlue::TGlue(int w, int h, int hshr, int hstr, int vshr, int vstr) { shape = new Shape; shape->width = w; shape->height = h; shape->hshrink = hshr; shape->hstretch = hstr; shape->vshrink = vshr; shape->vstretch = vstr; } TGlue::~TGlue() { delete shape; } /*************************************************************************/ inline bool Tray::TrayOrBg(Interactor* i) { return i == this || i == bg; } Tray::Tray(Interactor* b) { Init(b); } Tray::Tray(const char* name, Interactor* b) { SetInstance(name); Init(b); } void Tray::Init(Interactor* b) { SetClassName("Tray"); nelements = 0; head = nil; tail = nil; bg = b; tsolver = new TSolver(this, bg); } Tray::~Tray() { register TrayElement* e, *next; delete tsolver; for (e = head; e != nil; e = next) { next = e->next; delete e->child; delete e; } if (bg != nil) { delete bg; } } void Tray::ComponentBounds(int& w, int& h) { register TrayElement* e, *next; Shape* s; w = h = 0; for (e = head; e != nil; e = next) { next = e->next; s = e->child->GetShape(); w = Math::max(w, s->width); h = Math::max(h, s->height); } } void Tray::CalcShape() { int w, h; if (bg == nil) { ComponentBounds(w, h); tsolver->CalcShape(shape); shape->width = Math::max(shape->width, w); shape->height = Math::max(shape->height, h); } else { *shape = *bg->GetShape(); } tsolver->SetShape(this); } void Tray::Reconfig() { register TrayElement* e; for (e = head; e != nil; e = e->next) { tsolver->SetShape(e->child); } CalcShape(); } void Tray::DoInsert(Interactor* i, bool, IntCoord&, IntCoord&) { ++nelements; register TrayElement* e = new TrayElement; e->child = i; e->next = nil; if (head == nil) { head = e; tail = e; } else { tail->next = e; tail = e; } } void Tray::DoChange(Interactor* i) { tsolver->SetShape(i); CalcShape(); } void Tray::DoRemove(Interactor* i) { register TrayElement* e, * prev; if (i == bg) { bg = nil; tsolver->DeleteAlignmentsTo(i); } else { --nelements; prev = nil; for (e = head; e != nil; e = e->next) { if (e->child == i) { if (prev == nil) { head = e->next; } else { prev->next = e->next; } if (e == tail) { tail = prev; } delete e; tsolver->DeleteAlignmentsTo(i); break; } prev = e; } } } void Tray::Resize() { register TrayElement* e; canvas->SetBackground(output->GetBgColor()); if (bg != nil) { Place(bg, 0, 0, xmax, ymax); } for (e = head; e != nil; e = e->next) { tsolver->SetShape(e->child); } tsolver->Solve(xmax+1, ymax+1); for (e = head; e != nil; e = e->next) { PlaceElement(e); } } bool Tray::AlreadyInserted(Interactor* i) { register TrayElement* e; if (i == this || i == bg) { return true; } for (e = head; e != nil; e = e->next) { if (e->child == i) { return true; } } return false; } void Tray::PlaceElement(TrayElement* e) { IntCoord l, b, r, t, tmp; tsolver->GetPlacement(e->child, l, b, r, t); if ( r > 0 && l < xmax && t > 0 && b < ymax && r - l != -1 && t - b != -1 ) { e->visible = true; tmp = Math::min(l, r); r = Math::max(l, r); l = tmp; tmp = Math::min(b, t); t = Math::max(b, t); b = tmp; Place(e->child, l, b, r, t); } else { e->visible = false; } } void Tray::Draw() { register TrayElement* e; if (bg != nil) { bg->Draw(); } for (e = head; e != nil; e = e->next) { if (e->visible) { e->child->Draw(); } } } void Tray::Reshape(Shape& s) { *shape = s; Scene* p = Parent(); if (p != nil) { p->Change(this); } } void Tray::GetComponents(Interactor** c, int nc, Interactor**& a, int& n) { register TrayElement* e; register Interactor** ap; n = nelements; if (bg != nil) { ++n; } a = (n <= nc) ? c : new Interactor*[n]; ap = a; for (e = head; e != nil; e = e->next) { *ap++ = e->child; } if (bg != nil) { *ap = bg; } } void Tray::Align( Alignment a1, Interactor* i1, Alignment a2, Interactor* i2, TGlue* tg ) { if (!AlreadyInserted(i1)) { Insert(i1); } if (!AlreadyInserted(i2)) { Insert(i2); } tsolver->AddAlignment(a1, i1, a2, i2, tg); } void Tray::Align(Alignment a, Interactor* i, TGlue* tg) { if (!AlreadyInserted(i)) { Insert(i); } tsolver->AddAlignment(a, i, tg); } static void LoadInteractorArray ( Interactor* i[], Interactor* i0, Interactor* i1, Interactor* i2, Interactor* i3, Interactor* i4, Interactor* i5, Interactor* i6 ) { i[0] = i0; i[1] = i1; i[2] = i2; i[3] = i3; i[4] = i4; i[5] = i5; i[6] = i6; } void Tray::Align( Alignment a, Interactor* i0, Interactor* i1, Interactor* i2, Interactor* i3, Interactor* i4, Interactor* i5, Interactor* i6 ) { const int n = 7; Interactor* i[n]; int k; LoadInteractorArray(i, i0, i1, i2, i3, i4, i5, i6); for (k = 0; k < n && i[k] != nil; ++k) { if (!AlreadyInserted(i[k])) { Insert(i[k]); } } for (k = 1; k < n && i[k] != nil; ++k) { tsolver->AddAlignment(a, i[k-1], a, i[k]); } } void Tray::HBox( Interactor* i0, Interactor* i1, Interactor* i2, Interactor* i3, Interactor* i4, Interactor* i5, Interactor* i6 ) { const int n = 7; Interactor* i[n]; int k, last = n - 1; LoadInteractorArray(i, i0, i1, i2, i3, i4, i5, i6); for (k = 0; k < n && i[k] != nil; ++k) { if (!AlreadyInserted(i[k])) { Insert(i[k]); } } for (k = 1; k < n && i[k] != nil; ++k) { if (TrayOrBg(i[0]) && k == 1) { tsolver->AddAlignment(Left, this, Left, i[1]); } else if (TrayOrBg(i[k]) && (k == last || i[k+1] == nil)) { tsolver->AddAlignment(Right, i[k-1], Right, this); } else { tsolver->AddAlignment(Right, i[k-1], Left, i[k]); } } } void Tray::VBox( Interactor* i0, Interactor* i1, Interactor* i2, Interactor* i3, Interactor* i4, Interactor* i5, Interactor* i6 ) { const int n = 7; Interactor* i[n]; int k, last = n - 1; LoadInteractorArray(i, i0, i1, i2, i3, i4, i5, i6); for (k = 0; k < n && i[k] != nil; ++k) { if (!AlreadyInserted(i[k])) { Insert(i[k]); } } for (k = 1; k < n && i[k] != nil; ++k) { if (TrayOrBg(i[0]) && k == 1) { tsolver->AddAlignment(Top, this, Top, i[1]); } else if (TrayOrBg(i[k]) && (k == last || i[k+1] == nil)) { tsolver->AddAlignment(Bottom, i[k-1], Bottom, this); } else { tsolver->AddAlignment(Bottom, i[k-1], Top, i[k]); } } } neuron-7.6.3/src/lib/IV-2_6/viewport.cpp000077500000000000000000000160601340731477100176740ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * A viewport contains another interactor whose position is determined * by the viewport's perspective. */ #include #include #include #include #include #include #include #include Viewport::Viewport(Interactor* i, Alignment a) { Init(i, a); } Viewport::Viewport(const char* name, Interactor* i, Alignment a) { SetInstance(name); Init(i, a); } void Viewport::Init(Interactor* i, Alignment a) { SetClassName("Viewport"); background = nil; align = a; shape->Rigid(hfil, hfil, vfil, vfil); perspective = new Perspective; Propagate(false); if (i != nil) { Insert(i); } } Viewport::~Viewport() { Unref(perspective); Unref(background); } void Viewport::Redraw(IntCoord x1, IntCoord y1, IntCoord x2, IntCoord y2) { background->FillRect(canvas, x1, y1, x2, y2); } void Viewport::Reconfig() { Shape* s = interior()->GetShape(); cwidth = s->width; cheight = s->height; shape->width = cwidth; shape->height = cheight; perspective->Init(0, 0, cwidth, cheight); perspective->curx = 0; perspective->cury = 0; perspective->curwidth = cwidth; perspective->curheight = cheight; perspective->sx = s->hunits; perspective->sy = s->vunits; background = new Painter(output); background->Reference(); background->SetPattern(new Pattern(Pattern::lightgray)); } void Viewport::DoMove(Interactor* i, IntCoord& x, IntCoord& y) { perspective->curx = perspective->x0 - x; perspective->cury = perspective->y0 - y; perspective->Update(); MonoScene::DoMove(i, x, y); } static void AlignHelper(Alignment a, int& x, int& y, int width, int height) { switch (a) { case BottomLeft: case CenterLeft: case TopLeft: break; case BottomCenter: case Center: case TopCenter: x += width/2; break; case BottomRight: case CenterRight: case TopRight: x += width; break; } switch (a) { case BottomLeft: case BottomCenter: case BottomRight: break; case CenterLeft: case Center: case CenterRight: y += height/2; break; case TopLeft: case TopCenter: case TopRight: y += height; break; } } void Viewport::Resize() { canvas->SetBackground(output->GetBgColor()); float px = XPos(); float py = YPos(); float zx = XMag(); float zy = YMag(); perspective->curwidth = xmax+1; perspective->curheight = ymax+1; perspective->lx = Math::round(0.90 * perspective->curwidth); perspective->ly = Math::round(0.90 * perspective->curheight); DoAdjust(px, py, zx, zy); } void Viewport::Adjust(Perspective& np) { int x = np.curx; int y = np.cury; AlignHelper(align, x, y, np.curwidth, np.curheight); float px = float(x - np.x0) / float(np.width); float py = float(y - np.y0) / float(np.height); float zx = ( float(np.width) / float(cwidth) * float(perspective->curwidth) / float(np.curwidth) ); float zy = ( float(np.height) / float(cheight) * float(perspective->curheight) / float(np.curheight) ); DoAdjust(px, py, zx, zy); np = *perspective; } void Viewport::DoAdjust(float px, float py, float zx, float zy) { register Perspective* p = perspective; register Shape* s = interior()->GetShape(); cwidth = s->width; cheight = s->height; if (px < 0.0) px = 0.0; if (px > 1.0) px = 1.0; if (py < 0.0) py = 0.0; if (py > 1.0) py = 1.0; int w = Math::round(cwidth * zx); int h = Math::round(cheight * zy); int x = Math::round(w * px); int y = Math::round(h * py); AlignHelper(align, x, y, -p->curwidth, -p->curheight); Place(interior(), -x, -y, -x + (w - 1), -y + (h - 1)); p->width = w; p->height = h; p->curx = p->x0 + x; p->cury = p->y0 + y; p->Update(); } void Viewport::AdjustTo(float px, float py, float zx, float zy) { DoAdjust(px, py, zx, zy); } void Viewport::AdjustBy(float dpx, float dpy, float dzx, float dzy) { DoAdjust(XPos() + dpx, YPos() + dpy, XMag() * dzx, YMag() * dzy); } void Viewport::ScrollTo(float px, float py) { DoAdjust(px, py, XMag(), YMag()); } void Viewport::ScrollXTo(float px) { DoAdjust(px, YPos(), XMag(), YMag()); } void Viewport::ScrollYTo(float py) { DoAdjust(XPos(), py, XMag(), YMag()); } void Viewport::ScrollBy(float dpx, float dpy) { DoAdjust(XPos() + dpx, YPos() + dpy, XMag(), YMag()); } void Viewport::ScrollXBy(float dpx) { DoAdjust(XPos() + dpx, YPos(), XMag(), YMag()); } void Viewport::ScrollYBy(float dpy) { DoAdjust(XPos(), YPos() + dpy, XMag(), YMag()); } void Viewport::ZoomTo(float zx, float zy) { DoAdjust(XPos(), YPos(), zx, zy); } void Viewport::ZoomXTo(float zx) { DoAdjust(XPos(), YPos(), zx, YMag()); } void Viewport::ZoomYTo(float zy) { DoAdjust(XPos(), YPos(), XMag(), zy); } void Viewport::ZoomBy(float dzx, float dzy) { DoAdjust(XPos(), YPos(), XMag() * dzx, YMag() * dzy); } void Viewport::ZoomXBy(float dzx) { DoAdjust(XPos(), YPos(), XMag() * dzx, YMag()); } void Viewport::ZoomYBy(float dzy) { DoAdjust(XPos(), YPos(), XMag(), YMag() * dzy); } float Viewport::XPos() { int x = perspective->curx; int y = 0; AlignHelper(align, x, y, perspective->curwidth, perspective->curheight); return float(x - perspective->x0) / float(perspective->width); } float Viewport::YPos() { int x = 0; int y = perspective->cury; AlignHelper(align, x, y, perspective->curwidth, perspective->curheight); return float(y - perspective->y0) / float(perspective->height); } float Viewport::XMag() { return float(perspective->width) / float(cwidth); } float Viewport::YMag() { return float(perspective->height) / float(cheight); } neuron-7.6.3/src/lib/IV-2_6/world.cpp000066400000000000000000000123431340731477100171410ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * A world is the root scene for a display. */ #include #include #include #include #include #include #include #include double inch, inches, cm, mm, point, points; World* World::current_; World::World() { session_ = nil; display_ = nil; } World::World( const char* classname, int& argc, char** argv, const OptionDesc* opts, const PropertyData* initprops ) { session_ = new Session(classname, argc, argv, opts, initprops); display_ = session_->default_display(); make_current(); Sensor::init(); } World::~World() { delete session_; } Session* World::session() const { return session_; } Display* World::display() const { return display_; } const char* World::name() const { return session_->name(); } const char* World::classname() const { return session_->classname(); } int World::argc() const { return session_->argc(); } char** World::argv() const { return session_->argv(); } Style* World::style() const { return display_->style(); } const char* World::property_value(const char* s) const { String v; if (style()->find_attribute(String(s), v)) { return v.string(); } return nil; } bool World::property_is_on(const char* s) const { return style()->value_is_on(String(s)); } const Font* World::font() const { const Font* f = nil; Style* s = style(); String v; if (s->find_attribute("font", v) || s->find_attribute("Font", v)) { f = Font::lookup(v); } if (f == nil) { f = Font::lookup("fixed"); } return f; } const Color* World::foreground() const { const Color* c = nil; Style* s = style(); String v; if (s->find_attribute("foreground", v) || s->find_attribute("Foreground", v) ) { c = Color::lookup(display(), v); } if (c == nil) { c = new Color(0.0, 0.0, 0.0, 1.0); } return c; } const Color* World::background() const { const Color* c = nil; Style* s = style(); String v; if (s->find_attribute("background", v) || s->find_attribute("Background", v) ) { c = Color::lookup(display(), v); } if (c == nil) { c = new Color(1.0, 1.0, 1.0, 1.0); } return c; } bool World::shaped_windows() const { return style()->value_is_on("shaped_windows"); } bool World::double_buffered() const { return style()->value_is_on("double_buffered"); } void World::flush() { display_->flush(); } void World::sync() { display_->sync(); } Coord World::width() const { return display_->width(); } Coord World::height() const { return display_->height(); } unsigned int World::pwidth() const { return display_->pwidth(); } unsigned int World::pheight() const { return display_->pheight(); } void World::run() { session_->run(); } void World::quit() { session_->quit(); } bool World::done() const { return session_->done(); } bool World::pending() const { return session_->pending(); } void World::read(Event& e) { session_->read(e); } bool World::read(long sec, long usec, Event& e) { return session_->read(sec, usec, e); } void World::unread(Event& e) { session_->unread(e); } void World::poll(Event& e) { session_->poll(e); } void World::RingBell(int i) { display_->ring_bell(i); } void World::SetKeyClick(int i) { display_->set_key_click(i); } void World::SetAutoRepeat(bool b) { display_->set_auto_repeat(b); } void World::SetFeedback(int t, int s) { display_->set_pointer_feedback(t, s); } void World::SetScreen(int s) { display_->set_screen(s); } World* World::current() { if (current_ == nil) { World* w = new World; w->session_ = Session::instance(); w->display_ = w->session_->default_display(); w->make_current(); Sensor::init(); } return current_; } void World::make_current() { current_ = this; point = double(display_->pwidth()) / display_->a_width(); points = point; inch = 72.27 * point; inches = inch; cm = inch / 2.54; mm = inch / 25.4; } neuron-7.6.3/src/lib/IV-2_6/xbitmap2_6.cpp000066400000000000000000000303031340731477100177610ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Old X11-dependent bitmap code */ #include #include #include #include #include #include #include #include #include #include #include #include #include /* anachronisms */ static void DrawSourceTransformedImage( XImage* s, int sx0, int sy0, XImage* m, int mx0, int my0, XDrawable d, unsigned int height, int dx0, int dy0, bool stencil, unsigned long fg, unsigned long bg, GC gc, const Transformer& matrix, int xmin, int ymin, int xmax, int ymax ) { XDisplay* dpy = Session::instance()->default_display()->rep()->display_; unsigned long lastdrawnpixel = fg; for (int xx = xmin; xx <= xmax; ++xx) { float lx, ly; float rx, ry; float tx, ty; matrix.Transform(float(xx), float(ymin), lx, ly); matrix.Transform(float(xx + 1), float(ymin), rx, ry); matrix.Transform(float(xx), float(ymax+1), tx, ty); float dx = (tx - lx) / float(ymax - ymin + 1); float dy = (ty - ly) / float(ymax - ymin + 1); int ilx = 0, ily = 0; int irx = 0, iry = 0; bool lastmask = false, mask; unsigned long lastpixel = fg, pixel, source; for (int yy = ymin; yy <= ymax+1; ++yy) { mask = ( yy <= ymax && (m == nil || XGetPixel(m, xx-mx0, m->height-1-(yy-my0))) ); if ( yy=sy0+s->height || xx=sx0+s->width ) { source = bg; } else { source = XGetPixel(s, xx-sx0, s->height-1-(yy-sy0)); } if (stencil) { pixel = (source != 0) ? fg : bg; } else { pixel = source; } if (mask != lastmask || (lastmask && pixel != lastpixel)) { int iilx = Math::round(lx), iily = Math::round(ly); int iirx = Math::round(rx), iiry = Math::round(ry); if (lastmask) { if (lastpixel != lastdrawnpixel) { XSetForeground(dpy, gc, lastpixel); lastdrawnpixel = lastpixel; } if ( (ilx==iilx || ily==iily) && (irx==ilx || iry==ily) ) { XFillRectangle( dpy, d, gc, Math::min(ilx, iirx) - dx0, height - (Math::max(ily, iiry) - dy0), Math::abs(ilx - iirx), Math::abs(ily - iiry) ); } else { XPoint v[4]; v[0].x = ilx-dx0; v[0].y = height - (ily-dy0); v[1].x = iilx-dx0; v[1].y = height - (iily-dy0); v[2].x = iirx-dx0; v[2].y = height - (iiry-dy0); v[3].x = irx-dx0; v[3].y = height - (iry-dy0); XFillPolygon( dpy, d, gc, v, 4, Convex, CoordModeOrigin ); } } ilx = iilx; ily = iily; irx = iirx; iry = iiry; lastpixel = pixel; lastmask = mask; } lx += dx; ly += dy; rx += dx; ry += dy; } } XSetForeground(dpy, gc, fg); } static void DrawDestinationTransformedImage( XImage* s, int sx0, int sy0, XImage* m, int mx0, int my0, XDrawable d, unsigned int height, int dx0, int dy0, bool stencil, unsigned long fg, unsigned long bg, GC gc, const Transformer& matrix, int xmin, int ymin, int xmax, int ymax ) { XDisplay* dpy = Session::instance()->default_display()->rep()->display_; Transformer t(matrix); t.Invert(); unsigned long lastdrawnpixel = fg; for (IntCoord xx = xmin; xx <= xmax; ++xx) { float fx, fy; float tx, ty; t.Transform(float(xx) + 0.5, float(ymin) + 0.5, fx, fy); t.Transform(float(xx) + 0.5, float(ymax) + 1.5, tx, ty); float dx = (tx - fx) / float(ymax - ymin + 1); float dy = (ty - fy) / float(ymax - ymin + 1); IntCoord lasty = ymin; bool lastmask = false, mask; unsigned long lastpixel = fg, pixel, source; for (IntCoord yy = ymin; yy <= ymax+1; ++yy) { int ix = Math::round(fx - 0.5), iy = Math::round(fy - 0.5); bool insource = ( ix >= sx0 && ix < sx0 + s->width && iy >= sy0 && iy < sy0 + s->height ); bool inmask = ( m != nil && ix >= mx0 && ix < mx0 + m->width && iy >= my0 && iy < my0 + m->height ); if (yy <= ymax) { if (m == nil) { mask = insource; } else if (inmask) { mask = XGetPixel(m, ix-mx0, m->height-1-(iy-my0)) != 0; } else { mask = false; } } else { mask = false; } if (insource) { source = XGetPixel(s, ix-sx0, s->height-1-(iy-sy0)); } else { source = bg; } if (stencil) { pixel = (source != 0) ? fg : bg; } else { pixel = source; } if (mask != lastmask || (lastmask && pixel != lastpixel)) { if (lastmask) { if (lastpixel != lastdrawnpixel) { XSetForeground(dpy, gc, lastpixel); lastdrawnpixel = lastpixel; } XFillRectangle( dpy, d, gc, xx - dx0, height - (yy - dy0), 1, yy - lasty ); } lastmask = mask; lastpixel = pixel; lasty = yy; } fx += dx; fy += dy; } } XSetForeground(dpy, gc, fg); } void DrawTransformedImage( XImage* s, int sx0, int sy0, XImage* m, int mx0, int my0, XDrawable d, unsigned int height, int dx0, int dy0, bool stencil, unsigned long fg, unsigned long bg, GC gc, const Transformer& matrix ) { int x1 = (m != nil) ? mx0 : sx0; int y1 = (m != nil) ? my0 : sy0; int x2 = (m != nil) ? mx0 : sx0; int y2 = (m != nil) ? my0 + m->height : sy0 + s->height; int x3 = (m != nil) ? mx0 + m->width : sx0 + s->width; int y3 = (m != nil) ? my0 + m->height : sy0 + s->height; int x4 = (m != nil) ? mx0 + m->width : sx0 + s->width; int y4 = (m != nil) ? my0 : sy0; int sxmin = Math::min(x1, x2, x3, x4); int sxmax = Math::max(x1, x2, x3, x4) - 1; int symin = Math::min(y1, y2, y3, y4); int symax = Math::max(y1, y2, y3, y4) - 1; matrix.Transform(x1, y1); matrix.Transform(x2, y2); matrix.Transform(x3, y3); matrix.Transform(x4, y4); int dxmin = Math::min(x1, x2, x3, x4); int dxmax = Math::max(x1, x2, x3, x4) - 1; int dymin = Math::min(y1, y2, y3, y4); int dymax = Math::max(y1, y2, y3, y4) - 1; int swidth = sxmax - sxmin + 1; int sheight = symax - symin + 1; int dwidth = dxmax - dxmin + 1; int dheight = dymax - dymin + 1; bool rect = (x1 == x2 || y1 == y2) && (x1 == x4 || y1 == y4); bool alwaysdest = dwidth < 2 * swidth; bool alwayssource = dwidth * dheight > 3 * swidth * sheight; bool dest = alwaysdest || (!alwayssource && !rect); if (dest) { if (dheight > 0) { DrawDestinationTransformedImage( s, sx0, sy0, m, mx0, my0, d, height, dx0, dy0, stencil, fg, bg, gc, matrix, dxmin, dymin, dxmax, dymax ); } } else { if (sheight > 0) { DrawSourceTransformedImage( s, sx0, sy0, m, mx0, my0, d, height, dx0, dy0, stencil, fg, bg, gc, matrix, sxmin, symin, sxmax, symax ); } } } int Bitmap::Left() const { return rep()->display_->to_pixels(left_bearing()); } int Bitmap::Right() const { return rep()->display_->to_pixels(right_bearing()); } int Bitmap::Bottom() const { return rep()->display_->to_pixels(descent()); } int Bitmap::Top() const { return rep()->display_->to_pixels(ascent()); } void Bitmap::Transform(const Transformer* t) { Display* d = Session::instance()->default_display(); DisplayRep* r = d->rep(); XDisplay* dpy = r->display_; BitmapRep* b = rep(); BitmapRep* nb = new BitmapRep; Coord x1, y1, x2, y2, x3, y3, x4, y4; t->transform(b->left_, b->bottom_, x1, y1); t->transform(b->left_, b->top_, x2, y2); t->transform(b->right_, b->top_, x3, y3); t->transform(b->right_, b->bottom_, x4, y4); Coord xmax = Math::max(x1, x2, x3, x4); Coord xmin = Math::min(x1, x2, x3, x4); Coord ymax = Math::max(y1, y2, y3, y4); Coord ymin = Math::min(y1, y2, y3, y4); nb->width_ = xmax - xmin; nb->height_ = ymax - ymin; nb->left_ = xmin; nb->bottom_ = ymin; nb->right_ = xmax; nb->top_ = ymax; nb->pwidth_ = Math::max( 1, d->to_pixels(nb->right_) - d->to_pixels(nb->left_) ); nb->pheight_ = Math::max( 1, d->to_pixels(nb->top_) - d->to_pixels(nb->bottom_) ); nb->pixmap_ = XCreatePixmap(dpy, r->root_, nb->pwidth_, nb->pheight_, 1); GC gc = XCreateGC(dpy, nb->pixmap_, 0, nil); XSetForeground(dpy, gc, 0); XFillRectangle(dpy, nb->pixmap_, gc, 0, 0, nb->pwidth_, nb->pheight_); XSetForeground(dpy, gc, 1); b->fill(); DrawTransformedImage( b->image_, -d->to_pixels(-b->left_), -d->to_pixels(-b->bottom_), b->image_, -d->to_pixels(-b->left_), -d->to_pixels(-b->bottom_), nb->pixmap_, nb->pheight_, -d->to_pixels(-nb->left_), -d->to_pixels(-nb->bottom_), true, 1, 0, gc, *t ); XFreeGC(dpy, gc); delete b; rep_ = nb; rep_->modified_ = true; } void Bitmap::FlipHorizontal() { BitmapRep* b = new BitmapRep(rep_, BitmapRep::fliph); delete rep_; rep_ = b; } void Bitmap::FlipVertical() { BitmapRep* b = new BitmapRep(rep_, BitmapRep::flipv); delete rep_; rep_ = b; } void Bitmap::Rotate90() { BitmapRep* b = new BitmapRep(rep_, BitmapRep::rot90); delete rep_; rep_ = b; } void Bitmap::Rotate180() { BitmapRep* b = new BitmapRep(rep_, BitmapRep::rot180); delete rep_; rep_ = b; } void Bitmap::Rotate270() { BitmapRep* b = new BitmapRep(rep_, BitmapRep::rot270); delete rep_; rep_ = b; } void Bitmap::Invert() { BitmapRep* b = new BitmapRep(rep_, BitmapRep::inv); delete rep_; rep_ = b; } void Bitmap::Scale(float sx, float sy) { Transformer t; t.Scale(sx, sy); Transform(&t); } void Bitmap::Rotate(float angle) { Transformer t; t.Rotate(angle); Transform(&t); } neuron-7.6.3/src/lib/IV-2_6/xevent2_6.cpp000066400000000000000000000120071340731477100176270ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * X11-dependent event-reading code */ #include #include #include #include #include #include #include #include #include Mask motionmask = PointerMotionMask; Mask keymask = KeyPressMask; Mask entermask = EnterWindowMask; Mask leavemask = LeaveWindowMask; Mask focusmask = FocusChangeMask; Mask substructmask = SubstructureRedirectMask; Mask upmask = ButtonReleaseMask|OwnerGrabButtonMask; Mask downmask = ButtonPressMask|OwnerGrabButtonMask; Mask initmask = PointerMotionHintMask; bool Sensor::Caught(const Event& e) const { XEvent& xe = e.rep()->xevent_; switch (xe.type) { case MotionNotify: return (mask & motionmask) != 0; case FocusIn: case FocusOut: return (mask & focusmask) != 0; case KeyPress: case ButtonPress: return ButtonIsSet(down, e.button); case ButtonRelease: return ButtonIsSet(up, e.button); case EnterNotify: return (mask & entermask) != 0 && e.rep()->xevent_.xcrossing.detail != NotifyInferior; case LeaveNotify: return (mask & leavemask) != 0 && e.rep()->xevent_.xcrossing.detail != NotifyInferior; } return false; } void Event::GetInfo() { EventRep& e = *rep(); w = World::current(); y = 0; XEvent& xe = e.xevent_; switch (xe.type) { case MotionNotify: GetMotionInfo(); break; case KeyPress: GetKeyInfo(); break; case ButtonPress: GetButtonInfo(DownEvent); break; case ButtonRelease: GetButtonInfo(UpEvent); break; case FocusIn: eventType = FocusInEvent; break; case FocusOut: eventType = FocusOutEvent; break; case EnterNotify: GetCrossingInfo(EnterEvent); break; case LeaveNotify: GetCrossingInfo(LeaveEvent); break; } } void Event::GetMotionInfo() { rep()->acknowledge_motion(); XMotionEvent& m = rep()->xevent_.xmotion; eventType = MotionEvent; timestamp = m.time; x = m.x; y = m.y; wx = m.x_root; wy = m.y_root; GetKeyState(m.state); } void Event::GetButtonInfo(EventType t) { XButtonEvent& b = rep()->xevent_.xbutton; eventType = t; timestamp = b.time; x = b.x; y = b.y; wx = b.x_root; wy = b.y_root; button = b.button - 1; len = 0; GetKeyState(b.state | (Button1Mask << button)); } void Event::GetKeyInfo() { XKeyEvent& k = rep()->xevent_.xkey; char buf[4096]; eventType = KeyEvent; timestamp = k.time; x = k.x; y = k.y; wx = k.x_root; wy = k.y_root; button = k.keycode; len = mapkey(buf, sizeof(buf)); if (len != 0) { if (len < sizeof(keydata)) { keystring = keydata; } else { keystring = new char[len+1]; } strncpy(keystring, buf, len); keystring[len] = '\0'; } else { keystring = keydata; keydata[0] = '\0'; } GetKeyState(k.state); } void Event::GetKeyState(unsigned state) { shift = (state & ShiftMask) != 0; control = (state & ControlMask) != 0; meta = (state & Mod1Mask) != 0; shiftlock = (state & LockMask) != 0; leftmouse = (state & Button1Mask) != 0; middlemouse = (state & Button2Mask) != 0; rightmouse = (state & Button3Mask) != 0; } void Event::GetCrossingInfo(EventType t) { XCrossingEvent& c = rep()->xevent_.xcrossing; eventType = t; if (c.detail != NotifyInferior) { timestamp = c.time; x = c.x; y = c.y; wx = c.x_root; wy = c.y_root; GetKeyState(c.state); } } void Event::GetAbsolute(_lib_iv2_6(Coord)& absx, _lib_iv2_6(Coord)& absy) { absx = wx; absy = rep()->display_->pheight() - wy; } void Event::GetAbsolute( World*& wd, _lib_iv2_6(Coord)& absx, _lib_iv2_6(Coord)& absy ) { wd = w; absx = wx; absy = rep()->display_->pheight() - wy; } neuron-7.6.3/src/lib/IV-2_6/xinter.cpp000066400000000000000000000505441340731477100173300ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * X-specific code dealing with interactors and scenes. */ #include "../IV-X11/wtable.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include bool Interactor::ValidCanvas(Canvas* c) { bool b = false; if (c != nil) { Window* w = c->window(); if (w != nil) { b = w->bound(); } } return b; } void Interactor::request(Requisition& r) const { if (output == nil) { Interactor* i = (Interactor*)this; i->Config(World::current()); } Display* d = GetWorld()->display(); float align = 0.0; Requirement rx( d->to_coord(shape->width), d->to_coord(shape->hstretch), d->to_coord(shape->hshrink), align ); Requirement ry( d->to_coord(shape->height), d->to_coord(shape->vstretch), d->to_coord(shape->vshrink), align ); r.require(Dimension_X, rx); r.require(Dimension_Y, ry); } void Interactor::allocate(Canvas* c, const Allocation& a, Extension& ext) { ext.set(c, a); } /* * Draw a damaged area of the interactor's canvas. * Since interactors have their own subwindows, we don't need * to draw anything here. However, we need to check to see * if we need to allocate the subwindow because the outer window * might have been unbound without our knowing. We can't handle this * in allocate because our allocation might not have changed. */ void Interactor::draw(Canvas* c, const Allocation& a) const { Interactor* i = (Interactor*)this; const Allotment& ax = a.allotment(Dimension_X); const Allotment& ay = a.allotment(Dimension_Y); Coord width = ax.span(); Coord height = ay.span(); unsigned int pwidth = c->to_pixels(width); unsigned int pheight = c->to_pixels(height); int x0 = c->to_pixels(ax.origin()); int y0 = c->rep()->pheight_ - c->to_pixels(ay.origin()) - pheight; if (window != nil && window->bound()) { CanvasRep& cr = *canvas->rep(); WindowRep& wr = *window->Window::rep(); DisplayRep& dr = *wr.display_->rep(); if (x0 != wr.xpos_ || y0 != wr.ypos_ || cr.pwidth_ != pwidth || cr.pheight_ != pheight ) { cr.width_ = width; cr.height_ = height; cr.pwidth_ = pwidth; cr.pheight_ = pheight; cr.status_ = Canvas::unmapped; wr.xpos_ = x0; wr.ypos_ = y0; Allotment& w_ax = wr.allocation_.x_allotment(); w_ax.origin(0.0); w_ax.span(width); w_ax.alignment(0.0); Allotment& w_ay = wr.allocation_.y_allotment(); w_ay.origin(0.0); w_ay.span(height); w_ay.alignment(0.0); XMoveResizeWindow( dr.display_, wr.xwindow_, x0, y0, pwidth, pheight ); i->xmax = pwidth - 1; i->ymax = pheight - 1; i->Resize(); } if (cr.status_ == Canvas::unmapped) { XMapRaised(dr.display_, wr.xwindow_); cr.status_ = Canvas::mapped; } return; } Window* cw = c->window(); Display* d = cw->rep()->display_; delete i->window; i->window = new InteractorWindow(i, cw); i->window->display(d); style->attribute("double_buffered", "false"); style->attribute("overlay", "false"); i->window->style(style); i->canvas = window->canvas(); CanvasRep& cr = *i->canvas->rep(); cr.width_ = width; cr.height_ = height; cr.pwidth_ = pwidth; cr.pheight_ = pheight; WindowRep& w = *i->window->Window::rep(); w.xpos_ = x0; w.ypos_ = y0; Allotment& w_ax = w.allocation_.x_allotment(); w_ax.origin(0.0); w_ax.span(width); w_ax.alignment(0.0); Allotment& w_ay = w.allocation_.y_allotment(); w_ay.origin(0.0); w_ay.span(height); w_ay.alignment(0.0); i->window->bind(); i->xmax = pwidth - 1; i->ymax = pheight - 1; cr.status_ = Canvas::mapped; i->Resize(); XMapRaised(d->rep()->display_, w.xwindow_); } /* * Note that our allocation has been given to someone else. * We need to unmap the window so that it doesn't interfere * with whoever is now allocated the area. */ void Interactor::undraw() { if (window != nil && window->bound()) { WindowRep& w = *window->rep(); if (w.xwindow_ != WindowRep::unbound) { DisplayRep& d = *w.display_->rep(); if (w.toplevel_->bound()) { XUnmapWindow(d.display_, w.xwindow_); canvas->rep()->status_ = Canvas::unmapped; } else { XDestroyWindow(d.display_, w.xwindow_); window->unbind(); } } } } /* * Determine a handler for an interactor window. * This should simply end up calling interactor_->pick and returning * the appropriate InteractorHandler. */ Handler* InteractorWindow::target(const Event& e) const { if (!e.rep()->has_pointer_location()) { return nil; } WindowRep* w = Window::rep(); Hit h(&e); w->glyph_->pick(w->canvas_, w->allocation_, 0, h); return h.handler(); } /* * Set a handler for the interactor if the event is of interest. * This is complicated by grabbing, which occurs on mouse down events. * The case we want to make sure to when the UpEvent is sent * to an uninterested interactor. */ static bool grabbing; void Interactor::pick(Canvas*, const Allocation& a, int depth, Hit& h) { const Event* ep = h.event(); if ((ep != nil && parent != nil) || ( h.left() < a.right() && h.right() >= a.left() && h.bottom() < a.top() && h.top() >= a.bottom() ) ) { Event& e = *(Event*)ep; e.GetInfo(); Sensor* s = cursensor == nil ? input : cursensor; if ((s != nil && s->Caught(e)) || grabbing) { e.target = this; e.y = ymax - e.y; if (e.eventType == DownEvent) { grabbing = true; } else if (e.eventType == UpEvent) { grabbing = false; } h.target(depth, this, 0, handler_); } } } InteractorHandler::InteractorHandler(Interactor* i) { interactor_ = i; } InteractorHandler::~InteractorHandler() { } /* * Re-filter the event here before calling Handle because * the target might be associated with a grab. Note that this filtering * will not occur when some object other than the window reads events, * typically calling e.target->Handle(e). Interactors really ought * to learn to grab, but it isn't worth trying to change them. */ bool InteractorHandler::event(Event& e) { Interactor* i = interactor_; XEvent& xe = e.rep()->xevent_; switch (xe.type) { case FocusIn: e.eventType = FocusInEvent; break; case FocusOut: e.eventType = FocusOutEvent; break; default: break; } Sensor* s = i->cursensor == nil ? i->input : i->cursensor; if (s != nil && s->Caught(e)) { i->Handle(e); } return true; } void Interactor::Listen(Sensor* s) { cursensor = s; if (window == nil) { /* can't set input interest without window */ return; } Mask m = ExposureMask; if (s != nil) { m |= s->mask; } WindowRep* w = window->rep(); XSelectInput(w->display_->rep()->display_, w->xwindow_, m); } int Interactor::CheckQueue() { return QLength(window->rep()->dpy()); } void Interactor::Poll(Event& e) { e.window(nil); e.poll(); XMotionEvent& m = e.rep()->xevent_.xmotion; e.w = World::current(); e.wx = m.x_root; e.wy = m.y_root; e.GetKeyState(m.state); IntCoord x, y; GetPosition(x, y); e.x = m.x - x; e.y = e.display()->pheight() - 1 - m.y - y; } void Interactor::GetPosition(IntCoord& left, IntCoord& bottom) const { if (window == nil) { /* try to cause an error */ left = 32767; bottom = 32767; return; } WindowRep* w = window->rep(); Display* d = w->display_; XDisplay* dpy = d->rep()->display_; int x, y; XWindow child; XTranslateCoordinates( dpy, w->xwindow_, d->rep()->root_, 0, 0, &x, &y, &child ); left = x; bottom = d->pheight() - y - window->canvas()->pheight(); } InteractorWindow::InteractorWindow(Interactor* i) : Window(i) { interactor_ = i; parent_ = nil; } InteractorWindow::InteractorWindow(Interactor* i, Window* w) : Window(i) { interactor_ = i; parent_ = w; } InteractorWindow::~InteractorWindow() { } void InteractorWindow::set_attributes() { Interactor* i = interactor_; WindowRep& w = *Window::rep(); if (w.visual_ == nil) { w.visual_ = WindowVisual::find_visual(w.display_, i->style); } w.xattrmask_ |= CWBackPixmap; w.xattrs_.background_pixmap = ParentRelative; w.xattrmask_ |= CWWinGravity; w.xattrs_.win_gravity = UnmapGravity; w.xattrmask_ |= CWEventMask; Mask m = ExposureMask; Sensor* input = i->cursensor; if (input == nil) { input = i->input; i->cursensor = input; } if (input != nil) { m |= input->mask; } w.xattrs_.event_mask = m; if (i->cursor_ != nil) { w.xattrmask_ |= CWCursor; w.xattrs_.cursor = i->cursor_->rep()->xid(w.display_, w.visual_); } Style& s = *w.style_; switch (i->canvas_type_) { case CanvasShapeOnly: case CanvasInputOutput: break; case CanvasInputOnly: w.xclass_ = InputOnly; break; case CanvasSaveUnder: s.attribute("saveUnder", "true"); w.xattrmask_ |= CWSaveUnder; w.xattrs_.save_under = true; break; case CanvasSaveContents: s.attribute("backingStore", "true"); w.xattrmask_ |= CWBackingStore; w.xattrs_.backing_store = WhenMapped; break; case CanvasSaveBoth: s.attribute("saveUnder", "true"); w.xattrmask_ |= CWSaveUnder; w.xattrs_.save_under = true; s.attribute("backingStore", "true"); w.xattrmask_ |= CWBackingStore; w.xattrs_.backing_store = WhenMapped; } } void InteractorWindow::bind() { if (parent_ == nil) { parent_ = interactor_->parent->window; } WindowRep& w = *Window::rep(); WindowRep& pw = *parent_->Window::rep(); CanvasRep& c = *canvas()->rep(); w.toplevel_ = pw.toplevel_; w.do_bind(this, pw.xwindow_, w.xpos_, w.ypos_); w.init_renderer(this); } void InteractorWindow::unbind() { Window::unbind(); interactor_->Orphan(); } bool InteractorWindow::receive(const Event& e) { int ymax = canvas()->pheight() - 1; int itop; XEvent& xe = e.rep()->xevent_; switch (xe.type) { case Expose: itop = ymax - xe.xexpose.y; interactor_->Redraw( xe.xexpose.x, itop - xe.xexpose.height + 1, xe.xexpose.x + xe.xexpose.width - 1, itop ); break; case GraphicsExpose: itop = ymax - xe.xgraphicsexpose.y; interactor_->Redraw( xe.xgraphicsexpose.x, itop - xe.xgraphicsexpose.height + 1, xe.xgraphicsexpose.x + xe.xgraphicsexpose.width - 1, itop ); break; case MotionNotify: e.rep()->acknowledge_motion(); break; } return false; } /* * Interactor-specifc anachronistic World member functions */ static void AlignPosition(Window* w, Alignment a) { float xalign = 0.0, yalign = 0.0; bool needs_align = true; switch (a) { case BottomRight: case Right: xalign = 1.0; break; case Top: case TopLeft: yalign = 1.0; break; case BottomCenter: case HorizCenter: xalign = 0.5; break; case CenterLeft: case VertCenter: yalign = 0.5; break; case TopCenter: xalign = 0.5; yalign = 1.0; break; case TopRight: xalign = 1.0; yalign = 1.0; break; case _lib_iv2_6(Center): xalign = 0.5; yalign = 0.5; break; case CenterRight: xalign = 1.0; yalign = 0.5; break; case Bottom: case Left: case BottomLeft: needs_align = false; break; } if (needs_align) { w->align(xalign, yalign); } } void World::InsertApplication(Interactor* i) { delete i->insert_window; ApplicationWindow* w = new ApplicationWindow(i); i->insert_window = w; i->managed_window = w; w->display(display_); w->map(); Handler* h = i->handler_; w->focus_event(h, h); } void World::InsertApplication( Interactor* i, IntCoord left, IntCoord bottom, Alignment a ) { delete i->insert_window; ApplicationWindow* w = new ApplicationWindow(i); i->insert_window = w; i->managed_window = w; w->display(display_); w->pplace(left, bottom); AlignPosition(w, a); w->map(); Handler* h = i->handler_; w->focus_event(h, h); } void World::InsertToplevel(Interactor* i, Interactor* leader) { delete i->insert_window; TopLevelWindow* w = new TopLevelWindow(i); i->insert_window = w; i->managed_window = w; w->display(display_); Window* g; if (leader == i) { g = w; } else { g = leader->window; } w->group_leader(g); w->map(); Handler* h = i->handler_; w->focus_event(h, h); } void World::InsertToplevel( Interactor* i, Interactor* leader, IntCoord left, IntCoord bottom, Alignment a ) { delete i->insert_window; TopLevelWindow* w = new TopLevelWindow(i); i->insert_window = w; i->managed_window = w; w->display(display_); w->pplace(left, bottom); AlignPosition(w, a); Window* g; if (leader == i) { g = w; } else { g = leader->window; } w->group_leader(g); w->map(); Handler* h = i->handler_; w->focus_event(h, h); } class InteractorPopupWindow : public Window { public: InteractorPopupWindow(Glyph*); virtual ~InteractorPopupWindow(); protected: virtual void set_attributes(); }; InteractorPopupWindow::InteractorPopupWindow(Glyph* g) : Window(g) { } InteractorPopupWindow::~InteractorPopupWindow() { } void InteractorPopupWindow::set_attributes() { Window::set_attributes(); WindowRep& w = *rep(); w.xattrmask_ |= CWOverrideRedirect; w.xattrs_.override_redirect = True; } void World::InsertPopup(Interactor* i) { delete i->insert_window; Window* w = new InteractorPopupWindow(i); i->insert_window = w; i->managed_window = nil; w->display(display_); w->map(); } void World::InsertPopup( Interactor* i, IntCoord left, IntCoord bottom, Alignment a ) { delete i->insert_window; Window* w = new InteractorPopupWindow(i); i->insert_window = w; i->managed_window = nil; w->display(display_); w->pplace(left, bottom); AlignPosition(w, a); w->map(); } void World::InsertTransient(Interactor* i, Interactor* primary) { delete i->insert_window; TransientWindow* w = new TransientWindow(i); i->insert_window = w; i->managed_window = w; w->display(display_); Window* pw; if (primary == i) { pw = w; } else { pw = primary->managed_window; } w->group_leader(pw); w->transient_for(pw); w->map(); Handler* h = i->handler_; w->focus_event(h, h); } void World::InsertTransient( Interactor* i, Interactor* primary, IntCoord left, IntCoord bottom, Alignment a ) { delete i->insert_window; TransientWindow* w = new TransientWindow(i); i->insert_window = w; i->managed_window = w; w->display(display_); w->pplace(left, bottom); AlignPosition(w, a); Window* pw; if (primary == i) { pw = w; } else { pw = primary->managed_window; } w->group_leader(pw); w->transient_for(pw); w->map(); Handler* h = i->handler_; w->focus_event(h, h); } void World::InsertIcon(Interactor* i) { delete i->insert_window; IconWindow* w = new IconWindow(i); i->insert_window = w; i->managed_window = w; w->display(display_); w->map(); Handler* h = i->handler_; w->focus_event(h, h); } void World::InsertIcon( Interactor* i, IntCoord left, IntCoord bottom, Alignment a ) { delete i->insert_window; IconWindow* w = new IconWindow(i); i->insert_window = w; i->managed_window = w; w->display(display_); w->pplace(left, bottom); AlignPosition(w, a); w->map(); Handler* h = i->handler_; w->focus_event(h, h); } void World::Move(Interactor* i, IntCoord x, IntCoord y) { if (i->window != nil) { i->window->move(display_->to_coord(x), display_->to_coord(y)); } } void World::Raise(Interactor* i) { if (i->window != nil) { i->window->raise(); } } void World::Lower(Interactor* i) { if (i->window != nil) { i->window->lower(); } } void World::Change(Interactor* i) { Window* iw = i->insert_window; if (iw != nil) { WindowRep* w = iw->rep(); XWindow xw = w->xwindow_; if (xw != CanvasRep::unbound) { CanvasRep* c = i->canvas->rep(); Shape* s = i->GetShape(); if (c->pwidth_ != s->width || c->pheight_ != s->height) { iw->resize(); } else { i->Resize(); } } } } void World::Remove(Interactor* i) { i->parent = nil; if (i->insert_window != nil) { delete i->insert_window; i->insert_window = nil; i->managed_window = nil; } if (i->window != nil) { /* implicit i->Orphan() from InteractorWindow::unbind */ i->window->unbind(); i->Deactivate(); } } /* * Scene operations for manipulating interactor windows. */ void Scene::Place( Interactor* i, IntCoord l, IntCoord b, IntCoord r, IntCoord t, bool map ) { IntCoord x = l; IntCoord y = ymax - t; unsigned int width = r - l + 1; unsigned int height = t - b + 1; if (width == 0) { width = Math::round(inch); } if (height == 0){ height = Math::round(inch); } Display* d = window->display(); InteractorWindow* iw = i->window; XDisplay* dpy = d->rep()->display_; XWindow old_xwindow; if (iw != nil && iw->bound()) { old_xwindow = iw->Window::rep()->xwindow_; } else { old_xwindow = WindowRep::unbound; iw = new InteractorWindow(i, canvas->window()); i->window = iw; i->canvas = iw->canvas(); } iw->display(d); iw->style(i->style); WindowRep* w = iw->Window::rep(); CanvasRep* c = i->canvas->rep(); w->xpos_ = x; w->ypos_ = y; c->pwidth_ = width; c->pheight_ = height; c->width_ = d->to_coord(width); c->height_ = d->to_coord(height); if (old_xwindow == WindowRep::unbound) { iw->bind(); } else { XMoveResizeWindow(dpy, old_xwindow, x, y, width, height); } i->xmax = width - 1; i->ymax = height - 1; c->status_ = Canvas::mapped; i->Resize(); if (map) { XMapRaised(dpy, w->xwindow_); } } void Scene::Map(Interactor* i, bool raised) { if (window == nil || !window->bound() || i->window == nil) { return; } WindowRep* w = i->window->rep(); XDisplay* dpy = w->display_->rep()->display_; XWindow xw = w->xwindow_; if (raised) { XMapRaised(dpy, xw); } else { XMapWindow(dpy, xw); } i->canvas->rep()->status_ = Canvas::mapped; } void Scene::Unmap(Interactor* i) { if (window == nil || !window->bound() || i->window == nil) { return; } WindowRep* w = i->window->rep(); XUnmapWindow(w->display_->rep()->display_, w->xwindow_); i->canvas->rep()->status_ = Canvas::unmapped; } void Scene::Move(Interactor* i, IntCoord x, IntCoord y, Alignment a) { if (window == nil || !window->bound() || i->window == nil) { return; } IntCoord ax = x, ay = y; DoAlign(i, a, ax, ay); DoMove(i, ax, ay); Display* d = window->rep()->display_; i->window->move(d->to_coord(ax), d->to_coord(ay)); } neuron-7.6.3/src/lib/IV-2_6/xpainter.cpp000066400000000000000000001103061340731477100176420ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * X11-dependent painter code */ #include "../IV-X11/wtable.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include PainterRep::PainterRep() { display = Session::instance()->default_display(); DisplayRep* d = display->rep(); fillgc = XCreateGC(d->display_, d->root_, 0, nil); dashgc = XCreateGC(d->display_, d->root_, 0, nil); fillbg = true; overwrite = false; iv_xor = false; clipped = false; } PainterRep::~PainterRep() { XDisplay* dpy = display->rep()->display_; XFreeGC(dpy, fillgc); XFreeGC(dpy, dashgc); } void PainterRep::PrepareFill(const Pattern* p) { PatternRep& pr = *p->rep(); XDisplay* dpy = display->rep()->display_; if (pr.pixmap_ == nil) { XSetFillStyle(dpy, fillgc, FillSolid); } else if (fillbg) { XSetStipple(dpy, fillgc, pr.pixmap_); XSetFillStyle(dpy, fillgc, FillOpaqueStippled); } else { XSetStipple(dpy, fillgc, pr.pixmap_); XSetFillStyle(dpy, fillgc, FillStippled); } } void PainterRep::PrepareDash(const Brush* b) { BrushRep& br = *(b->rep(display)); XDisplay* dpy = display->rep()->display_; if (br.dash_list_ == nil) { XSetLineAttributes( dpy, dashgc, br.width_, LineSolid, CapButt, JoinMiter ); } else { XSetLineAttributes( dpy, dashgc, br.width_, LineOnOffDash, CapButt, JoinMiter ); XSetDashes(dpy, dashgc, 0, br.dash_list_, br.dash_count_); } } /* * Short-hand for allocating a vector of X points. * The idea is to use a static array if possible; otherwise * allocate/deallocate off the heap. */ static const int XPointListSize = 200; static XPoint xpoints[XPointListSize]; static XPoint* AllocPts(int n) { return (n <= XPointListSize) ? xpoints : new XPoint[n]; } static void FreePts(XPoint* v) { if (v != xpoints) { delete v; } } Painter::Painter() { rep = new PainterRep; Init(); } Painter::Painter(Painter* copy) { rep = new PainterRep; XDisplay* dpy = rep->display->rep()->display_; rep->fillbg = copy->rep->fillbg; rep->overwrite = copy->rep->overwrite; Copy(copy); if (copy->rep->iv_xor) { Begin_xor(); } rep->iv_xor = copy->rep->iv_xor; if (rep->overwrite) { XSetSubwindowMode(dpy, rep->fillgc, IncludeInferiors); XSetSubwindowMode(dpy, rep->dashgc, IncludeInferiors); } } Painter::~Painter() { Resource::unref(matrix); Resource::unref(font); Resource::unref(br); Resource::unref(foreground); Resource::unref(background); Resource::unref(pattern); delete rep; } void Painter::FillBg(bool b) { if (rep->fillbg != b) { if (rep->iv_xor) { End_xor(); } rep->fillbg = b; if (pattern != nil) { rep->PrepareFill(pattern); } if (br != nil) { rep->PrepareDash(br); } } } bool Painter::BgFilled() const { return rep->fillbg; } void Painter::SetColors(const Color* f, const Color* b) { if (rep->iv_xor) { End_xor(); } /* * Make sure to reference both new colors before unreferencing the old * in case the call is swapping colors. */ if (foreground != f) { Resource::ref(f); } if (background != b) { Resource::ref(b); } XDisplay* dpy = rep->display->rep()->display_; if (f != nil && foreground != f) { Resource::unref(foreground); foreground = f; unsigned long pixel = foreground->PixelValue(); XSetForeground(dpy, rep->fillgc, pixel); XSetForeground(dpy, rep->dashgc, pixel); } if (b != nil && background != b) { Resource::unref(background); background = b; unsigned long pixel = background->PixelValue(); XSetBackground(dpy, rep->fillgc, pixel); XSetBackground(dpy, rep->dashgc, pixel); } } void Painter::SetPattern(const Pattern* pat) { if (rep->iv_xor) { End_xor(); } if (pattern != pat) { Resource::ref(pat); Resource::unref(pattern); pattern = pat; if (pattern != nil) { rep->PrepareFill(pattern); } } } void Painter::SetBrush(const Brush* b) { if (rep->iv_xor) { End_xor(); } if (br != b) { Resource::ref(b); Resource::unref(br); br = b; if (br != nil) { rep->PrepareDash(br); } } } void Painter::SetFont(const Font* f) { if (font != f) { Resource::ref(f); Resource::unref(font); font = f; if (font != nil) { Display* d = rep->display; XSetFont( d->rep()->display_, rep->fillgc, font->rep(d)->font_->fid ); } } } void Painter::Clip( Canvas* c, IntCoord left, IntCoord bottom, IntCoord right, IntCoord top ) { XRectangle& r = rep->xclip[0]; IntCoord x, y; XDisplay* d = rep->display->rep()->display_; if (left > right) { x = right; r.width = left - right + 1; } else { x = left; r.width = right - left + 1; } if (bottom > top) { y = bottom; r.height = bottom - top + 1; } else { y = top; r.height = top - bottom + 1; } r.x = x; r.y = c->pheight() - 1 - y; if (r.x == 0 && r.y == 0 && r.width == c->pwidth() && r.height == c->pheight() ) { /* clipping to entire canvas is equivalent to no clipping at all */ NoClip(); } else { rep->clipped = true; XSetClipRectangles(d, rep->fillgc, 0, 0, rep->xclip, 1, Unsorted); XSetClipRectangles(d, rep->dashgc, 0, 0, rep->xclip, 1, Unsorted); } } void Painter::NoClip() { XDisplay* dpy = rep->display->rep()->display_; rep->clipped = false; XSetClipMask(dpy, rep->fillgc, None); XSetClipMask(dpy, rep->dashgc, None); } void Painter::SetOverwrite(bool children) { if (rep->overwrite != children) { XDisplay* dpy = rep->display->rep()->display_; rep->overwrite = children; XSetSubwindowMode( dpy, rep->fillgc, children ? IncludeInferiors : ClipByChildren ); XSetSubwindowMode( dpy, rep->dashgc, children ? IncludeInferiors : ClipByChildren ); } } void Painter::SetPlaneMask(int m) { XDisplay* dpy = rep->display->rep()->display_; XSetPlaneMask(dpy, rep->fillgc, m); XSetPlaneMask(dpy, rep->dashgc, m); } void Painter::Map( Canvas* c, IntCoord x, IntCoord y, IntCoord& mx, IntCoord& my ) { if (matrix == nil) { mx = x; my = y; } else { matrix->Transform(x, y, mx, my); } mx += xoff; my = c->pheight() - 1 - (my + yoff); } void Painter::MapList( Canvas* c, IntCoord x[], IntCoord y[], int n, IntCoord mx[], IntCoord my[] ) { IntCoord* xp, * yp, * mxp, * myp; IntCoord* lim; xp = x; yp = y; mxp = mx; myp = my; lim = &x[n]; if (matrix == nil) { for (; xp < lim; xp++, yp++, mxp++, myp++) { *mxp = *xp + xoff; *myp = c->pheight() - 1 - (*yp + yoff); } } else { for (; xp < lim; xp++, yp++, mxp++, myp++) { matrix->Transform(*xp, *yp, *mxp, *myp); *mxp += xoff; *myp = c->pheight() - 1 - (*myp + yoff); } } } void Painter::MapList( Canvas* c, float x[], float y[], int n, IntCoord mx[], IntCoord my[] ) { register float* xp, * yp; register IntCoord* mxp, * myp; float tmpx, tmpy, * lim; xp = x; yp = y; mxp = mx; myp = my; lim = &x[n]; if (matrix == nil) { for (; xp < lim; xp++, yp++, mxp++, myp++) { *mxp = Math::round(*xp + xoff); *myp = Math::round(c->pheight() - 1 - (*yp + yoff)); } } else { for (; xp < lim; xp++, yp++, mxp++, myp++) { matrix->Transform(*xp, *yp, tmpx, tmpy); *mxp = Math::round(tmpx + xoff); *myp = Math::round(c->pheight() - 1 - (tmpy + yoff)); } } } void Painter::Begin_xor() { if (!rep->iv_xor) { rep->iv_xor = true; DisplayRep& d = *rep->display->rep(); XDisplay* dpy = d.display_; unsigned long xor_pixel = d.default_visual_->iv_xor(*d.style_); XSetFunction(dpy, rep->fillgc, GXxor); XSetForeground(dpy, rep->fillgc, xor_pixel); XSetFillStyle(dpy, rep->fillgc, FillSolid); XSetFunction(dpy, rep->dashgc, GXxor); XSetForeground(dpy, rep->dashgc, xor_pixel); XSetFillStyle(dpy, rep->dashgc, FillSolid); } } void Painter::End_xor() { if (rep->iv_xor) { rep->iv_xor = false; XDisplay* dpy = rep->display->rep()->display_; XSetFunction(dpy, rep->fillgc, GXcopy); unsigned long pixel = foreground->PixelValue(); XSetForeground(dpy, rep->fillgc, pixel); if (pattern != nil) { rep->PrepareFill(pattern); } XSetFunction(dpy, rep->dashgc, GXcopy); XSetForeground(dpy, rep->dashgc, pixel); if (br != nil) { rep->PrepareDash(br); } } } inline unsigned char _txkey (int i) { if (i >= 0) { return ( i<32 ? i : i<160 ? 24 + (i>>2) : i<672 ? 54 + (i>>4) : 127 ); } else { return ( i>-32 ? i : i>-160 ? -24 - (i>>2) : i>-672 ? -54 - (i>>4) : -127 ); } } static int TxKey(Transformer* t, int x, int y) { if (t == nil) { return 0; } else { float x1, y1, x2, y2, x3, y3; t->matrix(x1, y1, x2, y2, x3, y3); x1 = x1 - 1.0; y2 = y2 - 1.0; return ( (_txkey((int)(x1*x)) << 24) + (_txkey((int)(y1*y)) << 16) + (_txkey((int)(x2*x)) << 8) + (_txkey((int)(y2*y))) ); } } /* * Per-display shared painter information. */ class Bitmap; declareTable2(BitmapTable,XFont,int,Bitmap*) implementTable2(BitmapTable,XFont,int,Bitmap*) declareTable2(RasterTable,const Raster*,int,RasterRep*) implementTable2(RasterTable,const Raster*,int,RasterRep*) class PainterDpyInfoList; class PainterDpyInfo { public: Display* display_; BitmapTable* btable_; BitmapTable* txtable_; RasterTable* tx_rasters_; static PainterDpyInfoList* info_list_; enum { TxFontsDefault, TxFontsOff, TxFontsOn, TxFontsCache } txfonts; enum { TxImagesDefault, TxImagesAuto, TxImagesDest, TxImagesSource } tximages; static PainterDpyInfo* find(Display*); int tx_key(const Transformer&, Coord x, Coord y); Bitmap* get_char_bitmap(const Font*, int c, int k, const Transformer&); RasterRep* tx_raster(const Raster*, const Transformer&); }; PainterDpyInfoList* PainterDpyInfo::info_list_; declarePtrList(PainterDpyInfoList,PainterDpyInfo); implementPtrList(PainterDpyInfoList,PainterDpyInfo); PainterDpyInfo* PainterDpyInfo::find(Display* d) { if (info_list_ == nil) { info_list_ = new PainterDpyInfoList(3); } for (ListItr(PainterDpyInfoList) i(*info_list_); i.more(); i.next()) { PainterDpyInfo* p = i.cur(); if (p->display_ == d) { return p; } } PainterDpyInfo* p = new PainterDpyInfo; p->display_ = d; p->btable_ = nil; p->txtable_ = nil; p->tx_rasters_ = nil; p->txfonts = PainterDpyInfo::TxFontsDefault; p->tximages = PainterDpyInfo::TxImagesDefault; String v; if (d->style()->find_attribute("TransformFonts", v)) { if (v.case_insensitive_equal("on")) { p->txfonts = PainterDpyInfo::TxFontsOn; } else if (v.case_insensitive_equal("off")) { p->txfonts = PainterDpyInfo::TxFontsOff; } else if (v.case_insensitive_equal("cache")) { p->txfonts = PainterDpyInfo::TxFontsCache; } } if (d->style()->find_attribute("TransformImages", v)) { if (v.case_insensitive_equal("auto")) { p->tximages = PainterDpyInfo::TxImagesAuto; } else if (v.case_insensitive_equal("off")) { p->tximages = PainterDpyInfo::TxImagesDest; } else if (v.case_insensitive_equal("source")) { p->tximages = PainterDpyInfo::TxImagesSource; } } info_list_->append(p); return p; } int PainterDpyInfo::tx_key(const Transformer& tx, Coord x, Coord y) { Coord x1, y1, x2, y2, x3, y3; tx.transform(0, 0, x1, y1); tx.transform(0, y, x2, y2); tx.transform(x, 0, x3, y3); int k1 = _txkey(int(x2 - x1)) & 0xff; int k2 = _txkey(int(y2 - y1 - y)) & 0xff; int k3 = _txkey(int(x3 - x1 - x)) & 0xff; int k4 = _txkey(int(y3 - y1)) & 0xff; return (k1 << 24) + (k2 << 16) + (k3 << 8) + k4; } Bitmap* PainterDpyInfo::get_char_bitmap( const Font* f, int c, int k, const Transformer& t ) { if (btable_ == nil) { btable_ = new BitmapTable(256); txtable_ = new BitmapTable(1024); } Bitmap* basic; XFont fid = f->rep(display_)->font_->fid; if (!btable_->find(basic, fid, c)) { basic = new Bitmap(f, c); Resource::ref(basic); btable_->insert(fid, c, basic); } Bitmap* tx; Pixmap mapid = basic->rep()->pixmap_; if (!txtable_->find(tx, mapid, k)) { tx = new Bitmap(*basic); Resource::ref(tx); tx->Transform(&t); txtable_->insert(mapid, k, tx); } return tx; } RasterRep* PainterDpyInfo::tx_raster( const Raster* r, const Transformer& tx ) { int key = tx_key(tx, r->width(), r->height()); if (key == 0) { return r->rep(); } else { if (tx_rasters_ == nil) { tx_rasters_ = new RasterTable(1024); } RasterRep* rep; if (!tx_rasters_->find(rep, r, key)) { Display* d = r->rep()->display_; rep = new RasterRep; Transformer v(tx); Coord x0, y0; v.transform(0, 0, x0, y0); v.translate(-x0, -y0); Coord x1, x2, x3, x4; Coord y1, y2, y3, y4; v.transform(-r->left_bearing(), -r->descent(), x1, y1); v.transform(-r->left_bearing(), r->ascent(), x2, y2); v.transform(r->right_bearing(), r->ascent(), x3, y3); v.transform(r->right_bearing(), -r->descent(), x4, y4); Coord xmax = Math::max(x1, x2, x3, x4); Coord xmin = Math::min(x1, x2, x3, x4); Coord ymax = Math::max(y1, y2, y3, y4); Coord ymin = Math::min(y1, y2, y3, y4); int width = d->to_pixels(xmax) - d->to_pixels(xmin); int height = d->to_pixels(ymax) - d->to_pixels(ymin); if (width <= 0) { width = 1; } if (height <= 0) { height = 1; } DisplayRep& dr = *d->rep(); XDisplay* dpy = dr.display_; RasterRep* srep = r->rep(); XImage* source = XGetImage( dpy, srep->pixmap_, 0, 0, srep->pwidth_, srep->pheight_, AllPlanes, ZPixmap ); Pixmap map = XCreatePixmap( dpy, dr.root_, width, height, dr.default_visual_->depth() ); GC xgc = XCreateGC(dpy, map, 0, nil); XSetForeground(dpy, xgc, 0); XFillRectangle(dpy, map, xgc, 0, 0, width, height); XImage* dest = XGetImage( dpy, map, 0, 0, width, height, AllPlanes, ZPixmap ); int dx0 = d->to_pixels(-xmin); int dy0 = d->to_pixels(-ymin); int sx0 = d->to_pixels(r->left_bearing()); int sy0 = d->to_pixels(r->descent()); for (int dy = 0; dy < height; ++dy) { Coord tx1, ty1, tx2, ty2; v.inverse_transform(- dx0, dy - dy0, tx1, ty1); v.inverse_transform(width - dx0, dy - dy0, tx2, ty2); float delta_x = (tx2 - tx1) / width; float delta_y = (ty2 - ty1) / width; int sx, sy; for (int dx = 0; dx < width; ++dx) { sx = int(tx1) + sx0; sy = int(ty1) + sy0; if ( sx >= 0 && sx < srep->pwidth_ && sy >= 0 && sy < srep->pheight_ ) { XPutPixel( dest, dx, height - 1 - dy, XGetPixel(source, sx, srep->pheight_ - 1 - sy) ); } tx1 = tx1 + delta_x; ty1 = ty1 + delta_y; } } XPutImage(dpy, map, xgc, dest, 0, 0, 0, 0, width, height); XFreeGC(dpy, xgc); XDestroyImage(source); XDestroyImage(dest); rep->display_ = d; rep->pixmap_ = map; rep->pwidth_ = width; rep->pheight_ = height; rep->width_ = xmax - xmin; rep->height_ = ymax - ymin; rep->left_ = xmin; rep->right_ = xmax; rep->bottom_ = ymin; rep->top_ = ymax; tx_rasters_->insert(r, key, rep); } return rep; } } void Painter::Stencil( Canvas* c, IntCoord x, IntCoord y, Bitmap* bitmap, Bitmap* mask ) { if (c == nil) { return; } Display* d = rep->display; XDisplay* dpy = d->rep()->display_; XDrawable xid = c->rep()->xdrawable_; if (xid == CanvasRep::unbound) { return; } if (rep->iv_xor) { End_xor(); } int tx = TxKey(matrix, bitmap->pwidth(), bitmap->pheight()); if (tx == 0) { IntCoord dx, dy; IntCoord dl = x - d->to_pixels(bitmap->left_bearing()); IntCoord dt = y + d->to_pixels(bitmap->ascent()); Map(c, dl, dt - 1, dx, dy); if (mask == nil) { XCopyPlane( dpy, bitmap->rep()->pixmap_, xid, rep->fillgc, 0, 0, bitmap->pwidth(), bitmap->pheight(), dx, dy, 1 ); } else if (mask == bitmap) { XSetForeground(dpy, rep->fillgc, 0); XSetBackground(dpy, rep->fillgc, AllPlanes); XSetFunction(dpy, rep->fillgc, GXand); XCopyPlane( dpy, bitmap->rep()->pixmap_, xid, rep->fillgc, 0, 0, bitmap->pwidth(), bitmap->pheight(), dx, dy, 1 ); XSetForeground(dpy, rep->fillgc, foreground->PixelValue()); XSetBackground(dpy, rep->fillgc, 0); XSetFunction(dpy, rep->fillgc, GXxor); XCopyPlane( dpy, bitmap->rep()->pixmap_, xid, rep->fillgc, 0, 0, bitmap->pwidth(), bitmap->pheight(), dx, dy, 1 ); XSetBackground(dpy, rep->fillgc, background->PixelValue()); XSetFunction(dpy, rep->fillgc, GXcopy); } else { IntCoord mx, my; IntCoord ml = x - d->to_pixels(mask->left_bearing()); IntCoord mt = y + d->to_pixels(mask->ascent()); Map(c, ml, mt - 1, mx, my); GC gc = XCreateGC(dpy, d->rep()->root_, 0, nil); XSetForeground(dpy, gc, foreground->PixelValue()); XSetBackground(dpy, gc, background->PixelValue()); XSetGraphicsExposures(dpy, gc, False); XSetClipOrigin(dpy, gc, mx, my); XSetClipMask(dpy, gc, mask->rep()->pixmap_); XCopyPlane( dpy, bitmap->rep()->pixmap_, xid, gc, 0, 0, bitmap->pwidth(), bitmap->pheight(), dx, dy, 1 ); XFreeGC(dpy, gc); } } else { bitmap->rep()->fill(); if (mask != nil) { mask->rep()->fill(); DrawTransformedImage( bitmap->rep()->image_, x - d->to_pixels(bitmap->left_bearing()), y - d->to_pixels(bitmap->descent()), mask->rep()->image_, x - d->to_pixels(mask->left_bearing()), y - d->to_pixels(mask->descent()), xid, c->pheight(), -xoff, -yoff, true, foreground->PixelValue(), background->PixelValue(), rep->fillgc, *matrix ); } else { DrawTransformedImage( bitmap->rep()->image_, x - d->to_pixels(bitmap->left_bearing()), y - d->to_pixels(bitmap->descent()), nil, 0, 0, xid, c->pheight(), -xoff, -yoff, true, foreground->PixelValue(), background->PixelValue(), rep->fillgc, *matrix ); } } } void Painter::RasterRect(Canvas* c, IntCoord x, IntCoord y, Raster* r) { if (c == nil) { return; } Display* d = r->rep()->display_; XDisplay* dpy = d->rep()->display_; XDrawable xid = c->rep()->xdrawable_; if (xid == CanvasRep::unbound) { return; } r->flush(); PainterDpyInfo& p = *PainterDpyInfo::find(rep->display); RasterRep* info = (matrix == nil) ? r->rep() : p.tx_raster(r, *matrix); IntCoord rw = (unsigned int)r->pwidth(); IntCoord rh = (unsigned int)r->pheight(); IntCoord x1, y1, x2, y2, x3, y3, x4, y4; Map(c, x, y, x1, y1); Map(c, x, y + rh, x2, y2); Map(c, x + rw, y + rh, x3, y3); Map(c, x + rw, y, x4, y4); IntCoord xmin = Math::min(x1, x2, x3, x4); IntCoord ymin = Math::min(y1, y2, y3, y4); XPoint clip_area[4]; clip_area[0].x = x1; clip_area[0].y = y1; clip_area[1].x = x2; clip_area[1].y = y2; clip_area[2].x = x3; clip_area[2].y = y3; clip_area[3].x = x4; clip_area[3].y = y4; Region rg = XPolygonRegion(clip_area, 4, EvenOddRule); if (rep->clipped) { Region tmp = XCreateRegion(); XUnionRectWithRegion(&rep->xclip[0], tmp, tmp); XIntersectRegion(rg, tmp, rg); XDestroyRegion(tmp); } XSetRegion(dpy, rep->fillgc, rg); XSetGraphicsExposures(dpy, rep->fillgc, False); XCopyArea( dpy, info->pixmap_, xid, rep->fillgc, 0, 0, info->pwidth_, info->pheight_, xmin, ymin ); XSetGraphicsExposures(dpy, rep->fillgc, True); XDestroyRegion(rg); if (rep->clipped) { XSetClipRectangles(dpy, rep->fillgc, 0, 0, rep->xclip, 1, Unsorted); } else { NoClip(); } } void Painter::Text(Canvas* c, const char* s, int len, IntCoord x, IntCoord y) { if (c == nil) { return; } XDisplay* d = rep->display->rep()->display_; XDrawable xid = c->rep()->xdrawable_; if (xid == CanvasRep::unbound) { return; } IntCoord x0, y0; IntCoord ybase = y + font->Baseline() + 1; IntCoord ytop = y + font->Height(); int txstring = TxKey(matrix, font->Width(s, len), font->Height()); if (style & Reversed) { SetColors(GetBgColor(), GetFgColor()); } if (txstring == 0) { Map(c, x, ybase - 1, x0, y0); if (rep->fillbg) { XDrawImageString( d, xid, rep->fillgc, x0, y0, s, len ); } else { XDrawString( d, xid, rep->fillgc, x0, y0, s, len ); } if (style & Boldface) { XDrawString( d, xid, rep->fillgc, x0-1, y0, s, len ); } } else { IntCoord curx1 = x; float fx0, fy0; Transformer notrans(*matrix); notrans.Transform(0.0, 0.0, fx0, fy0); notrans.Translate(-fx0, -fy0); int txchar = TxKey(matrix, font->Width("M"), font->Height()); Bitmap* bits; PainterDpyInfo& p = *PainterDpyInfo::find(rep->display); Transformer* oldmatrix; for (int i = 0; i < len; ++i) { IntCoord nextx = curx1 + font->Width(s+i, 1); if (rep->fillbg) { ClearRect(c, curx1, y, nextx, ytop); } switch (p.txfonts) { case PainterDpyInfo::TxFontsOff: Map(c, curx1, ybase - 1, x0, y0); XDrawString( d, xid, rep->fillgc, x0, y0, s+i, 1 ); if (style & Boldface) { XDrawString( d, xid, rep->fillgc, x0-1, y0, s+i, 1 ); } break; case PainterDpyInfo::TxFontsOn: bits = new Bitmap(font, s[i]); Stencil(c, curx1, ybase, bits, bits); if (style & Boldface) { Stencil(c, curx1-1, ybase, bits, bits); } break; case PainterDpyInfo::TxFontsCache: case PainterDpyInfo::TxFontsDefault: bits = p.get_char_bitmap(font, s[i], txchar, notrans); oldmatrix = matrix; matrix = nil; oldmatrix->Transform(curx1, ybase, x0, y0); Stencil(c, x0, y0, bits, bits); if (style & Boldface) { oldmatrix->Transform(curx1+1, ybase, x0, y0); Stencil(c, x0, y0, bits, bits); } matrix = oldmatrix; break; } curx1 = nextx; } } if (style & Outlined) { /* unimplemented */ } if (style & Underlined) { Line(c, x, ybase, x + font->Width(s, len) - 1, ybase); } if (style & Reversed) { SetColors(GetBgColor(), GetFgColor()); } } void Painter::Point(Canvas* c, IntCoord x, IntCoord y) { if (c == nil) { return; } CanvasRep* cr = c->rep(); if (cr->xdrawable_ == CanvasRep::unbound) { return; } IntCoord mx, my; Map(c, x, y, mx, my); XDrawPoint(cr->dpy(), cr->xdrawable_, rep->fillgc, mx, my); } void Painter::MultiPoint(Canvas* c, IntCoord x[], IntCoord y[], int n) { if (c == nil) { return; } CanvasRep* cr = c->rep(); if (cr->xdrawable_ == CanvasRep::unbound) { return; } register XPoint* v = AllocPts(n); for (register int i = 0; i < n; i++) { Map(c, x[i], y[i], v[i].x, v[i].y); } XDrawPoints(cr->dpy(), cr->xdrawable_, rep->fillgc, v, n, CoordModeOrigin); FreePts(v); } void Painter::Line( Canvas* c, IntCoord x1, IntCoord y1, IntCoord x2, IntCoord y2 ) { if (c == nil) { return; } CanvasRep* cr = c->rep(); if (cr->xdrawable_ == CanvasRep::unbound) { return; } IntCoord mx1, my1, mx2, my2; Map(c, x1, y1, mx1, my1); Map(c, x2, y2, mx2, my2); XDrawLine(cr->dpy(), cr->xdrawable_, rep->dashgc, mx1, my1, mx2, my2); } void Painter::Rect( Canvas* c, IntCoord x1, IntCoord y1, IntCoord x2, IntCoord y2 ) { if (c == nil) { return; } CanvasRep* cr = c->rep(); if (cr->xdrawable_ == CanvasRep::unbound) { return; } if (matrix != nil && matrix->Rotated() && !matrix->Rotated90()) { IntCoord x[4], y[4]; x[0] = x[3] = x1; x[1] = x[2] = x2; y[0] = y[1] = y1; y[2] = y[3] = y2; Polygon(c, x, y, 4); } else { IntCoord left, bottom, right, top, tmp; int w, h; Map(c, x1, y1, left, bottom); Map(c, x2, y2, right, top); if (left > right) { tmp = left; left = right; right = tmp; } if (top > bottom) { tmp = bottom; bottom = top; top = tmp; } w = right - left; h = bottom - top; XDrawRectangle( cr->dpy(), cr->xdrawable_, rep->dashgc, left, top, w, h ); } } void Painter::FillRect( Canvas* c, IntCoord x1, IntCoord y1, IntCoord x2, IntCoord y2 ) { if (c == nil) { return; } CanvasRep* cr = c->rep(); if (cr->xdrawable_ == CanvasRep::unbound) { return; } if (matrix != nil && matrix->Rotated() && !matrix->Rotated90()) { IntCoord x[4], y[4]; x[0] = x[3] = x1; x[1] = x[2] = x2; y[0] = y[1] = y1; y[2] = y[3] = y2; FillPolygon(c, x, y, 4); } else { IntCoord left, bottom, right, top, tmp; Map(c, x1, y1, left, bottom); Map(c, x2, y2, right, top); if (left > right) { tmp = left; left = right; right = tmp; } if (top > bottom) { tmp = bottom; bottom = top; top = tmp; } unsigned int w = right - left + 1; unsigned int h = bottom - top + 1; XFillRectangle( cr->dpy(), cr->xdrawable_, rep->fillgc, left, top, w, h ); } } void Painter::ClearRect( Canvas* c, IntCoord x1, IntCoord y1, IntCoord x2, IntCoord y2 ) { if (c == nil) { return; } CanvasRep* cr = c->rep(); if (cr->xdrawable_ == CanvasRep::unbound) { return; } XDisplay* dpy = cr->dpy(); XSetForeground(dpy, rep->fillgc, background->PixelValue()); XSetFillStyle(dpy, rep->fillgc, FillSolid); FillRect(c, x1, y1, x2, y2); XSetForeground(dpy, rep->fillgc, foreground->PixelValue()); rep->PrepareFill(pattern); } void Painter::Circle(Canvas* c, IntCoord x, IntCoord y, int r) { if (c == nil) { return; } CanvasRep* cr = c->rep(); if (cr->xdrawable_ == CanvasRep::unbound) { return; } if (matrix != nil && (matrix->Stretched() || matrix->Rotated())) { Ellipse(c, x, y, r, r); } else { IntCoord left, top, right, bottom, tmp; Map(c, x-r, y+r, left, top); Map(c, x+r, y-r, right, bottom); if (left > right) { tmp = left; left = right; right = tmp; } if (top > bottom) { tmp = bottom; bottom = top; top = tmp; } XDrawArc( cr->dpy(), cr->xdrawable_, rep->dashgc, left, top, right-left, bottom-top, 0, 360*64 ); } } void Painter::FillCircle(Canvas* c, IntCoord x, IntCoord y, int r) { if (c == nil) { return; } CanvasRep* cr = c->rep(); if (cr->xdrawable_ == CanvasRep::unbound) { return; } if (matrix != nil && (matrix->Stretched() || matrix->Rotated())) { FillEllipse(c, x, y, r, r); } else { IntCoord left, top, right, bottom, tmp; Map(c, x-r, y+r, left, top); Map(c, x+r, y-r, right, bottom); if (left > right) { tmp = left; left = right; right = tmp; } if (top > bottom) { tmp = bottom; bottom = top; top = tmp; } XFillArc( cr->dpy(), cr->xdrawable_, rep->fillgc, left, top, right-left, bottom-top, 0, 360*64 ); } } void Painter::MultiLine(Canvas* c, IntCoord x[], IntCoord y[], int n) { if (c == nil) { return; } CanvasRep* cr = c->rep(); if (cr->xdrawable_ == CanvasRep::unbound) { return; } register XPoint* v = AllocPts(n); for (register int i = 0; i < n; i++) { Map(c, x[i], y[i], v[i].x, v[i].y); } XDrawLines(cr->dpy(), cr->xdrawable_, rep->dashgc, v, n, CoordModeOrigin); FreePts(v); } void Painter::MultiLineNoMap(Canvas* c, IntCoord x[], IntCoord y[], int n) { if (c == nil) { return; } CanvasRep* cr = c->rep(); if (cr->xdrawable_ == CanvasRep::unbound) { return; } register XPoint* v = AllocPts(n); for (register int i = 0; i < n; i++) { v[i].x = x[i]; v[i].y = y[i]; } XDrawLines(cr->dpy(), cr->xdrawable_, rep->dashgc, v, n, CoordModeOrigin); FreePts(v); } void Painter::Polygon(Canvas* c, IntCoord x[], IntCoord y[], int n) { if (c == nil) { return; } CanvasRep* cr = c->rep(); if (cr->xdrawable_ == CanvasRep::unbound) { return; } register XPoint* v = AllocPts(n+1); register int i; for (i = 0; i < n; i++) { Map(c, x[i], y[i], v[i].x, v[i].y); } if (x[i-1] != x[0] || y[i-1] != y[0]) { v[i] = v[0]; ++i; } XDrawLines(cr->dpy(), cr->xdrawable_, rep->dashgc, v, i, CoordModeOrigin); FreePts(v); } void Painter::FillPolygonNoMap(Canvas* c, IntCoord x[], IntCoord y[], int n) { if (c == nil) { return; } CanvasRep* cr = c->rep(); if (cr->xdrawable_ == CanvasRep::unbound) { return; } register XPoint* v = AllocPts(n); for (register int i = 0; i < n; i++) { v[i].x = x[i]; v[i].y = y[i]; } XFillPolygon( cr->dpy(), cr->xdrawable_, rep->fillgc, v, n, Complex, CoordModeOrigin ); FreePts(v); } void Painter::FillPolygon(Canvas* c, IntCoord x[], IntCoord y[], int n) { if (c == nil) { return; } CanvasRep* cr = c->rep(); if (cr->xdrawable_ == CanvasRep::unbound) { return; } register XPoint* v = AllocPts(n+1); for (register int i = 0; i < n; i++) { Map(c, x[i], y[i], v[i].x, v[i].y); } XFillPolygon( cr->dpy(), cr->xdrawable_, rep->fillgc, v, n, Complex, CoordModeOrigin ); FreePts(v); } void Painter::Copy( Canvas* src, IntCoord x1, IntCoord y1, IntCoord x2, IntCoord y2, Canvas* dst, IntCoord x0, IntCoord y0 ) { if (src == nil || dst == nil) { return; } XDisplay* dpy = dst->rep()->dpy(); XDrawable src_xid = src->rep()->xdrawable_; XDrawable dst_xid = dst->rep()->xdrawable_; if (src_xid == CanvasRep::unbound || dst_xid == CanvasRep::unbound) { return; } IntCoord sx1, sy1, sx2, sy2, sx3, sy3, sx4, sy4, dx1, dy1; if (matrix == nil) { sx1 = x1; sy1 = y1; sx2 = x1; sy2 = y2; sx3 = x2; sy3 = y2; sx4 = x2; sy4 = y1; dx1 = x0; dy1 = y0; } else { Transformer t(*matrix); t.Transform(x1, y1, sx1, sy1); t.Transform(x1, y2, sx2, sy2); t.Transform(x2, y2, sx3, sy3); t.Transform(x2, y1, sx4, sy4); t.Transform(x0, y0, dx1, dy1); } int minx = Math::min(sx1, sx2, sx3, sx4); int maxx = Math::max(sx1, sx2, sx3, sx4); int miny = Math::min(sy1, sy2, sy3, sy4); int maxy = Math::max(sy1, sy2, sy3, sy4); int w = maxx - minx + 1; int h = maxy - miny + 1; int sx = minx + xoff; int sy = src->pheight() - 1 - (maxy + yoff); int dx = dx1 - (sx1 - minx) + xoff; int dy = dst->pheight() - 1 - (dy1 - (sy1 - maxy) + yoff); if ((sx1 == sx2 || sy1 == sy2) && (sx1 == sx4 || sy1 == sy4)) { if (src->status() == Canvas::offscreen) { XSetGraphicsExposures(dpy, rep->fillgc, False); XCopyArea( dpy, src_xid, dst_xid, rep->fillgc, sx, sy, w, h, dx, dy ); XSetGraphicsExposures(dpy, rep->fillgc, True); } else { XCopyArea( dpy, src_xid, dst_xid, rep->fillgc, sx, sy, w, h, dx, dy ); dst->rep()->wait_for_copy(); } } else { GC copygc = XCreateGC(dpy, dst_xid, 0, nil); Pixmap mask; mask = XCreatePixmap(dpy, rep->display->rep()->root_, w, h, 1); GC maskgc = XCreateGC(dpy, mask, 0, nil); XSetForeground(dpy, maskgc, 0); XFillRectangle(dpy, mask, maskgc, 0, 0, w, h); XSetForeground(dpy, maskgc, 1); XPoint v[4]; v[0].x = sx1 - minx; v[0].y = maxy - sy1; v[1].x = sx2 - minx; v[1].y = maxy - sy2; v[2].x = sx3 - minx; v[2].y = maxy - sy3; v[3].x = sx4 - minx; v[3].y = maxy - sy4; XFillPolygon(dpy, mask, maskgc, v, 4, Convex, CoordModeOrigin); XFreeGC(dpy, maskgc); XSetClipOrigin(dpy, copygc, dx, dy); XSetClipMask(dpy, copygc, mask); if (src->status() == Canvas::offscreen) { XSetGraphicsExposures(dpy, copygc, False); XCopyArea( dpy, src_xid, dst_xid, copygc, sx, sy, w, h, dx, dy ); XSetGraphicsExposures(dpy, copygc, True); } else { XCopyArea( dpy, src_xid, dst_xid, copygc, sx, sy, w, h, dx, dy ); dst->rep()->wait_for_copy(); } XFreePixmap(dpy, mask); XFreeGC(dpy, copygc); } } /* anachronism */ void CanvasRep::wait_for_copy() { Event e; XEvent& xe = e.rep()->xevent_; DisplayRep* r = display_->rep(); XDisplay* dpy = r->display_; WindowTable* wt = r->wtable_; Window* w; bool keep_waiting = true; while (keep_waiting) { XWindowEvent(dpy, xdrawable_, ExposureMask, &xe); switch (xe.type) { case NoExpose: keep_waiting = false; break; case Expose: if (wt->find(w, xe.xexpose.window)) { w->receive(e); } break; case GraphicsExpose: if (wt->find(w, xe.xgraphicsexpose.drawable)) { w->receive(e); } if (xe.xgraphicsexpose.count == 0) { keep_waiting = false; } break; } } } neuron-7.6.3/src/lib/IV-2_6/xpattern.cpp000066400000000000000000000061561340731477100176640ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include #include #include #include Pattern::Pattern() { init(nil, 0, 0); } Pattern::Pattern(const char* pattern, unsigned int w, unsigned int h) { init(pattern, w, h); } Pattern::Pattern(int pattern) { char p[4]; p[0] = (pattern & 0xf000) >> 12; p[1] = (pattern & 0x0f00) >> 8; p[2] = (pattern & 0x00f0) >> 4; p[3] = (pattern & 0x000f); init(p, 4, 4); } Pattern::Pattern(const int* pattern) { char p[32]; register char* pp = p; for (register int i = 0; i < 16; i++) { int scanline = pattern[i]; *pp++ = (scanline & 0xff00) >> 8; *pp++ = scanline & 0x00ff; } init(p, 16, 16); } static bool is_solid( unsigned char* pat, unsigned int width, unsigned int height ) { unsigned int nbits = width * height; unsigned int n_whole_bytes = nbits >> 3; unsigned char* last_byte = &pat[n_whole_bytes]; for (register unsigned char* cp = pat; cp < last_byte; cp++) { if (*cp != 0xff) { return false; } } nbits -= n_whole_bytes << 3; if (nbits == 0) { return true; } unsigned int mask = (1 << nbits) - 1; return (*last_byte & mask) == mask; } void Pattern::init( const char* pattern, unsigned int width, unsigned int height ) { rep_ = new PatternRep; rep_->display_ = Session::instance()->default_display(); if (pattern != nil && !is_solid((unsigned char*)pattern, width, height)) { DisplayRep* r = rep_->display_->rep(); rep_->pixmap_ = XCreateBitmapFromData( r->display_, r->root_, pattern, width, height ); } else { rep_->pixmap_ = 0; } } Pattern::~Pattern() { PatternRep* p = rep_; if (p->pixmap_ != 0) { XFreePixmap(p->display_->rep()->display_, p->pixmap_); } delete p; } neuron-7.6.3/src/lib/IV-Mac/000077500000000000000000000000001340731477100154155ustar00rootroot00000000000000neuron-7.6.3/src/lib/IV-Mac/bitmap.cpp000066400000000000000000000124041340731477100173760ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif // ========================================================================= // // // // MS-Windows implementation of the InterViews bitmap class. // // The windows data structure BITMAP is used until the bitmap is needed // for actual rendering in the canvas, at which time a temporary GDI object // is created. Operations on this bitmap are therefore very light-weight. // // // 1.1 // 1997/03/28 17:36:11 // // Windows 3.1/NT Port // Copyright (c) 1993 Tim Prinzing // // This media contains programs and data which are proprietary // to Tim Prinzing. // // These contents are provided under a Tim Prinzing software source // license, which prohibits their unauthorized resale or distribution // outside of the buyer's organization. // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL Tim Prinzing BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // // ========================================================================= #include #include #include #include #include #include Bitmap::Bitmap() { rep_ = nil; } // ----------------------------------------------------------------------- // Create a named bitmap. In the Windows world, this means a resource // based bitmap. The name of the bitmap is expected to match a name in // the resource file, or the number of the bitmap (ie "#123"). A null // pointer is returned if the bitmap can't be found. This interface is // the most natural, not favoring a particular windowing system because // the bitmap is implimented in terms of the native window system. // ----------------------------------------------------------------------- Bitmap* Bitmap::open(const char* name) { // ---- allocate the Bitmap instance ---- //Bitmap* bm = new Bitmap; //BitmapRep* b = new BitmapRep; //if (!bm || !b) // return (Bitmap*) 0; //bm->rep_ = b; return nil; } // ----------------------------------------------------------------------- // This constructor takes bitmap data from "compile-time" which in the X11 // world was probably from an XBM file. A difference from X11 is that // Windows expects the data to be aligned to 16-bit boundries for each scan // line. Because of the X11 heritage, the data passed is 8-bit aligned. // Also, the data in the X11 world is stored with a mapping of left to right // as LSB to MSB per byte, which is oposite from MS-Windows which stores // left to right as MSB to LSB. Another difference is that a black bit is // a one in X11 and a zero in Windows. The interface for this constructor // is the X11 format data, and conversion is performed into the Windows // format. This is to keep compatibility with X11 software directly. If // Windows native bitmaps are desired... the name based constructor // should be used. // ----------------------------------------------------------------------- Bitmap::Bitmap( const void* data, // bitmap data unsigned int w, // width of bitmap unsigned int h, // height of bitmap int x0, // x-coord of hotspot int y0) // y-coord of hotspot { rep_ = new BitmapRep(); rep_->data_ = data; rep_->width_ = w; rep_->height_ = h; rep_->xhot_ = x0; // Dont' know what this means with respect to placement. Assuming rep_->yhot_ = y0; // origin is left,bottom. } Bitmap::~Bitmap() { delete rep_; } Coord Bitmap::width() const { return Coord(rep_->width_); } Coord Bitmap::height() const { return Coord(rep_->height_); } unsigned int Bitmap::pwidth() const { return rep_->width_; } unsigned int Bitmap::pheight() const { return rep_->height_; } Coord Bitmap::left_bearing() const { return Coord(0); } Coord Bitmap::right_bearing() const { return Coord(int(rep_->width_)); } Coord Bitmap::ascent() const { return Coord(int(rep_->height_)); } Coord Bitmap::descent() const { return Coord(0); } // --------------------------------------------------------------------- // Bit manipulation functions... not bounds checked for efficiency. // --------------------------------------------------------------------- void Bitmap::poke(bool set, int x, int y) { ; } bool Bitmap::peek(int x, int y) const { return false; } // --------------------------------------------------------------------- // This function has absolutely no meaning in the MS-Windows // implimentation. I don't think it even has a reason to exist, and // should be removed from the interface!! // --------------------------------------------------------------------- void Bitmap::flush() const { } // ################################################################## // ################# class BitmapRep // ################################################################## BitmapRep::BitmapRep() { } BitmapRep::~BitmapRep() { } neuron-7.6.3/src/lib/IV-Mac/brush.cpp000077500000000000000000000112701340731477100172500ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif // ======================================================================= // // // // // 1.2 // 1999/08/13 16:36:33 // // InterViews port to the Windows 3.1/NT operating systems // Copyright (c) 1993 Tim Prinzing // // This media contains programs and data which are proprietary // to Tim Prinzing. // // These contents are provided under a Tim Prinzing software source // license, which prohibits their unauthorized resale or distribution // outside of the buyer's organization. // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL Tim Prinzing BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // // ======================================================================= /* * THIS FILE CONTAINS PORTIONS OF THE InterViews 3.1 DISTRIBUTION THAT // This media contains programs and data which are proprietary // to Tim Prinzing. // // These contents are provided under a Tim Prinzing software source // license, which prohibits their unauthorized resale or distribution // outside of the buyer's organization. * * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include // ----------------------------------------------------------------------- // constructors and destructors // ----------------------------------------------------------------------- Brush::Brush(Coord w) { init(nil, 0, w); } Brush::Brush( const int* p, // pattern dash/space pixel counts int c, // number of elements in the pattern array Coord w) // width of the brush { init(p, c, w); } Brush::Brush( int pat, // 16-bit specification of dash/space pattern Coord w) // width of the brush { int dash[16]; int count; calc_dashes(pat, dash, count); init(dash, count, w); } Brush::~Brush() { BrushRep* r = rep_; delete r; } void Brush::calc_dashes(int pat, int* dash, int& count) { unsigned int p = pat & 0xffff; if (p == 0 || p == 0xffff) { count = 0; } else { const unsigned int MSB = 1 << 15; while ((p & MSB) == 0) { p <<= 1; } if (p == 0x5555 || p == 0xaaaa) { dash[0] = 1; dash[1] = 3; count = 2; } else if (p == 0xaaaa) { dash[0] = 1; dash[1] = 1; count = 2; } else if (p == 0xcccc) { dash[0] = 2; dash[1] = 2; count = 2; } else if (p == 0xeeee) { dash[0] = 3; dash[1] = 1; count = 2; } else { unsigned int m = MSB; int index = 0; while (m != 0) { /* count the consecutive one bits */ int length = 0; while (m != 0 && (p & m) != 0) { ++length; m >>= 1; } dash[index++] = length; /* count the consecutive zero bits */ length = 0; while (m != 0 && (p & m) == 0) { ++length; m >>= 1; } if (length > 0) { dash[index++] = length; } } count = index; } } } void Brush::init(const int* pattern, int count, Coord w) { rep_ = new BrushRep; rep_->width_ = w; } BrushRep* Brush::rep(Display*) const { return rep_; } Coord Brush::width() const { return (rep_->width_); } neuron-7.6.3/src/lib/IV-Mac/canvas.cpp000066400000000000000000001102431340731477100173750ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif // ========================================================================= // // // // Macintosh dependent Canvas representation. This canvas type renders // into an Macintosh window. // // 1.6 // $Date: 4 Aug 1996 // // ========================================================================= /* * THIS FILE CONTAINS PORTIONS OF THE InterViews 3.1 DISTRIBUTION THAT * CONTAINED THE FOLLOWING COPYRIGHT MESSAGE: * * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ // ---- InterViews includes ----- #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // ---- libc includes ---- #include #include #include #include //#ifdef DEBUG #include //#endif extern "C" {extern void debugfile(const char*, ...);} // ---- templates used ---- declarePtrList(MACtransformPtrList,Transformer) implementPtrList(MACtransformPtrList,Transformer) declarePtrList(MACclipList,Rect) implementPtrList(MACclipList,Rect) const int TEXT_BUFFER_LEN = 80; // max buffered text length PathRenderInfo MACcanvas::path_; // ---------------------------------------------------------------------- // utility functions // ---------------------------------------------------------------------- static const float smoothness = 10.0; static bool straight( const Transformer& tx, Coord x0, Coord y0, Coord x1, Coord y1, Coord x2, Coord y2, Coord x3, Coord y3) { Coord tx0, tx1, tx2, tx3; Coord ty0, ty1, ty2, ty3; tx.transform(x0, y0, tx0, ty0); tx.transform(x1, y1, tx1, ty1); tx.transform(x2, y2, tx2, ty2); tx.transform(x3, y3, tx3, ty3); float f = ( (tx1 + tx2) * (ty0 - ty3) + (ty1 + ty2) * (tx3 - tx0) + 2 * (tx0 * ty3 - ty0 * tx3) ); return (f * f) < smoothness; } static inline Coord mid(Coord a, Coord b) { return (a + b) / 2; } // ######################################################## // ############ class Canvas // ######################################################## Canvas::Canvas() { } Canvas::~Canvas() { } void Canvas::front_buffer(){ } void Canvas::back_buffer(){ } //handled by MACcanvas -- I think that this is just necessary for linking Window* Canvas::window() const { return nil; } // ---------------------------------------------------------------------- // utility functions // ---------------------------------------------------------------------- static void rect_path( Canvas* c, Coord l, Coord b, Coord r, Coord t) { c->new_path(); c->move_to(l, b); c->line_to(l, t); c->line_to(r, t); c->line_to(r, b); c->close_path(); } // ---------------------------------------------------------------------- // convenience functions that form a typical path and do an operation // ---------------------------------------------------------------------- void Canvas::line( Coord x1, Coord y1, Coord x2, Coord y2, const Color* c, const Brush* b) { new_path(); move_to(x1, y1); line_to(x2, y2); stroke(c, b); } void Canvas::rect( Coord l, Coord b, Coord r, Coord t, const Color* c, const Brush* br) { rect_path(this, l, b, r, t); stroke(c, br); } void Canvas::fill_rect(Coord l, Coord b, Coord r, Coord t, const Color* c) { rect_path(this, l, b, r, t); fill(c); } void Canvas::clip_rect(Coord l, Coord b, Coord r, Coord t) { rect_path(this, l, b, r, t); clip(); } Coord Canvas::to_pixels_coord(Coord p, DimensionName d) const { return to_coord(to_pixels(p, d), d); } // -------------------------------------------------------------------------- // The following are convenience functions for making ellipse figures. The // function ellipse_path() creates a ellipse path in the canvas that can // be used to stroke, fill, clip, etc. // -------------------------------------------------------------------------- // multipliers for establishing bezier points static float p0 = 1.00000000; static float p1 = 0.89657547; // cos 30 * sqrt(1 + tan 15 * tan 15) static float p2 = 0.70710678; // cos 45 static float p3 = 0.51763809; // cos 60 * sqrt(1 + tan 15 * tan 15) static float p4 = 0.26794919; // tan 15 void Canvas::ellipse_path( Coord x, // x coordinate of ellipse center Coord y, // y coordinate of ellipse center Coord rx, // radius in x dimension Coord ry) // radius in y dimension { float px0 = p0 * rx, py0 = p0 * ry; float px1 = p1 * rx, py1 = p1 * ry; float px2 = p2 * rx, py2 = p2 * ry; float px3 = p3 * rx, py3 = p3 * ry; float px4 = p4 * rx, py4 = p4 * ry; new_path(); move_to(x + rx, y); curve_to(x + px2, y + py2, x + px0, y + py4, x + px1, y + py3); curve_to(x, y + ry, x + px3, y + py1, x + px4, y + py0); curve_to(x - px2, y + py2, x - px4, y + py0, x - px3, y + py1); curve_to(x - rx, y, x - px1, y + py3, x - px0, y + py4); curve_to(x - px2, y - py2, x - px0, y - py4, x - px1, y - py3); curve_to(x, y - ry, x - px3, y - py1, x - px4, y - py0); curve_to(x + px2, y - py2, x + px4, y - py0, x + px3, y - py1); curve_to(x + rx, y, x + px1, y - py3, x + px0, y - py4); } // ############################################################## // ################## // ################## class MACcanvas // ################## // ############################################################## // ----------------------------------------------------------------------- // constructors/destructors // ----------------------------------------------------------------------- MACcanvas::MACcanvas() { // ---- initialize transformation stack ----- transformers_ = new MACtransformPtrList; Transformer* identity = new Transformer; transformers_->append(identity); transformed_ = false; // ---- initialize the clipping stack ---- clippers_ = new MACclipList; clipping_ = new Rect; SetRect(clipping_,0, 0, 0, 0); // ---- initialize the path information ---- PathRenderInfo* p = &path_; if (p->point_ == nil) { p->point_ = new Point[10]; p->cur_point_ = p->point_; p->end_point_ = p->point_ + 10; } // ---- initially we have no logical attributes ---- lg_color_ = nil; lg_brush_ = nil; lg_font_ = nil; // ---- initialize the text handling ---- text_item_.count = 0; //-- set damage area to 0 SetRect(&damageArea, 0, 0, 0, 0); dpy = Session::instance()->default_display(); } MACcanvas::~MACcanvas() { // ---- free up tranformation stack ---- for (ListItr(MACtransformPtrList) i(*transformers_); i.more(); i.next()) { Transformer* t = i.cur(); delete t; } delete transformers_; delete clipping_; for (long j = clippers_->count()-1; j >= 0; --j) { delete (clippers_->item(j)); } delete clippers_; } Window* MACcanvas::window() const { return win_->ivWindowOf(); } PixelCoord MACcanvas::to_pixels(Coord val, DimensionName d) const { return dpy->to_pixels(val, d); } Coord MACcanvas::to_coord(PixelCoord val, DimensionName d) const { return dpy->to_coord(val, d); } static int s_nTime = -1, s_nTotalTime; // ----------------------------------------------------------------------- // beginPaint() is used before MACPaint calls the Glyph::draw in order to // initialize clipping to the damage area. This was added 1/3/99 to allow // fast drawing of certain glyphs without having the Background erase all // existing info in the pixrect // ----------------------------------------------------------------------- void MACcanvas::beginPaint() { // --damageArea.left; ++damageArea.right; --damageArea.top; ++damageArea.bottom; //debugfile("beginPaint %lx damage l=%d t=%d r=%d b=%d\n",(long)this, damageArea.left, damageArea.top, damageArea.right, damageArea.bottom); // SetRect(clipping_,0, 0, pwidth(), pheight()); *clipping_ = damageArea; ClipRect(clipping_); } // ----------------------------------------------------------------------- // endPaint() is used at the end of MACPaint to ensure that all characters // have been printed. // ----------------------------------------------------------------------- void MACcanvas::endPaint() { flush(); } // ---------------------------------------------------------------------- // set the canvas size in terms of points... This is normally called as // a result of the geometry negotiations done by the glyph hierarchy. // ---------------------------------------------------------------------- void MACcanvas::size( Coord w, // width of the canvas in points Coord h) // height of the canvas in points { psize( to_pixels(w, Dimension_X), to_pixels(h, Dimension_Y)); } // ---------------------------------------------------------------------- // This function currently does nothing because the canvas stores its size // in the portRect field of the Mac window. This limits the canvas to // being the window content regions size, but it also means that we let // the system keep track of the size. // ---------------------------------------------------------------------- // 2/17/96 there have been considerable difficulties and confusion resulting // from calling height when there is no macWindow. This happens due to wanting // to know width and height in order to do proper placement before mapping // since there is incessant conversion from a mac coord system where the origin of screen // and window is top/left and the interviews coord system where the origin of screen // and window is bottom/left. We will leave out for a moment the question of window // decorations and exterior vs interior vs canvas. Anyway, glyph request is called // on Window::map -> compute_geometry which is how we get here (and we were // throwing away the info) then the map calls windowrep::bind which // binds the canvas and calls glyph::request again and sets the // params_->bounds_->(bottom,right) which is immediately used in macwindow::bind // to create theMacWindow. After that, even with the old implementation // we can do whatever we want since all pointers are now set up. // Now here are the issues/problems so far: // Window::align which calls height is often called before mapping. // Just before theMacWindow creation in Macwindow::bind, // next_window_y needs the height if // the window had been placed before mapping. // So. What is proposed is to call Glyph::request when Window is constructed // after the rep is constructed and fill the params_->bounds_ fields. // when there is no macWindow, this info is used for width and height. // also, probably redundantly but who knows, psize calls can store it as well. // my guess is that it will not be used since the window is soon mapped anyway. // Request on window creation was too soon since the size requested was often 0.So align // remains a problem til after binding. However, at least the next_window_y seems to work now. void MACcanvas::psize( PixelCoord w, // physical width in pixels PixelCoord h) // physical height in pixels { // canvas_width = w; // canvas_height = h; if (!win_->macWindow()) { win_->params_->bounds_->bottom = h; win_->params_->bounds_->right = w; } } // ---------------------------------------------------------------------- // Width and Height information // ---------------------------------------------------------------------- Coord MACcanvas::width() const { if (win_->macWindow()) { #if carbon Rect contentRect; GetPortBounds(GetWindowPort(win_->macWindow()), &contentRect); #else Rect contentRect = (win_->macWindow())->portRect; #endif return to_coord((contentRect.right - contentRect.left), Dimension_X ); }else{ return to_coord(win_->params_->bounds_->right, Dimension_X); // assuming left is 0 } } Coord MACcanvas::height() const { if (win_->macWindow()) { #if carbon Rect contentRect; GetPortBounds(GetWindowPort(win_->macWindow()), &contentRect); #else Rect contentRect = (win_->macWindow())->portRect; #endif return to_coord((contentRect.bottom - contentRect.top), Dimension_Y); }else{ return to_coord(win_->params_->bounds_->bottom, Dimension_Y); // assuming top is 0 } } PixelCoord MACcanvas::pwidth() const { if (win_->macWindow()) { #if carbon Rect contentRect; GetPortBounds(GetWindowPort(win_->macWindow()), &contentRect); #else Rect contentRect = (win_->macWindow())->portRect; #endif return (contentRect.right - contentRect.left); }else{ return win_->params_->bounds_->right; // assuming left is 0 } } PixelCoord MACcanvas::pheight() const { if (win_->macWindow()) { #if carbon Rect contentRect; GetPortBounds(GetWindowPort(win_->macWindow()), &contentRect); #else Rect contentRect = (win_->macWindow())->portRect; #endif return (contentRect.bottom - contentRect.top); }else{ return win_->params_->bounds_->bottom; // assuming top is 0 } } // ---------------------------------------------------------------------- // Transformation stack management. This is largely the same as the // Windows implementation. // ---------------------------------------------------------------------- void MACcanvas::push_transform() { MACtransformPtrList& s = * transformers_; int index = s.count() - 1; Transformer* tmp = s.item(index); Transformer* m = new Transformer(*tmp); s.append(m); } void MACcanvas::pop_transform() { MACtransformPtrList& s = * transformers_; int i = s.count() - 1; if (i == 0) { // We pushed the first matrix during initialization, // so we must be underflowing the stack. Should be an exception. return; } Transformer* m = s.item(i); delete m; s.remove(i); transformed_ = ! matrix().identity(); } void MACcanvas::transform(const Transformer& t) { matrix().premultiply(t); transformed_ = ! matrix().identity(); } void MACcanvas::transformer(const Transformer& t) { matrix() = t; transformed_ = ! t.identity(); } const Transformer& MACcanvas::transformer() const { return matrix(); } Transformer& MACcanvas::matrix() const { MACtransformPtrList& s = *transformers_; return *(s.item(s.count() - 1)); } // ---------------------------------------------------------------------- // Clipping stack management -- again largely the same as the Windows // implementation // ---------------------------------------------------------------------- void MACcanvas::initClip() { SetRect(clipping_, 0, 0, pwidth(), pheight()); ClipRect(clipping_); } void MACcanvas::push_clipping(bool all) { Rect* old_clip = clipping_; Rect* new_clip = new Rect; if (all) { SetRect(new_clip,0, 0, pwidth(), pheight()); }else{ SetRect(new_clip,old_clip->left, old_clip->top, old_clip->right, old_clip->bottom); } //CombineRgn(new_clip, old_clip, old_clip, RGN_COPY); clippers_->append(old_clip); clipping_ = new_clip; //debugfile("pushclip %lx, %d %d %d %d\n", (long)this, new_clip->left, new_clip->right, new_clip->top, new_clip->bottom); ClipRect(new_clip); } void MACcanvas::pop_clipping() { MACclipList& s = * clippers_; int n = s.count(); if (n == 0) { // stack underflow--should raise exception return; } Rect* clip = clipping_; delete clip; clip = s.item(n - 1); s.remove(n - 1); clipping_ = clip; if (clip->right <= clip->left || clip->bottom <= clip->top) { SetRect(clip, 0,0,pwidth(),pheight()); } //debugfile("popclip %lx, %d %d %d %d\n", (long)this, clip->left, clip->right, clip->top, clip->bottom); ClipRect(clip); } void MACcanvas::clip() { flush(); //if (printing) return; #if 0 // fresco RgnHandle region = select_path(); RgnHandle clip = NewRgn(); GetClip(clip); SectRgn(clip, region, region); DisposeRgn(clip); SetClip(region); DisposeRgn(region); #endif // ---- make sure there are multiple points ---- PathRenderInfo* p = &path_; Point* pt = p->point_; int n = (int) (p->cur_point_ - p->point_); if (n <= 2) { return; } // if (xrect(pt, n)) // ---- rectangular clipping area ---- Rect intersect; Rect& xr = intersect; //Rect& xr = *clipping_; xr.left = Math::min(pt[0].h, pt[2].h); xr.top = Math::min(pt[0].v, pt[2].v); xr.right = Math::max(pt[0].h, pt[2].h); xr.bottom = Math::max(pt[0].v, pt[2].v); // ---- merge with existing clipping area ---- #if 0 if (xr.right > xr.left && xr.bottom > xr.top) { //debugfile("clip %lx, %d %d %d %d\n", (long)this, xr.left, xr.right, xr.top, xr.bottom); ClipRect(&xr); } #else //Rect intersect; SectRect(&xr, clipping_, &intersect); // ---- set new clipping area ---- if (intersect.right > intersect.left && intersect.bottom > intersect.top) { //debugfile("clip %lx, %d %d %d %d\n", (long)this, intersect.left, intersect.right, intersect.top, intersect.bottom); ClipRect(&intersect); } #endif #ifdef DEBUG // ---- canvas debug ---- printf("clip "); for (int i = 0; i < n; i++) { printf("[%d,%d] ", pt[i].x, pt[i].y); } printf("\n"); #endif } // ---------------------------------------------------------------------- // Double buffer management // ---------------------------------------------------------------------- void MACcanvas::front_buffer() { //if (win_) //win_->frontBuffer(); } void MACcanvas::back_buffer() { //if (win_) //win_->backBuffer(); } // ----------------------------------------------------------------------- // Canvas damaging interface. The Macintosh has a window damaging // support, but Fresco avoided its use. Instead, each MACwindow has // a boolen flag to update. Whenever a window is damaged, setWinToUpdate // is called. If the window is already set to be updated, the new damaged // region is merely added to the old damaged region. Otherwise, the damage // region is set to the new damage, and the window is put on the update list. // ----------------------------------------------------------------------- void MACcanvas::setWinToUpdate(void){ if(!(win_->update_)){ win_->update_ = true; WindowRep::update_list.append(win_); } } void MACcanvas::damage(const Extension& ext) { damage(ext.left(), ext.bottom(), ext.right(), ext.top()); } void MACcanvas::damage(Coord left, Coord bottom, Coord right, Coord top) { GrafPtr oldPort; Rect area; SetRect(&area, toPixelX(left), toPixelY(top), toPixelX(right), toPixelY(bottom)); //debugfile("damage %lx old l:%d r:%d t:%d b:%d\n", (long)this, damageArea.left, damageArea.right, damageArea.top, damageArea.bottom); //debugfile("damage this l:%d r:%d t:%d b:%d\n", area.left, area.right, area.top, area.bottom); if(EmptyRect(&damageArea)){ damageArea = area; } else { UnionRect(&damageArea, &area, &damageArea); } //debugfile("damage new l:%d r:%d t:%d b:%d\n", damageArea.left, damageArea.right, damageArea.top, damageArea.bottom); // ---- if we are bound to a window.. invalidate it's area ---- if (win_) { setWinToUpdate(); #if defined(DEBUG) printf("damage total l:%d r:%d t:%d b:%d\n", damageArea.left, damageArea.right, damageArea.top, damageArea.bottom); #endif } } bool MACcanvas::damaged(const Extension& ext) const { return damaged(ext.left(), ext.bottom(), ext.right(), ext.top()); } bool MACcanvas::damaged( Coord left, Coord bottom, Coord right, Coord top) const { Rect area; SetRect(&area, toPixelX(left), toPixelY(top), toPixelX(right), toPixelY(bottom)); // problem is that intersection of boundary doesn't work //return SectRect(&damageArea, &area, &area); const Rect& d = damageArea; return ( area.left < d.right && area.right > d.left && area.bottom > d.top && area.top < d.bottom ); } void MACcanvas::damage_area(Extension& ext) { ext.set_xy(nil, fromPixelX(damageArea.left), fromPixelY(damageArea.bottom), fromPixelX(damageArea.right), fromPixelY(damageArea.top)); } void MACcanvas::damage_all() { GrafPtr oldPort; SetRect(&damageArea, 0, 0, pwidth(), pheight()); if (window()) { setWinToUpdate(); } } bool MACcanvas::any_damage() const { return (!(EmptyRect(&damageArea))); } void MACcanvas::restrict_damage(const Extension& ext) { restrict_damage(ext.left(), ext.bottom(), ext.right(), ext.top()); } void MACcanvas::restrict_damage( Coord left, Coord bottom, Coord right, Coord top) { GrafPtr oldPort; Rect area; SetRect(&area, toPixelX(left), toPixelY(top), toPixelX(right), toPixelY(bottom)); damageArea = area; if (window()) { setWinToUpdate(); } } // // Force a portion of the canvas to be redrawn. This is typically caused // by an X expose event. We just damage the canvas. // void MACcanvas::redraw(Coord left, Coord bottom, Coord right, Coord top) { // At the moment, there is no memory HGC holding a copy, so we // simply damage the canvas. damage(left, bottom, right, top); } void MACcanvas::repair() { GrafPtr oldPort; printf("MACcanvas::repair Port code disabled\n"); //GetPort(&oldPort); //SetPort(win_->macWindow()); //ValidRect(&win_->macWindow()->portRect); //SetPort(oldPort); } // -------------------------------------------------------------------------- // This function fills the current path with a stenciled pattern // in the given color. This function is basically used to simulate // the alpha blending of color which is not directly supported by // the GDI interface (ie PatBlt doesn't allow raster operations that // specify source as part of the operation... so no stencil). Since // the regions stenciled are typically not that large, this shouldn't // be too big of a shortcoming... it's too bad though because some // smart framebuffers can do this in hardware wicked-fast :-) // // NOT YET IMPLEMENTED FOR THE MACHINTOSH // -------------------------------------------------------------------------- void MACcanvas::stencilFill(const Bitmap* b, const Color* c) { } void MACcanvas::new_path() { PathRenderInfo* p = &path_; p->curx_ = 0; p->cury_ = 0; Point* xp = p->point_; xp->h = 0; xp->v = 0; p->cur_point_ = xp; } void MACcanvas::move_to(Coord x, Coord y) { PathRenderInfo* p = &path_; p->curx_ = x; p->cury_ = y; Coord tx, ty; if (transformed_) { matrix().transform(x, y, tx, ty); } else { tx = x; ty = y; } // -- convert to MAC pixels -- Point* xp = p->point_; xp->h = toPixelX(tx); xp->v = toPixelY(ty); //if (printing) debugfile("move_to %g %g -> %d %d\n", x, y, xp->h, xp->v); p->cur_point_ = xp + 1; } void MACcanvas::line_to(Coord x, Coord y) { PathRenderInfo* p = &path_; p->curx_ = x; p->cury_ = y; Coord tx, ty; if (transformed_) { matrix().transform(x, y, tx, ty); } else { tx = x; ty = y; } if (p->cur_point_ == p->end_point_) { int old_size = (int) (p->cur_point_ - p->point_); int new_size = 2 * old_size; Point* new_path = new Point[new_size]; for (int i = 0; i < old_size; i++) { new_path[i] = p->point_[i]; } delete p->point_; p->point_ = new_path; p->cur_point_ = p->point_ + old_size; p->end_point_ = p->point_ + new_size; } // -- convert to MAC Pixels -- Point * xp = p->cur_point_; xp->h = toPixelX(tx); xp->v = toPixelY(ty); //if (printing) debugfile("line_to %g %g -> %d %d\n", x, y, xp->h, xp->v); p->cur_point_ = xp + 1; } void MACcanvas::curve_to( Coord x, Coord y, Coord x1, Coord y1, Coord x2, Coord y2) { PathRenderInfo* p = &MACcanvas::path_; Coord px = p->curx_; Coord py = p->cury_; if (straight(matrix(), px, py, x1, y1, x2, y2, x, y)) { line_to(x, y); } else { Coord xx = mid(x1, x2); Coord yy = mid(y1, y2); Coord x11 = mid(px, x1); Coord y11 = mid(py, y1); Coord x22 = mid(x2, x); Coord y22 = mid(y2, y); Coord x12 = mid(x11, xx); Coord y12 = mid(y11, yy); Coord x21 = mid(xx, x22); Coord y21 = mid(yy, y22); Coord cx = mid(x12, x21); Coord cy = mid(y12, y21); curve_to(cx, cy, x11, y11, x12, y12); curve_to(x, y, x21, y21, x22, y22); } } void MACcanvas::close_path() { PathRenderInfo* p = &MACcanvas::path_; Point* startp = p->point_; Point* xp = p->cur_point_; xp->h = startp->h; xp->v = startp->v; p->cur_point_ = xp + 1; } void MACcanvas::stroke(const Color* c, const Brush* b) { PathRenderInfo* p = &MACcanvas::path_; // --- determine the number of points, and if valid --- int n = (int) (p->cur_point_ - p->point_); if (n < 2) { return; } flush(); color(c); brush(b); // ---- render it ---- Point* pt = p->point_; MoveTo(pt[0].h, pt[0].v); for (int i = 1; i < n; i++){ LineTo(pt[i].h, pt[i].v); } } void MACcanvas::fill(const Color* c) { //if (printing) return; if (c->rep()->stipple) { // ---- stipple some color into the area ---- stencilFill(c->rep()->stipple, c); } else { PathRenderInfo* p = &MACcanvas::path_; int n = (int) (p->cur_point_ - p->point_); if (n <= 2) { return; } flush(); color(c); //Setup Region and render an outline to fill // RgnHandle region = NewRgn(); // OpenRgn(); PolyHandle poly; poly = OpenPoly(); Point* pt = p->point_; MoveTo(pt[0].h, pt[0].v); for (int i = 1; i < n; i++){ LineTo(pt[i].h, pt[i].v); } // CloseRgn(region); // PaintRgn(region); // DisposeRgn(region); ClosePoly(); PaintPoly(poly); KillPoly(poly); } #ifdef DEBUG // ---- canvas debug ---- MWassert( LPtoDP(drawable_, pt, n) ); printf("fill "); for (int i = 0; i < n; i++) { BOOL vis = PtVisible(drawable_, pt[i].x, pt[i].y); if (vis) printf("[%d,%d] ", pt[i].x, pt[i].y); else printf("(%d,%d> ", pt[i].x, pt[i].y); } printf("\n"); #endif } // ----------------------------------------------------------------------- // Changes the Color to use when rendering onto the canvas. // ----------------------------------------------------------------------- void MACcanvas::color(const Color* c) { if (c != nil && c != lg_color_){ // ---- render anything that was buffered ---- flush(); // ---- reference new color ---- Resource::ref(c); Resource::unref(lg_color_); lg_color_ = c; // ---- set new pen color ---- RGBForeColor(c->rep()->MACcolor()); // ---- set new brush color ---- if (c->rep()->stipple) { // THIS NEEDS WORK // // brush_stats_.lbStyle = BS_PATTERN; // brush_stats_.lbHatch = (long) c->rep()->stipple->hbm_; } else { //brush_stats_.lbStyle = BS_SOLID; //brush_stats_.lbColor = c->rep()->msColor(); } //brush_ = CreateBrushIndirect(&brush_stats_); //DeleteObject( SelectObject(drawable_, brush_)); // ---- set color operation ---- ColorRep* r = c->rep(); if (r->op == Color::Copy) { PenMode(srcCopy); } else if (r->op == Color::Xor) { PenMode(srcXor); } else if (r->op == Color::Invisible) { //SetROP2(drawable_, R2_NOP); } else { // ----- unrecognized color mode ---- printf("unrecognized color mode\n"); } } } // ----------------------------------------------------------------------- // Changes the brush to use when rendering a path -- size implemented, no dashes // ----------------------------------------------------------------------- void MACcanvas::brush(const Brush* b) { if (b != nil && b != lg_brush_) { // ---- reference the new brush ---- Resource::ref((const Resource*) b); Resource::unref((const Resource*) lg_brush_); lg_brush_ = b; BrushRep* r = b->rep(nil); short w = (r->width_ > 1.) ? short(r->width_) : 1; PenSize(w, w); // ---- get ready to create a new pen ---- //BrushRep& br = * b->rep(nil); //pen_stats_.lopnStyle = (br.dashCount) ? PS_DASH : PS_SOLID; //pen_stats_.lopnWidth.x = COORD2TWIPS(br.penWidth); // ---- establish the new pen ---- //pen_ = CreatePenIndirect(&pen_stats_); //DeleteObject( SelectObject(drawable_, pen_)); } } // ----------------------------------------------------------------------- // Changes the font to use when rendering. The actual creation and // selection of the GDI object is delayed until the actual text is to be // rendered, since further scaling and rotation might be desired. // ----------------------------------------------------------------------- void MACcanvas::font(const Font* f) { if (f != nil && f != lg_font_) { // ---- flush any buffered operations ---- flush(); // ---- register interest in new font, and release old ---- Resource::ref(f); Resource::unref(lg_font_); lg_font_ = f; } } void MACcanvas::begin_item(PixelCoord x, PixelCoord y, PixelCoord w) { text_item_.x = x;// toPixelX(x); //now done in flush text_item_.y = y;// toPixelY(y); text_item_.count = 0; } // ----------------------------------------------------------------------- // Render a character onto the canvas. This is a buffered operation that // tries to draw entire words at once. This mode is to provide compati- // bility with the original InterViews. // ----------------------------------------------------------------------- void MACcanvas::character( const Font* f, // font to use long ch, // character to print Coord width, // width of the character const Color* c, // color to use Coord x, // x-coordinate Coord y) // y-coordinate { font(f); color(c); // Transform the coordinates before testing for expected position // so that we can work in terms of pixels and deal with slop in // position better. // 3/9/97 M Hines. Well, not really. text_item_.y was in mac pixels and ty was in // interviews coords. If ever to_pixels is not 1 there will have to be a lot of changes. Transformer& m = matrix(); Coord tx = x; Coord ty = y; if (transformed_) { m.transform(tx, ty); // ROTATION SUPPORT TO BE ADDED } // the collection into a buffer on the mac is a significant efficiency improvement // however it is not clear to me if the next_x should be in pixel coords or interviews // coords. InterViews coords did not work well after resizing a Graph since it // started flushing every character. If we don't check x, then we don't flush enough // expecially during text rubberbanding. static Coord next_x; PixelCoord ptx = toPixelX(tx); PixelCoord pty = toPixelY(ty); PixelCoord pwidth = toPixelX(width); if (text_item_.count == 0) { begin_item(ptx, pty, pwidth); } else if ( (text_item_.count >= text_item_.size) || (pty != text_item_.y) //|| (!Math::equal(x, next_x, .01))){ || (!Math::equal(tx, next_x, float(1.1)))) {//allow 1 pixel slop flush(); begin_item(ptx, pty, pwidth); } next_x = tx + width; text_item_.buffer[text_item_.count++] = (char) ch; //if(printing) debugfile("character %c %g %g\n", ch, x, y); } // ----------------------------------------------------------------------- // Flush the text buffer. The text drawing is buffered until something // changes and causes a flush (by calling this function). // ----------------------------------------------------------------------- /* need to come to terms with fact that CreateFontIndirect slows things down to an extent which makes Win32s unusable. This hack allows only one font. */ //static HFONT new_fnt; //void cleanup_new_fnt() { //if (new_fnt) { // DeleteObject(new_fnt); //} //} void MACcanvas::flush() { // ---- check if there is anything to do ---- //int nchars = (int) (text_ptr_ - text_buff_); //if ((nchars == 0) || (lg_font_ == nil)) // return; // ---- render the text ---- if (text_item_.count > 0) { //set font FontRep* fr = lg_font_->rep(nil); TextFont(fr->font_); TextFace(fr->face_); TextSize(fr->size_); TextMode(fr->mode_); //if (printing) debugfile("flush %d %d\n",toPixelX(text_item_.x), toPixelY(text_item_.y)); MoveTo(text_item_.x, text_item_.y); DrawText(text_item_.buffer, 0, text_item_.count); // text_item_.buffer[text_item_.count] = '\0'; // debugfile("|%s|\n", text_item_.buffer); } text_item_.count = 0; return; #if 0 //MS Windows code for reference // ---- render the text ---- SetBkMode(drawable_, TRANSPARENT); FontRep* fr = lg_font_->rep(nil); MWassert(fr); fr->orientation(transformAngle()); // HFONT new_fnt = fr->Create(); if (!new_fnt) { new_fnt = fr->Create(); } HFONT old_fnt = (HFONT) SelectObject(drawable_, new_fnt); SetTextAlign(drawable_, TA_LEFT | TA_BASELINE | TA_NOUPDATECP); TextOut(drawable_, text_x0_, text_y0_, text_buff_, nchars); // DeleteObject( SelectObject(drawable_, old_fnt)); // ---- reset the buffer ---- text_ptr_ = text_buff_; #endif } // ----------------------------------------------------------------------- // Determine the angle of transformation in terms of tenths-of-a-degree. // The method used is to transform a couple of points, and then measure // the angle of rotation on the sample points. There is probably a better // way to do this, but it works. // NOT YET USED ON THE MACINTOSH // ----------------------------------------------------------------------- int MACcanvas::transformAngle() const { if (! transformed_ ) return 0; Transformer& t = matrix(); float x0 = float(0); float y0 = x0; float y1 = x0; float x1 = float(1); t.transform(x0, y0); t.transform(x1, y1); double dx = x1 - x0; double dy = y1 - y0; double rad = atan2(dy, dx); int tdeg = (int) (rad * double(572.9577951)); if (tdeg < 0) tdeg = 3600 + tdeg; return tdeg; } // ----------------------------------------------------------------------- // Stencil the "set" bits of the bitmap onto the canvas in the given color // at the given origin. The origin is in terms of the point system with // the origin in the lower left, which must be converted to the device // coordinate system which has an origin in the upper left. Further, the // blt coordinates must be adjusted this way as well. // // NOT YET IMPLEMENTED ON THE MACINTOSH // ----------------------------------------------------------------------- void MACcanvas::stencil( const Bitmap* mask, // bitmap to render const Color* c, // color to use Coord x, // x-coordinate Coord y) // y-coordinate { //just fill a rectangle for now. fill_rect(x + mask->left_bearing(), y + mask->descent(), x + mask->right_bearing(), y + mask->ascent(), c); } // ----------------------------------------------------------------------- // Render an image onto the GDI surface. The image is transformed in // terms of scaling only initially (all that Windows 3.1 supports). // Rotation is initially not supported. // NOT YET SUPPORTED ON THE MACINTOSH // ----------------------------------------------------------------------- void MACcanvas::image(const Raster* ras, Coord x, Coord y) { if (!ras || !ras->rep()->cg_) return; Coord tx, ty, tw, th; if (transformed_) { matrix().transform(x, y, tx, ty); matrix().transform(x+ras->width(), y+ras->height(), tw, th); tw -= tx; th -= ty; } else { tx = x; ty = y; tw = ras->width(); th = ras->height(); } Rect sr, dr; sr.left = 0; sr.top = 0; sr.right = ras->pwidth(); sr.bottom = ras->pheight(); dr.left = toPixelX(tx); dr.right = toPixelX(tx + tw); dr.top = toPixelY(ty+th); dr.bottom = toPixelY(ty); // ---- blt... the destination will be transformed ---- CGrafPtr cg; GDHandle gd; GetGWorld(&cg, &gd); CopyBits( #if carbon GetPortBitMapForCopyBits(ras->rep()->cg_), GetPortBitMapForCopyBits(cg), #else &GrafPtr(ras->rep()->cg_)->portBits, &GrafPtr(cg)->portBits, #endif &sr, &dr, srcCopy, nil ); } neuron-7.6.3/src/lib/IV-Mac/carbevent.cpp000066400000000000000000000603661340731477100201050ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #if carbon // ======================================================================= // // // // Macintosh implementation of the InterViews Event classes. The // flow of control is significantly different from MS-Windows. Events // are held on a que, and are read in by Session::read. The event handler // then parses the event. Macintosh native calls are performed on most // events. Mouse motion, key down events, and mouse down events in the // content area of a window, however, are given to the function // MACwindow::MACinput. This function calls EventRep::handleCallBack // which essentially allows Inteviews to handle the event. // // // 1.3 // $Date: 4 Aug 1996 // // ======================================================================= #include #include #include #include #include #include #include #include #include #include #include #include // add by jijun 5/22/97 extern "C" { void debugfile(const char*, ...);} //Temporarily being used so that we can quit from the program //Need to still do menu support. #define APPLE_MENU_ID 32000 #define FILE_MENU_ID 32001 #define QUIT_ITEM 9 static int last_button_; //extern "C" { void hoc_quit(); void ivoc_dismiss_defer();} declarePtrList(MAChandlerPtrList, Handler) implementPtrList(MAChandlerPtrList, Handler) // ---- grabbing event handler list ---- static MAChandlerPtrList grabberList(100); static Point mouse_loc_; Point EventRep::mouse_loc(EventRef er) { GetEventParameter(er, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(mouse_loc_), NULL, &mouse_loc_); return mouse_loc_; } //global point to determine mouse movement Point THE_PREVIOUS_MOUSE_POINT; Event::Event() { rep_ = new EventRep; } Event::Event(const Event& e) { rep_ = new EventRep; copy_rep(e); } Event::~Event() { if (rep_) delete rep_; } Event& Event::operator =(const Event& e) { copy_rep(e); return *this; } void Event::copy_rep(const Event& e) { *rep_ = *e.rep_; } void Event::display(Display*) { } Display* Event::display() const { return rep_->windowOf()->display(); } void Event::window(Window*) { // This is unsupported under the MS-Windows version. When the event // was received, it was already known exactly which window the event // was for, and changing it is dangerous. Supporting this call caused // strange behavior, so it has been changed to do nothing!! // Macintosh implementation has not been considered } Window* Event::window() const { return rep_->windowOf(); } // ----------------------------------------------------------------------- // The following operations deal with events coming from a UNIX style file // (actually socket) where events can be read, pushed back, or tested to // see if any new ones are pending. // // These should not be used anyway... the programmer should be running // things with Session::run() and using the Dispatch class for any other // forms of event handling. // // Pending has been implemented under the Macintosh because it was fairly // simple. The other functions haven't really been considered. // ----------------------------------------------------------------------- bool Event::pending() const { return Session::instance()->pending(); } void Event::read() { printf("Event::read - unsupported"); //Session::instance()->read(*this); } bool Event::read(long , long ) { Event::read(); //return Session::instance()->read(s, u, *this); return false; } void Event::unread() { printf("Event::unread - unsupported\n"); //rep()->display_->put(*this); } void Event::poll() { // MS Windows Note // used to query the mouse position, which could be synthsized, but // for now it's unimplimented... I consider this a rather unclean // interface to begin with. // Haven't really dealt with this for the Machintsoh printf("Event::poll - unsupported"); } // ----------------------------------------------------------------------- // Find an event handler for the window associated with this event. // ----------------------------------------------------------------------- Handler* Event::handler() const { Handler* h = nil; Window* w = rep_->windowOf(); if (w != nil) { h = w->target(*this); } return h; } // ----------------------------------------------------------------------- // This function parses the Macintosh Event Record and calls an appropriate // hook to deal with the event. // ----------------------------------------------------------------------- void Event::handle() { EventRef er = rep_->getEventRef(); if(er){ switch (GetEventClass(er)) { case kEventClassMouse: switch (GetEventKind(er)) { case kEventMouseDown: //printf("mouseDown\n"); rep_->mouseDownEventHook(); break; case kEventMouseUp: //printf("mouseUp\n"); rep_->mouseUpEventHook(); break; case kEventMouseDragged: case kEventMouseMoved: //printf("mouseMove\n"); rep_->mouseMotionEventHook(); break; default: break; } break; case kEventClassKeyboard: switch (GetEventKind(er)) { case kEventRawKeyDown: case kEventRawKeyRepeat: //printf("keyDown\n"); rep_->keyDownEventHook(); break; } break; default: break; } }else{ /* switch(record->what){ case updateEvt: printf("updateEvt\n"); rep_->updateEventHook(); break; case activateEvt: printf("activateEvt\n"); rep_->activateEventHook(); break; case diskEvt: printf("diskEvt\n"); rep_->diskEventHook(); break; case osEvt: printf("osEvt\n"); rep_->osEventHook(); break; case kHighLevelEvent: printf("kHighLevelEvent\n"); rep_->appleEventHook(); break; case nullEvent: printf("nullEvent\n"); rep_->nullEventHook(); break; default: printf("default\n"); break; } } else { */ printf("Error Allocating memory for record"); exit(1); } } // ----------------------------------------------------------------------- // event handler grabs // ----------------------------------------------------------------------- void Event::grab(Handler* h) const { // ---- push on grabber stack ---- Resource::ref(h); grabberList.append(h); } void Event::ungrab(Handler* h) const { // ---- remove from collection of grabbers ---- for (ListUpdater(MAChandlerPtrList) i(grabberList); i.more(); i.next()) { Handler* curr_h = i.cur(); if (curr_h == h) { i.remove_cur(); Resource::unref(h); break; } } } Handler* Event::grabber() const { if (grabberList.count() == 0) return nil; return grabberList.item(0); } bool Event::is_grabbing(Handler* h) const { for (ListItr(MAChandlerPtrList) i(grabberList); i.more(); i.next()) { Handler* curr_h = i.cur(); if (curr_h == h) { return true; } } return false; } // ----------------------------------------------------------------------- // Return the type of event. Since all the work is done at the time the // event is synthesized, this simply returns the event type that was // stashed in the EventRep. // ----------------------------------------------------------------------- EventType Event::type() const { return rep_->typeOf(); } unsigned long Event::time() const { EventRef temp; if(temp = (rep()->getEventRef())) { EventTime t = GetEventTime(temp); //printf("Event::time %g\n", t); return (long)(t*1000.); } //Should not reach this point return 0; } extern bool session_deactivating_; Coord Event::pointer_x() const { if (session_deactivating_) { return -1000.; } Coord x_temp; Display* dpy = display(); return dpy->to_coord(rep_->ivlocalMouse_x(), Dimension_X); } Coord Event::pointer_y() const { if (session_deactivating_) { return -1000.; } Display* dpy = display(); return dpy->to_coord(rep_->ivlocalMouse_y(), Dimension_Y);; } Coord Event::pointer_root_x() const { // Display* dpy = display(); // return dpy->to_coord(rep_->ivglobalMouse_x(), Dimension_X); Coord x = pointer_x() + window()->left(); // printf("rootx=%g\n", x); return x; } Coord Event::pointer_root_y() const { // Display* dpy = display(); // return dpy->to_coord(rep_->ivglobalMouse_y(), Dimension_Y); Coord y = pointer_y() + window()->bottom(); // printf("rooty=%g\n", y); return y; } EventButton Event::pointer_button() const { return rep_->buttonOf(); } unsigned int Event::keymask() const { printf("Event::keymask() - unsupported"); return 0; } // ------------------------------------------------------------------------- // key tests - It is presumed that this query is being made in response // to some key/pointer event, in which case the modifiers field of the EvenT // record would hold valid information. // ------------------------------------------------------------------------- bool Event::control_is_down() const { UInt32 modifier; GetEventParameter(rep_->getEventRef(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifier), NULL, &modifier); return (modifier & controlKey) ? true : false; } bool Event::shift_is_down() const { UInt32 modifier; GetEventParameter(rep_->getEventRef(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifier), NULL, &modifier); return (modifier & shiftKey) ? true : false; } //These aren't called ... so we'll deal with it later // bool Event::left_is_down() const { return true;} bool Event::middle_is_down() const { return false; } bool Event::right_is_down() const { return false; } bool Event::capslock_is_down() const { UInt32 modifier; GetEventParameter(rep_->getEventRef(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifier), NULL, &modifier); return (modifier & alphaLock) ? true : false; } bool Event::meta_is_down() const { return false; } unsigned char Event::keycode() const { char code; if (rep_->typeOf() == key){ GetEventParameter(rep_->getEventRef(), kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(code), NULL, &code); return ((char)code); } else { return 0; } } // from 0x20 to 0x2F unsigned int Event::mapkey(char* buff, unsigned int bufflen) const { // printf("Event::mapkey currently not implemented\n"); // return 0; buff[0] = keycode(); switch (buff[0]) { case 034: buff[0] = 2; break; // left arrow to ^b case 035: buff[0] = 6; break; // right arrow to ^f case 036: buff[0] = 16; break; // up arrow to ^p case 037: buff[0] = 14; break; // down arrow to ^n } buff[1] = '\0'; if (buff[0] == '\0') { return 0; }else{ return 1; } } unsigned long Event::keysym() const { // TBD //MWassert(0); printf("Event::keycode currently not implemented"); return 0; } // ####################################################################### // ########################## class EventRep // ####################################################################### EventRep::EventRep(){ theEvent_ = nil; win_ = nil; } EventRep::~EventRep(){ } // void EventRep::set(int type, int button, int x, int y) { type_ = type; button_ = button; localMouseLocation_.h = x; localMouseLocation_.v = y; } void EventRep::setWindow(WindowPtr aMacWindow){ WindowRep* temp; temp = WindowRep::rc(aMacWindow); if(temp){ win_ = temp->ivWindowOf(); } else { win_ = nil; } } void EventRep::mouseDownEventHook(void){ WindowPtr frontWindow = nil; WindowPtr hitWindow = nil; WindowRep *ourStructure; short windowPart; long menuChoice; Rect dragRect; short windowType; /* modal, modeless, etc. */ Point loc; frontWindow = FrontWindow(); loc = mouse_loc(theEvent_); windowPart = FindWindow(loc, &hitWindow); //Set InterViews type type_ = Event::down; //Set InterViews button UInt32 modifier; UInt16 button; GetEventParameter(getEventRef(), kEventParamMouseButton, typeMouseButton, NULL, sizeof(UInt16), NULL, &button); GetEventParameter(getEventRef(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifier), NULL, &modifier); if (button == kEventMouseButtonSecondary) { button_ = Event::right; }else if (button == kEventMouseButtonTertiary) { button_ = Event::middle; }else{ if(modifier & (controlKey | cmdKey)){ button_ = Event::right; } else if (modifier & optionKey){ button_ = Event::middle; } else { button_ = Event::left; } } last_button_ = button_; switch (windowPart) { case inMenuBar: #if 0 /* user made a menu selection */ if(ourStructure = ((CWindowPeek)frontWindow)->refCon) /* enable/disable menu items */ ourStructure->updateMenus(); #endif menuChoice = MenuSelect(loc); /* drop menu and track choice */ if (menuChoice) /* if a choice made */ { if((HiWord(menuChoice) == FILE_MENU_ID) && (LoWord(menuChoice) == QUIT_ITEM)){ //Session::instance()->quit(); // hoc_quit(); } else if ((HiWord(menuChoice) == APPLE_MENU_ID)){ appleMenuHook(LoWord(menuChoice)); } /* dispatch control */ } HiliteMenu(0); /* unhilite the menubar when done */ break; case inDrag: /* there has to be a hit window */ /* if clicking a background window & not a command drag */ if ( (hitWindow != frontWindow) && !(modifier & cmdKey)) { windowType = MACwindow::isDialog(frontWindow); if ( windowType == MACwindow::MODAL || windowType == MACwindow::MOVABLE_MODAL){ SysBeep(30); /* modal window in front, sorry Charlie */ } else { SelectWindow(hitWindow); /* activate this window */ // add by jijun 3/4/97 //allow fast drag selected window if (ourStructure = WindowRep::rc(hitWindow)) { ourStructure->doDrag(theEvent_); } } } else if (ourStructure = WindowRep::rc(hitWindow)) /* if it's our window */ { /* call the window's drag behavior */ ourStructure->doDrag(theEvent_); } else /* not our window, e.g. could be moveable dialog */ { GetRegionBounds(GetGrayRgn(), &dragRect); DragWindow(hitWindow, loc, &dragRect); } break; case inGrow: if (ourStructure = WindowRep::rc(hitWindow)) /* if it's our window */ { /* call the window's grow behavior */ ourStructure->doGrow(theEvent_); } break; case inGoAway: /* track mouse in go-away box */ if (TrackGoAway(hitWindow, loc)) { /* if the option key is down */ if (modifier & optionKey) { /* close all windows, asking user to save if needed */ WindowPtr macWindow = FrontWindow(); /* first window */ while (macWindow){ /* make sure it's our window, if not get next */ if((MACwindow::isOurWindow(macWindow)) && WindowRep::rc(macWindow)){ /* close this window, if cancelled, return error */ //need to add file saving options DisposeWindow(macWindow); //if (error){ //return error; //} } #if carbon macWindow = GetNextWindow(macWindow); #else macWindow = (WindowPtr)((CWindowPeek)macWindow)->nextWindow; #endif } }else { //close this one window ourStructure = WindowRep::rc(hitWindow); if (ourStructure && ourStructure->close_callback_) { // I hope nobody needs a real event. Event e; ourStructure->close_callback_->event(e); } } // ivoc_dismiss_defer(); } break; case inZoomIn: case inZoomOut: if (ourStructure = WindowRep::rc(hitWindow)) { /* track mouse in the zoom box */ if (TrackBox(hitWindow, loc, windowPart)) { /* determine if we're zooming in or out */ short zoomDirection = windowPart; /* tell the window to do it */ ourStructure->doZoom((void *)&zoomDirection); } } break; case inDesk: /* do nothing */ break; case inSysWindow: /* Pass along the click to system windows (desk accessories) */ /* Even in the System 7 environment you may get one of these */ /* if the user opens a DA inside your app's partition */ #if carbon #else SystemClick(theEvent_, hitWindow); #endif break; case inContent: /* if it is non-front window, activate it */ if (hitWindow != frontWindow){ windowType = MACwindow::isDialog(frontWindow); if ( windowType == MACwindow::MODAL || windowType == MACwindow::MOVABLE_MODAL){ SysBeep(30); /* modal window in front, sorry Charlie */ } else if (ourStructure = WindowRep::rc(hitWindow)) /* hit a background EasyWindow */ { ourStructure->doBackgroundClick(theEvent_); // not mac standard but helpful to handle the event as well as select window // give up drag/drop? ourStructure->MACinput(theEvent_, type_, button_); } else /* hit some other window */ { SelectWindow(hitWindow); /* activate this window */ } } /* otherwise, if it's my front window do click in content */ else if ((ourStructure = WindowRep::rc(frontWindow)) && #if carbon GetWindowKind(frontWindow) == 8) #else (((CWindowPeek)frontWindow)->windowKind == 8)) #endif { ourStructure->MACinput(theEvent_, type_, button_); } break; default: break; } } void EventRep::mouseUpEventHook(void){ WindowPtr frontWindow; WindowRep* ourStructure; //Set InterViews type type_ = Event::up; button_ = last_button_; frontWindow = FrontWindow(); if(MACwindow::isOurWindow(frontWindow)){ ourStructure = WindowRep::rc(frontWindow); } else { ourStructure = nil; } if(ourStructure) ourStructure->MACinput(theEvent_, type_, button_); } void EventRep::mouseMotionEventHook(void){ WindowPtr frontWindow; WindowRep* ourStructure; //Set InterViews type type_ = Event::motion; button_ = last_button_; frontWindow = FrontWindow(); if(MACwindow::isOurWindow(frontWindow)){ ourStructure = WindowRep::rc(frontWindow); } else { ourStructure = nil; } if(ourStructure) ourStructure->MACinput(theEvent_, type_, button_); } void EventRep::keyDownEventHook(void){ WindowPtr frontWindow; WindowRep* ourStructure; long menuChoice; char theKey; frontWindow = FrontWindow(); //Set InterViews type type_ = Event::key; button_ = Event::none; UInt32 modifier; GetEventParameter(getEventRef(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifier), NULL, &modifier); if(MACwindow::isOurWindow(frontWindow)){ ourStructure = WindowRep::rc(frontWindow); } else { ourStructure = nil; } /* If the command key is down, check for menu selection. Do this even when there is no window open. */ if (modifier & cmdKey) /* see if a menu shortcut was hit. */ { char code; GetEventParameter(getEventRef(), kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(code), NULL, &code); theKey = (char)(code & charCodeMask); /* get the key pressed */ //UpdateMenusHook(frontWindow); /* update the menus before selection */ menuChoice = MenuKey(theKey); /* find out which menu item it matches */ if (HiWord(menuChoice)) /* if it matches a menu item */ { /* don't care if it's handled or not, all command-keys filtered out */ //MenuDispatchHook(frontWindow, menuChoice); /* dispatch control */ HiliteMenu(0); } } /* If key not a command key, and there is a window, pass key event to window. Note: front window is our window, we tested early in this routine */ else if (ourStructure) { ourStructure->MACinput(theEvent_, type_, button_); } } // Apple Event support is currently unimplamented void EventRep::appleEventHook(void){ OSErr error; //in order to implement this process ... at startup we need to set up a dispatch table //of procedures to handle these events. The AEProcessAppleEvent will automatically //look these procedures up and call them. // change by jijun 5/22/97 //debugfile("\nEvent.what=%d",theEvent_->what); //debugfile("\nEvent.message=%ld",theEvent_->message); //debugfile("\nEvent.when=%ld",theEvent_->when); //debugfile("\nEvent.where=%p",theEvent_->where); //debugfile("\nEvent.modifiers=%d",theEvent_->modifiers); assert(0); // error = AEProcessAppleEvent(theEvent_); /* process the event */ //debugfile("\nAppleProcess, error=%d", error); #if 0 error = AEProcessAppleEvent(theEvent_); /* process the event */ if (error) { if (AEInteractWithUser(kNoTimeOut, nil, nil) == noErr) { //debugfile("We get AEInteractWithUser"); printf("Error in Apple Event Hook"); exit(1); } } #endif } void EventRep::nullEventHook(void){ //can do idle time tasks } void EventRep::osEventHook(void){ assert(0); #if 0 char eventType; eventType = theEvent_->message >> 24; if(eventType & mouseMovedMessage){ WindowPtr aMacWindow = FrontWindow(); //Set InterViews type type_ = Event::motion; //THIS COULD FAIL WITH A WINDOW THAT IS NOT OURS if(WindowRep::rc(aMacWindow)) WindowRep::rc(aMacWindow)->MACinput(theEvent_, type_, Event::none); } else if(eventType & suspendResumeMessage){ if(theEvent_->message & resumeFlag){ //resume event //possibly adjust sleeptime, set a switchdin to true, and activate front } else { //suspend } } #endif } void EventRep::diskEventHook(void){ assert(0); #if 0 Point standard; //should be taken care of by system standard.h = standard.v = 90; if(HiWord(theEvent_->message) != noErr){ #if carbon #else DILoad(); DIBadMount(standard, theEvent_->message); DIUnload(); #endif } #endif } void EventRep::activateEventHook(void){ assert(0); #if 0 WindowPtr theWin; theWin = ((WindowPtr)theEvent_->message); if((MACwindow::isOurWindow(theWin))){ setWindow(theWin); if(windowOf()){ windowOf()->rep()->activate((theEvent_->modifiers & activeFlag) != 0); } } #endif } void EventRep::updateEventHook(void){ #if 0 WindowPtr theWin; GrafPtr oldPort; Rect contentRct; theWin = ((WindowPtr)(theEvent_->message)); if((MACwindow::isOurWindow(theWin))){ setWindow(theWin); if(windowOf()){ windowOf()->rep()->update(); } else { //the addition of this else helped back menus draw correctly GetPort(&oldPort); #if carbon SetPort(GetWindowPort(theWin)); GetPortBounds(GetWindowPort(theWin), &contentRct); #else SetPort(theWin); contentRct = theWin->portRect; #endif BeginUpdate(theWin); //EraseRect(&contentRct); #if carbon RgnHandle visRgn; visRgn = NewRgn(); GetPortVisibleRegion(GetWindowPort(theWin), visRgn); UpdateControls(theWin, visRgn); DisposeRgn(visRgn); #else UpdateControls(theWin, theWin->visRgn); #endif /* draw contents */ //easyWindow->DoDraw(macWindow, data); EndUpdate(theWin); SetPort(oldPort); } } #endif } void EventRep::appleMenuHook(short menuItem){ assert(0); #if 0 Str255 itemName; GrafPtr oldPort; switch(menuItem) { case 1: /* do the about box */ break; default: /* other Apple menu items */ GetPort(&oldPort); /* save port - OK, I'm paranoid */ GetMenuItemText(GetMenuHandle(APPLE_MENU_ID), menuItem, itemName); /* get chosen item's name */ /* Under System 7, the system immediately launches the "DA" as an application. It then comes back here immediately. Your app is still in the foreground. The system will then send us events to tell us to go into the background, and bring the "DA" into the foreground. */ #if carbon #else OpenDeskAcc(itemName); /* launch it */ #endif SetPort(oldPort); /* restore port, just in case */ break; } #endif } int EventRep::ivglobalMouse_x() { Point globalLocation; GrafPtr oldPort; GetPort(&oldPort); win_->rep()->setport(); LocalToGlobal(&globalLocation); SetPort(oldPort); return (globalLocation.h); } int EventRep::ivglobalMouse_y() { Point globalLocation; int height; GrafPtr oldPort; GetPort(&oldPort); win_->rep()->setport(); LocalToGlobal(&globalLocation); SetPort(oldPort); Display* d = win_->display(); if(d){ height = d->pheight(); } else { printf("Display not found line 768 event.c\n"); } return (height - globalLocation.v); } // ----------------------------------------------------------------------- // When a message comes in for a window that is use input related, this // function gets called by MACinput. This function then invokes the // current handler. // ----------------------------------------------------------------------- void EventRep::handleCallback(Event& e) { Handler* h = e.grabber(); if (h == nil) { h = e.handler(); } if (h != nil) { bool b = Resource::defer(true); h->ref(); h->event(e); h->unref(); Resource::flush(); Resource::defer(b); } } #endif neuron-7.6.3/src/lib/IV-Mac/color.cpp000066400000000000000000000205411340731477100172410ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif // ======================================================================= // // // // Macintosh implementation of the InterViews Color classes. // // // 1.1 // $Date: 4 Aug 1996 // // ======================================================================= #include #include #include #include #include #include #include #include #include #include //Appropriate conversion factor for the RGB color codes in the Macintosh #define BIT14_COLOR ((2 << 15) - 1) // ####################################################################### // ################# class ColorRep // ####################################################################### // ----------------------------------------------------------------------- // constructors/destructors // ----------------------------------------------------------------------- ColorRep::ColorRep( int r, // red component of color int g, // green component of color int b) // blue component of color { color_.red = r; color_.green = g; color_.blue = b; } ColorRep::~ColorRep() { } // ------------------------------------------------------------------ // translates a color name to the X11 string format of an rgb // specification (ie #??????). The colormap name is basically a // section in the colormap.ini file. // ------------------------------------------------------------------ #ifdef MAC static struct { char* name; char* value; } cc[] = { {"red", "#ff0000"}, {"green", "#00ff00"}, {"blue", "#0000ff"}, {"white", "#ffffff"}, {"black", "#000000"}, {"orange", "#ffa500"}, {"brown", "#a52a2a"}, {"violet", "#ee82ee"}, {"yellow", "#ffff00"}, {"gray", "#bebebe"}, {0} }; #endif const char* ColorRep::nameToRGB(const char* colormap, const char* name) { if(!colormap && !name) return nil; #ifdef MAC int i; for (i = 0; cc[i].name; ++i) { if (strcmp(cc[i].name, name) == 0) { return cc[i].value; } } #endif #if 0 if (COLORMAP_FILE == NULL) { const char* loc = Session::installLocation(); const char* leafname = "/colormap.ini"; COLORMAP_FILE = new char[ strlen(loc) + strlen(leafname) + 1]; strcpy(COLORMAP_FILE, loc); strcat(COLORMAP_FILE, leafname); } static char rgbName[10]; if (GetPrivateProfileString(colormap, name, "", rgbName, 10, COLORMAP_FILE)) { return rgbName; } #endif return NULL; } const Color* ColorRep::rgbToColor(const char* name) { if (name[0] == '#') { int r; int g; int b; sscanf(&(name[1]), "%2x", &r); sscanf(&(name[3]), "%2x", &g); sscanf(&(name[5]), "%2x", &b); const Color* c = new Color( (ColorIntensity) (r/255.0), (ColorIntensity) (g/255.0), (ColorIntensity) (b/255.0), 1.0); return c; } return nil; } // ####################################################################### // ################# class Color // ####################################################################### // The following data is used to create 16 stipple patterns used when the // alpha value of the color is set to something other than 1.0. static unsigned char stippleData[16][8] = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, { 0x11, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00 }, { 0x11, 0x00, 0x44, 0x00, 0x11, 0x00, 0x44, 0x00 }, { 0x55, 0x00, 0x44, 0x00, 0x55, 0x00, 0x44, 0x00 }, { 0x55, 0x00, 0x55, 0x00, 0x55, 0x00, 0x55, 0x00 }, { 0x55, 0x22, 0x55, 0x00, 0x55, 0x22, 0x55, 0x00 }, { 0x55, 0x22, 0x55, 0x88, 0x55, 0x22, 0x55, 0x88 }, { 0x55, 0xAA, 0x55, 0x88, 0x55, 0xAA, 0x55, 0x88 }, { 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA }, { 0x77, 0xAA, 0x55, 0xAA, 0x77, 0xAA, 0x55, 0xAA }, { 0x77, 0xAA, 0xDD, 0xAA, 0x77, 0xAA, 0xDD, 0xAA }, { 0xFF, 0xAA, 0xDD, 0xAA, 0xFF, 0xAA, 0xDD, 0xAA }, { 0xFF, 0xAA, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF, 0xAA }, { 0xFF, 0xBB, 0xFF, 0xAA, 0xFF, 0xBB, 0xFF, 0xAA }, { 0xFF, 0xBB, 0xFF, 0xEE, 0xFF, 0xBB, 0xFF, 0xEE }, { 0xFF, 0xFF, 0xFF, 0xEE, 0xFF, 0xFF, 0xFF, 0xEE }, }; Color::Color( ColorIntensity r, // red component of color ColorIntensity g, // green component of color ColorIntensity b, // blue component of color float alpha, ColorOp op) { int red = (int) (r * BIT14_COLOR); int green = (int) (g * BIT14_COLOR); int blue = (int) (b * BIT14_COLOR); impl_ = new ColorRep(red, green, blue); impl_->op = op; // ---- set stipple pattern if dither desired ---- impl_->alpha = alpha; if ((alpha > 0.9999) && (alpha < 1.0001)) { impl_->stipple = NULL; } else { int index = int(alpha * 16); index = (index > 15) ? 15 : index; index = (index < 0) ? 0 : index; impl_->stipple = new Bitmap(stippleData[index], 8, 8); } } Color::Color( const Color& color, float alpha, ColorOp op) { RGBColor* cref = color.impl_->MACcolor(); int red = cref->red; int green = cref->green; int blue = cref->blue; impl_ = new ColorRep(red, blue, green); impl_->op = op; // ---- set stipple pattern if dither desired ---- impl_->alpha = alpha; if ((alpha > 0.9999) && (alpha < 1.0001)) { impl_->stipple = NULL; } else { int index = int(alpha * 16); index = (index > 15) ? 15 : index; index = (index < 0) ? 0 : index; impl_->stipple = new Bitmap(stippleData[index], 8, 8); } } Color::~Color() { delete impl_->stipple; delete impl_; } void Color::intensities( Display*, ColorIntensity& r, ColorIntensity& g, ColorIntensity& b) const { intensities(r, g, b); } void Color::intensities( ColorIntensity& r, ColorIntensity& g, ColorIntensity& b) const { RGBColor * cref = impl_->MACcolor(); r = (ColorIntensity) (((float) cref->red) / (float)BIT14_COLOR); g = (ColorIntensity) (((float) cref->green) / (float)BIT14_COLOR); b = (ColorIntensity) (((float) cref->blue) / (float)BIT14_COLOR); } float Color::alpha() const { return impl_->alpha; } const Color* Color::brightness(float adjust) const { ColorIntensity r, g, b; intensities(r, g, b); if (adjust >= 0) { r += (1 - r) * adjust; g += (1 - g) * adjust; b += (1 - b) * adjust; } else { float f = (float) (adjust + 1.0); r *= f; g *= f; b *= f; } return new Color(r, g, b); } bool Color::distinguished(const Color* c) const { return distinguished(Session::instance()->default_display(), c); } bool Color::distinguished(Display* d, const Color* color) const { RGBColor * cref = color->impl_->MACcolor(); int red = cref->red; int green = cref->green; int blue = cref->blue; RGBColor * bogus; //return ( globalPalette.findEntry(red,green,blue,bogus) ) ? false : true; return false; } // --------------------------------------------------------------------------- // Lookup color by name. This is intended to look things up by the X11 // style name, which is partially supported under the Macintosh implementation. // If the name starts with a '#' then we translate the hex numbers to rgb // values directly. Otherwise, we attempt to look up the color name in // the default colormap. // --------------------------------------------------------------------------- const Color* Color::lookup(Display* d, const char* name) { if (name) { // ---- check for rgb specification ---- if (name[0] == '#') return ColorRep::rgbToColor(name); // ---- must be a color name ---- const char* rgb; if (rgb = ColorRep::nameToRGB("default", name)) { return ColorRep::rgbToColor(rgb); } } return nil; } const Color* Color::lookup(Display* d, const String& s) { // Since the value is not expected to be null terminiated, we simply // pass it through to the function that expects a (const char*) arg. return lookup(d, s.string()); } bool Color::find( const Display* display, const String& name, ColorIntensity& r, ColorIntensity& g, ColorIntensity& b) { NullTerminatedString nm(name); return find(display, nm.string(), r, g, b); } bool Color::find( const Display*, const char* name, ColorIntensity& r, ColorIntensity& g, ColorIntensity& b) { const char* rgb; if (rgb = ColorRep::nameToRGB("default", name)) { if (name[0] == '#') { int ir; int ig; int ib; sscanf(&(name[1]), "%2x", &ir); sscanf(&(name[3]), "%2x", &ig); sscanf(&(name[5]), "%2x", &ib); r = (ColorIntensity) (ir/255.0); g = (ColorIntensity) (ig/255.0); b = (ColorIntensity) (ib/255.0); return true; } } return false; } neuron-7.6.3/src/lib/IV-Mac/cursor.cpp000077500000000000000000000107661340731477100174530ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif // ========================================================================= // // cursor.c // // Macintosh implementation of the InterViews cursor class. // // // // 1.1 // $Date: 4 Aug 1996 // ====================================================================== #if carbon static Cursor mac_arrow; // before defining the InterViews Cursor #endif #include #include #include #include #include #include #include #include #include Cursor* defaultCursor; Cursor* arrow; Cursor* crosshairs; Cursor* ltextCursor; Cursor* rtextCursor; Cursor* hourglass; Cursor* upperleft; Cursor* upperright; Cursor* lowerleft; Cursor* lowerright; Cursor* noCursor; /* * Define the builtin cursors. */ void Cursor::init() { // // The MS include file define MAKEINTRESOURCE to cast to a string, which // is not the integer that it really is (which we expect as a constructor // argument. Therefore, we cast the IDC_XXX values to an int. // //arrow = new Cursor((int) IDC_ARROW); //crosshairs = new Cursor((int) IDC_CROSS); crosshairs = new Cursor(crossCursor); hourglass = new Cursor(watchCursor); //Arrow seems to need a special setup since it shares the name with the //Mac native definition. A new cursor is formed by calling a new Cursor with //a predefined cursor. It's data member "theCursor" is then forced to be a cursor //handle to the Macintosh arrow. This method is ugly but it is the only way I //could think of doing it at the time. arrow = new Cursor(crossCursor); #if carbon // following line gives bus error on osx. // GetQDGlobalsArrow((arrow->rep())->theCursor); GetQDGlobalsArrow(&mac_arrow); *(arrow->rep())->theCursor = &mac_arrow; #else *((arrow->rep())->theCursor) = &(qd.arrow); #endif defaultCursor = arrow; } // ----------------------------------------------------------------------- // constructors and destructors for the Cursor class. // ----------------------------------------------------------------------- /* * Create a cursor a specific pattern and mask (16x16 in size) */ Cursor::Cursor( short xoff, short yoff, const int* p, const int* m, const Color*, // foreground color const Color *) // background color { //printf("This Cursor::Cursor(short xoff ... is not yet implemented\n"); rep_ = new CursorRep(xoff, yoff, p, m); } /* * Create a cursor from bitmaps. */ Cursor::Cursor( const Bitmap* pat, const Bitmap* mask, const Color* , // foreground color - unsupported const Color* ) // background color - unsupported { //printf("This Cursor::Cursor(const Bitmap ... is not yet implemented\n"); rep_ = new CursorRep(*pat->rep(), *mask->rep()); } /* * Create a cursor from a font. */ Cursor::Cursor( const Font*, // font to use int , // data character int , // mask character const Color* , // foreground color const Color* ) // background color { // !!!! currently unsupported !!!!! //WindowRep::errorMessage("TBD - cursor from a font"); printf("NOT IMPLEMENTED - Create cursor from font"); exit(1); } /* * Create a cursor from the predefined cursor font. */ Cursor::Cursor( int n, // resource id const Color*, // foreground color const Color*) // background color { rep_ = new CursorRep(n); } Cursor::Cursor( const char* n) { rep_ = new CursorRep(n); } Cursor::~Cursor() { delete rep_; } // ####################################################################### // ################## class CursorRep // ####################################################################### CursorRep::CursorRep(int id) { theCursor = GetCursor(id); } CursorRep::CursorRep(const char* n) { printf("NOT IMPLEMENTED - CursorRep(const char *n)"); exit(1); } CursorRep::CursorRep( BitmapRep& data, BitmapRep& mask) { printf("NOT IMPLEMENTED - CursorRep(const bitmap)"); theCursor = GetCursor(4); } CursorRep::CursorRep( short hot_x, short hot_y, const int* data, const int* mask) { printf("NOT IMPLEMENTED - Data Mask Cursor"); theCursor = GetCursor(4); } CursorRep::~CursorRep() { //char buf[100]; //DestroyCursor(cursor); printf("NOT IMPLEMENTED - destroy cursor"); exit(1); } neuron-7.6.3/src/lib/IV-Mac/display.cpp000066400000000000000000000131261340731477100175710ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif // ======================================================================= // // // // // 1.2 // $Date: 4 Aug 1996 // // ======================================================================= #include #include #include #include #include #include #include #include #if !carbon #include // SysBeep got moved #endif class DisplayRep { public: DisplayRep(); ~DisplayRep(); public: PixelCoord pwidth_; PixelCoord pheight_; Coord width_; Coord height_; Style* style_; }; DisplayRep::DisplayRep() { style_ = nil; } DisplayRep::~DisplayRep() { } // ####################################################################### // ################# class Display // ####################################################################### extern Style* iv_display_style_; Display::Display(DisplayRep* d) { rep_ = d; x_point_ = 1; y_point_ = 1; x_pixel_ = 1; y_pixel_ = 1; // ---- determine display size ---- GDHandle theGraphicsDevice = GetMainDevice(); Rect theScreen = (*theGraphicsDevice)->gdRect; rep_->pwidth_ = (theScreen.right) - (theScreen.left); rep_->pheight_ = (theScreen.bottom) - (theScreen.top);; rep_->width_ = to_coord( rep_->pwidth_, Dimension_X); rep_->height_ = to_coord( rep_->pheight_, Dimension_Y); } Display* Display::open(const String&) { return open((const char*) 0); } Display* Display::open() { return open(nil); } Display* Display::open(const char*) { DisplayRep* d = new DisplayRep; return new Display(d); } void Display::close() { } Display::~Display() { DisplayRep* d = rep(); //Resource::unref_deferred(d->style_); delete d; } int Display::fd() const { return 0; } Coord Display::width() const { return rep()->width_; } Coord Display::height() const { return rep()->height_; } PixelCoord Display::pwidth() const { return rep()->pwidth_; } PixelCoord Display::pheight() const { return rep()->pheight_; } /* * Convert millimeters to points. We use 72.0 pts/in and 25.4 mm/in. */ // This function is probably unecessary for Macintosh port static inline double mm_to_points(double mm) { return (72.0 / 25.4) * mm; } Coord Display::a_width() const { DisplayRep& d = *rep(); return d.width_; } Coord Display::a_height() const { DisplayRep& d = *rep(); return d.height_; } bool Display::defaults(String&) const { return false; } void Display::style(Style* s) { DisplayRep& d = *rep(); Resource::ref(s); Resource::unref(d.style_); d.style_ = s; } Style* Display::style() const { return rep()->style_; } void Display::set_screen(int) //Not implemented in MS-windows version ... not done here { } void Display::repair() //Not implemented in MS-windows version ... not done here { } void Display::flush() //Not implemented in MS-windows version ... not done here { } void Display::sync() //Not implemented in MS-windows version ... not done here { } void Display::ring_bell(int) { SysBeep(30); } void Display::set_key_click(int) //Not implemented in MS-windows version ... not done here { } void Display::set_auto_repeat(bool) //Not implemented in MS-windows version ... not done here { } void Display::set_pointer_feedback(int, int) //Not implemented in MS-windows version ... not done here { } void Display::move_pointer( Coord, // x coordinate Coord) // y coordinate { // although you can move the pointer... it's only useful when there // is no mouse attached. The instant the mouse is touched the pointer // goes back to where it was. An assertion failure is done if there // is an attempt to warp the pointer since this really isn't portable // to Windows. //MWassert(0); } SelectionManager* Display::primary_selection() { return nil; //find_selection("PRIMARY"); } SelectionManager* Display::secondary_selection() { return nil; //find_selection("SECONDARY"); } SelectionManager* Display::clipboard_selection() { return nil; //find_selection("CLIPBOARD"); } SelectionManager* Display::find_selection(const char*) { return nil; //find_selection(String(name)); } SelectionManager* Display::find_selection(const String&) { return nil; } /* * Read the next event if one is pending. Otherwise, return false. * Window::receive will be called on the target window for the event, * if the window is known and is valid. Because we don't keep track * of subwindows, it is possible to get an event for a subwindow after * the main window has been unmapped. We must ignore such events. */ bool Display::get(Event&) { return false; } void Display::put(const Event&) { } /* * Check to see if the display connection just shut down. */ bool Display::closed() { return false; } /* * Add a handler to the grabber list. The handler is ref'd to ensure * that it is not deallocated while on the list. */ void Display::grab(Window*, Handler* h) { Event e; e.grab(h); } /* * Remove a handler from the grabber list. * This function has no effect if the handler is not presently on the list. * If the handler is on the list, it is unref'd. */ void Display::ungrab(Handler* h, bool) { Event e; e.ungrab(h); } /* * Return the most recent grabber, or nil if the list is empty. */ Handler* Display::grabber() const { Event e; return e.grabber(); } /* * Check whether a given handler is on the grabber list. */ bool Display::is_grabbing(Handler* h) const { Event e; return e.is_grabbing(h); } neuron-7.6.3/src/lib/IV-Mac/event.cpp000066400000000000000000000536721340731477100172570ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #if !carbon // ======================================================================= // // // // Macintosh implementation of the InterViews Event classes. The // flow of control is significantly different from MS-Windows. Events // are held on a que, and are read in by Session::read. The event handler // then parses the event. Macintosh native calls are performed on most // events. Mouse motion, key down events, and mouse down events in the // content area of a window, however, are given to the function // MACwindow::MACinput. This function calls EventRep::handleCallBack // which essentially allows Inteviews to handle the event. // // // 1.3 // $Date: 4 Aug 1996 // // ======================================================================= #include #include #include #include #include #include #include #include #include #include #include #include #if !carbon #include // SysBeep got moved #endif // add by jijun 5/22/97 extern "C" { void debugfile(const char*, ...);} //Temporarily being used so that we can quit from the program //Need to still do menu support. #define APPLE_MENU_ID 32000 #define FILE_MENU_ID 32001 #define QUIT_ITEM 9 static int last_button_; //extern "C" { void hoc_quit(); void ivoc_dismiss_defer();} declarePtrList(MAChandlerPtrList, Handler) implementPtrList(MAChandlerPtrList, Handler) // ---- grabbing event handler list ---- static MAChandlerPtrList grabberList(100); #if carbon static Point mouse_loc_; Point& EventRep::mouse_loc(EventRef er) { GetEventParameter(er, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(mouse_loc_), NULL, &mouse_loc_); return mouse_loc_; } #endif //global point to determine mouse movement Point THE_PREVIOUS_MOUSE_POINT; Event::Event() { rep_ = new EventRep; } Event::Event(const Event& e) { rep_ = new EventRep; copy_rep(e); } Event::~Event() { if (rep_) delete rep_; } Event& Event::operator =(const Event& e) { copy_rep(e); return *this; } void Event::copy_rep(const Event& e) { *rep_ = *e.rep_; } void Event::display(Display*) { } Display* Event::display() const { return rep_->windowOf()->display(); } void Event::window(Window*) { // This is unsupported under the MS-Windows version. When the event // was received, it was already known exactly which window the event // was for, and changing it is dangerous. Supporting this call caused // strange behavior, so it has been changed to do nothing!! // Macintosh implementation has not been considered } Window* Event::window() const { return rep_->windowOf(); } // ----------------------------------------------------------------------- // The following operations deal with events coming from a UNIX style file // (actually socket) where events can be read, pushed back, or tested to // see if any new ones are pending. // // These should not be used anyway... the programmer should be running // things with Session::run() and using the Dispatch class for any other // forms of event handling. // // Pending has been implemented under the Macintosh because it was fairly // simple. The other functions haven't really been considered. // ----------------------------------------------------------------------- bool Event::pending() const { return Session::instance()->pending(); } void Event::read() { printf("Event::read - unsupported"); //Session::instance()->read(*this); } bool Event::read(long , long ) { Event::read(); //return Session::instance()->read(s, u, *this); return false; } void Event::unread() { printf("Event::unread - unsupported\n"); //rep()->display_->put(*this); } void Event::poll() { // MS Windows Note // used to query the mouse position, which could be synthsized, but // for now it's unimplimented... I consider this a rather unclean // interface to begin with. // Haven't really dealt with this for the Machintsoh printf("Event::poll - unsupported"); } // ----------------------------------------------------------------------- // Find an event handler for the window associated with this event. // ----------------------------------------------------------------------- Handler* Event::handler() const { Handler* h = nil; Window* w = rep_->windowOf(); if (w != nil) { h = w->target(*this); } return h; } // ----------------------------------------------------------------------- // This function parses the Macintosh Event Record and calls an appropriate // hook to deal with the event. // ----------------------------------------------------------------------- void Event::handle() { EventRecord * record = rep_->getEventRecord(); if(record){ switch(record->what){ case mouseDown: printf("mouseDown\n"); rep_->mouseDownEventHook(); break; case mouseUp: printf("mouseUp\n"); rep_->mouseUpEventHook(); // ivoc_dismiss_defer(); break; case keyDown: case autoKey: printf("keyDown\n"); rep_->keyDownEventHook(); break; case updateEvt: printf("updateEvt\n"); rep_->updateEventHook(); break; case activateEvt: printf("activateEvt\n"); rep_->activateEventHook(); break; case diskEvt: printf("diskEvt\n"); rep_->diskEventHook(); break; case osEvt: printf("osEvt\n"); rep_->osEventHook(); break; case kHighLevelEvent: printf("kHighLevelEvent\n"); rep_->appleEventHook(); break; case nullEvent: printf("nullEvent\n"); rep_->nullEventHook(); break; default: printf("default\n"); break; } } else { printf("Error Allocating memory for record"); exit(1); } } // ----------------------------------------------------------------------- // event handler grabs // ----------------------------------------------------------------------- void Event::grab(Handler* h) const { // ---- push on grabber stack ---- Resource::ref(h); grabberList.append(h); } void Event::ungrab(Handler* h) const { // ---- remove from collection of grabbers ---- for (ListUpdater(MAChandlerPtrList) i(grabberList); i.more(); i.next()) { Handler* curr_h = i.cur(); if (curr_h == h) { i.remove_cur(); Resource::unref(h); break; } } } Handler* Event::grabber() const { if (grabberList.count() == 0) return nil; return grabberList.item(0); } bool Event::is_grabbing(Handler* h) const { for (ListItr(MAChandlerPtrList) i(grabberList); i.more(); i.next()) { Handler* curr_h = i.cur(); if (curr_h == h) { return true; } } return false; } // ----------------------------------------------------------------------- // Return the type of event. Since all the work is done at the time the // event is synthesized, this simply returns the event type that was // stashed in the EventRep. // ----------------------------------------------------------------------- EventType Event::type() const { return rep_->typeOf(); } unsigned long Event::time() const { EventRecord * temp; if(temp = (rep()->getEventRecord())) return temp->when; //Should not reach this point return 0; } Coord Event::pointer_x() const { Coord x_temp; Display* dpy = display(); return dpy->to_coord(rep_->ivlocalMouse_x(), Dimension_X); } Coord Event::pointer_y() const { Display* dpy = display(); return dpy->to_coord(rep_->ivlocalMouse_y(), Dimension_Y);; } Coord Event::pointer_root_x() const { // Display* dpy = display(); // return dpy->to_coord(rep_->ivglobalMouse_x(), Dimension_X); Coord x = pointer_x() + window()->left(); // printf("rootx=%g\n", x); return x; } Coord Event::pointer_root_y() const { // Display* dpy = display(); // return dpy->to_coord(rep_->ivglobalMouse_y(), Dimension_Y); Coord y = pointer_y() + window()->bottom(); // printf("rooty=%g\n", y); return y; } EventButton Event::pointer_button() const { return rep_->buttonOf(); } unsigned int Event::keymask() const { printf("Event::keymask() - unsupported"); return 0; } // ------------------------------------------------------------------------- // key tests - It is presumed that this query is being made in response // to some key/pointer event, in which case the modifiers field of the EvenT // record would hold valid information. // ------------------------------------------------------------------------- bool Event::control_is_down() const { return (rep_->getEventRecord()->modifiers & controlKey) ? true : false; } bool Event::shift_is_down() const { return (rep_->getEventRecord()->modifiers & shiftKey) ? true : false; } //These aren't called ... so we'll deal with it later // bool Event::left_is_down() const { return true;} bool Event::middle_is_down() const { return false; } bool Event::right_is_down() const { return false; } bool Event::capslock_is_down() const { return (rep_->getEventRecord()->modifiers & alphaLock) ? true : false; } bool Event::meta_is_down() const { return false; } unsigned char Event::keycode() const { if (rep_->typeOf() == key){ return ((char)((rep_->getEventRecord()->message) & charCodeMask)); } else { return 0; } } // from 0x20 to 0x2F unsigned int Event::mapkey(char* buff, unsigned int bufflen) const { // printf("Event::mapkey currently not implemented\n"); // return 0; buff[0] = keycode(); buff[1] = '\0'; if (buff[0] == '\0') { return 0; }else{ return 1; } } unsigned long Event::keysym() const { // TBD //MWassert(0); printf("Event::keycode currently not implemented"); return 0; } // ####################################################################### // ########################## class EventRep // ####################################################################### EventRep::EventRep(){ theEvent_ = new EventRecord; win_ = nil; } EventRep::~EventRep(){ if(theEvent_) delete theEvent_; } void EventRep::setWindow(WindowPtr aMacWindow){ WindowRep* temp; temp = WindowRep::rc(aMacWindow); if(temp){ win_ = temp->ivWindowOf(); } else { win_ = nil; } } void EventRep::mouseDownEventHook(void){ WindowPtr frontWindow = nil; WindowPtr hitWindow = nil; WindowRep *ourStructure; short windowPart; long menuChoice; Rect dragRect; short windowType; /* modal, modeless, etc. */ frontWindow = FrontWindow(); windowPart = FindWindow(theEvent_->where, &hitWindow); //Set InterViews type type_ = Event::down; //Set InterViews button if(theEvent_->modifiers & (controlKey | cmdKey)){ button_ = Event::right; } else if (theEvent_->modifiers & optionKey){ button_ = Event::middle; } else { button_ = Event::left; } last_button_ = button_; switch (windowPart) { case inMenuBar: #if 0 /* user made a menu selection */ if(ourStructure = ((CWindowPeek)frontWindow)->refCon) /* enable/disable menu items */ ourStructure->updateMenus(); #endif menuChoice = MenuSelect(theEvent_->where); /* drop menu and track choice */ if (menuChoice) /* if a choice made */ { if((HiWord(menuChoice) == FILE_MENU_ID) && (LoWord(menuChoice) == QUIT_ITEM)){ //Session::instance()->quit(); // hoc_quit(); } else if ((HiWord(menuChoice) == APPLE_MENU_ID)){ appleMenuHook(LoWord(menuChoice)); } /* dispatch control */ } HiliteMenu(0); /* unhilite the menubar when done */ break; case inDrag: /* there has to be a hit window */ /* if clicking a background window & not a command drag */ if ( (hitWindow != frontWindow) && !(theEvent_->modifiers & cmdKey)) { windowType = MACwindow::isDialog(frontWindow); if ( windowType == MACwindow::MODAL || windowType == MACwindow::MOVABLE_MODAL){ SysBeep(30); /* modal window in front, sorry Charlie */ } else { SelectWindow(hitWindow); /* activate this window */ // add by jijun 3/4/97 //allow fast drag selected window if (ourStructure = WindowRep::rc(hitWindow)) { ourStructure->doDrag(theEvent_); } } } else if (ourStructure = WindowRep::rc(hitWindow)) /* if it's our window */ { /* call the window's drag behavior */ ourStructure->doDrag(theEvent_); } else /* not our window, e.g. could be moveable dialog */ { #if carbon GetRegionBounds(GetGrayRgn(), &dragRect); #else dragRect = (**GetGrayRgn()).rgnBBox; /* drag to any screen */ #endif DragWindow(hitWindow, theEvent_->where, &dragRect); } break; case inGrow: if (ourStructure = WindowRep::rc(hitWindow)) /* if it's our window */ { /* call the window's grow behavior */ ourStructure->doGrow(theEvent_); } break; case inGoAway: /* track mouse in go-away box */ if (TrackGoAway(hitWindow, theEvent_->where)) { /* if the option key is down */ if (theEvent_->modifiers & optionKey) { /* close all windows, asking user to save if needed */ WindowPtr macWindow = FrontWindow(); /* first window */ while (macWindow){ /* make sure it's our window, if not get next */ if((MACwindow::isOurWindow(macWindow)) && WindowRep::rc(macWindow)){ /* close this window, if cancelled, return error */ //need to add file saving options DisposeWindow(macWindow); //if (error){ //return error; //} } #if carbon macWindow = GetNextWindow(macWindow); #else macWindow = (WindowPtr)((CWindowPeek)macWindow)->nextWindow; #endif } }else { //close this one window ourStructure = WindowRep::rc(hitWindow); if (ourStructure && ourStructure->close_callback_) { // I hope nobody needs a real event. Event e; ourStructure->close_callback_->event(e); } } // ivoc_dismiss_defer(); } break; case inZoomIn: case inZoomOut: if (ourStructure = WindowRep::rc(hitWindow)) { /* track mouse in the zoom box */ if (TrackBox(hitWindow, theEvent_->where, windowPart)) { /* determine if we're zooming in or out */ short zoomDirection = windowPart; /* tell the window to do it */ ourStructure->doZoom((void *)&zoomDirection); } } break; case inDesk: /* do nothing */ break; case inSysWindow: /* Pass along the click to system windows (desk accessories) */ /* Even in the System 7 environment you may get one of these */ /* if the user opens a DA inside your app's partition */ #if carbon #else SystemClick(theEvent_, hitWindow); #endif break; case inContent: /* if it is non-front window, activate it */ if (hitWindow != frontWindow){ windowType = MACwindow::isDialog(frontWindow); if ( windowType == MACwindow::MODAL || windowType == MACwindow::MOVABLE_MODAL){ SysBeep(30); /* modal window in front, sorry Charlie */ } else if (ourStructure = WindowRep::rc(hitWindow)) /* hit a background EasyWindow */ { ourStructure->doBackgroundClick(theEvent_); // not mac standard but helpful to handle the event as well as select window // give up drag/drop? ourStructure->MACinput(theEvent_, type_, button_); } else /* hit some other window */ { SelectWindow(hitWindow); /* activate this window */ } } /* otherwise, if it's my front window do click in content */ else if ((ourStructure = WindowRep::rc(frontWindow)) && #if carbon GetWindowKind(frontWindow) == 8) #else (((CWindowPeek)frontWindow)->windowKind == 8)) #endif { ourStructure->MACinput(theEvent_, type_, button_); } break; default: break; } } void EventRep::mouseUpEventHook(void){ WindowPtr frontWindow; WindowRep* ourStructure; //Set InterViews type type_ = Event::up; button_ = last_button_; frontWindow = FrontWindow(); if(MACwindow::isOurWindow(frontWindow)){ ourStructure = WindowRep::rc(frontWindow); } else { ourStructure = nil; } if(ourStructure) ourStructure->MACinput(theEvent_, type_, button_); } void EventRep::keyDownEventHook(void){ WindowPtr frontWindow; WindowRep* ourStructure; long menuChoice; char theKey; frontWindow = FrontWindow(); //Set InterViews type type_ = Event::key; button_ = Event::none; if(MACwindow::isOurWindow(frontWindow)){ ourStructure = WindowRep::rc(frontWindow); } else { ourStructure = nil; } /* If the command key is down, check for menu selection. Do this even when there is no window open. */ if (theEvent_->modifiers & cmdKey) /* see if a menu shortcut was hit. */ { theKey = (char)(theEvent_->message & charCodeMask); /* get the key pressed */ //UpdateMenusHook(frontWindow); /* update the menus before selection */ menuChoice = MenuKey(theKey); /* find out which menu item it matches */ if (HiWord(menuChoice)) /* if it matches a menu item */ { /* don't care if it's handled or not, all command-keys filtered out */ //MenuDispatchHook(frontWindow, menuChoice); /* dispatch control */ HiliteMenu(0); } } /* If key not a command key, and there is a window, pass key event to window. Note: front window is our window, we tested early in this routine */ else if (ourStructure) { ourStructure->MACinput(theEvent_, type_, button_); } } // Apple Event support is currently unimplamented void EventRep::appleEventHook(void){ OSErr error; //in order to implement this process ... at startup we need to set up a dispatch table //of procedures to handle these events. The AEProcessAppleEvent will automatically //look these procedures up and call them. // change by jijun 5/22/97 //debugfile("\nEvent.what=%d",theEvent_->what); //debugfile("\nEvent.message=%ld",theEvent_->message); //debugfile("\nEvent.when=%ld",theEvent_->when); //debugfile("\nEvent.where=%p",theEvent_->where); //debugfile("\nEvent.modifiers=%d",theEvent_->modifiers); error = AEProcessAppleEvent(theEvent_); /* process the event */ //debugfile("\nAppleProcess, error=%d", error); #if 0 error = AEProcessAppleEvent(theEvent_); /* process the event */ if (error) { if (AEInteractWithUser(kNoTimeOut, nil, nil) == noErr) { //debugfile("We get AEInteractWithUser"); printf("Error in Apple Event Hook"); exit(1); } } #endif } void EventRep::nullEventHook(void){ //can do idle time tasks } void EventRep::osEventHook(void){ char eventType; eventType = theEvent_->message >> 24; if(eventType & mouseMovedMessage){ WindowPtr aMacWindow = FrontWindow(); //Set InterViews type type_ = Event::motion; //THIS COULD FAIL WITH A WINDOW THAT IS NOT OURS if(WindowRep::rc(aMacWindow)) WindowRep::rc(aMacWindow)->MACinput(theEvent_, type_, Event::none); } else if(eventType & suspendResumeMessage){ if(theEvent_->message & resumeFlag){ //resume event //possibly adjust sleeptime, set a switchdin to true, and activate front } else { //suspend } } } void EventRep::diskEventHook(void){ Point standard; //should be taken care of by system standard.h = standard.v = 90; if(HiWord(theEvent_->message) != noErr){ #if carbon #else DILoad(); DIBadMount(standard, theEvent_->message); DIUnload(); #endif } } void EventRep::activateEventHook(void){ WindowPtr theWin; theWin = ((WindowPtr)theEvent_->message); if((MACwindow::isOurWindow(theWin))){ setWindow(theWin); if(windowOf()){ windowOf()->rep()->activate((theEvent_->modifiers & activeFlag) != 0); } } } void EventRep::updateEventHook(void){ WindowPtr theWin; GrafPtr oldPort; Rect contentRct; theWin = ((WindowPtr)(theEvent_->message)); if((MACwindow::isOurWindow(theWin))){ setWindow(theWin); if(windowOf()){ windowOf()->rep()->update(); } else { //the addition of this else helped back menus draw correctly GetPort(&oldPort); #if carbon SetPort(GetWindowPort(theWin)); GetPortBounds(GetWindowPort(theWin), &contentRct); #else SetPort(theWin); contentRct = theWin->portRect; #endif BeginUpdate(theWin); //EraseRect(&contentRct); #if carbon RgnHandle visRgn; visRgn = NewRgn(); GetPortVisibleRegion(GetWindowPort(theWin), visRgn); UpdateControls(theWin, visRgn); DisposeRgn(visRgn); #else UpdateControls(theWin, theWin->visRgn); #endif /* draw contents */ //easyWindow->DoDraw(macWindow, data); EndUpdate(theWin); SetPort(oldPort); } } } void EventRep::appleMenuHook(short menuItem){ Str255 itemName; GrafPtr oldPort; switch(menuItem) { case 1: /* do the about box */ break; default: /* other Apple menu items */ GetPort(&oldPort); /* save port - OK, I'm paranoid */ GetMenuItemText(GetMenuHandle(APPLE_MENU_ID), menuItem, itemName); /* get chosen item's name */ /* Under System 7, the system immediately launches the "DA" as an application. It then comes back here immediately. Your app is still in the foreground. The system will then send us events to tell us to go into the background, and bring the "DA" into the foreground. */ #if carbon #else OpenDeskAcc(itemName); /* launch it */ #endif SetPort(oldPort); /* restore port, just in case */ break; } } int EventRep::ivglobalMouse_x() { Point globalLocation; GrafPtr oldPort; GetPort(&oldPort); win_->rep()->setport(); LocalToGlobal(&globalLocation); SetPort(oldPort); return (globalLocation.h); } int EventRep::ivglobalMouse_y() { Point globalLocation; int height; GrafPtr oldPort; GetPort(&oldPort); win_->rep()->setport(); LocalToGlobal(&globalLocation); SetPort(oldPort); Display* d = win_->display(); if(d){ height = d->pheight(); } else { printf("Display not found line 768 event.c\n"); } return (height - globalLocation.v); } // ----------------------------------------------------------------------- // When a message comes in for a window that is use input related, this // function gets called by MACinput. This function then invokes the // current handler. // ----------------------------------------------------------------------- void EventRep::handleCallback(Event& e) { Handler* h = e.grabber(); if (h == nil) { h = e.handler(); } if (h != nil) { bool b = Resource::defer(true); h->ref(); h->event(e); h->unref(); Resource::flush(); Resource::defer(b); } } #endif neuron-7.6.3/src/lib/IV-Mac/font.cpp000066400000000000000000000423471340731477100171010ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif // ========================================================================= // // // // MS-Windows dependent Font representation. The font information is stored // in a LOGFONT structure until the font is needed, at which time it can be // created with CreateFontIndirect(). // // The user is given a constructor with a LOGFONT structure to use as a // reference. This is primarily for flexibility where one doesn't care // about portability (one really shouldn't use the FontRep directly). The // user is cautioned however that there is no guarantee the fields won't // be overwritten (lfEscapement and lfOrientation may change for example). // // // 1.1 // 1997/03/28 17:36:16 // // Windows 3.1/NT InterViews Port // Copyright (c) 1993 Tim Prinzing // // This media contains programs and data which are proprietary // to Tim Prinzing. // // These contents are provided under a Tim Prinzing software source // license, which prohibits their unauthorized resale or distribution // outside of the buyer's organization. // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL Tim Prinzing BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // // ====================================================================== /* * PORTIONS OF THIS FILE ARE BASED UPON THE InterViews 3.1 DISTRIBUTION * WHICH CARRIED THE FOLLOWING COPYRIGHT: * * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ // ---- libc includes ---- #include #include #include // ---- InterViews includes ---- #include #include #include #include #include #include #include #include #include // ---- font family name list type ----- //declarePtrList(MWfamilyPtrList, char) //implementPtrList(MWfamilyPtrList, char) // ------------------------------------------------------------------ // window used to determine font dimensions. This is needed because // character width information may be needed before any windows have // been created by this library (This is the case with InterViews // which builds up the entire glyph hierarchy before creating the // window to hold it). The desktop window is used for this purpose. // ------------------------------------------------------------------ // ------------------------------------------------------------------ // This function delivers a default FontRep structure... presumably // because we couldn't determine/create what was really desired and // we are forced to have a valid font. // // This function basically lets the MS-Windows font-mapping mechanism // get as close as it can, and uses a default point size of 12. // ------------------------------------------------------------------ inline FontRep* defaultFontRep(const char* nm) { FontRep* rep = new FontRep("Chicago", 12, FontRep::normal); return rep; } static void nofont(const char* name) { static bool seen = 0; if (!seen) { seen = true; printf("Can't find font:\n%s\nUsing default font. This is the\ last time this message will be seen in this session", name); //MessageBox(NULL, buf, "Missing Font", MB_OK); } } // ------------------------------------------------------------------ // Preferred constructor... provides a simple interface to creating // fonts as they are typically desired. // ------------------------------------------------------------------ #if USE_SIOUX_WINDOW #include //extern "C" { // extern WindowPtr SIOUXTextWindow; //} #endif FontRep::FontRep( const char* face_name, // name of typeface int height, // desired height of the font int style_flags) // desired style attributes { size_ = height; Str255 name; name[0] = strlen(face_name); strcpy((char*) &name[1], face_name); GetFNum(name, &font_); if(!(font_)){ name[0] = strlen("monaco"); strcpy((char*) &name[1], "monaco"); GetFNum(name, &font_); if(!(font_)) font_ = 1; size_ = 9; } face_ = normal; //default mode_ = srcOr; char_extra_ = 0; sp_extra_ = 0; // ---- set style ---- if (style_flags & bold) face_ = bold; if (style_flags & italic) face_ = italic; if (style_flags & underline) face_ = underline; if (style_flags & strikeout) face_ = shadow; //this isn't quite right ... needs to be changed //now must get the info CGrafPtr cg; GDHandle gd; GetGWorld(&cg, &gd); if(cg){ #if carbon short save_font = GetPortTextFont(cg); short save_face = GetPortTextFace(cg); short save_size = GetPortTextSize(cg); short save_mode = GetPortTextMode(cg); #else short save_font = cg->txFont; short save_face = cg->txFace; short save_size = cg->txSize; short save_mode = cg->txMode; #endif TextFont(font_); TextFace(face_); TextSize(size_); TextMode(mode_); GetFontInfo(&info_); widths_ = new int[255]; for (int c = 0; c < 255; ++c) { widths_[c] = CharWidth(c); } TextFont(save_font); TextFace(save_face); TextSize(save_size); TextMode(save_mode); } else { #if USE_SIOUX_WINDOW //if the SIOUX window is being used, it must be checked to get the font //before other Interviews windows are created. #if carbon GrafPtr oldPort; #else WindowPtr oldPort; #endif GetPort(&oldPort); #if carbon GrafPtr stp = GetWindowPort(SIOUXTextWindow->window); SetPort(stp); short save_font = GetPortTextFont(stp); short save_face = GetPortTextFace(stp); short save_size = GetPortTextSize(stp); short save_mode = GetPortTextMode(stp); #else SetPort(SIOUXTextWindow->window); short save_font = SIOUXTextWindow->window->txFont; short save_face = SIOUXTextWindow->window->txFace; short save_size = SIOUXTextWindow->window->txSize; short save_mode = SIOUXTextWindow->window->txMode; #endif TextFont(font_); TextFace(face_); TextSize(size_); TextMode(mode_); GetFontInfo(&info_); widths_ = new int[255]; for (int c = 0; c < 255; ++c) { widths_[c] = CharWidth(c); } TextFont(save_font); TextFace(save_face); TextSize(save_size); TextMode(save_mode); SetPort(oldPort); #else printf("Font information could not be found in font.c 215\n"); exit(0); #endif } } FontRep::~FontRep() { } // ----------------------------------------------------------------------- // Makes sure that the font has been associated with a device, and // associates it with the main window if it has not already been // associated with a device. This should be successfully called before // any attempt is made to fetch metric data. // ----------------------------------------------------------------------- // ------------------------------------------------------------------- // Associates the font metric data with the given device context. // Returns the success of finding all of the data. // ------------------------------------------------------------------- // ---------------------------------------------------------------------- // return the width of the given character, or -1 if there is a problem. // The widths are in terms of the display context which the font was // associated with. // ---------------------------------------------------------------------- // ----------------------------------------------------------------------- // Scale the font. This will work as a result of scaling the height in // the LOGFONT structure because True-Type fonts are used, which will scale // to whatever is asked for. A side effect of scaling however, is that // all the metrics need to be recalculated. Since metrics are associated // with a particular device under windows, we need a device context to use. // ----------------------------------------------------------------------- // ################################################################### // ################## class Font // ################################################################### // ----------------------------------------------------------------------- // The following function attempts to extract font information out of a // string. This is a really poor interface, and is provided only for // compatibility with the X11 version. The font handling really needs to // be improved. // // The type of string searched for is of the following form: // // *facename*style*--size* // // This format will be emitted by the FontFamily class when used with // MS-Windows. This form can also be used with X11 as it will uniquely // match most fonts. Any other string will cause the function to return a // null pointer (indicating failure). // ----------------------------------------------------------------------- static FontRep* StringToFont(const String& name) { int start_mark; // start of a range int end_mark; // end of a range if (name[0] != '*') return 0; // ---- extract the facename ---- if ((end_mark = name.search(1, '*')) < 0) return 0; NullTerminatedString facename = name.substr(1, end_mark - 1); // ---- extract the style ---- start_mark = end_mark + 1; if (start_mark >= name.length()) return 0; if ((end_mark = name.search(start_mark, '*')) < 0) return 0; NullTerminatedString stylename = name.substr(start_mark, end_mark - start_mark); // ---- extract the size ---- start_mark = end_mark + 1; if (start_mark >= name.length()) return 0; if ((end_mark = name.search(start_mark, '*')) < 0) return 0; if (name[start_mark+1] != '-') return 0; NullTerminatedString sizename = name.substr(start_mark+2, end_mark-(start_mark+2)); // ---- create the FontRep instance ---- int size; // point size int style; // style value sizename.convert(size); if (stylename == String("normal")) style = FontRep::normal; else if (stylename == String("bold")) style = FontRep::bold; else if (stylename == String("italic")) style = FontRep::italic; else style = FontRep::normal; FontRep* rep = new FontRep(facename.string(), size /* * 20 */, style); return rep; } // ----------------------------------------------------------------------- // The following are the constructors and destructors for the Font class. // The string is limited to a format that StringToFont() can understand. // The font can be scaled internally by FontRep since only TrueType fonts // are used by FontRep. // ----------------------------------------------------------------------- Font::Font(const String& name, float scale) { printf("Font::Font(const String& name ... not implement\n"); } Font::Font(const char* name, float scale) { printf("Font::Font(const char* name ... not implement\n"); } Font::Font(FontImpl* i) { impl_ = i; } Font::~Font() { FontRep* rep = (FontRep*) impl_; delete rep; } // This has no meaning in the MS-Windows implimentation void Font::cleanup() { } // ----------------------------------------------------------------------- // Get/Create a font from a name. MS-Windows has it's own mapping scheme // that always returns a font of some sort. It seems reasonable to provide // a font here even if we can't exactly match, since there is a seperate // function to determine if the font exists. // ----------------------------------------------------------------------- const Font* Font::lookup(const String& name) { return (lookup(name.string())); } const Font* Font::lookup(const char* name) { FontRep* rep; //printf("font1 %s\n", name); if ((rep = StringToFont(String(name))) != nil) { return new Font((FontImpl*)rep); } else { nofont(name); rep = defaultFontRep(name); return new Font((FontImpl*)rep); } } // ----------------------------------------------------------------------- // Determine if the named font exists. Initially, this is just a test of // whether or not the name parses into something reasonable, but it needs // to also be compared to the fontlist of available TrueType fonts. There // is no display in MS-Windows (ie no networked graphics), so it is ignored. // ----------------------------------------------------------------------- bool Font::exists(Display*, const String& name) { FontRep* rep = StringToFont(name); if (rep != nil) { delete rep; return true; } return false; } bool Font::exists(Display*, const char* name) { FontRep* rep = StringToFont(String(name)); if (rep != nil) { delete rep; return true; } return false; } FontRep* Font::rep(Display*) const { return (FontRep*) impl_; } const char* Font::name() const { FontRep* r = (FontRep*)impl_; GetFontName(r->font_, r->name_); r->name_[r->name_[0]+1] = '\0'; return (const char*)(&r->name_[1]); } const char* Font::encoding() const { printf("const char* Font::encoding not yet implemented\n"); return nil; } Coord Font::size() const { FontRep* rep = (FontRep*) impl_; return Coord(rep->size_); } // --------------------------------------------------------------------------- // Get the bounding box information for the font. The FontRep actually // has more information than available in the FontBoundingBox, so applications // that need more info can access FontRep info directly, but this will // affect portability. // --------------------------------------------------------------------------- void Font::font_bbox( FontBoundingBox& b) const // return information { FontRep* rep = (FontRep*) impl_; if(!rep) printf("Font rep failure Line 401 of font.c\n"); b.left_bearing_ = 0; b.right_bearing_ = 0; b.width_ = rep->info_.widMax; b.ascent_ = rep->info_.ascent; b.descent_ = rep->info_.descent; b.font_ascent_ = b.ascent_; b.font_descent_ = b.descent_; } void Font::char_bbox( long c, // character to measure FontBoundingBox& b) const // return information { if (c < 0) { b.left_bearing_ = 0; b.right_bearing_ = 0; b.width_ = 0; b.ascent_ = 0; b.descent_ = 0; b.font_ascent_ = 0; b.font_descent_ = 0; return; } FontRep* rep = (FontRep*) impl_; if(!rep) printf("Font rep failure Line 401 of font.c\n"); b.width_ = width(c); b.left_bearing_ = 0; b.right_bearing_ = b.width_; // guess b.ascent_ = rep->info_.ascent; b.descent_ = rep->info_.descent; b.font_ascent_ = b.ascent_; b.font_descent_ = b.descent_; } void Font::string_bbox( const char* s, // string to measure length of int len, // number of characters in string FontBoundingBox& b) const // return information { FontRep* rep = (FontRep*) impl_; if(!rep) printf("Font rep failure Line 401 of font.c\n"); b.width_ = width(s, len); b.left_bearing_ = 0; b.right_bearing_ = b.width_; // guess (2/21/97 hines) for xvarlabels b.ascent_ = rep->info_.ascent; b.descent_ = rep->info_.descent; b.font_ascent_ = b.ascent_; b.font_descent_ = b.descent_; } Coord Font::width(long c) const { FontRep* rep = (FontRep*) impl_; if ((rep == nil) || (c < 0) || (c > 255)) { return 0; } return Coord(rep->widths_[c]); } Coord Font::width( const char* s, // string to measure int len) const // number of characters in string { FontRep* rep = (FontRep*) impl_; if(!rep) printf("Font rep failure Line 439 of font.c\n"); // ---- associate with main window for metrics ---- int i; Coord swidth = 0; for (i=0; idefault_display()->to_pixels(Coord(offset)); w = 0; for (p = s, n = 0; *p != '\0' && n < len; ++p, ++n) { cw = (int)width(*p); w += cw; if (w > xoffset) { break; } } coff = xoffset - w + cw; if (between && coff > cw/2) { ++n; } return Math::min(n, len); } neuron-7.6.3/src/lib/IV-Mac/mprinter.cpp000066400000000000000000000143571340731477100177730ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #include #include #include #include #include #include extern "C" {extern void debugfile(const char*, ...);} MacPrinterCanvas::MacPrinterCanvas() { #if carbon #else prRecHdl = nil; #endif setup(false); } MacPrinterCanvas::~MacPrinterCanvas() { #if carbon #else if (prRecHdl) { DisposeHandle((char**)prRecHdl); } #endif } Window* MacPrinterCanvas::window()const { //debugfile("MacPrinter::window()\n"); return nil; } void MacPrinterCanvas::size(Coord, Coord) {}; void MacPrinterCanvas::psize(Coord, Coord) {}; void MacPrinterCanvas::resize(Coord, Coord, Coord, Coord) {} Coord MacPrinterCanvas::width() const { #if carbon return Coord(pwidth()); #else Rect& r = (*prRecHdl)->prInfo.rPage; return Coord(r.right); #endif } Coord MacPrinterCanvas::height() const { #if carbon return Coord(pheight()); #else Rect& r = (*prRecHdl)->prInfo.rPage; return Coord(r.bottom); #endif } PixelCoord MacPrinterCanvas::pwidth() const { #if carbon return 8*72; #else Rect& r = (*prRecHdl)->prInfo.rPage; return r.right; #endif } PixelCoord MacPrinterCanvas::pheight() const { #if carbon return 10*72; #else Rect& r = (*prRecHdl)->prInfo.rPage; return r.bottom; #endif } PixelCoord MacPrinterCanvas::to_pixels(Coord x, DimensionName)const { return int(x); } Coord MacPrinterCanvas::to_coord(PixelCoord x, DimensionName)const {return Coord(x); } MacPrinter::MacPrinter(ostream*) : Printer(nil){ c = new MacPrinterCanvas(); } MacPrinter::~MacPrinter() { delete c; } Window* MacPrinter::window()const { // debugfile("MacPrinter::window()\n"); return nil; } void MacPrinter::prolog(const char*) {c->start();} void MacPrinter::setup() { c->setup();} bool MacPrinterCanvas::setup(bool s){ #if carbon return false; #else GetPort(&oldPort); PrOpen(); if (!prRecHdl) { prRecHdl = THPrint(NewHandleClear(sizeof(TPrint))); if (PrError() != noErr) { return false; } PrintDefault(prRecHdl); if (PrError() != noErr) { return false; } }else{ PrValidate(prRecHdl); } if (s) { PrStlDialog(prRecHdl); } PrClose(); if (PrError() != noErr) { return false; } //debugfile("MacPrinterCanvas::setup width=%d height=%d\n", pwidth(), pheight()); SetPort(oldPort); return true; #endif } bool MacPrinterCanvas::start() { #if carbon return false; #else //debugfile("MacPrinter::init\n"); GetPort(&oldPort); PrOpen(); if (!prRecHdl) { prRecHdl = THPrint(NewHandleClear(sizeof(TPrint))); if (PrError() != noErr) { return false; } PrintDefault(prRecHdl); if (PrError() != noErr) { return false; } PrStlDialog(prRecHdl); }else{ PrValidate(prRecHdl); } gPrinterPort = PrOpenDoc(prRecHdl, nil, nil); if (PrError() != noErr) { return false; } PrOpenPage(gPrinterPort, nil); if (PrError() != noErr) { return false; } damage_all(); beginPaint(); return true; #endif } void MacPrinter::epilog() {c->finish();} bool MacPrinterCanvas::finish() { #if carbon return false; #else endPaint(); PrClosePage(gPrinterPort); if (PrError() != noErr) { return false; } PrCloseDoc(gPrinterPort); if (PrError() != noErr) { return false; } if ((**prRecHdl).prJob.bJDocLoop == bSpoolLoop) { TPrStatus theStatus; PrPicFile(prRecHdl, nil, nil, nil, &theStatus); if (PrError() != noErr) { return false; } } PrClose(); if (PrError() != noErr) { return false; } SetPort(oldPort); //debugfile("MacPrinter::finish\n"); return true; #endif } // for scaling text void MacPrinterCanvas::flush() { // ---- check if there is anything to do ---- //int nchars = (int) (text_ptr_ - text_buff_); //if ((nchars == 0) || (lg_font_ == nil)) // return; // ---- render the text ---- if (text_item_.count > 0) { //set font FontRep* fr = lg_font_->rep(nil); TextFont(fr->font_); TextFace(fr->face_); float a00, a01, a10, a11, a20, a21; transformer().matrix(a00, a01, a10, a11, a20, a21); int size = int(double(fr->size_)*sqrt(a00*a00 + a01*a01) +.01); TextSize(size); TextMode(fr->mode_); //if (printing) debugfile("flush %d %d\n",toPixelX(text_item_.x), toPixelY(text_item_.y)); MoveTo(toPixelX(text_item_.x), toPixelY(text_item_.y)); DrawText(text_item_.buffer, 0, text_item_.count); // text_item_.buffer[text_item_.count] = '\0'; // debugfile("|%s|\n", text_item_.buffer); } text_item_.count = 0; return; } void MacPrinter::resize(Coord, Coord, Coord, Coord) {} Coord MacPrinter::width() const {return c->width();} Coord MacPrinter::height() const {return c->height();} PixelCoord MacPrinter::pwidth() const {return c->pwidth();} PixelCoord MacPrinter::pheight() const {return c->pheight();} void MacPrinter::character( const Font* f, // font to use long ch, // character to print Coord width, // width of the character const Color* co, // color to use Coord x, // x-coordinate Coord y) // y-coordinate { c->character(f, ch, width, co, x, y); } void MacPrinter::transformer(const Transformer& t){c->transformer(t);} const Transformer& MacPrinter::transformer() const {return c->transformer();} void MacPrinter::comment(const char* text) {} void MacPrinter::page(const char* label) {} void MacPrinter::push_transform() {c->push_transform();} void MacPrinter::pop_transform() {c->pop_transform();} void MacPrinter::transform(const Transformer& t) {c->transform(t);} void MacPrinter::push_clipping(bool) {c->push_clipping();} void MacPrinter::pop_clipping() {c->pop_clipping();} void MacPrinter::new_path() {c->new_path();} void MacPrinter::move_to(Coord x, Coord y) {c->move_to(x,y);} void MacPrinter::line_to(Coord x, Coord y) {c->line_to(x,y);} void MacPrinter::curve_to( Coord x, Coord y, Coord x1, Coord y1, Coord x2, Coord y2 ) {c->curve_to(x,y,x1,y1,x2,y2);} void MacPrinter::close_path() {c->close_path();} void MacPrinter::stroke(const Color* color, const Brush* brush) {c->stroke(color,brush);} void MacPrinter::fill(const Color* color) {c->fill(color);} void MacPrinter::clip() {c->clip();} void MacPrinter::stencil( const Bitmap* mask, const Color* color, Coord x, Coord y ) {c->stencil(mask,color,x,y);} void MacPrinter::image(const Raster* raster, Coord x, Coord y) {c->image(raster,x,y);} neuron-7.6.3/src/lib/IV-Mac/raster.cpp000077500000000000000000000121661340731477100174320ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif // ========================================================================= // // // // MS-Windows implementation of the InterViews Raster class. // // A memory device context is used to store the raster. The peek and poke // operations simply get translated to calls that get and set pixel values // the the memory device context. // // 1.3 // 1999/01/11 12:03:41 // // Windows 3.1/NT Port // Copyright (c) 1993 Tim Prinzing // // This media contains programs and data which are proprietary // to Tim Prinzing. // // These contents are provided under a Tim Prinzing software source // license, which prohibits their unauthorized resale or distribution // outside of the buyer's organization. // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL Tim Prinzing BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // // ========================================================================= #include #include #include #include #include #include Raster::Raster( unsigned long width, // width of bitmap in pixels unsigned long height) // height of bitmap in pixels { rep_ = new RasterRep(); rep_->width_ = width; rep_->height_ = height; Rect c; c.left = 0; c.top = 0; c.right = width; c.bottom = height; QDErr error = NewGWorld(&rep_->cg_, 0, &c, nil, nil, 0); #if 0 RGBColor cc; cc.red = cc.green = cc.blue = 0x0; CGrafPtr cg; GDHandle gd; GetGWorld(&cg, &gd); SetGWorld(rep_->cg_, nil); RGBBackColor(&cc); SetGWorld(cg, gd); #endif } Raster::Raster(const Raster& ras) { assert(0); rep_ = new RasterRep(); rep_->width_ = 0; rep_->height_ = 0; rep_->cg_ = nil; } Raster::~Raster() { if (rep_->cg_) { DisposeGWorld(rep_->cg_); } delete rep_; } // ------------------------------------------------------------------------- // These function simply query the resolution of the memory device context. // The width() and height() functions also scale for the resolution of the // current display in the session. // ------------------------------------------------------------------------- Coord Raster::width() const { Display* d = Session::instance()->default_display(); return d->to_coord(rep_->width_, Dimension_X); } Coord Raster::height() const { Display* d = Session::instance()->default_display(); return d->to_coord(rep_->height_, Dimension_Y); } unsigned long Raster::pwidth() const { return rep_->width_; } unsigned long Raster::pheight() const { return rep_->height_; } // ----------------------------------------------------------------------- // should provide reasonable return values. // ----------------------------------------------------------------------- Coord Raster::left_bearing() const { return Coord(0); } Coord Raster::right_bearing() const { return width(); } Coord Raster::ascent() const { return height(); } Coord Raster::descent() const { return Coord(0); } // ----------------------------------------------------------------------- // Pixel access. Note the the orgin of the Raster is the lower left // corner, but for the MS-Windows bitmap it is the upper left corner // so translation is done for pixel access. // ----------------------------------------------------------------------- void Raster::peek( unsigned long x, // x coordinate of pixel queried unsigned long y, // y coordinate of pixel queried ColorIntensity& red, ColorIntensity& green, ColorIntensity& blue, float& alpha) const { // ---- get the pixel value ---- RGBColor c; CGrafPtr cg; GDHandle gd; GetGWorld(&cg, &gd); SetGWorld(rep_->cg_, nil); GetCPixel(x, rep_->height_ - y, &c); SetGWorld(cg, gd); // --- convert from RGB to intensity ---- ColorIntensity scaleFactor(0xffff); red = c.red / scaleFactor; green = c.green / scaleFactor; blue = c.blue / scaleFactor; alpha = 1.0; } void Raster::poke( unsigned long x, unsigned long y, ColorIntensity red, ColorIntensity green, ColorIntensity blue, float alpha) { RGBColor c; ColorIntensity scaleFactor(0xffff); c.red = (unsigned short) (red*scaleFactor); c.green = (unsigned short) (green*scaleFactor); c.blue = (unsigned short) (blue*scaleFactor); CGrafPtr cg; GDHandle gd; GetGWorld(&cg, &gd); SetGWorld(rep_->cg_, nil); SetCPixel(x, rep_->height_ - y, &c); SetGWorld(cg, gd); } void Raster::flush() const { // This is a no-op for the MS-Windows implementation. } // ##################################################################### // ###################### class RasterRep // ##################################################################### RasterRep::RasterRep() {} RasterRep::~RasterRep(){} neuron-7.6.3/src/lib/IV-Mac/session.cpp000066400000000000000000001246321340731477100176140ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif // ======================================================================= // // // // Session management for an application. This class is a clearing house // for the control part of an application. // // // 1.5 // $Date: 4 AUG 1996 // /* * THIS FILE CONTAINS PORTIONS OF THE InterViews 3.1 DISTRIBUTION THAT * CONTAINED THE FOLLOWING COPYRIGHT: * * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ // ======================================================================= #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if !carbon #include #include // add by jijun 6/19/97 #include #endif #include extern "C" { void debugfile(const char*, ...);} #include void debugfile(const char* format, ...) { va_list args; static FILE* df; if (!df) { df = fopen("debugfile", "w"); } va_start(args, format); vfprintf(df, format, args); fflush(df); } //Constant setting the time to yield when no events have been received #define SLEEP_TIME 10000 //------------------------------------------------------------------- #ifdef MAC static PropertyData properties[] = { {"*gui", "sgimotif"}, {"*PopupWindow*overlay", "true"}, {"*PopupWindow*saveUnder", "on"}, {"*TransientWindow*saveUnder", "on"}, {"*background", "#ffffff"}, {"*brush_width", "0"}, //{"*double_buffered", "on"}, {"*double_buffered", "off"}, {"*flat", "#aaaaaa"}, {"*font", "*Arial*bold*--12*"}, {"*MenuBar*font", "*Arial*bold*--12*"}, {"*MenuItem*font", "*Arial*bold*--12*"}, {"*foreground", "#000000"}, {"*synchronous", "off"}, {"*malloc_debug", "on"}, {"*Scene_background", "#ffffff"}, {"*Scene_foreground", "#000000"}, {"*FieldEditor*background", "#ffffff"}, {"*background", "#cfffff"}, {"*default_brush", "0"}, {"*view_margin", ".25"}, {"*dismiss_button", "on"}, {"*use_transient_windows", "yes"}, {"*nrn_library", " $(NEURONHOME)/lib"}, {"*view_pick_epsilon", "2"}, {"*pwm_canvas_height", "120"}, {"*pwm_paper_height", "11"}, {"*pwm_paper_width", "8.5"}, {"*pwm_paper_resolution", ".5"}, {"*pwm_pixel_resolution", "0"}, {"*window_manager_offset_x", "5."}, {"*window_manager_offset_y", "26."}, {"*pwm_print_file_filter", "*.ps"}, {"*pwm_idraw_file_filter", "*.id"}, {"*pwm_ascii_file_filter", "*"}, {"*pwm_save_file_filter", "*.ses"}, {"*pwm_idraw_prologue", "$(NEURONHOME)/lib/prologue.id"}, {"*pwm_postscript_filter", "sed 's;/Adobe-;/;'"}, {"*SlowSlider*autorepeatStart", "0."}, {"*scene_print_border", "1"}, {"*radioScale", "1.2"}, {"*xvalue_format", "%.5g"}, {"*graph_axis_default", "0"}, {"*shape_scale_file", "$(NEURONHOME)/lib/shape.cm2"}, {"*CBWidget_ncolor", "10"}, {"*CBWidget_nbrush", "10"}, { nil } }; #endif Session* SessionRep::instance_; // I DO NOT KNOW IF THIS IS NECESSARY ... BUT I DIDN'T WANT TO TAKE IT OUT #if 0 const char* SECTION_NAME = "InterViews"; // This is the name of the section in the WIN.INI file where the // configuration information should be fetched from. The .ini files // are used in Win32 so that things will work with Win32s. const char* LOCATION_KEY = "location"; // This is the key used to fetch the value of the location of the // top of the configuration directory. Things like application // defaults live at this location. const char* APPDEF_DEFAULT = SECTION_NAME; // Name of the default application defaults file. This should contain // style definitions that are defaults for the entire library. const char* APPDEF_DEFAULT_ALT = "intervie"; // win3.1 install and using NT const char* APPDEF_DIRECTORY = "app-defaults"; // This is the name of the directory where the default style information // lives. In X-Windows this is called app-defaults. Each application // is expected to have a file in this directory to establish reasonable // default behavior. const char* APPDEF_DIR_ALT = "app-defa"; // win3.1 install and using NT static char* INSTALL_LOCATION = NULL; // pathname of the installation location.... determined by reading the // win.ini file and querying the location key. #endif // ----------------------------------------------------------------------- // Predefined command-line options. // ----------------------------------------------------------------------- static OptionDesc defoptions[] = { { "-background", "*background", OptionValueNext }, { "-bg", "*background", OptionValueNext }, { "-dbuf", "*double_buffered", OptionValueImplicit, "on" }, { "-display", "*display", OptionValueNext }, { "-dpi", "*dpi", OptionValueNext }, { "-fg", "*foreground", OptionValueNext }, { "-flat", "*flat", OptionValueNext }, { "-fn", "*font", OptionValueNext }, { "-font", "*font", OptionValueNext }, { "-foreground", "*foreground", OptionValueNext }, { "-geometry", "*geometry", OptionValueNext }, { "-iconic", "*iconic", OptionValueImplicit, "on" }, { "-monochrome", "*gui", OptionValueImplicit, "monochrome" }, { "-motif", "*gui", OptionValueImplicit, "Motif" }, { "-mswin", "*gui", OptionValueImplicit, "mswin" }, { "-name", "*name", OptionValueNext }, { "-nodbuf", "*double_buffered", OptionValueImplicit, "off" }, { "-noshape", "*shaped_windows", OptionValueImplicit, "off" }, { "-openlook", "*gui", OptionValueImplicit, "OpenLook" }, { "-reverse", "*reverseVideo", OptionValueImplicit, "on" }, { "-rv", "*reverseVideo", OptionValueImplicit, "on" }, { "-shape", "*shaped_windows", OptionValueImplicit, "on" }, { "-smotif", "*gui", OptionValueImplicit, "SGIMotif" }, { "-synchronous", "*synchronous", OptionValueImplicit, "on" }, { "+synchronous", "*synchronous", OptionValueImplicit, "off" }, { "-title", "*title", OptionValueNext }, { "-visual", "*visual", OptionValueNext }, { "-visual_id", "*visual_id", OptionValueNext }, { "-xrm", nil, OptionPropertyNext }, #ifdef sgi { "-malloc", "*malloc_debug", OptionValueImplicit, "on" }, #endif { nil } }; // ####################################################################### // ##################### SessionRep class // ####################################################################### #if USE_SIOUX_WINDOW extern "C"{ short InstallConsole(short fd); extern void hoc_quit(); extern Boolean SIOUXQuitting; } #endif /************************************************************************/ /* Purpose..: Check if the window belongs to us */ /* Input....: Pointer to the window */ /* Returns..: TRUE ours */ /* Jijun 4/26/97 copy form: SIOUXWindows.c */ /************************************************************************/ static void FlashControl(ControlHandle theControl) { unsigned long aLong; HiliteControl(theControl, 1); Delay(3L, &aLong); HiliteControl(theControl, 0); } /************************************************************************/ /* Purpose..: Frame a control */ /* Input....: Control Handle */ /* Returns..: --- */ /* Jijun 4/26/97 copy form: SIOUXWindows.c */ /************************************************************************/ static void FrameControl(ControlHandle theControl) { #if carbon //use by LowMemoryBox #else Rect myRect; HLock((Handle)theControl); myRect.top = (*theControl)->contrlRect.top - 4; myRect.left = (*theControl)->contrlRect.left - 4; myRect.bottom = (*theControl)->contrlRect.bottom + 4; myRect.right = (*theControl)->contrlRect.right + 4; HUnlock((Handle)theControl); PenNormal(); PenSize(3,3); FrameRoundRect(&myRect,16,16); PenNormal(); #endif } /****************************************************************/ /* Purpose..: Display a low-memory box */ /* Input....: --- */ /* Returns..: --- */ /* Jijun 4/25/97 reference: SIOUXWindows.c */ /****************************************************************/ static void LowMemoryBox(void) { #if carbon // why not use some kind of alert? #else WindowPtr wp, theWindow; GrafPtr savePort; EventRecord theEvent; Handle theIcon; ControlHandle okButton, dummyCntl; Rect aRect = {0, 0, 75, 270}; Boolean done = FALSE; short height, width; SetCursor(&qd.arrow); GetPort(&savePort); // Center it horizontally and 20% down vertically width = (qd.screenBits.bounds.right - qd.screenBits.bounds.left - aRect.right) / 2; height = (qd.screenBits.bounds.bottom - qd.screenBits.bounds.top - LMGetMBarHeight() - aRect.bottom) / 5 + LMGetMBarHeight(); OffsetRect(&aRect, width, height); // Create a simple window with an OK button if ((wp = NewWindow(0L, &aRect, "\p", TRUE, dBoxProc, (WindowPtr)-1L, FALSE, 0L)) == 0L) { SysBeep(10); return; } SetPort(wp); SetRect(&aRect, 80, 15, 260, 46); TETextBox("Low Memory", 10, &aRect, teForceLeft); SetRect(&aRect, 8, 8, 40, 40); theIcon = GetIcon(0); PlotIcon(&aRect, theIcon); SetRect(&aRect, 105, 50, 165, 68); okButton = NewControl(wp, &aRect, "\pContinue", TRUE, 0, 0, 0, pushButProc|kControlUsesOwningWindowsFontVariant, 0); // Outline the default button ... FrameControl(okButton); while (!done) { if(GetNextEvent(mDownMask | keyDownMask, &theEvent)) { if (theEvent.what == mouseDown) { if ((FindWindow(theEvent.where, &theWindow) == inContent) && (theWindow == wp)) { GlobalToLocal(&theEvent.where); if (FindControl(theEvent.where, wp, &dummyCntl) == kControlButtonPart) if (TrackControl(dummyCntl, theEvent.where, 0L) != 0) { done = TRUE; } } } else if (theEvent.what == keyDown) { char key; key = theEvent.message & charCodeMask; if (key == 0x0d || key == 0x03) { //FlashControl(okButton); done = TRUE; } } } } DisposeControl(okButton); DisposeWindow(wp); ReleaseResource(theIcon); SetPort(savePort); #endif } /****************************************************************/ /* Purpose..: Low-memory Dialog Box */ /* Input....: --- */ /* Returns..: --- */ /* Jijun 4/28/97 */ /****************************************************************/ static void DMemory(void) { #if carbon // why not use an alert? #else DialogPtr lm; WindowPtr wp; GrafPtr savePort; EventRecord theEvent; Handle theIcon; Rect aRect = {0, 0, 100, 240}; Boolean done = FALSE; short length; short height, width; short contButton; SetCursor(&qd.arrow); GetPort(&savePort); /* Center it horizontally and 20% down vertically */ width = (qd.screenBits.bounds.right - qd.screenBits.bounds.left - aRect.right) / 2; height = (qd.screenBits.bounds.bottom - qd.screenBits.bounds.top - LMGetMBarHeight() - aRect.bottom) / 5 + LMGetMBarHeight(); OffsetRect(&aRect, width, height); contButton=StopAlert(stopIcon, 0); //debugfile("contButton=%d",contButton); // Create a simple dialog if ((lm = NewDialog(0L,&aRect,"\p",TRUE,dBoxProc,(WindowPtr)-1L, 0, 0,0)) == 0L) { SysBeep(10); return; } SetPort(lm); SetRect(&aRect, 0, 5, 240, 55); TETextBox("Not Enough Memory", 17, &aRect, teCenter); SetRect(&aRect, 8, 8, 40, 40); theIcon = GetIcon(0); PlotIcon(&aRect, theIcon); while (!GetNextEvent(mDownMask | keyDownMask, &theEvent)) /* just loop */ ; DisposeDialog(lm); SetPort(savePort); #endif } // add by jijun 5/30/97 //extern "C" { int hoc_xopen1(const char* filename, const char* rcs);} extern "C" { #if !carbon void mac_open_doc(const char* s); void mac_open_app(); bool is_mac_dll(FSSpec*); bool mac_open_dll(const char*, FSSpec*); #endif } extern "C" { /****************************************************************/ /* Purpose..: Create a full path name for a FSSpec file */ /* Input....: FSSpec */ /* Returns..: String[255] Ptr */ /* Jijun 5/30/97 */ /****************************************************************/ static char* fullname(const FSSpec &file){ short refNum; CInfoPBRec myPB; char prePath[256]; static char fullPath[256]; OSErr err; Str255 dirName; char * s; fullPath[0]='\0'; myPB.dirInfo.ioVRefNum = file.vRefNum; myPB.dirInfo.ioDrParID = file.parID; myPB.dirInfo.ioFDirIndex= -1; myPB.dirInfo.ioNamePtr = dirName; do { myPB.dirInfo.ioDrDirID = myPB.dirInfo.ioDrParID; err = PBGetCatInfoSync(&myPB); //debugfile("\nerror after PBGetCatInfoSync: %ld", err); if (err) { return nil; } else { dirName[dirName[0]+1]='\0'; strcpy(prePath, (char*)&dirName[1]); strcat(prePath, ":"); strcat(prePath, fullPath); strcpy(fullPath, prePath); //debugfile("\nfullPath= %s", fullPath); //debugfile("\nmyPB.dirInfo.ioDrDirID= %ld", myPB.dirInfo.ioDrDirID); } } while (myPB.dirInfo.ioDrDirID > fsRtDirID); s=fullPath; return s; } } // for external C /****************************************************************/ /* Purpose..: Handling Open Application AppleEvent */ /* Input....: theAppleEvent, reply, handleRefcon */ /* Returns..: OSErr */ /* Jijun 5/29/97 reference: Interapplication (4-15) */ /****************************************************************/ static pascal OSErr MyHandleOApp (const AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon) { AEDescList docList; //debugfile("\nWe are in MyHandleOApp"); //debugfile("\ntheAppleEvent Descriptor type: %ld", theAppleEvent.descriptorType); //debugfile("\ntheAppleEvent Descriptor handle*: %ld", *(theAppleEvent.dataHandle)); //debugfile("\ntheAppleEvent Descriptor handle**: %ld", **(theAppleEvent.dataHandle)); //debugfile("\nreply Descriptor type: %ld", reply.descriptorType); //debugfile("\nhandlerRefcon: %ld", handlerRefcon); #if !carbon mac_open_app(); #endif //OSErr myErr=AEGetParamDesc(&theAppleEvent, keyDirectObject, typeAEList, &docList); //debugfile("\nerror after AEGetParamDesc: %ld", myErr); return (0); } /****************************************************************/ /* Purpose..: Handling Open Documents AppleEvent */ /* Input....: theAppleEvent, reply, handleRefcon */ /* Returns..: OSErr */ /* Jijun 5/28/97 reference: Interapplication (4-15) */ /****************************************************************/ static pascal OSErr MyHandleODoc (const AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon) { //void MyHandleODoc (AppleEvent &theAppleEvent, AppleEvent &reply, long handlerRefcon) { FSSpec myFSS; AEDescList docList; long itemInList; AEKeyword keywd; DescType returnedType; Size actualSize; //debugfile("\n\nWe are in MyHandleODoc"); //debugfile("\ntheAppleEvent Descriptor type: %ld", theAppleEvent.descriptorType); //debugfile("\ntheAppleEvent Descriptor handle*: %ld", *(theAppleEvent.dataHandle)); //debugfile("\ntheAppleEvent Descriptor handle**: %ld", **(theAppleEvent.dataHandle)); //debugfile("\nreply Descriptor type: %ld", reply.descriptorType); //debugfile("\nhandlerRefcon: %ld", handlerRefcon); // get the direct parameter--a descriptor list-- and put it into docList OSErr myErr=AEGetParamDesc(theAppleEvent, keyDirectObject, typeAEList, &docList); //debugfile("\nerror after AEGetParamDesc: %ld", myErr); if (myErr) { return myErr; } else { // check for missing required parameters //myErr = MyGotRequiredParams(theAppleEvent); if (myErr) { return myErr; } else { // count the number of descriptor records int the list myErr = AECountItems(&docList, &itemInList); //debugfile("\nerror after AECountItems: %ld", myErr); //debugfile("\nitemInList: %ld", itemInList); if (myErr) { return myErr; } else { // get each descriptor record from list, coerce the returned data to an FSSpec record, // and open the associated file // first all the dll's #if !carbon for (long index=1; index<=itemInList; index++) { myErr = AEGetNthPtr(&docList, index, typeFSS, &keywd, &returnedType, &myFSS, sizeof(myFSS), &actualSize); //debugfile("\nerror after AEGetNthPtr: %ld", myErr); if (myErr) { return myErr; } else { char* s=fullname(myFSS); myFSS.name[myFSS.name[0]+1]='\0'; strcat(s,(char*)&myFSS.name[1]); //debugfile("\nMyOpenFile is %s", s); if (is_mac_dll(&myFSS)) { mac_open_dll(s, &myFSS); } } // noerr for AEGetNthPtr } // for loop #endif #if !carbon // then all the hoc files for (long index=1; index<=itemInList; index++) { myErr = AEGetNthPtr(&docList, index, typeFSS, &keywd, &returnedType, &myFSS, sizeof(myFSS), &actualSize); //debugfile("\nerror after AEGetNthPtr: %ld", myErr); if (myErr) { return myErr; } else { char* s=fullname(myFSS); myFSS.name[myFSS.name[0]+1]='\0'; strcat(s,(char*)&myFSS.name[1]); //debugfile("\nMyOpenFile is %s", s); if (!is_mac_dll(&myFSS)) { mac_open_doc(s); } //hoc_xopen1(s, 0); //myErr=FSpDelete(&myFSS); } // noerr for AEGetNthPtr } // for loop #endif } // noerr for AECountItems } // noerr for MyGotRequiredParams OSErr ingoreErr=AEDisposeDesc(&docList); //debugfile("\nerror after AEDisposeDesc: %ld", ingoreErr); } // noerr for AEGetParamDesc return myErr; } #define EmergencyMemorySize 100000 extern "C" { static char** emergency_memory_; static pascal long emergency_memory(Size) { int a5 = SetCurrentA5(); long rval = 0; //debugfile("before emergency_memory \n"); LowMemoryBox(); DMemory(); if (emergency_memory_) { EmptyHandle(emergency_memory_); emergency_memory_ = 0; rval = EmergencyMemorySize; //printf("Warning: released emergency memory. Next call here will abort.\n"); //debugfile("after emergency_memory\n"); } SetA5(a5); if (rval == 0) { abort(); } return rval; } } SessionRep::SessionRep() { GrowZoneUPP myGrowZone; /* for growzone 4/28/97 jijun */ AEEventHandlerUPP myHandleODoc; // add by jijun 5/28/97 for handle open doc AEEventHandlerUPP myHandleOApp; // add by jijun 5/29/97 for handle open app AEEventHandlerUPP handler; long handleRefcon; #if carbon // I don't know if memory still needs to be managed #else MaxApplZone(); /* take all the memory we can */ emergency_memory_ = NewHandle(EmergencyMemorySize); myGrowZone = NewGrowZoneProc(emergency_memory); SetGrowZone(myGrowZone); #endif SessionRep::makeChecks(); SessionRep::initToolboxFunctions(); // add by jijun 5/28/97 for handle open doc //debugfile("\nWe will begin install AppleEvent handler"); AEGetEventHandler(kCoreEventClass, kAEOpenDocuments, &handler, &handleRefcon, FALSE); //debugfile("\nDoc handleRefcon:%ld", handleRefcon); AEGetEventHandler(kCoreEventClass, kAEOpenApplication, &handler, &handleRefcon, FALSE); //debugfile("\nApp handleRefcon:%ld", handleRefcon); #if carbon myHandleOApp=NewAEEventHandlerUPP(&MyHandleOApp); myHandleODoc=NewAEEventHandlerUPP(&MyHandleODoc); #else myHandleOApp=NewAEEventHandlerProc(&MyHandleOApp); myHandleODoc=NewAEEventHandlerProc(&MyHandleODoc); #endif OSErr error=AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, myHandleOApp, 0, FALSE); //debugfile("\nerror=%ld", error); if (!error) { //debugfile("\nNo error in install open application handler"); error=AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, myHandleODoc, 0, FALSE); //debugfile("\nerror=%ld", error); } #if USE_SIOUX_WINDOW InstallConsole(0); #endif } SessionRep::~SessionRep() { delete name_; Resource::unref(style_); delete argv_; } Style* iv_display_style_; // see display.cpp // makeChecks - // Make sure that the system is able to handle the inteviews code // ie. has color QuickDraw, and is System 7.0 or better. // Checkout EasyApp file init.c line 109 void SessionRep::makeChecks(void){ OSErr error; long systemVersion; long response; /* get the system version, must be 7 or better */ error = Gestalt(gestaltSystemVersion, &systemVersion); if (error){ printf("Error reading system\n"); exit(1); } if (systemVersion < 0x700){ printf("InterViews requires System 7.0 or later\n"); exit(1); } /* get quickdraw version */ error = Gestalt(gestaltQuickdrawVersion, &response); if (error){ printf("Error reading system\n"); exit(1); } // must be color quick draw if(response < gestalt8BitQD){ printf("InterViews requires Color QuickDraw\n"); exit(1); } //If drag and drop supported an additional check will need to be made for it. } // initToolboxFunctions - // Initialize the Macintosh toolboxes for use by the program void SessionRep::initToolboxFunctions (void) { /* Initialize all the needed managers. */ #if carbon // MoreMasterPointers(32); InitCursor(); #else InitGraf(&qd.thePort); InitFonts(); InitWindows(); InitMenus(); TEInit(); InitDialogs(0L); InitCursor(); FlushEvents(everyEvent,0); #endif } void SessionRep::set_style(Display* d) { #if 0 //!OCSMALL char buf[512]; sprintf(buf, "%s\\%s\\%s", Session::installLocation(), APPDEF_DIRECTORY, APPDEF_DEFAULT); FILE* f; if ((f = fopen(buf, "r")) == (FILE*)0) { char buf2[512]; sprintf(buf2, "%s\\%s\\%s", Session::installLocation(), APPDEF_DIR_ALT, APPDEF_DEFAULT_ALT); if ((f = fopen(buf2, "r")) == (FILE*)0) { char buf3[1024]; sprintf(buf3, "Can't open InterViews resources file in either\n%s or\n%s", buf, buf2); //MessageBox(NULL, buf3, "Invalid Installation", MB_OK); //abort(); } APPDEF_DIRECTORY = APPDEF_DIR_ALT; APPDEF_DEFAULT = APPDEF_DEFAULT_ALT; } fclose(f); Style* s = new Style(*style_); load_app_defaults(s, APPDEF_DEFAULT, -5); load_props(s, props_, -10); load_app_defaults(s, classname_, -5); #else Style* s = new Style(*style_); #if defined(MAC) load_props(s, properties, -5); #else #endif load_props(s, props_, -10); #endif iv_display_style_ = s; s->ref(); //d->style(s); } void SessionRep::load_app_defaults(Style* s, const char* leafName, int priority) { #if 0 const char* topDir = Session::installLocation(); if (topDir) { char subPath[80]; sprintf(subPath,"/%s/%s", APPDEF_DIRECTORY, leafName); load_path(s, topDir, subPath, priority); } #endif } // ----------------------------------------------------------------------- // Property parsing errors // ----------------------------------------------------------------------- void SessionRep::missing_colon(const String& s) { char buff[135]; const char* property = s.string(); sprintf("Missing colon in property: %s", property); //WindowRep::errorMessage(buff); // NOT REACHED } void SessionRep::bad_property_name(const String& s) { char buff[135]; const char* property = s.string(); sprintf("Bad property name: %s", property); //WindowRep::errorMessage(buff); // NOT REACHED } void SessionRep::bad_property_value(const String& s) { char buff[135]; const char* property = s.string(); sprintf("Bad property value: %s", property); //WindowRep::errorMessage(buff); // NOT REACHED } // ----------------------------------------------------------------------- // Use ICCCM rules to find an application's instance name from the command // line or an environment variable. // ----------------------------------------------------------------------- String* SessionRep::find_name() { String name; if (find_arg(String("-name"), name)) { return new String(name); } if (argc_ > 0) { String s(argv_[0]); int slash = s.rindex('/'); if (slash >= 0) { s = s.right(slash + 1); } return new String(s); } return new String("noname"); } // ----------------------------------------------------------------------- // Open the default display and initialize its style information. For the // current Mac version, this doesn't do much since we are only considering // one display. // ----------------------------------------------------------------------- void SessionRep::init_display() { set_style(nil); display_ = Display::open(); display_->style(iv_display_style_); connect(display_); } void SessionRep::connect(Display* d) { set_style(d); } // ----------------------------------------------------------------------- // Report that an argument is bad and exit. A caller of this function // may assume that it does not return. // // We also assume that arg is null-terminated (because it came // from argv). // ----------------------------------------------------------------------- void SessionRep::bad_arg(const char* fmt, const String& arg) { char buff[135]; sprintf(buff, fmt, arg.string()); //WindowRep::errorMessage(buff); // NOT REACHED } // ####################################################################### // ##################### Session (unportable part) // ####################################################################### // ----------------------------------------------------------------------- // This function is an extension of the InterViews distribution. // A pathname of location of the installation directory tree is // returned, that can be used to locate various pieces of configuration // information (such as application defaults). // // This location is found under MS-Windows using the win.ini file (Uses // the Win16 interface so that Win32s works... which doesn't support the // registry at this time). // ----------------------------------------------------------------------- const char* Session::installLocation() { printf("Session::installLocation() not implemented\n"); return nil; } static Point where; // Session::read - // This function is called by Session::Run when there is an event pending. Because // we are generating mouse moved events with every pixel of movement, events should // be coming fast and furiously. This style of handling mouse movement was taken from // the Fresco ... natively, the Macintosh does not consider general mouse movements an // event. void Session::read(Event& e) { assert(0); // see iv_carbon_dialog_handle #if 0 RgnHandle region = NewRgn(); SetRectRgn(region, where.h, where.v, (where.h + 1), (where.v +1)); WaitNextEvent(everyEvent, e.rep()->getEventRecord(), SLEEP_TIME, region); DisposeRgn(region); where = e.rep()->getEventRecord()->where; #endif } // our problem is that pending does not deal with move events. bool read_if_pending(Event& e); bool read_if_pending(Event& e) { #if 0 RgnHandle region = NewRgn(); SetRectRgn(region, where.h, where.v, (where.h + 1), (where.v +1)); bool b = WaitNextEvent(everyEvent, e.rep()->getEventRecord(), 0, region); DisposeRgn(region); if (b) { where = e.rep()->getEventRecord()->where; } return b; #else #if defined(carbon) EventQueueRef eqr = GetMainEventQueue(); EventTargetRef target = GetEventDispatcherTarget(); EventRef er; while (ReceiveNextEvent(0, NULL, kEventDurationNoWait, true, &er) == noErr) { SendEventToEventTarget(er, target); ReleaseEvent(er); } #else assert(0); #endif return false; #endif } /* * Read an event as above, but time out after a given (sec, usec) delay. * Return true if an event was read, false if the time-out expired. */ bool Session::read(long, long, Event&) { printf("Session::read - unsupported\n"); // NOT REACHED return false; } /* * Check for a pending event, returning it if there is one. */ bool SessionRep::srcheck(Event&) { printf("Session::check - unsupported\n"); return false; } /* * Put an event back from whence it came. */ void Session::unread(Event&) { printf("Session::unread - unsupported\n"); } /* * Poll an event (implies the event already has an associated display). */ void Session::poll(Event&) { printf("Session::poll - unsupported\n"); } // the stdin event from another thread needs to go to the main thread extern "C" { static EventTypeSpec etype[] = {{'nrn1', 'nrn2'}}; static OSStatus ehandler(EventHandlerCallRef x, EventRef er, void*) { OSStatus result; QuitApplicationEventLoop(); result = noErr; return result; } // after Apple-H to hide the windows. showing them leaves them blank, // so must handle the show event // when a menu is open and one clicks in another application then the // menu should be closed so we must handle the deactivate event. static EventTypeSpec showtype[] = { {kEventClassApplication, kEventAppShown}, {kEventClassApplication, kEventAppDeactivated} }; bool session_deactivating_; bool need_motion_on_deactivate_; static OSStatus show_handler(EventHandlerCallRef x, EventRef er, void*) { OSStatus result = noErr; switch (GetEventKind(er)) { case kEventAppShown: // printf("kEventAppShown\n"); Session::instance()->screen_update(); break; case kEventAppDeactivated: // printf("kEventAppDeactivated\n"); Event e; if (e.grabber()) { //printf("grabbing\n"); if (need_motion_on_deactivate_) { // motion out of window sometimes leaves a button highlighted e.rep()->set(Event::motion, Event::left, -1000, -1000); }else{ e.rep()->set(Event::up, Event::left, -1000, -1000); } session_deactivating_ = true; EventRep::handleCallback(e); session_deactivating_ = false; Session::instance()->screen_update();; // is still grabbing but it will go away as soon as any mouse press // in any InterViews window } break; } return result; } int stdin_event_ready(); int dialog_running_ = 0; int stdin_event_ready() { if (dialog_running_) { return 0; } OSStatus err; EventRef er; err = CreateEvent(NULL, 'nrn1' , 'nrn2', 0, kEventAttributeNone, &er); err = PostEventToQueue(GetMainEventQueue(), er, kEventPriorityStandard); ReleaseEvent(er); return 1; } } // ####################################################################### // ############### Session class (portable part) // ####################################################################### Session::Session( const char* classname, int& argc, char** argv, const OptionDesc* opts, const PropertyData* initprops) { SessionRep::instance_ = this; rep_ = new SessionRep(); rep_->init(classname, argc, argv, opts, initprops); EventHandlerUPP hupp = NewEventHandlerUPP(ehandler); OSStatus err = InstallEventHandler(GetApplicationEventTarget(), hupp, 1, etype, 0, NULL); hupp = NewEventHandlerUPP(show_handler); err = InstallEventHandler(GetApplicationEventTarget(), hupp, 2, showtype, 0, NULL); } Session::~Session() { delete rep_; } Session* Session::instance() { return SessionRep::instance_; } const char* Session::name() const { return rep_->name_->string(); } const char* Session::classname() const { return rep_->classname_; } int Session::argc() const { return rep_->argc_; } char** Session::argv() const { return rep_->argv_; } Style* Session::style() const { SessionRep* s = rep_; if (s->display_ != nil) return s->display_->style(); return s->style_; } // ----------------------------------------------------------------------- // These have no equivalent in MS-Windows as there is no network-based // graphics available. HASN'T BEEN THOUGHT ABOUT FOR THE MAC // ----------------------------------------------------------------------- void Session::default_display(Display*) { } Display* Session::default_display() const { return rep_->display_; } Display* Session::connect(const String&) { return rep_->display_; } Display* Session::connect(const char*) { return rep_->display_; } void Session::disconnect(Display*) { } #if USE_SIOUX_WINDOW //These functions and variables are included for the SIOUX interface which //Neuron uses extern "C" { long SIOUXHandleOneEvent(EventRecord *); long ReadCharsFromConsole(char *buffer, long n); // extern WindowPtr SIOUXTextWindow; extern Boolean SIOUXUseWaitNextEvent; Boolean IVOCGoodLine; char* hoc_console_buffer; } #endif void Session::screen_update() { while(WindowRep::update_list.count() > 0){ WindowRep::update_list.item(0)->repair(); WindowRep::update_list.item(0)->update_ = false; WindowRep::update_list.remove(0); } } // ----------------------------------------------------------------------- // Event loops // ----------------------------------------------------------------------- #if carbon // event handling is claimed to be simplified in carbon. We assume // event handlers have been installed. I'm hoping that the sioux console // window will happily coexist with the interviews windows in the case // that the console is waiting for input and all events will be nicely // delivered. int Session::run() { screen_update(); //printf("RunApplicationEventLoop\n"); #if 1 RunApplicationEventLoop(); #else EventTargetRef target = GetEventDispatcherTarget(); EventRef er; while (ReceiveNextEvent(0, NULL, kEventDurationForever, true, &er) == noErr) { SendEventToEventTarget(er, target); ReleaseEvent(er); } #endif //printf("Return from RunApplicationEventLoop\n"); return 0; } #else int Session::run() { Event e; bool& done = rep_->done_; EventRecord event; done = false; #if USE_SIOUX_WINDOW WindowPtr temp = 0; bool eventHandled; SIOUXUseWaitNextEvent = false; char buffer[100]; int n=0; static int cnt=0; #endif do { #if USE_SIOUX_WINDOW eventHandled = false; IVOCGoodLine = false; //also set to false in SIOUX.c in Read from console //This code was an attempt to compensate for the case that there is only a SIOUX //window on the screen. Haven't really had the opportunity to test it out. //if(MACwindow::noInterviewsWindows()){ // SIOUXUseWaitNextEvent = true; // n = ReadCharsFromConsole(*hoc_console_buffer, 256); // if(IVOCGoodLine){ // eventHandled = true; // (*hoc_console_buffer)[n] = '\0'; // (*hoc_console_buffer)[(n - 1)] = '\n'; // return 0; // } //} #endif //if there are no events available repair damaged Interviews Windows if (!(EventAvail(everyEvent, &event))) { screen_update(); } #if 0 // promising but a lot of work just to get the title bar and scrollbar for free #if USE_SIOUX_WINDOW eventHandled = SIOUXHandleOneEvent(&event); if (eventHandled) { //n = ReadCharsFromConsole(hoc_console_buffer, 256); if(IVOCGoodLine){ eventHandled = true; hoc_console_buffer[n] = '\0'; hoc_console_buffer[(n - 1)] = '\n'; return 0; } } #endif #else #if USE_SIOUX_WINDOW //check to see if the SIOUX window needs to handle the event if(event.what != osEvt){ //avoid checking with the mouse movement calls FindWindow(event.where, &temp); if(((event.what == updateEvt) || (event.what == activateEvt)) && ((WindowPtr)(event.message) == SIOUXTextWindow->window)){ eventHandled = true; SIOUXUseWaitNextEvent = true; SIOUXHandleOneEvent(nil); SIOUXUseWaitNextEvent = false; } else if(temp && (temp == SIOUXTextWindow->window) && (FrontWindow() == temp)){ n = ReadCharsFromConsole(hoc_console_buffer, 256); if(IVOCGoodLine){ eventHandled = true; hoc_console_buffer[n] = '\0'; hoc_console_buffer[(n - 1)] = '\n'; return 0; } } } #endif #endif //let Interviews handle the event if SIOUX did not. #if USE_SIOUX_WINDOW if (SIOUXQuitting) { hoc_quit(); } if(!(eventHandled)){ #endif read(e); e.handle(); #if USE_SIOUX_WINDOW } #endif } while (!done); #if USE_SIOUX_WINDOW //This code was merely for testing with the SIOUX console in //the InterViews project. //Reinstated for ivoc testing printf("InterViews has exited"); SIOUXUseWaitNextEvent = true; ReadCharsFromConsole(buffer, 100); #endif return 0; } #endif int Session::run_window(Window* w) { w->map(); return run(); } void Session::quit() { rep_->done_ = true; QuitApplicationEventLoop(); } void Session::unquit() { rep_->done_ = false; } /* * Return loop status. */ bool Session::done() const { return rep_->done_; } /* * Check if an event is pending on any display. */ bool Session::pending() const { EventRecord event; return EventAvail(everyEvent, &event); } // ----------------------------------------------------------------------- // Initialize.... loading the styles based upon command line arguments // and the application defaults settings. // ----------------------------------------------------------------------- void SessionRep::init( const char* name, int& argc, char** argv, const OptionDesc* opts, const PropertyData* initprops) { done_ = false; argc_ = argc; argv_ = new char*[argc + 1]; for (int i = 0; i < argc; i++) { argv_[i] = argv[i]; } argv_[argc_] = nil; init_style(name, initprops); if (opts != nil) { parse_args(argc, argv, opts); } parse_args(argc, argv, defoptions); init_display(); // ---- build default cursors ---- Cursor::init(); #ifdef sgi if (style_->value_is_on("malloc_debug")) { mallopt(M_DEBUG, 1); } #endif } /* * Parse the argument list, setting any properties that are specified * by the option list. Matching arguments are removed (in-place) * from the argument list. */ void SessionRep::parse_args(int& argc, char** argv, const OptionDesc* opts) { int i; int newargc = 1; char* newargv[1024]; newargv[0] = argv[0]; for (i = 1; i < argc; i++) { bool matched = false; String arg(argv[i]); for (const OptionDesc* o = &opts[0]; o->name != nil; o++) { if (match(arg, *o, i, argc, argv)) { matched = true; break; } } if (!matched) { newargv[newargc] = argv[i]; ++newargc; } } if (newargc < argc) { for (i = 1; i < newargc; i++) { argv[i] = newargv[i]; } argc = newargc; argv[argc] = nil; } } /* * See if the given argument matches the option description. */ bool SessionRep::match( const String& arg, const OptionDesc& o, int& i, int argc, char** argv) { String opt(o.name); if (arg != opt) { if (o.style == OptionValueAfter) { int n = opt.length(); if (opt == arg.left(n)) { style_->attribute(String(o.path), arg.right(n)); return true; } } return false; } String name, value; extract(arg, o, i, argc, argv, name, value); style_->attribute(name, value); return true; } /* * Extract an attribute from a given argument. */ void SessionRep::extract( const String& arg, const OptionDesc& o, int& i, int argc, char** argv, String& name, String& value) { int colon; switch (o.style) { case OptionPropertyNext: value = next_arg(i, argc, argv, "missing property after '%s'", arg); colon = value.index(':'); if (colon < 0) { bad_arg("missing ':' in '%s'", value); } else { name = value.left(colon); value = value.right(colon+1); } break; case OptionValueNext: name = o.path; value = next_arg(i, argc, argv, "missing value after '%s'", arg); break; case OptionValueImplicit: name = o.path; value = o.value; break; case OptionValueIsArg: name = o.path; value = arg; break; case OptionValueAfter: bad_arg("missing value in '%s'", arg); break; } } /* * Make sure there is another argument--if not generate an error. */ String SessionRep::next_arg( int& i, int argc, char** argv, const char* message, const String& arg) { ++i; if (i == argc) { bad_arg(message, arg); } return String(argv[i]); } /* * Find the value for a specific argument. */ bool SessionRep::find_arg( const String& arg, String& value) { int last = argc_ - 1; for (int i = 1; i < last; i++) { if (arg == argv_[i]) { value = String(argv_[i+1]); return true; } } return false; } /* * Initialize style information for the session. */ void SessionRep::init_style( const char* name, const PropertyData* props) { classname_ = name; name_ = find_name(); style_ = new Style(*name_); Resource::ref(style_); style_->alias(classname_); props_ = props; } void SessionRep::load_props( Style* s, const PropertyData* props, int priority) { if (props != nil) { for (const PropertyData* p = &props[0]; p->path != nil; p++) { s->attribute(String(p->path), String(p->value), priority); } } } void SessionRep::load_path( Style* s, const char* head, const char* tail, int priority) { String h(head); String t(tail); char* buff = new char[strlen(head) + strlen(tail) + 1]; sprintf(buff, "%s%s", head, tail); load_file(s, buff, priority); delete buff; } void SessionRep::load_file( Style* s, const char* filename, int priority) { InputFile* f = InputFile::open(String(filename)); if (f == nil) { return; } const char* start; int len = f->read(start); if (len > 0) { load_list(s, String(start, len), priority); } f->close(); delete f; } void SessionRep::load_list( Style* s, const String& str, int priority) { const char* p = str.string(); const char* q = p + str.length(); const char* start = p; for (; p < q; p++) { if (*p == '\n') { if (p > start && *(p-1) != '\\') { load_property(s, String(start, (int)(p - start)), priority); start = p + 1; } } } } void SessionRep::load_property( Style* s, const String& prop, int priority) { String p(strip(prop)); if (p.length() == 0 || p[0] == '!') { return; } int colon = p.index(':'); if (colon < 0) { missing_colon(p); } else { String name(strip(p.left(colon))); String value(strip(p.right(colon + 1))); if (name.length() <= 0) { bad_property_name(name); } else if (value.length() <= 0) { bad_property_value(value); } else { s->attribute(name, value, priority); } } } String SessionRep::strip(const String& s) { int i = 0; int len = s.length(); for (i = 0; i < len && isspace(s[i]); i++); int j = len - 1; for (; j >= 0 && isspace(s[j]); j--); return s.substr(i, j - i + 1); } neuron-7.6.3/src/lib/IV-Mac/window.cpp000066400000000000000000001574411340731477100174440ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif // ======================================================================= // // // // Macintosh implementation of the InterViews Window classes. Primary // event handling is contaied within the event.c file, but the actual // implementation of the different events on the windows is done by the // MACwindow class. Mouse down/up and keydown events within the content // region of an active window are handled by Interviews event handler, and // are passed by the function MACinput. // // // 1.7 // $Date: 4 Aug 1996 // /* * THIS FILE CONTAINS PORTIONS OF THE InterViews 3.1 DISTRIBUTION THAT * CONTAINED THE FOLLOWING COPYRIGHT: * * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * THIS FILE CONTAINS PORTIONS OF THE Fresco DISTRIBUTION THAT * CONTAINED THE FOLLOWING COPYRIGHT: */ // Copyright (c) 1995 Silicon Graphics, Inc. // Copyright (c) 1995 Fujitsu, Ltd. // // Permission to use, copy, modify, distribute, and sell this software and // its documentation for any purpose is hereby granted without fee, provided // that (i) the above copyright notices and this permission notice appear in // all copies of the software and related documentation, and (ii) the names of // Silicon Graphics and Fujitsu may not be used in any advertising or // publicity relating to the software without the specific, prior written // permission of Silicon Graphics and Fujitsu. // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL SILICON GRAPHICS OR FUJITSU BE LIABLE FOR // ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, // OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, // WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF // LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE // OF THIS SOFTWARE. // // ======================================================================= #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include extern "C" {void debugfile(const char*, ...);} #define MenuID altDBoxProc //#define MenuID plainDBox //This is used to ensure that the Inteviews loop will not be called the SIOUX window //if there are no Interviews windows #if USE_SIOUX_WINDOW static bool NO_IV_WINDOWS = true; #endif //Variable to keep track of next window placement static int NEXT_WINDOWS_PLACE_X = 0; static int NEXT_WINDOWS_PLACE_Y = 40; // --- global event for rapid processing ---- static Event* input_e = 0; static EventRep* input_er = 0; // Names of the classes that get registered by InterViews applications. // THESE NAMES AREN'T CURRENTLY USED?IMPLEMENTED const char* WINDOW_CLASSNAME = "ivWindow"; const char* POPUP_CLASSNAME = "ivPopupWindow"; const char* TOPLEVEL_CLASSNAME = "ivTopLevelWindow"; // List of damged windows implementPtrList(MACWindowRepList, WindowRep) MACWindowRepList WindowRep::update_list; // ---- templates ---- declarePtrList(MACcursorPtrList, Cursor) implementPtrList(MACcursorPtrList, Cursor) #if carbon extern "C" { #define NTYPE 6 static EventTypeSpec etype[] = { {kEventClassMouse, kEventMouseDown}, {kEventClassMouse, kEventMouseMoved}, {kEventClassMouse, kEventMouseDragged}, {kEventClassMouse, kEventMouseUp}, {kEventClassKeyboard, kEventRawKeyDown}, {kEventClassKeyboard, kEventRawKeyRepeat} }; static OSStatus ehandler(EventHandlerCallRef x, EventRef er, void* v) { //printf("ehandler class=%d kind=%d\n", GetEventClass(er), GetEventKind(er)); OSStatus result; result = CallNextEventHandler(x, er); if (result == eventNotHandledErr) { input_er->setEventRef(er); input_e->handle(); result = noErr; } // UInt32 ek; // ek = GetEventKind(er); // printf("%d\n", ek); // wish we could do following only on last of a sequence of events. Session::instance()->screen_update(); return result; } static EventTypeSpec showtype[] = {{kEventClassWindow, kEventWindowShown}}; static OSStatus show_handler(EventHandlerCallRef x, EventRef er, void* v) { OSStatus result; WindowRef wr; // printf("kEventWindowShown\n"); result = GetEventParameter(er, kEventParamDirectObject, typeWindowRef, NULL, sizeof(WindowRef), NULL, &wr); WindowRep* wrep = (WindowRep*)GetWRefCon(wr); wrep->ivWindowOf()->canvas()->damage_all(); result = noErr; return result; } } int iv_carbon_in_menu_; void iv_carbon_dialog_handle(WindowRef w) { EventRef er; OSStatus result; result = ReceiveNextEvent(0, NULL, kEventDurationForever, true, &er); //printf("%d %c%c%c%c %d %d\n", result, //GetEventClass(er)>>24,GetEventClass(er)>>16,GetEventClass(er)>>8,GetEventClass(er)>>0, //GetEventKind(er), IsWindowActive(w)); WindowRef wr; if (GetEventClass(er) == kEventClassMouse && GetEventParameter(er, kEventParamWindowRef, typeWindowRef, NULL, sizeof(wr), NULL, &wr) == 0) { if (FrontWindow() != w) { //printf("SelectWindow\n"); // SelectWindow(w); } }else if ( GetEventClass(er) == kEventClassKeyboard) { wr = FrontWindow(); }else{ wr = nil; } //printf("dialog iv_carbon_in_menu = %d\n", iv_carbon_in_menu_); if (wr == w || iv_carbon_in_menu_) { SendEventToEventTarget(er, GetEventDispatcherTarget()); } ReleaseEvent(er); } #endif // ####################################################################### // ################# MACcreateParams class // ####################################################################### MACcreateParams::MACcreateParams() { //These settings are defaults ... the glyph sets many of these in WindowRep::bind bounds_ = new Rect; title_ = 0; where_.v = 70; where_.h = 555; id_ = documentProc; away_ = true; refCon_input_ = 0; SetRect(bounds_, 0, 0, 200 , 150); titleOf("Neuron\0"); #if carbon wclass_ = kDocumentWindowClass; id_ = kWindowCloseBoxAttribute| kWindowResizableAttribute | kWindowCollapseBoxAttribute; #endif } MACcreateParams::~MACcreateParams() { if(title_) delete title_; if(bounds_) delete bounds_; } void MACcreateParams::titleOf(const char* t) { if(t){ if (title_) delete title_; title_ = new char[strlen(t)+1]; strcpy(title_, t); } } const char* MACcreateParams::titleOf() { return title_; } // ####################################################################### // ################# MACwindow class // ####################################################################### // ----------------------------------------------------------------------- // constructors and destructors // ----------------------------------------------------------------------- MACwindow::MACwindow() { theMacWindow_ = nil; buffer_bitmap_ = nil; doubleBuffered_ = true; params_ = new MACcreateParams; hasGrow = true; horizScroll = nil; vertScroll = nil; update_ = false; placed_ = false; } MACwindow::~MACwindow() { if(params_) delete params_; if (buffer_bitmap_) { DisposeGWorld(buffer_bitmap_); } //shouldn't have to call this ... unbind should take care of disposing //of the window. It is merely a safety precaution. if (theMacWindow_) DisposeWindow(theMacWindow_); } //The next_window functions place new windows according to Macintosh standards int MACwindow::next_window_x(void){ if (placed_) return left_; int this_window_position = NEXT_WINDOWS_PLACE_X; NEXT_WINDOWS_PLACE_X += 20; if(NEXT_WINDOWS_PLACE_X >= getIvWindow()->display()->pwidth()) NEXT_WINDOWS_PLACE_X = 20; return this_window_position; } int MACwindow::next_window_y(void){ if (placed_) { Window* w = getIvWindow(); int t = bottom_ - w->display()->to_pixels(w->height());//bottom_ measured from top of screen return (t>40) ? t : 40; } int this_window_position = NEXT_WINDOWS_PLACE_Y; NEXT_WINDOWS_PLACE_Y += 20; if(NEXT_WINDOWS_PLACE_Y >= getIvWindow()->display()->pheight()) NEXT_WINDOWS_PLACE_Y = 40; return this_window_position; } // ----------------------------------------------------------------------- // Window binding functions. bind() actually creates the window and binds // it to this object. unbind() removes the attachment to the Macintosh // window and destroys it. // ----------------------------------------------------------------------- void MACwindow::bind() { //If we have a SIOUX_window ... set up event looping to support both windows #if USE_SIOUX_WINDOW MACwindow::setNoInterviewsWindows(false); #endif long totalSpace, contigSize; Requisition r; // ---- if already bound... nothing to do ---- if (theMacWindow_) return; // ---- check for available memory ---- PurgeSpace(&totalSpace, &contigSize); #if carbon #else if (contigSize < (sizeof(CWindowRecord))){ printf("Error Message"); exit(1); } #endif //pointer to the MACwindow structure in the Refcon field params_->refCon_input_ = (long)this; // ---- create the window ---- #if carbon OSStatus st = CreateNewWindow( params_->wclass_, // (params_->away_?kWindowCloseBoxAttribute:0) | kWindowResizableAttribute | kWindowCollapseBoxAttribute, params_->id_, params_->bounds_, &theMacWindow_ ); if (st != noErr) { printf("CreateNewWindow error %d\n", st); } SetWRefCon(theMacWindow_, params_->refCon_input_); Str255 ti; CopyCStringToPascal(params_->titleOf(), ti); SetWTitle(theMacWindow_, ti); EventHandlerUPP hupp = NewEventHandlerUPP(ehandler); InstallWindowEventHandler(theMacWindow_, hupp, NTYPE, etype, 0, NULL); hupp = NewEventHandlerUPP(show_handler); InstallWindowEventHandler(theMacWindow_, hupp, 1, showtype, 0, NULL); #else theMacWindow_ = NewCWindow(nil, //where the window record will be stored params_->bounds_, //size of window C2PStr((Ptr)params_->titleOf()), //string title false, //not visible on screen till mapped params_->id_, //type of window nil, //places window in front params_->away_, //whether a window can be closed params_->refCon_input_); //associated window #endif // ---- move the window ---- //This probably needs to be changed to conform with Mac "human interface" standards //but it gives you some flexibility if(theMacWindow_){ MoveWindow(theMacWindow_, next_window_x(), next_window_y(), false); // MoveWindowStructure(theMacWindow_, next_window_x(), next_window_y()); } else { printf("Memory allocation error"); exit(1); } //Force an update ... otherwise window stays blank unitl a key press getIvWindow()->canvas()->damage_all(); } void MACwindow::unbind() { if (!theMacWindow_) { // MessageBox(NULL,"MWwindow::unbind has no binding", "zzz", MB_OK); return; } if (update_) { int i, cnt = WindowRep::update_list.count(); for (i=0; i < cnt; ++i) { if (WindowRep::update_list.item(i) == (WindowRep*)this) { WindowRep::update_list.remove(i); break; } } } // ---- close window and destroy the memory allocated ---- DisposeWindow(theMacWindow_); theMacWindow_ = 0; } bool MACwindow::map() { if(theMacWindow_){ ShowWindow(theMacWindow_); SelectWindow(theMacWindow_); getIvWindow()->canvas()->damage_all(); //Needed for Neuron Event e; getIvWindow()->receive(e); return 1; } return 0; } void MACwindow::unmap() { if(theMacWindow_) HideWindow(theMacWindow_); } bool MACwindow::isMapped() { if(theMacWindow_){ #if carbon return IsWindowVisible(theMacWindow_)?true:false; #else return(((CWindowPeek)theMacWindow_)->visible); #endif } else { return 0; } } //SIOUX Specific stuff #if USE_SIOUX_WINDOW bool MACwindow::noInterviewsWindows(void){ return NO_IV_WINDOWS; } void MACwindow::setNoInterviewsWindows(bool windows){ NO_IV_WINDOWS = windows; } #endif // getIvWindow - // Since MACwindow is always the superclass of a WindowRep we are able to //make this type-cast in order to get the associated InterViews Window. Window * MACwindow::getIvWindow() const{ #if 0 if(params_->refCon_input_){ return ((WindowRep*)params_->refCon_input_)->ivWindowOf(); } else { return nil; } #else return ((WindowRep*)this)->ivWindowOf(); #endif } // isOurWindow - // I honestly don't know how effective/necessary this function is yet ... may fail to // distinguish between one of our graphics windows and the SIOUX window bool MACwindow::isOurWindow(WindowPtr theWin){ if(theWin){ #if carbon return GetWindowKind(theWin) == userKind; #else return(((CWindowPeek)theWin)->windowKind == userKind); #endif } else { return false; } } //This function is necessary since the Macintosh handles events for dialogs //differently than events for normal windows. DIALOG EVENT HANDLING STILL NEEDS //TO BE IMPLEMENTED. short MACwindow::isDialog(WindowPtr macWindow) { Boolean result = 0; short windowVariant; if (macWindow) { #if carbon if (GetWindowKind(macWindow) == dialogKind) /* window accessor */ #else if (((CWindowPeek)macWindow)->windowKind == dialogKind) /* window accessor */ #endif { windowVariant = GetWVariant(macWindow); switch (windowVariant) { case dBoxProc: case plainDBox: case altDBoxProc: result = MODAL; break; case noGrowDocProc: result = MODELESS; break; case movableDBoxProc: result = MOVABLE_MODAL; break; } } } return(result); } // contentRect - // Useful for actually finding the content area of the window when clipping. // May not be terribly useful, however, if Macintosh scroll bars are ignored. void MACwindow::contentRect (void *data){ Rect *contentRect = (Rect*)data; #if carbon GetPortBounds(GetWindowPort(theMacWindow_), contentRect); #else *contentRect = theMacWindow_->portRect; #endif if (vertScroll){ contentRect->right -=15; if (contentRect->right < contentRect->left) contentRect->right = contentRect->left; } if (horizScroll){ contentRect->bottom -=15; if (contentRect->bottom < contentRect->top) contentRect->bottom = contentRect->top; } } // drawGrowIcon - // This function is one that I had some trouble with. It is designed to prevent you from // drawing a blanked out scroll bar when you don't need one, but since we don't have any // scroll bars ... DrawGrowIcon is never called. That's where we get our mysterious // grow corner from. We could just force the issue by drawing the empty scroll bars and // grow icon, but they must be maintained. We also would make some of the drawing in the // canvas look awkward. void MACwindow::drawGrowIcon(void){ RgnHandle savedClip, contentRgn, windowRgn; Rect contentRct; #if 1 /* create necessary regions */ savedClip = NewRgn(); contentRgn = NewRgn(); windowRgn = NewRgn(); GetClip(savedClip); /* get content region */ contentRect(&contentRct); RectRgn(contentRgn, &contentRct); /* exclude it from the clip */ #if carbon Rect winRect; GetPortBounds(GetWindowPort(theMacWindow_), &winRect); RectRgn(windowRgn, &winRect); #else RectRgn(windowRgn, &(theMacWindow_->portRect)); #endif DiffRgn(windowRgn, contentRgn, contentRgn); SetClip(contentRgn); DrawGrowIcon(theMacWindow_); SetClip(savedClip); DisposeRgn(savedClip); DisposeRgn(contentRgn); DisposeRgn(windowRgn); #else if(hasGrow) DrawGrowIcon(theMacWindow_); #endif } // activate - // Responds to an activate event from the system on one of our windows void MACwindow::activate(bool activ){ short hiliteCode; ControlHandle theControl; GrafPtr oldPort; GetPort(&oldPort); setport(); #if carbon // I wish I knew what I was doing GetRootControl(theMacWindow_, &theControl); if (activ) { ActivateControl(theControl); }else{ DeactivateControl(theControl); } #else if (activ) /* activating window */ { hiliteCode = 0; } else { hiliteCode = 255; } //theControl = ((CWindowPeek)theMacWindow_)->controlList; theControl = GetControlListFromWindow(theMacWindow_); while(theControl) { if ((theControl == horizScroll) || (theControl == vertScroll)){ if (activ) { ShowControl(theControl); } else { HideControl(theControl); } } else { HiliteControl(theControl, hiliteCode); } theControl = (**theControl).nextControl; } #endif if (hasGrow) { drawGrowIcon(); } SetPort(oldPort); /* allow window to modify menu bar */ if(activ){ //UpdateMenusHook(); } } // repair - // This function responds to the repair list that is maintained and cycled through // after every event. It redraws the windows damaged region void MACwindow::repair(void){ GrafPtr oldPort; Rect contentRct; GetPort(&oldPort); setport(); MACcanvas* can = (MACcanvas*) getIvWindow()->canvas(); #if carbon RgnHandle visRgn; visRgn = NewRgn(); GetPortVisibleRegion(GetWindowPort(theMacWindow_), visRgn); UpdateControls(theMacWindow_, visRgn); // DisposeRgn(visRgn); #else UpdateControls(theMacWindow_, theMacWindow_->visRgn); #endif // Rect * damage = can->getDamage(); // debugfile("Damage area is l: %d r: %d t: %d b: %d\n", damage->left, damage->right, damage->top, damage->bottom); /* draw contents */ MACpaint(); if (hasGrow){ drawGrowIcon(); } #if carbon Rect r; GetPortBounds(GetWindowPort(theMacWindow_), &r); ValidWindowRect(theMacWindow_, &r); QDFlushPortBuffer(GetWindowPort(theMacWindow_), visRgn); DisposeRgn(visRgn); #else ValidRect(&theMacWindow_->portRect); #endif can->clearDamage(); SetPort(oldPort); } // update - // This function responds to a system event of updating a window. It is modeled after // the Fresco code. An offscreen graphics world is used for double buffering. void MACwindow::update(void){ GrafPtr oldPort; Rect contentRct; BeginUpdate(theMacWindow_); #if carbon SetGWorld(GetWindowPort(theMacWindow_), GetMainDevice()); Rect r; GetPortBounds(GetWindowPort(theMacWindow_), &r); ClipRect(&r); RgnHandle vr; vr = NewRgn(); GetPortVisibleRegion(GetWindowPort(theMacWindow_), vr); Rect pr; GetPortBounds(GetWindowPort(theMacWindow_), &pr); #else SetGWorld((CGrafPort*) theMacWindow_, GetMainDevice()); Rect r = theMacWindow_->portRect; ClipRect(&r); RgnHandle vr = theMacWindow_->visRgn; Rect pr = theMacWindow_->portRect; #endif Rect content; content.top = pr.top; content.left = pr.left; contentRect(&content); #if 0 if (vertScroll){ content.right = pr.right - 15; } else { content.right = pr.right; } if (horizScroll){ content.bottom = pr.bottom - 15; } else { content.bottom = pr.bottom; } #endif RgnHandle cr = NewRgn(); RectRgn(cr, &content); RgnHandle ir = NewRgn(); SectRgn(vr, cr, ir); if (! EqualRgn(vr, ir)) { // only controls need to be updated RgnHandle wr = NewRgn(); DiffRgn(vr, cr, wr); EraseRgn(wr); UpdateControls(theMacWindow_, wr); if (hasGrow) { DrawGrowIcon(theMacWindow_); } DisposeRgn(wr); } if (! EmptyRgn(ir)) { #if carbon Rect damage; GetRegionBounds(ir, &damage); #else Rect damage = (*ir)->rgnBBox; #endif Boolean good = false; //This fresco implementation is probably better/faster, but having trouble with the size //of the pixmap ... I think. if (0 /*buffer_bitmap_ != nil*/) { PixMapHandle pixmap = GetGWorldPixMap(buffer_bitmap_); good = LockPixels(pixmap); if (good) { // Blast the damaged region from the buffer to the window. CopyBits( #if carbon GetPortBitMapForCopyBits(buffer_bitmap_), GetPortBitMapForCopyBits(GetWindowPort(theMacWindow_)), #else &GrafPtr(buffer_bitmap_)->portBits, &GrafPtr(theMacWindow_)->portBits, #endif &damage, &damage, srcCopy, nil ); UnlockPixels(pixmap); } } if (! good) { //THIS NEEDS WORK -- this rectangular call is ignored and paint is called // I think that is why we can see the pixels being blasted to the screen // on resizing. MACcanvas* can = (MACcanvas*) getIvWindow()->canvas(); // can->setDamage(&damage); can->addToDamage(&damage); // 2/24/97 setDamage insufficient because the update make take place immediately after // a redraw. ie a popup window may be dismissed over the window it wants to draw a large // part of. // damage content area //Coord l = to_coord(damage.left - 1, X_axis); //Coord b = to_coord(damage.bottom - 1, Y_axis); //Coord r = to_coord(damage.right + 1, X_axis); //Coord t = to_coord(damage.top + 1, Y_axis); //redraw(l, b, r - l, t - b); MACpaint(); } } DisposeRgn(cr); DisposeRgn(ir); #if carbon DisposeRgn(vr); #endif EndUpdate(theMacWindow_); } // doDrag - // implements window dragging ... the neuron section is for the Print // Manager window #if carbon void MACwindow::doDrag(EventRef theEvent){ #else void MACwindow::doDrag(EventRecord * theEvent){ #endif Rect r; /* get dimensions of all monitors */ #if carbon Point p; GetRegionBounds(GetGrayRgn(), &r); DragWindow(theMacWindow_, EventRep::mouse_loc(theEvent), &r); #else r = (**GetGrayRgn()).rgnBBox; /* drag the window within the rectangle defining all monitors */ DragWindow(theMacWindow_, theEvent->where, &r); #endif //Needed for Neuron Event e; getIvWindow()->receive(e); } // doGrow - // Responds to a click to the grow icon(which isn't currently displayed) // It allows the user to resize the window. Again there is neuron code to // alert the print manager of the change, and the canvas is damages so that // the window's contents will be updated. #if carbon void MACwindow::doGrow(EventRef theEvent){ #else void MACwindow::doGrow(EventRecord* theEvent){ #endif #if carbon Boolean result; Rect rout; #else long result; #endif Rect r; short width, height; short newWidth; short newHeight; GrafPtr oldPort; ControlHandle theControl; width = getIvWindow()->canvas()->pwidth(); height = getIvWindow()->canvas()->pheight(); if(vertScroll){ width += 16; /* width of scroll bar */ } if(horizScroll){ height += 16; } /* Set minimum/maximum bounds for window */ r.left = shrink_.h; r.top = shrink_.v; r.right = stretch_.h; r.bottom = stretch_.v; /* track mouse and resize window outline as we go */ #if carbon result = ResizeWindow(theMacWindow_, EventRep::mouse_loc(theEvent), &r, &rout); #else result = GrowWindow(theMacWindow_, theEvent->where, &r); #endif if (result) { GetPort(&oldPort); setport(); if (hasGrow) /* must ensure this gets invalidated */ { Rect growBoxRect; #if carbon Rect r = rout; GetPortBounds(GetWindowPort(theMacWindow_), &r); SetRect(&growBoxRect, r.right - 15, r.bottom - 15, r.right, r.bottom); InvalWindowRect(theMacWindow_, &growBoxRect); #else SetRect(&growBoxRect, theMacWindow_->portRect.right - 15, theMacWindow_->portRect.bottom - 15, theMacWindow_->portRect.right, theMacWindow_->portRect.bottom); InvalRect(&growBoxRect); #endif } #if carbon #else newWidth = LoWord((long*)result); newHeight = HiWord((long*)result); SizeWindow(theMacWindow_, newWidth, newHeight, true); #endif /* resize scroll bars */ theControl = (horizScroll); if (theControl){ HideControl(theControl); adjustScrollBar(theControl); ShowControl(theControl); } theControl = (vertScroll); if (theControl){ HideControl(theControl); adjustScrollBar(theControl); ShowControl(theControl); } if (hasGrow) { drawGrowIcon(); } // reset clipping to entire window ((MACcanvas*)getIvWindow()->canvas())->initClip(); //force an update getIvWindow()->canvas()->damage_all(); //Needed for Neuron Event e; getIvWindow()->receive(e); /* restore port */ SetPort(oldPort); } } // doZoom - // Currently doesNothing. If one wanted to implement this code they would // need to get the zoom.c file from EasyApp and include its relative headers. Zoom.c // provides a zooming algorithm which is supposedly good -- at least it is complex. // This has not been done because it wasn't a priority void MACwindow::doZoom (void *data) { #if 0 ControlHandle theControl; short zoomDirection = *(short*)data; Rect idealSize; idealSize.left = 0; idealSize.top = 0; idealSize.right = docWidth; //this would need to be calculated idealSize.bottom = docHeight; //this would need to be calculated if(vertScroll) { idealSize.right += 16; /* width of scroll bar */ } if(horizScroll) { idealSize.bottom += 16; } /* erase window and resize it, using Dean Yu's zooming code */ //ZoomTheWindow( (WindowPeek)theMacWindow_, zoomDirection, &idealSize); /* resize scrollbars, if any */ theControl = (horizScroll); if (theControl) { HideControl(theControl); adjustScrollBar(theControl); ShowControl(theControl); } theControl = (vertScroll); if (theControl) { HideControl(theControl); adjustScrollBar(theControl); ShowControl(theControl); } if (hasGrow) { drawGrowIcon(); } #endif } // doBackgroundClick - // Handles mouse down events to content regions of non-active windows. // Currently it just activates the window ... but it is set up to also handle drag and // drop support. #if carbon void MACwindow::doBackgroundClick(EventRef theEvent){ #else void MACwindow::doBackgroundClick(EventRecord * theEvent){ #endif Boolean activate = true; /* Bring window forward? Assume yes. */ Point localPoint; GrafPtr oldPort; // This function is an outline for drag and drop support of window items. It is // not currently implemented, but is based on the EasyApp design if(false) { GetPort(&oldPort); setport(); /* convert to local coordinates */ //EasyGlobalToLocal(macWindow, theEvent->where, &localPoint); /* now see if click is in selected item */ /* For example, let's say the user clicks an object. You would call WaitMouseMoved() to determine if a drag was beginning, and handle it like this #if carbon if (WaitMouseMoved(EventRep::mouse_loc(theEvent))) { easyWindow->DoDragItems(macWindow, theEvent); activate = false; // don't activate background window } #else if (WaitMouseMoved(theEvent->where)) { easyWindow->DoDragItems(macWindow, theEvent); activate = false; // don't activate background window } #endif This is for drag and drop only! Do not allow user to move anything in a background window other than dragging to a new window. If the drag begins in a background window and ends in the same window, nothing should happen. The original sender window is NOT an acceptable destination when the sender is a background window. Notice that a click but not a drag on a background selection results in the window being activated! */ SetPort(oldPort); } if(activate) { SelectWindow(theMacWindow_); } } // adjustScrollBar - // Sets scroll tab and bar positioning appropriately in a window. // Will be useful if Mac scroll bars are actually used/implemented. void MACwindow::adjustScrollBar (ControlHandle theControl) { #if carbon Rect r; GetPortBounds(GetWindowPort(theMacWindow_), &r); short top = r.top; short left = r.left; short bottom = r.bottom; short right = r.right; #else short top = theMacWindow_->portRect.top; short left = theMacWindow_->portRect.left; short bottom = theMacWindow_->portRect.bottom; short right = theMacWindow_->portRect.right; #endif short max; if (theControl == vertScroll) { MoveControl(theControl, right - 15, -1); SizeControl(theControl, 16, bottom - 13); max = getIvWindow()->canvas()->pheight() - ((bottom - 15) - top); } else { MoveControl(theControl, -1, bottom - 15); SizeControl(theControl, right - 13, 16); max = getIvWindow()->canvas()->pwidth() - ((right - 15) - left); } if (max < 0) { max = 0; } SetControlMaximum (theControl, max); } // ----------------------------------------------------------------------- // MACpaint - // This is the primary function for drawing into a window. It is basically // Fresco code which has been adapted to Inteviews needs. Drawing is limited // to a damaged region which is maintained by the window. // ----------------------------------------------------------------------- long MACwindow::MACpaint() { MACcanvas* can = (MACcanvas*) getIvWindow()->canvas(); PixMapHandle pixmap = 0; if (doubleBuffered_) { // Make sure the buffer is allocated. Rect c; c.left = 0; c.top = 0; c.right = can->pwidth(); c.bottom = can->pheight(); if (buffer_bitmap_ == nil) { //printf("Set NewGWorld\n"); QDErr error = NewGWorld(&buffer_bitmap_, 0, &c, nil, nil, 0); if (error != noErr) printf("Buffer Allocation Error\n"); } else { GWorldFlags flags = UpdateGWorld(&buffer_bitmap_, 0, &c, nil, nil, 0); if (flags & gwFlagErr) { DisposeGWorld(buffer_bitmap_); //printf("I can't handle any more captain\n"); buffer_bitmap_ = nil; } else if (flags & reallocPix) { can->setDamage(&c); } } if (buffer_bitmap_ != nil) { // Make sure the pixels are allocated pixmap = GetGWorldPixMap(buffer_bitmap_); Boolean good = LockPixels(pixmap); if (! good) { // Don't use double buffering. pixmap = 0; } } } // Setup the graphics world for drawing. CGrafPtr cg; GDHandle gd; GetGWorld(&cg, &gd); if (pixmap != 0) { // Draw into the buffer. SetGWorld(buffer_bitmap_, nil); } else { // Draw directly to the window without using double buffering. #if carbon SetGWorld(GetWindowPort(theMacWindow_), GetMainDevice()); #else SetGWorld((CGrafPort*)theMacWindow_, GetMainDevice()); #endif } // Paint the image. if (getIvWindow()->glyph()) { // Rect * dam = can->getDamage(); // debugfile("draw Damage area is l: %d r: %d t: %d b: %d\n", dam->left, dam->right, dam->top, dam->bottom); can->beginPaint(); getIvWindow()->glyph()->draw(can, ((WindowRep*)this)->getAllocation()); can->endPaint(); // dam = can->getDamage(); // debugfile("after draw Damage area is l: %d r: %d t: %d b: %d\n", dam->left, dam->right, dam->top, dam->bottom); } if (pixmap != 0) { // Rect * dam = can->getDamage(); // debugfile("paint Damage area is l: %d r: %d t: %d b: %d\n", dam->left, dam->right, dam->top, dam->bottom); // Blast the damaged region from the buffer to the window. #if carbon SetGWorld(GetWindowPort(theMacWindow_), GetMainDevice()); CopyBits( GetPortBitMapForCopyBits(buffer_bitmap_), GetPortBitMapForCopyBits(GetWindowPort(theMacWindow_)), can->getDamage(), can->getDamage(), srcCopy, nil ); ValidWindowRect(theMacWindow_, can->getDamage()); #else SetGWorld((CGrafPort*)theMacWindow_, GetMainDevice()); CopyBits( &GrafPtr(buffer_bitmap_)->portBits, &GrafPtr(theMacWindow_)->portBits, can->getDamage(), can->getDamage(), srcCopy, nil ); ValidRect(can->getDamage()); #endif UnlockPixels(pixmap); } SetGWorld(cg, gd); return 0; } // ####################################################################### // ################# WindowRep class // ####################################################################### // ----------------------------------------------------------------------- // constructors and destructors // ----------------------------------------------------------------------- WindowRep::WindowRep(Window* w) { win = w; cursor_ = nil; close_callback_ = nil; // Create the global event used by MACinput() if it hasn't yet // been allocated. if (! input_e) { input_e = new Event; input_er = (input_e) ? input_e->rep() : 0; if (!input_e || !input_er){ printf("allocation failure"); exit(1); } } } WindowRep::~WindowRep() { // When closebox is selected, need to dismiss the Window. And don't want to // cast to a ManagedWindow. Resource::unref_deferred(close_callback_); } // ----------------------------------------------------------------------- // When binding to the MAC-Window, we also bind // this WindowRep to the CanvasRep, so that it can handle things like // invalidation of parts of the window. // // The Window class (and all derived classes) stash their desired window // dimensions into the canvas, so we get our desired size from there. // ----------------------------------------------------------------------- void WindowRep::bind() { Requisition r; // ---- bind to the CanvasRep ---- MACcanvas* c = (MACcanvas*) win->canvas_; c->bind(this); Display* d = getIvWindow()->display(); //setup window sizing for glyph creation win->glyph_->request(r); params_->bounds_->bottom = d->to_pixels(r.y_requirement().natural(), Dimension_Y); params_->bounds_->right = d->to_pixels(r.x_requirement().natural(), Dimension_X); //setup window expansion paramaters shrink_.h = d->to_pixels((r.x_requirement().natural() - r.x_requirement().shrink()), Dimension_X); shrink_.v = d->to_pixels((r.y_requirement().natural() - r.y_requirement().shrink()), Dimension_Y); stretch_.h = d->to_pixels(Math::min((r.x_requirement().natural() + r.x_requirement().stretch()),(float)2000.), Dimension_X); stretch_.v = d->to_pixels(Math::min((r.y_requirement().natural() + r.y_requirement().stretch()), (float)2000.), Dimension_Y); // ---- bind to MS-Window ---- MACwindow::bind(); // ---- initialize for allocation ---- const Requirement& rx = win->shape_.requirement(Dimension_X); const Requirement& ry = win->shape_.requirement(Dimension_Y); Coord xsize = win->canvas_->width(); Coord ysize = win->canvas_->height(); Coord ox = xsize * rx.alignment(); Coord oy = ysize * ry.alignment(); win->allocation_.allot(Dimension_X, Allotment(ox, xsize, ox / xsize)); win->allocation_.allot(Dimension_Y, Allotment(oy, ysize, oy / ysize)); Extension ext; ext.clear(); // ---- tell the glyphs what they have been allocated ---- win->glyph_->allocate(win->canvas_, win->allocation_, ext); } //------------------------------------------------------------------------ // This function is a wrapper for the MACwindow::doGrow function. The // MACwindow function does the actual resizing, but it does not have access // to the InterViews Windows private member. It can therefore not allocate // new space for the Glyph. //------------------------------------------------------------------------ #if carbon void WindowRep::doGrow(EventRef theEvent){ #else void WindowRep::doGrow(EventRecord* theEvent){ #endif MACwindow::doGrow(theEvent); // ---- invalidate stored canvases ---- win->glyph_->undraw(); // ---- initialize for allocation ---- const Requirement& rx = win->shape_.requirement(Dimension_X); const Requirement& ry = win->shape_.requirement(Dimension_Y); Coord xsize = win->canvas_->width(); Coord ysize = win->canvas_->height(); Coord ox = xsize * rx.alignment(); Coord oy = ysize * ry.alignment(); win->allocation_.allot(Dimension_X, Allotment(ox, xsize, ox / xsize)); win->allocation_.allot(Dimension_Y, Allotment(oy, ysize, oy / ysize)); Extension ext; ext.clear(); // ---- tell the glyphs what they have been allocated ---- win->glyph_->allocate(win->canvas_, win->allocation_, ext); } // ----------------------------------------------------------------------- // process a mouse/keyboard event. A global object is used to decrease the // construction/destruction time since mouse movement will generate a lot // of these! "input_er" is a pointer to the EventRep of the global Event // "input_e". No pointer checks are made as the library will bail out if // the Event and associated EventRep can't be constructed in the first // place. // ----------------------------------------------------------------------- #if carbon long WindowRep::MACinput(EventRef theEvent, int type, int button){ #else long WindowRep::MACinput(EventRecord* theEvent, int type, int button){ #endif Point theMouse; GrafPtr oldPort; // ---- set the EventRecord ---- #if carbon input_er->setEventRef(theEvent); #else input_er->setEventRecord(theEvent); #endif input_er->type_ = type; input_er->win_ = win; input_er->button_ = button; GetPort(&oldPort); setport(); #if carbon theMouse = EventRep::mouse_loc(theEvent); #else theMouse = theEvent->where; #endif GlobalToLocal(&theMouse); input_er->localMouseLocation_ = theMouse; SetPort(oldPort); //printf("Macinput %lx %lx %d %d %d\n", (long)win, (long)win->canvas(), type, theMouse.h, theMouse.v); // ---- go process it ---- EventRep::handleCallback(*input_e); return 0; } // // ####################################################################### // ##################### Window class // ####################################################################### Window::Window(Glyph* g) { rep_ = new WindowRep(this); rep_->request_on_resize_ = false; canvas_ = new MACcanvas; ((MACcanvas*)canvas_)->bind(rep_); glyph_ = g; glyph_->ref(); style_ = nil; focus_in_ = nil; focus_out_ = nil; //rep_->windowClass(WINDOW_CLASSNAME); //rep_->classStyle(CS_HREDRAW | CS_VREDRAW); } Window::Window(WindowRep* w) { rep_ = w; } Window::~Window() { if (bound()) { Window::unbind(); } delete rep_; rep_ = nil; // // An undraw() message must be passed down the glyph hierarchy to // disassociate the canvas with it before deletion of the canvas... and // ultimately the glyphs which might have kept a pointer to the canvas. // if (glyph_) glyph_->undraw(); Resource::unref_deferred(glyph_); delete canvas_; Resource::unref_deferred(style_); Resource::unref_deferred(focus_in_); Resource::unref_deferred(focus_out_); } void Window::repair() { //I am not sure if this is what is wanted ... this needs to be changed? rep_->repair(); } // ----------------------------------------------------------------------- // attribute functions of window // ----------------------------------------------------------------------- void Window::style(Style* s) { Resource::ref(s); Resource::unref(style_); style_ = s; } Style* Window::style() const { return style_; } void Window::display(Display*) { // no such thing under MS-Windows ... HAVEN'T THOUGHT ABOUT ON THE MAC } Display* Window::display() const { Session* s = Session::instance(); if(s){ return s->default_display(); } else { printf("Window::display error\n"); } //Should not be reached return nil; } // ----------------------------------------------------------------------- // cursor functions // ----------------------------------------------------------------------- void Window::cursor(Cursor* c) { WindowRep& w = *rep(); w.cursor_ = c; if (c == nil){ #if carbon SetCursor(*(arrow->rep()->theCursor)); #else SetCursor(&qd.arrow); #endif }else{ if((c->rep()) && (c->rep()->theCursor)){ SetCursor(*(c->rep()->theCursor)); } else { printf("This cursor not implemented\n"); } } } Cursor* Window::cursor() const { return rep_->cursor_; } void Window::push_cursor() { WindowRep& w = *rep(); w.cursor_stack_->prepend(w.cursor_); } void Window::pop_cursor() { WindowRep& w = *rep(); if (w.cursor_stack_->count() > 0) { cursor(w.cursor_stack_->item(0)); w.cursor_stack_->remove(0); } } // ----------------------------------------------------------------------- // window placement functions // ----------------------------------------------------------------------- void Window::place(Coord left, Coord bottom) { WindowRep& w = *rep(); w.placed_ = true; if (w.bound()) { move(left, bottom); } else { Display* d = display(); w.left_ = d->to_pixels(left, Dimension_X); w.bottom_ = d->pheight() - d->to_pixels(bottom, Dimension_Y); } } void Window::pplace(IntCoord pleft, IntCoord pbottom) { WindowRep& w = *rep(); w.placed_ = true; if (w.bound()) { move((Coord) pleft, (Coord) pbottom); } else { w.left_ = pleft; w.bottom_ = display()->pheight() - pbottom; } } // Align the window around the current origin using the given alignment. // As typical with InterViews, the alignment is from 0 to 1. An alignment // of 0 would keep the origin the same, and an alignment of 1 would shift // the origin to the other side. void Window::align(float x, float y) { Coord l = left(); Coord b = bottom(); l = l - (width() * x); b = b - (height() * y); place(l, b); } // Return the x-coordinate of the left side of the window in terms // of InterViews display coordinates. Coord Window::left() const { WindowRep& w = *rep(); Display* d = display(); if (w.bound()) { #if carbon Rect r; GetWindowBounds(w.macWindow(), kWindowStructureRgn, &r); return d->to_coord(r.left, Dimension_X); #else // ---- get the Macintosh screen coordinates ---- GrafPtr oldPort; WindowPtr theWin = w.macWindow(); GetPort(&oldPort); w.setport(); Point lowerLeft; lowerLeft.h = theWin->portRect.left; lowerLeft.v = theWin->portRect.bottom; LocalToGlobal(&lowerLeft); SetPort(oldPort); return d->to_coord(lowerLeft.h, Dimension_X); #endif } else { return d->to_coord(w.left_, Dimension_X); } } // Return the y-coordinate of the bottom side of the window in terms // of InterViews display coordinates. This is opposite the coordinate // system used by Macintosh, and is therefore adjusted. Coord Window::bottom() const { WindowRep& w = *rep(); Display* d = display(); if (w.bound()) { #if carbon Rect r; GetWindowBounds(w.macWindow(), kWindowStructureRgn, &r); return d->height() - d->to_coord(r.bottom, Dimension_Y); #else // ---- get the Macintosh screen coordinates ---- GrafPtr oldPort; WindowPtr theWin = w.macWindow(); GetPort(&oldPort); w.setport(); Point lowerLeft; lowerLeft.h = theWin->portRect.left; lowerLeft.v = theWin->portRect.bottom; LocalToGlobal(&lowerLeft); SetPort(oldPort); return (d->height() - d->to_coord(lowerLeft.v, Dimension_Y)); #endif } else { return d->height() - d->to_coord(w.bottom_, Dimension_Y); }; } // ----------------------------------------------------------------------- // Window dimensions. The canvas is queried to get the dimensions. The // canvas checks the size of the windows portRect and returns a value. // Since there are borders/tile bars, appropriate values are added so that // the returned window size is correct. // ----------------------------------------------------------------------- Coord Window::width() const { #if carbon WindowRep& w = *rep(); Display* d = display(); if (w.bound()) { Rect r; GetWindowBounds(w.macWindow(), kWindowStructureRgn, &r); return d->to_coord(r.right - r.left, Dimension_X); }else{ return 100; } #else if (rep_->params_->id_ == MenuID) return canvas_->width(); return ((canvas_->width()) + 3); #endif } Coord Window::height() const { #if carbon WindowRep& w = *rep(); Display* d = display(); if (w.bound()) { Rect r; GetWindowBounds(w.macWindow(), kWindowStructureRgn, &r); return d->to_coord(r.bottom - r.top, Dimension_Y); }else{ return 100; } #else if (rep_->params_->id_ == MenuID) return canvas_->height(); return ((canvas_->height()) + 17); #endif } // ----------------------------------------------------------------------- // Window mapping functions // // Many operations upon the real window are postponed until a request is // made to map the window to the display. At this point, any attributes // desired of the window have already been set, and we are ready to really // create the window and map it. If the window is already bound to an // macWindow, than we simply map it. // ----------------------------------------------------------------------- void Window::map() { // ---- check to see if we are already mapped ---- if (is_mapped()) return; // ---- check to see if we are bound to a macWindow ---- if (!bound()) { if (style_ == nil) style(new Style(Session::instance()->style())); configure(); default_geometry(); compute_geometry(); set_props(); bind(); String s; if (style_->find_attribute("name", s)) { #if carbon Str255 s1; CopyCStringToPascal(s.string(), s1); SetWTitle(rep()->macWindow(), s1); #else CopyString s1(s); SetWTitle(rep()->macWindow(), C2PStr((char*)s1.string())); #endif } } // This may be needed later in the Mac implementation... #if 0 // ensure top on screen if window small enough Coord above = display()->height()-(bottom() + canvas()->height()); // dont ask me why the above does not work with the // managedwindow height() if (above < 0. && ((bottom() + above) > 0) ) { // DebugMessage("%g %g %g %g\n", bottom(), canvas()->height(),height(), display()->height()-(bottom() + height())); place(left(), bottom() + above); } #endif do_map(); } void Window::unmap() { if (is_mapped()) { WindowRep& w = *rep(); glyph_->undraw(); w.unmap(); } } bool Window::is_mapped() const { WindowRep& w = *rep(); return w.isMapped(); } // ----------------------------------------------------------------------- // Binding functions. // // These functions bind and unbind the InterViews windows with their real // associated windows in the window-system dependant world. // ----------------------------------------------------------------------- void Window::bind() { WindowRep& w = *rep(); w.bind(); } void Window::unbind() { WindowRep& w = *rep(); if (glyph_) glyph_->undraw(); w.unbind(); } bool Window::bound() const { WindowRep& w = *rep(); return w.bound(); } // ----------------------------------------------------------------------- void Window::set_attributes() //this is not implemented in the MS-Windows Version { } /* * Search for a handler for the given event. * For events that have no associated pointer location, return nil. * Otherwise, use pick on the glyph to find a handler. */ Handler* Window::target(const Event& e) const { Hit hit(&e); glyph_->pick(canvas_, allocation_, 0, hit); Handler* h = hit.handler(); return h; } // ----------------------------------------------------------------------- // Window::receive // This function is only called inside MAC native functions under the // current implementation. It is used as a function to communicte with the // Window/Print Manager. // ----------------------------------------------------------------------- bool Window::receive(const Event& e) { //printf("Window::receive not implemented\n"); return false; } // ----------------------------------------------------------------------- // Pointer grabs // // grab_pointer() grabs control of the display pointer and uses the given // cursor when it is outside the window. ungrab_pointer() relases the // control over the pointer and allows it to be used by other windows. // ----------------------------------------------------------------------- void Window::grab_pointer(Cursor* c) const { //The MAC seems to be handling this natively // however a menu may persist after a mouse release and if the next // click is off the application it should disappear. Since there is // no equivalent to SetCapture on mswin or XGrabPointer on X11 // we make use of the application deactivate event in session.cpp // and that will check Event::grabber } void Window::ungrab_pointer() const { //The MAC seems to be handling this natively } void Window::raise() { printf("Window::raise not implemented\n"); } void Window::lower() { printf("Window::lower not implemented\n"); } // Move the window to the position given by the InterViews display // coordinates for the left and bottom. These must be converted to // Macintosh screen coordinates, which are different in the y-axis. void Window::move(Coord left, Coord bottom) { WindowPtr theWin = rep_->macWindow(); Display* d = display(); if(!d) printf("Error finding display in Window::move\n"); #if carbon Rect r; //GetPortBounds(GetWindowPort(theWin), &r); GetWindowBounds(theWin, kWindowStructureRgn, &r); #else Rect r = theWin->portRect; #endif int width = r.right - r.left; int height = r.bottom - r.top; int y = (d->pheight() - d->to_pixels(bottom, Dimension_Y)) - height; int x = d->to_pixels(left, Dimension_X); // ---- move the window ---- //x = (x > 0 ? x : 0); //y = (y > 0 ? y : 0); //MoveWindow(theWin, x, y, true); MoveWindowStructure(theWin, x, y); } void Window::resize() { WindowPtr theWin = rep_->macWindow(); Rect* curr_pos; if (rep_->request_on_resize_) { Box::full_request(true); glyph_->request(shape_); Box::full_request(false); } // ----- determine desired size ---- int width = canvas_->pwidth(); int height = canvas_->pheight(); // ---- resize the window ---- SizeWindow(theWin, width, height, true); //force an update canvas_->damage_all(); } // Protected operation called by map() void Window::configure() { if (style_) rep()->doubleBuffer(style_->value_is_on("double_buffered")); } // Protected operation called by map(). // // Determines the desired geometry by sending the request() protocol // down through the glyph hierarchy. void Window::default_geometry() { if (glyph_ && canvas_) { glyph_->request(shape_); Coord width = shape_.requirement(Dimension_X).natural(); Coord height = shape_.requirement(Dimension_Y).natural(); canvas_->size(width, height); } else { printf("Window::default_geometry not functioning properly\n"); // NOT REACHED } } // Protected operation called by map() void Window::compute_geometry() { } //not implemented by MS-Windows version // protected function called by map() void Window::set_props() //not implemented by MS-Windows version { } // protected function called by map() void Window::do_map() { WindowRep& w = *rep(); w.map(); } // ####################################################################### // THE FOLLOWING WINDOW TYPES HAVE NOT YET BEEN IMPLEMENTED. // ####################################################################### // ####################################################################### // ##################### class ManagedWindow // ####################################################################### ManagedWindow::ManagedWindow(Glyph* g) : Window(g) { mrep_ = new ManagedWindowRep(this); mrep_->wm_delete_ = nil; // not used. see WindowRep::close_callback_; mrep_->group_leader_ = nil; mrep_->transient_for_ = nil; mrep_->icon_ = nil; mrep_->icon_bitmap_ = nil; mrep_->icon_mask_ = nil; } ManagedWindow::~ManagedWindow() { delete mrep_; } // ----------------------------------------------------------------------- // Window::height is now checking the type of mac window. So use that for now. // ----------------------------------------------------------------------- Coord ManagedWindow::width() const { return Window::width(); } Coord ManagedWindow::height() const { return Window::height(); } // ----------------------------------------------------------------------- // Handle window events. // ----------------------------------------------------------------------- ManagedWindow* ManagedWindow::icon() const { return nil; } Bitmap* ManagedWindow::icon_bitmap() const { return nil; } Bitmap* ManagedWindow::icon_mask() const { return nil; } void ManagedWindow::icon(ManagedWindow* i) { } void ManagedWindow::icon_bitmap(Bitmap* b) { } void ManagedWindow::icon_mask(Bitmap* b) { } void ManagedWindow::iconify() { } void ManagedWindow::deiconify() { } void ManagedWindow::resize() { } // ----------------------------------------------------------------------- // Install "focus in" and "focus out" handlers. Activation of these // handlers is through Window::receive(). // ----------------------------------------------------------------------- void ManagedWindow::focus_event(Handler* in, Handler* out) { } void ManagedWindow::wm_delete(Handler* h) { Resource::ref(h); Resource::unref(rep_->close_callback_); rep_->close_callback_ = h; } void ManagedWindow::set_props() { } // ---------------------------------------------------------------------- // The X-Windows function XParseGeometry() appears at the end of this // file and is used to parse the geometry specifications. // ---------------------------------------------------------------------- const int NoValue = 0; const int XValue = 1; const int YValue = 2; const int WidthValue = 4; const int HeightValue = 8; const int XNegative = 16; const int YNegative = 32; int XParseGeometry (const char*, int*, int*, unsigned int*, unsigned int*); void ManagedWindow::compute_geometry() { } // ####################################################################### // ############### class ManagedWindowRep // ####################################################################### ManagedWindowRep::ManagedWindowRep(ManagedWindow* w) { win = w; } ManagedWindowRep::~ManagedWindowRep() { } // ----------------------------------------------------------------------- // MS-Windows sends this message to determine how it can resize the window, // so we let it know based upon the information from the last request() // query of the glyph hierarchy. // ----------------------------------------------------------------------- // ####################################################################### // ################### class ApplicationWindow // ####################################################################### ApplicationWindow::ApplicationWindow(Glyph* g) : ManagedWindow(g) { } ApplicationWindow::~ApplicationWindow() { } void ApplicationWindow::compute_geometry() { } void ApplicationWindow::set_props() { } // ####################################################################### // ############### class TopLevelWindow // ####################################################################### TopLevelWindow::TopLevelWindow(Glyph* g) : ManagedWindow(g) { } TopLevelWindow::~TopLevelWindow() { } void TopLevelWindow::group_leader(Window* primary) { } Window* TopLevelWindow::group_leader() const { return nil; } void TopLevelWindow::set_props() { ManagedWindow::set_props(); } // ####################################################################### // ############### class TransientWindow // ####################################################################### TransientWindow::TransientWindow(Glyph* g) : TopLevelWindow(g) { } TransientWindow::~TransientWindow() { } void TransientWindow::transient_for(Window* primary) { } Window* TransientWindow::transient_for() const { return ManagedWindow::rep()->transient_for_; } /* * Don't do the normal geometry property lookup, etc. for transients. */ void TransientWindow::configure() { Window::configure(); } void TransientWindow::set_attributes() { Style& s = *style(); s.alias("TransientWindow"); TopLevelWindow::set_attributes(); } // ####################################################################### // ################### class PopupWindow // ####################################################################### PopupWindow::PopupWindow(Glyph* g) : Window(g) { #if carbon rep_->params_->wclass_ = kPlainWindowClass; rep_->params_->id_ = 0; #else rep_->params_->id_ = MenuID; #endif } PopupWindow::~PopupWindow() { } void PopupWindow::set_attributes() { } neuron-7.6.3/src/lib/IV-Win/000077500000000000000000000000001340731477100154525ustar00rootroot00000000000000neuron-7.6.3/src/lib/IV-Win/bitmap.cpp000066400000000000000000000251351340731477100174400ustar00rootroot00000000000000#include <../../config.h> /* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ========================================================================= // // // // MS-Windows implementation of the InterViews bitmap class. // // The windows data structure BITMAP is used until the bitmap is needed // for actual rendering in the canvas, at which time a temporary GDI object // is created. Operations on this bitmap are therefore very light-weight. // // // ======================================================================== #include #include #include #include #include #include #include #include Bitmap::Bitmap() { rep_ = nil; } // copy constructor Bitmap::Bitmap(const Bitmap& bm) { rep_ = (bm.rep_) ? new BitmapRep(*bm.rep_) : nil; } // ----------------------------------------------------------------------- // Create a named bitmap. In the Windows world, this means a resource // based bitmap. The name of the bitmap is expected to match a name in // the resource file, or the number of the bitmap (ie "#123"). A null // pointer is returned if the bitmap can't be found. This interface is // the most natural, not favoring a particular windowing system because // the bitmap is implimented in terms of the native window system. // ----------------------------------------------------------------------- Bitmap* Bitmap::open(const char* name) { // ---- allocate the Bitmap instance ---- Bitmap* bm = new Bitmap; BitmapRep* b = new BitmapRep; if (!bm || !b) return (Bitmap*) 0; bm->rep_ = b; // ----- try to load the bitmap ---- if (b->Load(name) == false) { // ---- failed to load ---- delete bm; return (Bitmap*) 0; } return bm; } // ----------------------------------------------------------------------- // This constructor takes bitmap data from "compile-time" which in the X11 // world was probably from an XBM file. A difference from X11 is that // Windows expects the data to be aligned to 16-bit boundries for each scan // line. Because of the X11 heritage, the data passed is 8-bit aligned. // Also, the data in the X11 world is stored with a mapping of left to right // as LSB to MSB per byte, which is oposite from MS-Windows which stores // left to right as MSB to LSB. Another difference is that a black bit is // a one in X11 and a zero in Windows. The interface for this constructor // is the X11 format data, and conversion is performed into the Windows // format. This is to keep compatibility with X11 software directly. If // Windows native bitmaps are desired... the name based constructor // should be used. // ----------------------------------------------------------------------- Bitmap::Bitmap( const void* data, // bitmap data unsigned int w, // width of bitmap unsigned int h, // height of bitmap int x0, // x-coord of hotspot int y0) // y-coord of hotspot { BitmapRep* b = new BitmapRep(data, w, h, x0, y0); rep_ = b; } Bitmap::~Bitmap() { delete rep_; } Coord Bitmap::width() const { return rep()->width_; } Coord Bitmap::height() const { return rep()->height_; } unsigned int Bitmap::pwidth() const { return rep()->pwidth(); } unsigned int Bitmap::pheight() const { return rep()->pheight(); } Coord Bitmap::left_bearing() const { return -rep()->left_; } Coord Bitmap::right_bearing() const { return rep()->right_; } Coord Bitmap::ascent() const { return rep()->top_; } Coord Bitmap::descent() const { return -rep()->bottom_; } // --------------------------------------------------------------------- // Bit manipulation functions... not bounds checked for efficiency. // --------------------------------------------------------------------- void Bitmap::poke(bool set, int x, int y) { BitmapRep* b = rep(); b->poke(set, x, y); } bool Bitmap::peek(int x, int y) const { BitmapRep* b = rep(); return b->peek(x,y); } // --------------------------------------------------------------------- // This function has absolutely no meaning in the MS-Windows // implimentation. I don't think it even has a reason to exist, and // should be removed from the interface!! // --------------------------------------------------------------------- void Bitmap::flush() const { } // ################################################################## // ################# class BitmapRep // ################################################################## BitmapRep::BitmapRep() { bm_.bmBits = nil; hot_x_ = 0; hot_y_ = 0; } BitmapRep::BitmapRep(const BitmapRep& b) { left_ = b.left_; bottom_ = b.bottom_; right_ = b.right_; top_ = b.top_; width_ = b.width_; height_ = b.height_; hot_x_ = b.hot_x_; hot_y_ = b.hot_y_; // ---- copy logical bitmap representation ---- bm_ = b.bm_; unsigned int len = b.bm_.bmWidthBytes * b.bm_.bmHeight; bm_.bmBits = new char[len]; Memory::copy( b.bm_.bmBits, bm_.bmBits, len); } static unsigned char FlipBits(unsigned char before) { unsigned char after = 0; int i; unsigned char mask; for (i=0; i<8; i++) { mask = 1 << i; if (before & mask) after |= 1 << (7-i); } return after; } BitmapRep::BitmapRep( const void* data, // bitmap data unsigned int w, // width of bitmap unsigned int h, // height of bitmap int x0, // x-coord of hotspot int y0) // y-coord of hotspot { hot_x_ = x0; hot_y_ = y0; // ---- fill in BITMAP structure ---- bm_.bmType = 0; bm_.bmWidth = w; bm_.bmHeight = h; bm_.bmPlanes = 1; bm_.bmBitsPixel = 1; bm_.bmWidthBytes = (w / 16) * 2; if ((w % 16) != 0) bm_.bmWidthBytes += 2; bm_.bmBits = new char[(bm_.bmWidthBytes) * h]; // ---- initialize the bitmap data ---- char* curr_byte = (char*) bm_.bmBits; // current byte of scan line unsigned int scan_line; // current scan line index int i; // index into current line if (data != nil) { // ---- initialize from data ---- char* copy_data = (char*) data; // current byte being copied int scanBytes = (bm_.bmWidth / 8) + ((bm_.bmWidth % 8) ? 1 : 0); for (scan_line = 0; scan_line < h; scan_line++) { for (i = 0; i < bm_.bmWidthBytes; i++) { if (i < scanBytes) { *(curr_byte++) = ~ FlipBits(*(copy_data++)); } else { *(curr_byte++) = char(0xFF); } } } } else { // ---- create an empty bitmap ---- for (scan_line = 0; scan_line < h; scan_line++) { for (i = 0; i < bm_.bmWidthBytes; i++) { *(curr_byte++) = char(0xFF); } } } // ---- fill in size fields ----- SyncSize(); } // ----------------------------------------------------------------------- // Load a bitmap from a resource. Since the "Bitmap" class is supposed to // be mono and depends upon it... bad status will be returned if the bitmap // is in fact color! // ----------------------------------------------------------------------- bool BitmapRep::Load(const char* name) { HINSTANCE hinst = theApp.hinst; HBITMAP hbmp; // ----- try to load the bitmap ---- if ((hbmp = LoadBitmap(hinst, name)) == NULL) { // ---- failed to load ---- return false; } // ---- load the bitmap into the BITMAP structure ---- GetObject(hbmp, sizeof(BITMAP), &bm_); if ((bm_.bmPlanes != 1) || (bm_.bmBitsPixel != 1)) { // ---- bitmap is color ---- DeleteObject(hbmp); return false; } // ---- fetch bitmap data ---- int bm_size = bm_.bmWidthBytes * bm_.bmHeight; bm_.bmBits = new char[bm_size]; long nfetched = GetBitmapBits(hbmp, bm_size, bm_.bmBits); DeleteObject(hbmp); if (nfetched != 0L) { SyncSize(); return true; } return false; } // ----------------------------------------------------------------------- // Synchronize the size fields with the bitmap size and origin. // NOTE: This later needs to be adjusted to convert to points. // ----------------------------------------------------------------------- void BitmapRep::SyncSize() { Display* dpy = Session::instance()->default_display(); MWassert(dpy); width_ = dpy->to_coord(bm_.bmWidth, Dimension_X); height_ = dpy->to_coord(bm_.bmHeight, Dimension_Y); if (hot_x_ == -1 && hot_y_ == -1) { left_ = 0; right_ = width_; bottom_ = 0; top_ = height_; } else { left_ = - dpy->to_coord(hot_x_, Dimension_X); right_ = width_ - dpy->to_coord(hot_x_, Dimension_X); bottom_ = dpy->to_coord(hot_y_, Dimension_Y) - height_; top_ = dpy->to_coord(hot_y_, Dimension_Y); } } BitmapRep::~BitmapRep() { if (bm_.bmBits != nil) delete [] (char*)bm_.bmBits; } // ----------------------------------------------------------------------- // Determine if the bit at the given coordinate is set or not. For // efficiency the coordinates are not checked, and are presumed to have // been checked by the client of this function. // ----------------------------------------------------------------------- bool BitmapRep::peek(int x, int y) const { int offset = (y * bm_.bmWidthBytes) + (x / 8); unsigned char* bits = (unsigned char*) bm_.bmBits; unsigned char data = bits[offset]; unsigned char mask = 0x80 >> (x % 8); return (data & mask); } // ----------------------------------------------------------------------- // Set or clear the bit at the given coordinate. For efficiency, the // coordinates are not checked, and are presumed to have been checked by // the client of this function. // ----------------------------------------------------------------------- void BitmapRep::poke( bool set, // set or clear? int x, // x-coordinate int y) // y-coordinate { int offset = (y * bm_.bmWidthBytes) + (x / 8); unsigned char mask = 0x80 >> (x % 8); unsigned char* bits = (unsigned char*) bm_.bmBits; if (set) { // ---- set the bit ---- bits[offset] |= mask; } else { // ---- clear the bit ---- bits[offset] &= ~mask; } } neuron-7.6.3/src/lib/IV-Win/brush.cpp000077500000000000000000000120241340731477100173030ustar00rootroot00000000000000#include <../../config.h> /* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ======================================================================= // // // // // ======================================================================== /* * THIS FILE CONTAINS PORTIONS OF THE InterViews 3.1 DISTRIBUTION THAT // This media contains programs and data which are proprietary // to Tim Prinzing. // // These contents are provided under a Tim Prinzing software source // license, which prohibits their unauthorized resale or distribution // outside of the buyer's organization. * * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include // ----------------------------------------------------------------------- // constructors and destructors // ----------------------------------------------------------------------- Brush::Brush(Coord w) { init(nil, 0, w); } Brush::Brush( const int* p, // pattern dash/space pixel counts int c, // number of elements in the pattern array Coord w) // width of the brush { init(p, c, w); } Brush::Brush( int pat, // 16-bit specification of dash/space pattern Coord w) // width of the brush { int dash[16]; int count; calc_dashes(pat, dash, count); init(dash, count, w); } Brush::~Brush() { BrushRep* r = rep_; delete r; } void Brush::calc_dashes(int pat, int* dash, int& count) { unsigned int p = pat & 0xffff; if (p == 0 || p == 0xffff) { count = 0; } else { const unsigned int MSB = 1 << 15; while ((p & MSB) == 0) { p <<= 1; } if (p == 0x5555 || p == 0xaaaa) { dash[0] = 1; dash[1] = 3; count = 2; } else if (p == 0xaaaa) { dash[0] = 1; dash[1] = 1; count = 2; } else if (p == 0xcccc) { dash[0] = 2; dash[1] = 2; count = 2; } else if (p == 0xeeee) { dash[0] = 3; dash[1] = 1; count = 2; } else { unsigned int m = MSB; int index = 0; while (m != 0) { /* count the consecutive one bits */ int length = 0; while (m != 0 && (p & m) != 0) { ++length; m >>= 1; } dash[index++] = length; /* count the consecutive zero bits */ length = 0; while (m != 0 && (p & m) == 0) { ++length; m >>= 1; } if (length > 0) { dash[index++] = length; } } count = index; } } } void Brush::init(const int* pattern, int count, Coord w) { rep_ = new BrushRep; // ---- fill in the values for solid brush ---- rep_->penWidth = w; rep_->dashCount = count; if (count > 0) { rep_->dashList = new DWORD[count]; for (int i = 0; i < count; ++i) { rep_->dashList[i] = pattern[i]; } } else { rep_->dashList = nil; } } BrushRep* Brush::rep(Display*) const { return rep_; } Coord Brush::width() const { return rep_->penWidth; } int Brush::dash_count() const { return rep_->dashCount; } int Brush::dash_list(int i) const { return int(rep_->dashList[i]); } neuron-7.6.3/src/lib/IV-Win/canvas.cpp000066400000000000000000000464711340731477100174450ustar00rootroot00000000000000#include <../../config.h> /* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ========================================================================= // // // // MS-Windows dependent Canvas representation. This canvas type renders // into an MS-Windows window. Because it is largely GDI based, most of the // CanvasRep can be reused for printing which also uses the GDI interface. // // True-Type fonts are used to provide scaling and rotation capabilies, // which greatly simplifies (and increases performance of) the font scale // and rotate capabilies of InterViews. This class is therefore dependant // upon MS-Windows 3.1 or later since that is the version that introduced // True-Type fonts. // // // NOTE: // The implementation is now divided into a WIN32s/WIN16 implementation and // a WIN32 implementation. Since using the NT paths (which aren't supported // in Win16 or Win32s) allows better buffering accross the rpc interface, // it is used on NT systems to provide better performance. // // // ======================================================================== /* * THIS FILE CONTAINS PORTIONS OF THE InterViews 3.1 DISTRIBUTION THAT * CONTAINED THE FOLLOWING COPYRIGHT MESSAGE: * * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ // ---- InterViews includes ----- #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // ---- libc includes ---- #include #include #include #include //#include "/nrn/src/mswin/winio/debug.h" #ifdef DEBUG #include #endif // ---- templates used ---- declarePtrList(MWtransformPtrList,Transformer) implementPtrList(MWtransformPtrList,Transformer) declareList(MWclipList,HRGN) implementList(MWclipList,HRGN) // ######################################################## // ############ class Canvas // ######################################################## Canvas::Canvas() { } Canvas::~Canvas() { } // ------------------------------------------------------------------------- // These functions are defined to do nothing as a convenience to subclasses // that are not windowed and don't care about these. // ------------------------------------------------------------------------- void Canvas::front_buffer() { } void Canvas::back_buffer() { } Window* Canvas::window() const { return nil; } // ---------------------------------------------------------------------- // utility functions // ---------------------------------------------------------------------- static void rect_path( Canvas* c, Coord l, Coord b, Coord r, Coord t) { c->new_path(); c->move_to(l, b); c->line_to(l, t); c->line_to(r, t); c->line_to(r, b); c->close_path(); } // ---------------------------------------------------------------------- // convenience functions that form a typical path and do an operation // ---------------------------------------------------------------------- void Canvas::line( Coord x1, Coord y1, Coord x2, Coord y2, const Color* c, const Brush* b) { new_path(); move_to(x1, y1); line_to(x2, y2); stroke(c, b); } void Canvas::rect( Coord l, Coord b, Coord r, Coord t, const Color* c, const Brush* br) { rect_path(this, l, b, r, t); stroke(c, br); } void Canvas::fill_rect(Coord l, Coord b, Coord r, Coord t, const Color* c) { rect_path(this, l, b, r, t); fill(c); } void Canvas::clip_rect(Coord l, Coord b, Coord r, Coord t) { rect_path(this, l, b, r, t); clip(); } Coord Canvas::to_pixels_coord(Coord p, DimensionName d) const { return to_coord(to_pixels(p, d), d); } // -------------------------------------------------------------------------- // The following are convenience functions for making ellipse figures. The // function ellipse_path() creates a ellipse path in the canvas that can // be used to stroke, fill, clip, etc. // -------------------------------------------------------------------------- // multipliers for establishing bezier points static float p0 = 1.00000000; static float p1 = 0.89657547; // cos 30 * sqrt(1 + tan 15 * tan 15) static float p2 = 0.70710678; // cos 45 static float p3 = 0.51763809; // cos 60 * sqrt(1 + tan 15 * tan 15) static float p4 = 0.26794919; // tan 15 void Canvas::ellipse_path( Coord x, // x coordinate of ellipse center Coord y, // y coordinate of ellipse center Coord rx, // radius in x dimension Coord ry) // radius in y dimension { float px0 = p0 * rx, py0 = p0 * ry; float px1 = p1 * rx, py1 = p1 * ry; float px2 = p2 * rx, py2 = p2 * ry; float px3 = p3 * rx, py3 = p3 * ry; float px4 = p4 * rx, py4 = p4 * ry; new_path(); move_to(x + rx, y); curve_to(x + px2, y + py2, x + px0, y + py4, x + px1, y + py3); curve_to(x, y + ry, x + px3, y + py1, x + px4, y + py0); curve_to(x - px2, y + py2, x - px4, y + py0, x - px3, y + py1); curve_to(x - rx, y, x - px1, y + py3, x - px0, y + py4); curve_to(x - px2, y - py2, x - px0, y - py4, x - px1, y - py3); curve_to(x, y - ry, x - px3, y - py1, x - px4, y - py0); curve_to(x + px2, y - py2, x + px4, y - py0, x + px3, y - py1); curve_to(x + rx, y, x + px1, y - py3, x + px0, y - py4); } // ############################################################## // ################## // ################## class MWcanvas // ################## // ############################################################## // ----------------------------------------------------------------------- // constructors/destructors // ----------------------------------------------------------------------- MWcanvas::MWcanvas() : damageArea(0.0, 0.0, 0.0, 0.0) { win_ = nil; // ---- initialize transformation stack ----- transformers_ = new MWtransformPtrList; Transformer* identity = new Transformer; transformers_->append(identity); transformed_ = false; // ---- initialize the clipping stack ---- clippers_ = new MWclipList; clipping_ = CreateRectRgn(0, 0, 0, 0); // hines thinks this is bug when one wants to recover resources on exit // clippers_->append(clipping_); dpy = Session::instance()->default_display(); MWassert(dpy); } MWcanvas::~MWcanvas() { // ---- free up tranformation stack ---- for (ListItr(MWtransformPtrList) i(*transformers_); i.more(); i.next()) { Transformer* t = i.cur(); delete t; } delete transformers_; DeleteObject(clipping_); for (long j = clippers_->count()-1; j >= 0; --j) { DeleteObject(clippers_->item(j)); } delete clippers_; } Window* MWcanvas::window() const { return win_->ivWindowOf(); } PixelCoord MWcanvas::to_pixels(Coord val, DimensionName d) const { return dpy->to_pixels(val, d); } Coord MWcanvas::to_coord(PixelCoord val, DimensionName d) const { return dpy->to_coord(val, d); } #include static int s_nTime = -1, s_nTotalTime; // ----------------------------------------------------------------------- // beginPaint() initializes for the begin of paint sequence... the display // context is now valid. Note that this isn't necessarily a result of the // WM_PAINT message! endPaint() is the end of paint sequence... the // display context is going invalid. There should be no rendering outside // of these calls. // ----------------------------------------------------------------------- void dpy_setmapmode(HDC); void MWcanvas::setmapmode(HDC hdc) { dpy_setmapmode(hdc); } void MWcanvas::beginPaint( HDC hdc, // device context to use const RECT& r) // area of update region { drawable_ = hdc; // ---- use TWIPS mapping mode for convenient conversion ---- // MWassert(SetMapMode(hdc, MM_TWIPS)); setmapmode(hdc); POINT pt; pt.y = pheight(); pt.x = pwidth(); MWassert( DPtoLP(hdc, &pt, 1) ); MWassert( SetWindowOrgEx(hdc, 0, - pt.y, NULL) ); // ---- initialize clipping to cover update area ---- SelectClipRgn(hdc, NULL); SetRectRgn(clipping_, r.left,r.top,r.right,r.bottom); SelectClipRgn(hdc, clipping_); // ---- make sure the update area is contained in the damage rect ---- MWcoordRect area( to_coord(r.left, Dimension_X), height() - to_coord(r.bottom, Dimension_Y), to_coord(r.right, Dimension_X), height() - to_coord(r.top, Dimension_Y)); damageArea = damageArea || area; } void MWcanvas::endPaint() { // ---- clear damage ---- damageArea = MWcoordRect(0.0, 0.0, 0.0, 0.0); SelectClipRgn(drawable_, NULL); // ---- flag context as no longer valid ---- drawable_ = nil; } // ---------------------------------------------------------------------- // set the canvas size in terms of points... the pixel size is then // calculated from the DPI of the display. This is normally called as // a result of the geometry negotiations done by the glyph hierarchy. // ---------------------------------------------------------------------- void MWcanvas::size( Coord w, // width of the canvas in points Coord h) // height of the canvas in points { psize( to_pixels(w, Dimension_X), to_pixels(h, Dimension_Y)); } // ---------------------------------------------------------------------- // set the canvas size in terms of pixels... the point size is then // calculated from the DPI of the display. // ---------------------------------------------------------------------- void MWcanvas::psize( PixelCoord w, // physical width in pixels PixelCoord h) // physical height in pixels { pixelSize.x(w); pixelSize.y(h); } // ---------------------------------------------------------------------- // Width and Height information // ---------------------------------------------------------------------- Coord MWcanvas::width() const { return to_coord( pwidth(), Dimension_X ); } Coord MWcanvas::height() const { return to_coord( pheight(), Dimension_Y ); } PixelCoord MWcanvas::pwidth() const { return pixelSize.x(); } PixelCoord MWcanvas::pheight() const { return pixelSize.y(); } // ---------------------------------------------------------------------- // Transformation stack management. The management of the stack is // largely the same between the Win32 and Win16 operation. The main // difference is that the Win32 functionality uses the SetWorldTransform // function available in NT which transforms all the other GDI calls, and // the Win16 functionality tries to transform the data before handing it // to the MS-Windows API. // ---------------------------------------------------------------------- void MWcanvas::push_transform() { MWtransformPtrList& s = * transformers_; int index = s.count() - 1; Transformer* tmp = s.item(index); Transformer* m = new Transformer(*tmp); s.append(m); } void MWcanvas::pop_transform() { MWtransformPtrList& s = * transformers_; int i = s.count() - 1; if (i == 0) { // We pushed the first matrix during initialization, // so we must be underflowing the stack. Should be an exception. return; } Transformer* m = s.item(i); delete m; s.remove(i); transformed_ = ! matrix().identity(); } void MWcanvas::transform(const Transformer& t) { matrix().premultiply(t); transformed_ = ! matrix().identity(); } void MWcanvas::transformer(const Transformer& t) { matrix() = t; transformed_ = ! t.identity(); } const Transformer& MWcanvas::transformer() const { return matrix(); } Transformer& MWcanvas::matrix() const { MWtransformPtrList& s = *transformers_; return *(s.item(s.count() - 1)); } // ---------------------------------------------------------------------- // Clipping stack management // ---------------------------------------------------------------------- void MWcanvas::push_clipping(bool) { HRGN old_clip = clipping_; HRGN new_clip = CreateRectRgn(0, 0, pwidth(), pheight()); CombineRgn(new_clip, old_clip, old_clip, RGN_COPY); clippers_->append(old_clip); clipping_ = new_clip; SelectClipRgn(drawable_, new_clip); } void MWcanvas::pop_clipping() { MWclipList& s = * clippers_; int n = s.count(); if (n == 0) { // stack underflow--should raise exception return; } HRGN clip = clipping_; DeleteObject(clip); clip = s.item(n - 1); s.remove(n - 1); clipping_ = clip; SelectClipRgn(drawable_, clip); } // ---------------------------------------------------------------------- // Double buffer management // ---------------------------------------------------------------------- void MWcanvas::front_buffer() { if (win_) win_->frontBuffer(); } void MWcanvas::back_buffer() { if (win_) win_->backBuffer(); } // ----------------------------------------------------------------------- // Canvas damaging interface. MS-Windows has a window damage API, so it // is used to manage the damage. // // Damage coordinates are always absolute with respect to the canvas, // so they are not transformed. The canvas coordinate system has the // origin in the lower left, but the MS-Windows coordinate system has // the origin at the upper left. // ----------------------------------------------------------------------- void MWcanvas::damage(const Extension& ext) { damage(ext.left(), ext.bottom(), ext.right(), ext.top()); } void MWcanvas::damage(Coord left, Coord bottom, Coord right, Coord top) { MWcoordRect area(left, bottom, right, top); if (damageArea.origin() != damageArea.corner()) damageArea = damageArea || area; else damageArea = area; // ---- if we are bound to a window.. invalidate it's area ---- if (win_) { // ---- convert to device coordinates ---- RECT wr; wr.left = to_pixels(area.left(), Dimension_X); wr.right = to_pixels(area.right(), Dimension_X); wr.top = pixelSize.y() - to_pixels(area.top(), Dimension_Y); wr.bottom = pixelSize.y() - to_pixels(area.bottom(), Dimension_Y); // ---- invalidate ---- InvalidateRect(win_->msWindow(), &wr, TRUE); #ifdef DEBUG printf("damage l:%d r:%d t:%d b:%d\n", wr.left, wr.right, wr.top, wr.bottom); #endif } } bool MWcanvas::damaged(const Extension& ext) const { return damaged(ext.left(), ext.bottom(), ext.right(), ext.top()); } bool MWcanvas::damaged( Coord left, Coord bottom, Coord right, Coord top) const { MWcoordRect area(left, bottom, right, top); return damageArea.intersects(area); } void MWcanvas::damage_area(Extension& ext) { ext.set_xy(nil, damageArea.left(), damageArea.bottom(), damageArea.right(), damageArea.top()); } void MWcanvas::damage_all() { damageArea.origin(MWcoordPoint(0,0)); damageArea.corner(MWcoordPoint(width(), height())); if (win_) { InvalidateRect(win_->msWindow(), NULL, TRUE); } } bool MWcanvas::any_damage() const { return (damageArea.origin() != damageArea.corner()); } void MWcanvas::restrict_damage(const Extension& ext) { restrict_damage(ext.left(), ext.bottom(), ext.right(), ext.top()); } void MWcanvas::restrict_damage( Coord left, Coord bottom, Coord right, Coord top) { MWcoordRect area(left, bottom, right, top); damageArea = area; if (win_) { // ---- convert the area to device coordinates ---- RECT wr; wr.left = to_pixels(area.left(), Dimension_X); wr.right = to_pixels(area.right(), Dimension_X); wr.top = pixelSize.y() - to_pixels(area.top(), Dimension_Y); wr.bottom = pixelSize.y() - to_pixels(area.bottom(), Dimension_Y); ValidateRect(win_->msWindow(), 0); InvalidateRect(win_->msWindow(), &wr, TRUE); } } // // Force a portion of the canvas to be redrawn. This is typically caused // by an X expose event. If there is no damage and we have a buffer // with a copy of the canvas, then we can just copy it to the draw buffer. // Otherwise, we just damage the area. // void MWcanvas::redraw(Coord left, Coord bottom, Coord right, Coord top) { // At the moment, there is no memory HGC holding a copy, so we // simply damage the canvas. damage(left, bottom, right, top); } void MWcanvas::repair() { HWND hwnd = win_->msWindow(); ValidateRect(hwnd, NULL); } // -------------------------------------------------------------------------- // This function fills the current path with a stenciled pattern // in the given color. This function is basically used to simulate // the alpha blending of color which is not directly supported by // the GDI interface (ie PatBlt doesn't allow raster operations that // specify source as part of the operation... so no stencil). Since // the regions stenciled are typically not that large, this shouldn't // be too big of a shortcoming... it's too bad though because some // smart framebuffers can do this in hardware wicked-fast :-) // -------------------------------------------------------------------------- void MWcanvas::stencilFill(const Bitmap* b, const Color* c) { // ---- clip to the current path (ie area to be filled) ---- push_clipping(); clip(); // ---- determine the clipping bounds (in Coord) ---- RECT r; MWassert( GetClipBox(drawable_, &r) != ERROR ); Coord left(float(r.left) / float(20)); Coord right(float(r.right) / float(20)); Coord top(float(r.top) / float(20)); Coord bottom(float(r.bottom) / float(20)); // ---- lay down some stencil ---- for (Coord x = left; x < right; x += b->width()) { for (Coord y = bottom; y < top; y += b->height()) { stencil(b, c, x, y); } } // ---- restore ---- pop_clipping(); } neuron-7.6.3/src/lib/IV-Win/canvas16.cpp000066400000000000000000000600441340731477100176040ustar00rootroot00000000000000#include <../../config.h> /* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ========================================================================= // // // // MS-Windows implementation of the InterViews Canvas class using only // those features of the MS-Windows SDK that are available in Win16 and // Win32s. // // // ======================================================================== /* * THIS FILE CONTAINS PORTIONS OF THE InterViews 3.1 DISTRIBUTION THAT * CONTAINED THE FOLLOWING COPYRIGHT: * * * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef DEBUG #include #endif #undef Polygon const int TEXT_BUFFER_LEN = 80; // max buffered text length PathRenderInfo MWcanvas16::path_; // // converts a Coordinate to TWIPS, which is what is expected for most // of the Windows operations (ie those using logical coordainates). // inline int COORD2TWIPS(Coord c) { return int( c * 20.0 + ((c > 0) ? 0.5 : -0.5)); } // ----------------------------------------------------------------------- // constructors/destructors // ----------------------------------------------------------------------- MWcanvas16::MWcanvas16() { // ---- initialize the path information ---- PathRenderInfo* p = &MWcanvas16::path_; if (p->point_ == nil) { p->point_ = new POINT[10]; p->cur_point_ = p->point_; p->end_point_ = p->point_ + 10; } // ---- set pen template to a solid thin black line ---- pen_stats_.lopnStyle = PS_SOLID; pen_stats_.lopnWidth.x = 0; pen_stats_.lopnWidth.y = 0; // to avoid UMR with purify pen_stats_.lopnColor = RGB(0,0,0); // ---- set brush to a solid white ---- brush_stats_.lbStyle = BS_SOLID; brush_stats_.lbColor = RGB(255,255,255); brush_stats_.lbHatch = 0; // to avoid UMR with purify // ---- initially we have no logical attributes ---- lg_color_ = nil; lg_brush_ = nil; lg_font_ = nil; // ---- initialize the text buffer ---- text_buff_ = new char[TEXT_BUFFER_LEN]; text_ptr_ = text_buff_; text_width_ = 0; text_x0_ = 0; text_y0_ = 0; text_x_ptr_ = 0; text_y_ptr_ = 0; } MWcanvas16::~MWcanvas16() { delete text_buff_; } // ----------------------------------------------------------------------- // Initialize for begin of paint sequence... the display context is now // valid. Note that this isn't necessarily a result of the WM_PAINT // message! // ----------------------------------------------------------------------- void MWcanvas16::beginPaint( HDC hdc, // device context to use const RECT& r) // area of update region { MWcanvas::beginPaint(hdc, r); // ---- establish default pen and brush ---- pen_ = CreatePenIndirect(&pen_stats_); old_pen_ = (HPEN) SelectObject(drawable_, pen_); brush_ = CreateBrushIndirect(&brush_stats_); old_brush_ = (HBRUSH) SelectObject(drawable_, brush_); } void MWcanvas16::endPaint() { // ---- finish any buffered operations ---- flush(); // ---- release GDI objects ---- SelectObject(drawable_, old_pen_); DeleteObject(pen_); pen_ = nil; SelectObject(drawable_, old_brush_); DeleteObject(brush_); brush_ = nil; MWcanvas::endPaint(); } // ---------------------------------------------------------------------- // utility functions // ---------------------------------------------------------------------- static bool rectangular( int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3) { return ( (x0 == x1 && y1 == y2 && x2 == x3 && y3 == y0) || (x0 == x3 && y3 == y2 && x2 == x1 && y1 == y0) ); } static bool xrect(const POINT* p, unsigned int n) { return ( n == 5 && p[0].x == p[4].x && p[0].y == p[4].y && rectangular( p[0].x, p[0].y, p[1].x, p[1].y, p[2].x, p[2].y, p[3].x, p[3].y ) ); } static const float smoothness = 10.0; static bool straight( const Transformer& tx, Coord x0, Coord y0, Coord x1, Coord y1, Coord x2, Coord y2, Coord x3, Coord y3) { Coord tx0, tx1, tx2, tx3; Coord ty0, ty1, ty2, ty3; tx.transform(x0, y0, tx0, ty0); tx.transform(x1, y1, tx1, ty1); tx.transform(x2, y2, tx2, ty2); tx.transform(x3, y3, tx3, ty3); float f = ( (tx1 + tx2) * (ty0 - ty3) + (ty1 + ty2) * (tx3 - tx0) + 2 * (tx0 * ty3 - ty0 * tx3) ); return (f * f) < smoothness; } static inline Coord mid(Coord a, Coord b) { return (a + b) / 2; } // ---------------------------------------------------------------------- // Transformation // ---------------------------------------------------------------------- void MWcanvas16::push_transform() { flush(); MWcanvas::push_transform(); } void MWcanvas16::pop_transform() { flush(); MWcanvas::pop_transform(); } void MWcanvas16::transform(const Transformer& t) { flush(); MWcanvas::transform(t); } void MWcanvas16::transformer(const Transformer& t) { flush(); MWcanvas::transformer(t); } const Transformer& MWcanvas16::transformer() const { return MWcanvas::transformer(); } // ---------------------------------------------------------------------- // clipping // ---------------------------------------------------------------------- void MWcanvas16::push_clipping(bool) { flush(); MWcanvas::push_clipping(); } void MWcanvas16::pop_clipping() { flush(); MWcanvas::pop_clipping(); } void MWcanvas16::clip() { flush(); // ---- make sure there are multiple points ---- PathRenderInfo* p = &path_; POINT* pt = p->point_; int n = (int) (p->cur_point_ - p->point_); if (n <= 2) { return; } // // The path must be in terms of device units for specification of // clipping... so we transform the path specifications from logical // units (TWIPS) to device units before setting the clipping. // if(drawable_ == nil) // sometimes its null because of event input -- just ignore return; MWassert( LPtoDP(drawable_, pt, n) ); // ---- create a region to represent clipping ---- HRGN clip; if (xrect(pt, n)) { // ---- rectangular clipping area ---- RECT xr; xr.left = Math::min(pt[0].x, pt[2].x); xr.top = Math::min(pt[0].y, pt[2].y); xr.right = Math::max(pt[0].x, pt[2].x); xr.bottom = Math::max(pt[0].y, pt[2].y); clip = CreateRectRgn(xr.left, xr.top, xr.right, xr.bottom ); } else { clip = CreatePolygonRgn(pt, n, WINDING); } #if 1 // ---- merge with existing clipping area ---- HRGN intersect = CreateRectRgn(0,0,0,0); CombineRgn(intersect, clipping_, clip, RGN_AND); DeleteObject(clip); clip = intersect; #endif //DebugMessage // ---- set new clipping area ---- SelectClipRgn(drawable_, clip); DeleteObject(clipping_); clipping_ = clip; #ifdef DEBUG // ---- canvas debug ---- printf("clip "); for (int i = 0; i < n; i++) { printf("[%d,%d] ", pt[i].x, pt[i].y); } printf("\n"); #endif } void MWcanvas16::new_path() { PathRenderInfo* p = &path_; p->curx_ = 0; p->cury_ = 0; POINT* xp = p->point_; xp->x = 0; xp->y = 0; p->cur_point_ = xp; } void MWcanvas16::move_to(Coord x, Coord y) { PathRenderInfo* p = &path_; p->curx_ = x; p->cury_ = y; Coord tx, ty; if (transformed_) { matrix().transform(x, y, tx, ty); } else { tx = x; ty = y; } #if 0 if (tx < -1500. || tx > 1500. || ty < -1500. || ty > 1500.) { p->cur_point_ = p->point_; return; } #endif // -- convert to TWIPS -- POINT* xp = p->point_; xp->x = COORD2TWIPS(tx); xp->y = COORD2TWIPS(ty); p->cur_point_ = xp + 1; } void MWcanvas16::line_to(Coord x, Coord y) { PathRenderInfo* p = &path_; p->curx_ = x; p->cury_ = y; Coord tx, ty; if (transformed_) { matrix().transform(x, y, tx, ty); } else { tx = x; ty = y; } #if 0 if (tx < -1500. || tx > 1500. || ty < -1500. || ty > 1500.) { return; } #endif if (p->cur_point_ == p->end_point_) { int old_size = (int) (p->cur_point_ - p->point_); int new_size = 2 * old_size; POINT* new_path = new POINT[new_size]; for (int i = 0; i < old_size; i++) { new_path[i] = p->point_[i]; } delete p->point_; p->point_ = new_path; p->cur_point_ = p->point_ + old_size; p->end_point_ = p->point_ + new_size; } // -- convert to TWIPS -- POINT* xp = p->cur_point_; xp->x = COORD2TWIPS(tx); xp->y = COORD2TWIPS(ty); p->cur_point_ = xp + 1; } void MWcanvas16::curve_to( Coord x, Coord y, Coord x1, Coord y1, Coord x2, Coord y2) { PathRenderInfo* p = &MWcanvas16::path_; Coord px = p->curx_; Coord py = p->cury_; if (straight(matrix(), px, py, x1, y1, x2, y2, x, y)) { line_to(x, y); } else { Coord xx = mid(x1, x2); Coord yy = mid(y1, y2); Coord x11 = mid(px, x1); Coord y11 = mid(py, y1); Coord x22 = mid(x2, x); Coord y22 = mid(y2, y); Coord x12 = mid(x11, xx); Coord y12 = mid(y11, yy); Coord x21 = mid(xx, x22); Coord y21 = mid(yy, y22); Coord cx = mid(x12, x21); Coord cy = mid(y12, y21); curve_to(cx, cy, x11, y11, x12, y12); curve_to(x, y, x21, y21, x22, y22); } } void MWcanvas16::close_path() { PathRenderInfo* p = &MWcanvas16::path_; POINT* startp = p->point_; POINT* xp = p->cur_point_; xp->x = startp->x; xp->y = startp->y; p->cur_point_ = xp + 1; } void MWcanvas16::stroke(const Color* c, const Brush* b) { PathRenderInfo* p = &MWcanvas16::path_; // --- determine the number of points, and if valid --- int n = (int) (p->cur_point_ - p->point_); if (n < 2) { return; } flush(); color(c); brush(b); // ---- determine the shape, and render it ---- POINT* pt = p->point_; if (n == 2) { // ---- draw a line ---- #ifdef WIN16 MoveTo(drawable_, pt[0].x, pt[0].y); #else MoveToEx(drawable_, pt[0].x, pt[0].y, NULL); #endif LineTo(drawable_, pt[1].x, pt[1].y); } else { // ---- draw a multi-line segment ---- Polyline(drawable_, pt, n); } } void MWcanvas16::fill(const Color* c) { if (c->rep()->stipple) { // ---- stipple some color into the area ---- stencilFill(c->rep()->stipple, c); } else { PathRenderInfo* p = &MWcanvas16::path_; int n = (int) (p->cur_point_ - p->point_); if (n <= 2) { return; } flush(); color(c); HPEN hpen = (HPEN)SelectObject(drawable_, CreatePen(PS_SOLID, 0, lg_color_->rep()->msColor())); POINT* pt = p->point_; if (xrect(pt, n)) { // ---- draw a rectangle ---- int x = Math::min(pt[0].x, pt[2].x); int y = Math::min(pt[0].y, pt[2].y); int x1 = Math::max(pt[0].x, pt[2].x); int y1 = Math::max(pt[0].y, pt[2].y); Rectangle(drawable_, x, y, x1, y1); } else { Polygon(drawable_, pt, n); } DeleteObject(SelectObject(drawable_, hpen)); } #ifdef DEBUG // ---- canvas debug ---- MWassert( LPtoDP(drawable_, pt, n) ); printf("fill "); for (int i = 0; i < n; i++) { BOOL vis = PtVisible(drawable_, pt[i].x, pt[i].y); if (vis) printf("[%d,%d] ", pt[i].x, pt[i].y); else printf("(%d,%d> ", pt[i].x, pt[i].y); } printf("\n"); #endif } // ----------------------------------------------------------------------- // Changes the Color to use when rendering onto the canvas. // ----------------------------------------------------------------------- void MWcanvas16::color(const Color* c) { // ---- render anything that was buffered ---- flush(); // ---- reference new color ---- Resource::ref(c); Resource::unref(lg_color_); lg_color_ = c; // ---- set new pen color ---- pen_stats_.lopnColor = c->rep()->msColor(); pen_ = CreatePenIndirect(&pen_stats_); DeleteObject( SelectObject(drawable_, pen_)); // ---- set new brush color ---- if (c->rep()->stipple) { // THIS NEEDS WORK // // brush_stats_.lbStyle = BS_PATTERN; // brush_stats_.lbHatch = (long) c->rep()->stipple->hbm_; } else { brush_stats_.lbStyle = BS_SOLID; brush_stats_.lbColor = c->rep()->msColor(); } brush_ = CreateBrushIndirect(&brush_stats_); DeleteObject( SelectObject(drawable_, brush_)); // ---- set text color ---- SetTextColor(drawable_, c->rep()->msColor()); // ---- set color operation ---- ColorRep* r = c->rep(); if (r->op == Color::Copy) { SetROP2(drawable_, R2_COPYPEN); } else if (r->op == Color::Xor) { // SetROP2(drawable_, R2_XORPEN); SetROP2(drawable_, 6); // this is insane, but... } else if (r->op == Color::Invisible) { SetROP2(drawable_, R2_NOP); } else { // ----- unrecognized color mode ---- MWassert(0); } } // ----------------------------------------------------------------------- // Changes the brush to use when rendering a path // ----------------------------------------------------------------------- void MWcanvas16::brush(const Brush* b) { if (b != nil && b != lg_brush_) { // ---- reference the new brush ---- Resource::ref((const Resource*) b); Resource::unref((const Resource*) lg_brush_); lg_brush_ = b; // ---- get ready to create a new pen ---- BrushRep& br = * b->rep(nil); pen_stats_.lopnStyle = (br.dashCount) ? PS_DASH : PS_SOLID; pen_stats_.lopnWidth.x = COORD2TWIPS(br.penWidth); // ---- establish the new pen ---- pen_ = CreatePenIndirect(&pen_stats_); DeleteObject( SelectObject(drawable_, pen_)); } } // ----------------------------------------------------------------------- // Changes the font to use when rendering. The actual creation and // selection of the GDI object is delayed until the actual text is to be // rendered, since further scaling and rotation might be desired. // ----------------------------------------------------------------------- void MWcanvas16::font(const Font* f) { if (f != nil && f != lg_font_) { // ---- flush any buffered operations ---- flush(); // ---- register interest in new font, and release old ---- Resource::ref(f); Resource::unref(lg_font_); lg_font_ = f; } } // ----------------------------------------------------------------------- // Render a character onto the canvas. This is a buffered operation that // tries to draw entire words at once. This mode is to provide compati- // bility with the original InterViews. An extended interface will also // be provided that bypasses the buffering for operations less complex // than document type functions, and requiring higher performance out of // the text rendering. // ----------------------------------------------------------------------- void MWcanvas16::character( const Font* f, // font to use long ch, // character to print Coord width, // width of the character const Color* c, // color to use Coord x, // x-coordinate Coord y) // y-coordinate { //return; font(f); color(c); // ---- a space or unprintable marks the end of a word ---- if ((ch == ' ') || (! isprint(ch))) { flush(); return; } // Transform the coordinates before testing for expected position // so that we can work in terms of pixels and deal with slop in // position better. Transformer& m = matrix(); Coord tx = x; Coord ty = y; if (transformed_) { m.transform(tx, ty); // ROTATION SUPPORT TO BE ADDED } int ix = COORD2TWIPS( tx ); int iy = COORD2TWIPS( ty ); // test if this is a different word (ie not in the expected // position. If it is a new word, the old word is flushed // and this character will be treated as the first of the word. // ROTATION SUPPORT TO BE ADDED if ((ix > (text_x_ptr_ + 1)) || (ix < (text_x_ptr_ - 1)) || (iy != text_y_ptr_)) { flush(); } // ---- test if this is the first new character ---- if (text_ptr_ == text_buff_) { // ---- this is the first new character since a flush ---- // Determine the coordinates, size, and rotation. Since // the rotation needs to be specified in the LOGFONT, we need // to extract this information from the transformation matrix. text_x0_ = ix; text_y0_ = iy; text_width_ = 0; text_x_ptr_ = text_x0_; text_y_ptr_ = text_y0_; } // ---- record the new character information ---- text_width_ += COORD2TWIPS( width ); text_x_ptr_ += COORD2TWIPS( width ); text_y_ptr_ = text_y0_; *text_ptr_++ = char(ch & 0xff); } // ----------------------------------------------------------------------- // Flush the text buffer. The text drawing is buffered until something // changes and causes a flush (by calling this function). Nearly all of // the work was previously done by setting up the LOGFONT structure // properly // // Some adjustment is required to cause proper placement in the y // direction. The target position of the text is the text baseline from // the InterViews point of view, and upper left corner from the Windows // point of view. We therefore need to back off the ascent since the two // coordinate systems have the y-axis going in opposite directions. // ----------------------------------------------------------------------- // well, what if we cache the HFONT on the font object itself? lets try it! /* need to come to terms with fact that CreateFontIndirect slows things down to an extent which makes Win32s unusable. This hack allows only one font. */ // static HFONT new_fnt; // void cleanup_new_fnt() { // if (new_fnt) { // DeleteObject(new_fnt); // } // } void MWcanvas16::flush() { // ---- check if there is anything to do ---- int nchars = (int) (text_ptr_ - text_buff_); if ((nchars == 0) || (lg_font_ == nil)) return; // ---- render the text ---- SetBkMode(drawable_, TRANSPARENT); FontRep* fr = lg_font_->rep(nil); MWassert(fr); // the one consequence of caching the font is that it is no longer possible // to transform the angle like this at this point. so we lose rotated text // but gain the ability to use different fonts! // fr->orientation(transformAngle()); // HFONT new_fnt = fr->Create(); // if (!new_fnt) { // new_fnt = fr->Create(); // } HFONT old_fnt = (HFONT) SelectObject(drawable_, fr->HFont()); SetTextAlign(drawable_, TA_LEFT | TA_BASELINE | TA_NOUPDATECP); TextOut(drawable_, text_x0_, text_y0_, text_buff_, nchars); SelectObject(drawable_, old_fnt); // DeleteObject( SelectObject(drawable_, old_fnt)); // ---- reset the buffer ---- text_ptr_ = text_buff_; } // ----------------------------------------------------------------------- // Determine the angle of transformation in terms of tenths-of-a-degree. // The method used is to transform a couple of points, and then measure // the angle of rotation on the sample points. There is probably a better // way to do this, but it works. // ----------------------------------------------------------------------- int MWcanvas16::transformAngle() const { if (! transformed_ ) return 0; Transformer& t = matrix(); float x0 = float(0); float y0 = x0; float y1 = x0; float x1 = float(1); t.transform(x0, y0); t.transform(x1, y1); double dx = x1 - x0; double dy = y1 - y0; double rad = atan2(dy, dx); int tdeg = (int) (rad * double(572.9577951)); if (tdeg < 0) tdeg = 3600 + tdeg; return tdeg; } // ----------------------------------------------------------------------- // Stencil the "set" bits of the bitmap onto the canvas in the given color // at the given origin. The origin is in terms of the point system with // the origin in the lower left, which must be converted to the device // coordinate system which has an origin in the upper left. Further, the // blt coordinates must be adjusted this way as well. // // If the transformation matrix is identity, the bitmap is simply blt'd // using the raster operation discussed in the Petzold V3.0 book on page // 624 which transfers only the black bits. It corresponds to the operation // ((Destination ^ Pattern) & Source) ^ Pattern. If the transformer is not // identity, then the Windows function StretchBlt is used to scale the // bitmap. The default mode of STRETCH_ANDSCANS is appropriate since it // favors the black bits. // // Currently, a rotated bitmap is NOT supported! // ----------------------------------------------------------------------- void MWcanvas16::stencil( const Bitmap* mask, // bitmap to render const Color* c, // color to use Coord x, // x-coordinate Coord y) // y-coordinate { BitmapRep& br = * mask->rep(); HBITMAP hbm = CreateBitmapIndirect((BITMAP*) &(br.bm_)); HDC mem_hdc = CreateCompatibleDC(drawable_); SelectObject(mem_hdc, hbm); // // convert the coordinates to TWIPS for the page space to device space // mapping. // int x0 = COORD2TWIPS( x + mask->left_bearing() ); int y0 = COORD2TWIPS( y - mask->descent() ); int width = COORD2TWIPS( mask->width() ); int height = COORD2TWIPS( mask->height() ); // ---- set the color to use ---- flush(); color(c); // For some reason, text color must be black when stenciling or the // colors of the stencil are affected. SetTextColor(drawable_, RGB(0, 0, 0)); // ---- blt... the destination will be transformed ---- MWassert( StretchBlt(drawable_, x0, y0 + height, width, - height, mem_hdc, 0, 0, br.bm_.bmWidth, br.bm_.bmHeight, 0xB8074AL) ); // ---- cleanup ---- DeleteDC(mem_hdc); DeleteObject(hbm); } // ----------------------------------------------------------------------- // Render an image onto the GDI surface. The image is transformed in // terms of scaling only initially (all that Windows 3.1 supports). // Rotation is initially not supported. // ----------------------------------------------------------------------- void MWcanvas16::image(const Raster* ras, Coord x, Coord y) { // // convert the coordinates to TWIPS for the page space to device space // mapping. // Coord tx, ty, tw, th; if (transformed_) { matrix().transform(x, y, tx, ty); matrix().transform(x+ras->width(), y+ras->height(), tw, th); tw -= tx; th -= ty; } else { tx = x; ty = y; tw = ras->width(); ty = ras->height(); } int x0 = COORD2TWIPS( tx ); int y0 = COORD2TWIPS( ty ); int width = COORD2TWIPS( tw ); int height = COORD2TWIPS( th ); // ---- blt... the destination will be transformed ---- MWassert( StretchBlt(drawable_, x0, y0 + height, width, - height, ras->rep()->deviceContext(), 0, 0, ras->pwidth(), ras->pheight(), SRCCOPY) ); } neuron-7.6.3/src/lib/IV-Win/canvas32.cpp000077500000000000000000000243541340731477100176110ustar00rootroot00000000000000#include <../../config.h> /* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ========================================================================= // // // // MS-Windows implementation of the InterView Canvas class using NT-specific // features. Specifically, this version of the canvas uses the world // transform and paths features available when a device context is placed // into "GM_ADVANCED" mode. // // // ======================================================================== #include #include #include #include #include #include #include #include #include #include #include #include #include #include // // converts a Coordinate to TWIPS, which is what is expected for most // of the Windows operations (ie those using logical coordainates). // inline int COORD2TWIPS(Coord c) { return int( c * 20.0 + ((c > 0) ? 0.5 : -0.5)); } MWcanvas32::MWcanvas32() { pathBracketStarted = false; } MWcanvas32::~MWcanvas32() { } void MWcanvas32::beginPaint( HDC hdc, // device context to use const RECT& r) // area of update region { // // set the "advanced" graphic mode, to use paths and transforms. // MWassert(SetGraphicsMode(hdc, GM_ADVANCED)); MWcanvas::beginPaint(hdc, r); } // ---------------------------------------------------------------------- // Transformation // // Set the world-coordinate transformation matrix to match the new one // we get from the changed stack. // // Note that the "translate" component of the transformation matrix is // in terms of printer points and the page space is in terms of twips, // so we multiply the traslate component by 20 to adjust it to match // the MS-Windows translation. // // ---------------------------------------------------------------------- void MWcanvas32::pop_transform() { // ---- base functionality ---- MWcanvas::pop_transform(); // ---- update MS-Windows matrix ---- XFORM x; matrix().matrix(x.eM11, x.eM12, x.eM21, x.eM22, x.eDx, x.eDy); x.eDx = x.eDx * FLOAT(20.0); x.eDy = x.eDy * FLOAT(20.0); SetWorldTransform(drawable_, &x); } void MWcanvas32::transform(const Transformer& t) { // ---- base functionality ---- MWcanvas::transform(t); // ---- update MS-Windows matrix ---- XFORM x; matrix().matrix(x.eM11, x.eM12, x.eM21, x.eM22, x.eDx, x.eDy); x.eDx = x.eDx * FLOAT(20.0); x.eDy = x.eDy * FLOAT(20.0); SetWorldTransform(drawable_, &x); } void MWcanvas32::transformer(const Transformer& t) { // ---- base functionality ---- MWcanvas::transformer(t); // ---- update MS-Windows matrix ---- XFORM x; matrix().matrix(x.eM11, x.eM12, x.eM21, x.eM22, x.eDx, x.eDy); x.eDx = x.eDx * FLOAT(20.0); x.eDy = x.eDy * FLOAT(20.0); SetWorldTransform(drawable_, &x); } // ---------------------------------------------------------------------- // clipping // ---------------------------------------------------------------------- void MWcanvas32::clip() { // ---- close the path bracket --- MWassert(pathBracketStarted); MWassert(EndPath(drawable_)); pathBracketStarted = false; // ---- set the new clipping ---- HRGN rgn; MWassert(rgn = PathToRegion(drawable_)); MWassert(ExtSelectClipRgn(drawable_, rgn, RGN_AND) != ERROR); // ---- replace the old region ----- DeleteObject(clipping_); clipping_ = rgn; } void MWcanvas32::new_path() { MWassert( BeginPath(drawable_) ); pathBracketStarted = true; } void MWcanvas32::move_to(Coord x, Coord y) { if (! pathBracketStarted ) { new_path(); } int xTwip = int(x * 20.0); int yTwip = int(y * 20.0); MWassert(MoveToEx(drawable_, xTwip, yTwip, NULL)); } void MWcanvas32::line_to(Coord x, Coord y) { int xTwip = int(x * 20.0); int yTwip = int(y * 20.0); MWassert(LineTo(drawable_, xTwip, yTwip)); } void MWcanvas32::curve_to( Coord x, Coord y, Coord x1, Coord y1, Coord x2, Coord y2) { POINT pts[3]; pts[0].x = int( x * 20.0 ); pts[0].y = int( y * 20.0 ); pts[1].x = int( x1 * 20.0 ); pts[1].y = int( y1 * 20.0 ); pts[2].x = int( x2 * 20.0 ); pts[2].y = int( y2 * 20.0 ); MWassert( PolyBezierTo(drawable_, (const POINT*) &pts, 3) ); } void MWcanvas32::close_path() { MWassert( CloseFigure(drawable_) ); } void MWcanvas32::stroke(const Color* color, const Brush* b) { // ---- close the path bracket --- MWassert(pathBracketStarted); MWassert(EndPath(drawable_)); pathBracketStarted = false; // ---- ready pen data ---- BrushRep brep; BrushRep* br; if (b) { br = b->rep(nil); }else{ br = &brep; brep.penWidth = 0; brep.dashList = nil; brep.dashCount = 0; } DWORD styOption = (br->dashList) ? PS_USERSTYLE : PS_SOLID; DWORD style = PS_GEOMETRIC | styOption; LOGBRUSH brushData; brushData.lbStyle = BS_SOLID; brushData.lbColor = color->rep()->msColor(); brushData.lbHatch = NULL; if (color->rep()->op == Color::Xor) { SetROP2(drawable_, R2_XORPEN); } else if (color->rep()->op == Color::Invisible) { SetROP2(drawable_, R2_NOP); } else { SetROP2(drawable_, R2_COPYPEN); } // ---- create the pen, and make it current ---- HPEN pen = ExtCreatePen(style, (DWORD) (br->penWidth * 20.0), &brushData, br->dashCount, br->dashList); HPEN old = (HPEN)SelectObject(drawable_, pen); // ---- stroke the path ---- MWassert( StrokePath(drawable_) ); // --- remove and destroy pen --- SelectObject(drawable_, old); MWassert( DeleteObject(pen) ); } void MWcanvas32::fill(const Color* color) { if (color->rep()->stipple) { // ---- stipple some color into the area ---- stencilFill(color->rep()->stipple, color); } else { // ---- close the path bracket --- MWassert(pathBracketStarted); MWassert(EndPath(drawable_)); pathBracketStarted = false; // ---- create the brush, and make it current ---- HBRUSH brush; HBRUSH old; HBITMAP hbm = NULL; brush = CreateSolidBrush(color->rep()->msColor()); MWassert(brush); old = (HBRUSH)SelectObject(drawable_, brush); // ---- fill the path ---- MWassert( FillPath(drawable_) ); // --- remove and destroy resources --- SelectObject(drawable_, old); MWassert( DeleteObject(brush) ); if (hbm) DeleteObject(hbm); } } // ------------------------------------------------------------------------- // text interface // ------------------------------------------------------------------------- void MWcanvas32::character( const Font* f, // font to use long ch, // character to print Coord width, // width of the character const Color* color, // color to use Coord x, // x-coordinate Coord y) // y-coordinate { char c = (char) ch; SetBkMode(drawable_, TRANSPARENT); SetTextColor(drawable_, color->rep()->msColor()); FontRep* fr = f->rep(nil); MWassert(fr); HFONT new_fnt = fr->Create(); HFONT old_fnt = (HFONT) SelectObject(drawable_, new_fnt); SetTextAlign(drawable_, TA_LEFT | TA_BASELINE | TA_NOUPDATECP); TextOut(drawable_, int(x * Coord(20)), int(y * Coord(20)), &c, 1); DeleteObject( SelectObject(drawable_, old_fnt)); } // ----------------------------------------------------------------------- // Stencil the "set" bits of the bitmap onto the canvas in the given color // at the given origin. // ----------------------------------------------------------------------- void MWcanvas32::stencil( const Bitmap* mask, // bitmap to render const Color* c, // color to use Coord x, // x-coordinate Coord y) // y-coordinate { BitmapRep& br = * mask->rep(); HBITMAP hbm = CreateBitmapIndirect((BITMAP*) &(br.bm_)); HDC mem_hdc = CreateCompatibleDC(drawable_); SelectObject(mem_hdc, hbm); // // convert the coordinates to TWIPS for the page space to device space // mapping. // int x0 = COORD2TWIPS( x + mask->left_bearing() ); int y0 = COORD2TWIPS( y - mask->descent() ); int width = COORD2TWIPS( mask->width() ); int height = COORD2TWIPS( mask->height() ); // ---- set the color to use ---- HBRUSH brush = CreateSolidBrush(c->rep()->msColor()); MWassert(brush); HBRUSH old = (HBRUSH)SelectObject(drawable_, brush); // For some reason, text color must be black when stenciling or the // colors of the stencil are affected. SetTextColor(drawable_, RGB(0, 0, 0)); // ---- blt... the destination will be transformed ---- MWassert( StretchBlt(drawable_, x0, y0 + height, width, - height, mem_hdc, 0, 0, br.bm_.bmWidth, br.bm_.bmHeight, 0xB8074AL) ); // ---- cleanup ---- DeleteDC(mem_hdc); DeleteObject(hbm); SelectObject(drawable_, old); DeleteObject(brush); } // ----------------------------------------------------------------------- // Render an image onto the GDI surface. The image is transformed in // terms of scaling only initially (all that Windows 3.1 supports). // Rotation is initially not supported. // ----------------------------------------------------------------------- void MWcanvas32::image(const Raster* ras, Coord x, Coord y) { // // convert the coordinates to TWIPS for the page space to device space // mapping. // int x0 = int( x * 20.0); int y0 = int( y * 20.0); int width = ras->pwidth() * 20; int height = ras->pheight() * 20; // ---- blt... the destination will be transformed ---- MWassert( StretchBlt(drawable_, x0, y0 + height, width, - height, ras->rep()->deviceContext(), 0, 0, ras->pwidth(), ras->pheight(), SRCCOPY) ); } neuron-7.6.3/src/lib/IV-Win/color.cpp000066400000000000000000001000621340731477100172730ustar00rootroot00000000000000#include <../../config.h> /* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ======================================================================= // // // // MS-Windows implementation of the InterViews Color classes. // // // ======================================================================== #include #include #include #include #include #include #include #include #include #include // ####################################################################### // ################# class MWpalette // ####################################################################### static const int GROW_SIZE = 16; declareTable(MWcolorTable, COLORREF, COLORREF) implementTable(MWcolorTable, COLORREF, COLORREF) unsigned long key_to_hash(COLORREF r) { return (unsigned long) r; } // ----------------------------------------------------------------------- // Constructors/destructor // ----------------------------------------------------------------------- MWpalette::MWpalette() { // ---- lookup table for unique colors ---- table = new MWcolorTable(502); // ---- create a temporary logical palette ---- int allocSize = sizeof(LOGPALETTE) + (GROW_SIZE * sizeof(PALETTEENTRY)); LOGPALETTE* lpal = (LOGPALETTE*) new char[allocSize]; // ---- initialize it ---- lpal->palNumEntries = GROW_SIZE; lpal->palVersion = 0x300; for (int i = 0; i < GROW_SIZE; i++) { lpal->palPalEntry[i].peRed = 0; lpal->palPalEntry[i].peGreen = 0; lpal->palPalEntry[i].peBlue = 0; lpal->palPalEntry[i].peFlags = 0; } // ---- create it ---- palette = CreatePalette(lpal); #if !defined(__MWERKS__) //bug in pro 6. can't delete before calling main? delete []lpal; #endif numEntries = 0; palSize = GROW_SIZE; } MWpalette::MWpalette(LOGPALETTE* lpal) { palette = CreatePalette(lpal); palSize = lpal->palNumEntries; numEntries = palSize; } MWpalette::~MWpalette() { DeleteObject(palette); } // ----------------------------------------------------------------------- // Add an entry to the palette. // ----------------------------------------------------------------------- COLORREF MWpalette::addEntry( int r, int g, int b) { COLORREF color = PALETTERGB( LOBYTE(r), LOBYTE(g), LOBYTE(b)); COLORREF bogus; // ---- see if it's already there ---- if (table->find(bogus, color)) return color; // ---- extend the palette if necessary ---- if (numEntries >= palSize) { palSize += GROW_SIZE; ResizePalette(palette, palSize); } // ---- add the entry to the palette ---- PALETTEENTRY newEntry; newEntry.peRed = LOBYTE(r); newEntry.peGreen = LOBYTE(g); newEntry.peBlue = LOBYTE(b); newEntry.peFlags = 0; SetPaletteEntries(palette, numEntries++, 1, &newEntry); // ---- add to the hash table ---- table->insert(color, color); return color; } bool MWpalette::findEntry(int r, int g, int b, COLORREF& value) { COLORREF color = PALETTERGB( LOBYTE(r), LOBYTE(g), LOBYTE(b)); if (table->find(value, color)) return true; return false; } // ----------------------------------------------------------------------- // Realize the palette into the given device context. This merges the // palette entries into the system palette. The number of entries that // changed in the system palette is returned. // ----------------------------------------------------------------------- int MWpalette::realizeInto( HDC hdc, // device context to realize into BOOL background) // always background? { SelectPalette(hdc, palette, background); return RealizePalette(hdc); } // ####################################################################### // ################# class ColorRep // ####################################################################### // --- name of the colormap file for name lookup ---- static char* COLORMAP_FILE = NULL; // initially, we have a shared palette for all windows of the application. static MWpalette globalPalette; MWpalette* ColorRep::defaultPalette() { return &globalPalette; } // ----------------------------------------------------------------------- // constructors/destructors // ----------------------------------------------------------------------- ColorRep::ColorRep( int r, // red component of color int g, // green component of color int b) // blue component of color { // ---- add to the palette ---- color = globalPalette.addEntry(r, g, b); } ColorRep::~ColorRep() { } // ------------------------------------------------------------------ // translates a color name to the X11 string format of an rgb // specification (ie #??????). The colormap name is basically a // section in the colormap.ini file. // ------------------------------------------------------------------ // oreilly: just put the entire thing in here so installation is easy -- no // dependency on app defaults or other install location files at all static struct { const char* name; const char* value; } cc[] = { {"snow", "#fffafa"}, {"ghost white", "#f8f8ff"}, {"GhostWhite", "#f8f8ff"}, {"white smoke", "#f5f5f5"}, {"WhiteSmoke", "#f5f5f5"}, {"gainsboro", "#dcdcdc"}, {"floral white", "#fffaf0"}, {"FloralWhite", "#fffaf0"}, {"old lace", "#fdf5e6"}, {"OldLace", "#fdf5e6"}, {"linen", "#faf0e6"}, {"antique white", "#faebd7"}, {"AntiqueWhite", "#faebd7"}, {"papaya whip", "#ffefd5"}, {"PapayaWhip", "#ffefd5"}, {"blanched almond", "#ffebcd"}, {"BlanchedAlmond", "#ffebcd"}, {"bisque", "#ffe4c4"}, {"peach puff", "#ffdab9"}, {"PeachPuff", "#ffdab9"}, {"navajo white", "#ffdead"}, {"NavajoWhite", "#ffdead"}, {"moccasin", "#ffe4b5"}, {"cornsilk", "#fff8dc"}, {"ivory", "#fffff0"}, {"lemon chiffon", "#fffacd"}, {"LemonChiffon", "#fffacd"}, {"seashell", "#fff5ee"}, {"honeydew", "#f0fff0"}, {"mint cream", "#f5fffa"}, {"MintCream", "#f5fffa"}, {"azure", "#f0ffff"}, {"alice blue", "#f0f8ff"}, {"AliceBlue", "#f0f8ff"}, {"lavender", "#e6e6fa"}, {"lavender blush", "#fff0f5"}, {"LavenderBlush", "#fff0f5"}, {"misty rose", "#ffe4e1"}, {"MistyRose", "#ffe4e1"}, {"white", "#ffffff"}, {"black", "#000000"}, {"dark slate gray", "#2f4f4f"}, {"DarkSlateGray", "#2f4f4f"}, {"dark slate grey", "#2f4f4f"}, {"DarkSlateGrey", "#2f4f4f"}, {"dim gray", "#696969"}, {"DimGray", "#696969"}, {"dim grey", "#696969"}, {"DimGrey", "#696969"}, {"slate gray", "#708090"}, {"SlateGray", "#708090"}, {"slate grey", "#708090"}, {"SlateGrey", "#708090"}, {"light slate gray", "#778899"}, {"LightSlateGray", "#778899"}, {"light slate grey", "#778899"}, {"LightSlateGrey", "#778899"}, {"gray", "#bebebe"}, {"grey", "#bebebe"}, {"light grey", "#d3d3d3"}, {"LightGrey", "#d3d3d3"}, {"light gray", "#d3d3d3"}, {"LightGray", "#d3d3d3"}, {"midnight blue", "#191970"}, {"MidnightBlue", "#191970"}, {"navy", "#000080"}, {"navy blue", "#000080"}, {"NavyBlue", "#000080"}, {"cornflower blue", "#6495ed"}, {"CornflowerBlue", "#6495ed"}, {"dark slate blue", "#483d8b"}, {"DarkSlateBlue", "#483d8b"}, {"slate blue", "#6a5acd"}, {"SlateBlue", "#6a5acd"}, {"medium slate blue", "#7b68ee"}, {"MediumSlateBlue", "#7b68ee"}, {"light slate blue", "#8470ff"}, {"LightSlateBlue", "#8470ff"}, {"medium blue", "#0000cd"}, {"MediumBlue", "#0000cd"}, {"royal blue", "#4169e1"}, {"RoyalBlue", "#4169e1"}, {"blue", "#0000ff"}, {"dodger blue", "#1e90ff"}, {"DodgerBlue", "#1e90ff"}, {"deep sky blue", "#00bfff"}, {"DeepSkyBlue", "#00bfff"}, {"sky blue", "#87ceeb"}, {"SkyBlue", "#87ceeb"}, {"light sky blue", "#87cefa"}, {"LightSkyBlue", "#87cefa"}, {"steel blue", "#4682b4"}, {"SteelBlue", "#4682b4"}, {"light steel blue", "#b0c4de"}, {"LightSteelBlue", "#b0c4de"}, {"light blue", "#add8e6"}, {"LightBlue", "#add8e6"}, {"powder blue", "#b0e0e6"}, {"PowderBlue", "#b0e0e6"}, {"pale turquoise", "#afeeee"}, {"PaleTurquoise", "#afeeee"}, {"dark turquoise", "#00ced1"}, {"DarkTurquoise", "#00ced1"}, {"medium turquoise", "#48d1cc"}, {"MediumTurquoise", "#48d1cc"}, {"turquoise", "#40e0d0"}, {"cyan", "#00ffff"}, {"light cyan", "#e0ffff"}, {"LightCyan", "#e0ffff"}, {"cadet blue", "#5f9ea0"}, {"CadetBlue", "#5f9ea0"}, {"medium aquamarine", "#66cdaa"}, {"MediumAquamarine", "#66cdaa"}, {"aquamarine", "#7fffd4"}, {"dark green", "#006400"}, {"DarkGreen", "#006400"}, {"dark olive green", "#556b2f"}, {"DarkOliveGreen", "#556b2f"}, {"dark sea green", "#8fbc8f"}, {"DarkSeaGreen", "#8fbc8f"}, {"sea green", "#2e8b57"}, {"SeaGreen", "#2e8b57"}, {"medium sea green", "#3cb371"}, {"MediumSeaGreen", "#3cb371"}, {"light sea green", "#20b2aa"}, {"LightSeaGreen", "#20b2aa"}, {"pale green", "#98fb98"}, {"PaleGreen", "#98fb98"}, {"spring green", "#00ff7f"}, {"SpringGreen", "#00ff7f"}, {"lawn green", "#7cfc00"}, {"LawnGreen", "#7cfc00"}, {"green", "#00ff00"}, {"chartreuse", "#7fff00"}, {"medium spring green", "#00fa9a"}, {"MediumSpringGreen", "#00fa9a"}, {"green yellow", "#adff2f"}, {"GreenYellow", "#adff2f"}, {"lime green", "#32cd32"}, {"LimeGreen", "#32cd32"}, {"yellow green", "#9acd32"}, {"YellowGreen", "#9acd32"}, {"forest green", "#228b22"}, {"ForestGreen", "#228b22"}, {"olive drab", "#6b8e23"}, {"OliveDrab", "#6b8e23"}, {"dark khaki", "#bdb76b"}, {"DarkKhaki", "#bdb76b"}, {"khaki", "#f0e68c"}, {"pale goldenrod", "#eee8aa"}, {"PaleGoldenrod", "#eee8aa"}, {"light goldenrod yellow", "#fafad2"}, {"LightGoldenrodYellow", "#fafad2"}, {"light yellow", "#ffffe0"}, {"LightYellow", "#ffffe0"}, {"yellow", "#ffff00"}, {"gold", "#ffd700"}, {"light goldenrod", "#eedd82"}, {"LightGoldenrod", "#eedd82"}, {"goldenrod", "#daa520"}, {"dark goldenrod", "#b8860b"}, {"DarkGoldenrod", "#b8860b"}, {"rosy brown", "#bc8f8f"}, {"RosyBrown", "#bc8f8f"}, {"indian red", "#cd5c5c"}, {"IndianRed", "#cd5c5c"}, {"saddle brown", "#8b4513"}, {"SaddleBrown", "#8b4513"}, {"sienna", "#a0522d"}, {"peru", "#cd853f"}, {"burlywood", "#deb887"}, {"beige", "#f5f5dc"}, {"wheat", "#f5deb3"}, {"sandy brown", "#f4a460"}, {"SandyBrown", "#f4a460"}, {"tan", "#d2b48c"}, {"chocolate", "#d2691e"}, {"firebrick", "#b22222"}, {"brown", "#a52a2a"}, {"dark salmon", "#e9967a"}, {"DarkSalmon", "#e9967a"}, {"salmon", "#fa8072"}, {"light salmon", "#ffa07a"}, {"LightSalmon", "#ffa07a"}, {"orange", "#ffa500"}, {"dark orange", "#ff8c00"}, {"DarkOrange", "#ff8c00"}, {"coral", "#ff7f50"}, {"light coral", "#f08080"}, {"LightCoral", "#f08080"}, {"tomato", "#ff6347"}, {"orange red", "#ff4500"}, {"OrangeRed", "#ff4500"}, {"red", "#ff0000"}, {"hot pink", "#ff69b4"}, {"HotPink", "#ff69b4"}, {"deep pink", "#ff1493"}, {"DeepPink", "#ff1493"}, {"pink", "#ffc0cb"}, {"light pink", "#ffb6c1"}, {"LightPink", "#ffb6c1"}, {"pale violet red", "#db7093"}, {"PaleVioletRed", "#db7093"}, {"maroon", "#b03060"}, {"medium violet red", "#c71585"}, {"MediumVioletRed", "#c71585"}, {"violet red", "#d02090"}, {"VioletRed", "#d02090"}, {"magenta", "#ff00ff"}, {"violet", "#ee82ee"}, {"plum", "#dda0dd"}, {"orchid", "#da70d6"}, {"medium orchid", "#ba55d3"}, {"MediumOrchid", "#ba55d3"}, {"dark orchid", "#9932cc"}, {"DarkOrchid", "#9932cc"}, {"dark violet", "#9400d3"}, {"DarkViolet", "#9400d3"}, {"blue violet", "#8a2be2"}, {"BlueViolet", "#8a2be2"}, {"purple", "#a020f0"}, {"medium purple", "#9370db"}, {"MediumPurple", "#9370db"}, {"thistle", "#d8bfd8"}, {"snow1", "#fffafa"}, {"snow2", "#eee9e9"}, {"snow3", "#cdc9c9"}, {"snow4", "#8b8989"}, {"seashell1", "#fff5ee"}, {"seashell2", "#eee5de"}, {"seashell3", "#cdc5bf"}, {"seashell4", "#8b8682"}, {"AntiqueWhite1", "#ffefdb"}, {"AntiqueWhite2", "#eedfcc"}, {"AntiqueWhite3", "#cdc0b0"}, {"AntiqueWhite4", "#8b8378"}, {"bisque1", "#ffe4c4"}, {"bisque2", "#eed5b7"}, {"bisque3", "#cdb79e"}, {"bisque4", "#8b7d6b"}, {"PeachPuff1", "#ffdab9"}, {"PeachPuff2", "#eecbad"}, {"PeachPuff3", "#cdaf95"}, {"PeachPuff4", "#8b7765"}, {"NavajoWhite1", "#ffdead"}, {"NavajoWhite2", "#eecfa1"}, {"NavajoWhite3", "#cdb38b"}, {"NavajoWhite4", "#8b795e"}, {"LemonChiffon1", "#fffacd"}, {"LemonChiffon2", "#eee9bf"}, {"LemonChiffon3", "#cdc9a5"}, {"LemonChiffon4", "#8b8970"}, {"cornsilk1", "#fff8dc"}, {"cornsilk2", "#eee8cd"}, {"cornsilk3", "#cdc8b1"}, {"cornsilk4", "#8b8878"}, {"ivory1", "#fffff0"}, {"ivory2", "#eeeee0"}, {"ivory3", "#cdcdc1"}, {"ivory4", "#8b8b83"}, {"honeydew1", "#f0fff0"}, {"honeydew2", "#e0eee0"}, {"honeydew3", "#c1cdc1"}, {"honeydew4", "#838b83"}, {"LavenderBlush1", "#fff0f5"}, {"LavenderBlush2", "#eee0e5"}, {"LavenderBlush3", "#cdc1c5"}, {"LavenderBlush4", "#8b8386"}, {"MistyRose1", "#ffe4e1"}, {"MistyRose2", "#eed5d2"}, {"MistyRose3", "#cdb7b5"}, {"MistyRose4", "#8b7d7b"}, {"azure1", "#f0ffff"}, {"azure2", "#e0eeee"}, {"azure3", "#c1cdcd"}, {"azure4", "#838b8b"}, {"SlateBlue1", "#836fff"}, {"SlateBlue2", "#7a67ee"}, {"SlateBlue3", "#6959cd"}, {"SlateBlue4", "#473c8b"}, {"RoyalBlue1", "#4876ff"}, {"RoyalBlue2", "#436eee"}, {"RoyalBlue3", "#3a5fcd"}, {"RoyalBlue4", "#27408b"}, {"blue1", "#0000ff"}, {"blue2", "#0000ee"}, {"blue3", "#0000cd"}, {"blue4", "#00008b"}, {"DodgerBlue1", "#1e90ff"}, {"DodgerBlue2", "#1c86ee"}, {"DodgerBlue3", "#1874cd"}, {"DodgerBlue4", "#104e8b"}, {"SteelBlue1", "#63b8ff"}, {"SteelBlue2", "#5cacee"}, {"SteelBlue3", "#4f94cd"}, {"SteelBlue4", "#36648b"}, {"DeepSkyBlue1", "#00bfff"}, {"DeepSkyBlue2", "#00b2ee"}, {"DeepSkyBlue3", "#009acd"}, {"DeepSkyBlue4", "#00688b"}, {"SkyBlue1", "#87ceff"}, {"SkyBlue2", "#7ec0ee"}, {"SkyBlue3", "#6ca6cd"}, {"SkyBlue4", "#4a708b"}, {"LightSkyBlue1", "#b0e2ff"}, {"LightSkyBlue2", "#a4d3ee"}, {"LightSkyBlue3", "#8db6cd"}, {"LightSkyBlue4", "#607b8b"}, {"SlateGray1", "#c6e2ff"}, {"SlateGray2", "#b9d3ee"}, {"SlateGray3", "#9fb6cd"}, {"SlateGray4", "#6c7b8b"}, {"LightSteelBlue1", "#cae1ff"}, {"LightSteelBlue2", "#bcd2ee"}, {"LightSteelBlue3", "#a2b5cd"}, {"LightSteelBlue4", "#6e7b8b"}, {"LightBlue1", "#bfefff"}, {"LightBlue2", "#b2dfee"}, {"LightBlue3", "#9ac0cd"}, {"LightBlue4", "#68838b"}, {"LightCyan1", "#e0ffff"}, {"LightCyan2", "#d1eeee"}, {"LightCyan3", "#b4cdcd"}, {"LightCyan4", "#7a8b8b"}, {"PaleTurquoise1", "#bbffff"}, {"PaleTurquoise2", "#aeeeee"}, {"PaleTurquoise3", "#96cdcd"}, {"PaleTurquoise4", "#668b8b"}, {"CadetBlue1", "#98f5ff"}, {"CadetBlue2", "#8ee5ee"}, {"CadetBlue3", "#7ac5cd"}, {"CadetBlue4", "#53868b"}, {"turquoise1", "#00f5ff"}, {"turquoise2", "#00e5ee"}, {"turquoise3", "#00c5cd"}, {"turquoise4", "#00868b"}, {"cyan1", "#00ffff"}, {"cyan2", "#00eeee"}, {"cyan3", "#00cdcd"}, {"cyan4", "#008b8b"}, {"DarkSlateGray1", "#97ffff"}, {"DarkSlateGray2", "#8deeee"}, {"DarkSlateGray3", "#79cdcd"}, {"DarkSlateGray4", "#528b8b"}, {"aquamarine1", "#7fffd4"}, {"aquamarine2", "#76eec6"}, {"aquamarine3", "#66cdaa"}, {"aquamarine4", "#458b74"}, {"DarkSeaGreen1", "#c1ffc1"}, {"DarkSeaGreen2", "#b4eeb4"}, {"DarkSeaGreen3", "#9bcd9b"}, {"DarkSeaGreen4", "#698b69"}, {"SeaGreen1", "#54ff9f"}, {"SeaGreen2", "#4eee94"}, {"SeaGreen3", "#43cd80"}, {"SeaGreen4", "#2e8b57"}, {"PaleGreen1", "#9aff9a"}, {"PaleGreen2", "#90ee90"}, {"PaleGreen3", "#7ccd7c"}, {"PaleGreen4", "#548b54"}, {"SpringGreen1", "#00ff7f"}, {"SpringGreen2", "#00ee76"}, {"SpringGreen3", "#00cd66"}, {"SpringGreen4", "#008b45"}, {"green1", "#00ff00"}, {"green2", "#00ee00"}, {"green3", "#00cd00"}, {"green4", "#008b00"}, {"chartreuse1", "#7fff00"}, {"chartreuse2", "#76ee00"}, {"chartreuse3", "#66cd00"}, {"chartreuse4", "#458b00"}, {"OliveDrab1", "#c0ff3e"}, {"OliveDrab2", "#b3ee3a"}, {"OliveDrab3", "#9acd32"}, {"OliveDrab4", "#698b22"}, {"DarkOliveGreen1", "#caff70"}, {"DarkOliveGreen2", "#bcee68"}, {"DarkOliveGreen3", "#a2cd5a"}, {"DarkOliveGreen4", "#6e8b3d"}, {"khaki1", "#fff68f"}, {"khaki2", "#eee685"}, {"khaki3", "#cdc673"}, {"khaki4", "#8b864e"}, {"LightGoldenrod1", "#ffec8b"}, {"LightGoldenrod2", "#eedc82"}, {"LightGoldenrod3", "#cdbe70"}, {"LightGoldenrod4", "#8b814c"}, {"LightYellow1", "#ffffe0"}, {"LightYellow2", "#eeeed1"}, {"LightYellow3", "#cdcdb4"}, {"LightYellow4", "#8b8b7a"}, {"yellow1", "#ffff00"}, {"yellow2", "#eeee00"}, {"yellow3", "#cdcd00"}, {"yellow4", "#8b8b00"}, {"gold1", "#ffd700"}, {"gold2", "#eec900"}, {"gold3", "#cdad00"}, {"gold4", "#8b7500"}, {"goldenrod1", "#ffc125"}, {"goldenrod2", "#eeb422"}, {"goldenrod3", "#cd9b1d"}, {"goldenrod4", "#8b6914"}, {"DarkGoldenrod1", "#ffb90f"}, {"DarkGoldenrod2", "#eead0e"}, {"DarkGoldenrod3", "#cd950c"}, {"DarkGoldenrod4", "#8b6508"}, {"RosyBrown1", "#ffc1c1"}, {"RosyBrown2", "#eeb4b4"}, {"RosyBrown3", "#cd9b9b"}, {"RosyBrown4", "#8b6969"}, {"IndianRed1", "#ff6a6a"}, {"IndianRed2", "#ee6363"}, {"IndianRed3", "#cd5555"}, {"IndianRed4", "#8b3a3a"}, {"sienna1", "#ff8247"}, {"sienna2", "#ee7942"}, {"sienna3", "#cd6839"}, {"sienna4", "#8b4726"}, {"burlywood1", "#ffd39b"}, {"burlywood2", "#eec591"}, {"burlywood3", "#cdaa7d"}, {"burlywood4", "#8b7355"}, {"wheat1", "#ffe7ba"}, {"wheat2", "#eed8ae"}, {"wheat3", "#cdba96"}, {"wheat4", "#8b7e66"}, {"tan1", "#ffa54f"}, {"tan2", "#ee9a49"}, {"tan3", "#cd853f"}, {"tan4", "#8b5a2b"}, {"chocolate1", "#ff7f24"}, {"chocolate2", "#ee7621"}, {"chocolate3", "#cd661d"}, {"chocolate4", "#8b4513"}, {"firebrick1", "#ff3030"}, {"firebrick2", "#ee2c2c"}, {"firebrick3", "#cd2626"}, {"firebrick4", "#8b1a1a"}, {"brown1", "#ff4040"}, {"brown2", "#ee3b3b"}, {"brown3", "#cd3333"}, {"brown4", "#8b2323"}, {"salmon1", "#ff8c69"}, {"salmon2", "#ee8262"}, {"salmon3", "#cd7054"}, {"salmon4", "#8b4c39"}, {"LightSalmon1", "#ffa07a"}, {"LightSalmon2", "#ee9572"}, {"LightSalmon3", "#cd8162"}, {"LightSalmon4", "#8b5742"}, {"orange1", "#ffa500"}, {"orange2", "#ee9a00"}, {"orange3", "#cd8500"}, {"orange4", "#8b5a00"}, {"DarkOrange1", "#ff7f00"}, {"DarkOrange2", "#ee7600"}, {"DarkOrange3", "#cd6600"}, {"DarkOrange4", "#8b4500"}, {"coral1", "#ff7256"}, {"coral2", "#ee6a50"}, {"coral3", "#cd5b45"}, {"coral4", "#8b3e2f"}, {"tomato1", "#ff6347"}, {"tomato2", "#ee5c42"}, {"tomato3", "#cd4f39"}, {"tomato4", "#8b3626"}, {"OrangeRed1", "#ff4500"}, {"OrangeRed2", "#ee4000"}, {"OrangeRed3", "#cd3700"}, {"OrangeRed4", "#8b2500"}, {"red1", "#ff0000"}, {"red2", "#ee0000"}, {"red3", "#cd0000"}, {"red4", "#8b0000"}, {"DeepPink1", "#ff1493"}, {"DeepPink2", "#ee1289"}, {"DeepPink3", "#cd1076"}, {"DeepPink4", "#8b0a50"}, {"HotPink1", "#ff6eb4"}, {"HotPink2", "#ee6aa7"}, {"HotPink3", "#cd6090"}, {"HotPink4", "#8b3a62"}, {"pink1", "#ffb5c5"}, {"pink2", "#eea9b8"}, {"pink3", "#cd919e"}, {"pink4", "#8b636c"}, {"LightPink1", "#ffaeb9"}, {"LightPink2", "#eea2ad"}, {"LightPink3", "#cd8c95"}, {"LightPink4", "#8b5f65"}, {"PaleVioletRed1", "#ff82ab"}, {"PaleVioletRed2", "#ee799f"}, {"PaleVioletRed3", "#cd6889"}, {"PaleVioletRed4", "#8b475d"}, {"maroon1", "#ff34b3"}, {"maroon2", "#ee30a7"}, {"maroon3", "#cd2990"}, {"maroon4", "#8b1c62"}, {"VioletRed1", "#ff3e96"}, {"VioletRed2", "#ee3a8c"}, {"VioletRed3", "#cd3278"}, {"VioletRed4", "#8b2252"}, {"magenta1", "#ff00ff"}, {"magenta2", "#ee00ee"}, {"magenta3", "#cd00cd"}, {"magenta4", "#8b008b"}, {"orchid1", "#ff83fa"}, {"orchid2", "#ee7ae9"}, {"orchid3", "#cd69c9"}, {"orchid4", "#8b4789"}, {"plum1", "#ffbbff"}, {"plum2", "#eeaeee"}, {"plum3", "#cd96cd"}, {"plum4", "#8b668b"}, {"MediumOrchid1", "#e066ff"}, {"MediumOrchid2", "#d15fee"}, {"MediumOrchid3", "#b452cd"}, {"MediumOrchid4", "#7a378b"}, {"DarkOrchid1", "#bf3eff"}, {"DarkOrchid2", "#b23aee"}, {"DarkOrchid3", "#9a32cd"}, {"DarkOrchid4", "#68228b"}, {"purple1", "#9b30ff"}, {"purple2", "#912cee"}, {"purple3", "#7d26cd"}, {"purple4", "#551a8b"}, {"MediumPurple1", "#ab82ff"}, {"MediumPurple2", "#9f79ee"}, {"MediumPurple3", "#8968cd"}, {"MediumPurple4", "#5d478b"}, {"thistle1", "#ffe1ff"}, {"thistle2", "#eed2ee"}, {"thistle3", "#cdb5cd"}, {"thistle4", "#8b7b8b"}, {"gray0", "#000000"}, {"grey0", "#000000"}, {"gray1", "#030303"}, {"grey1", "#030303"}, {"gray2", "#050505"}, {"grey2", "#050505"}, {"gray3", "#080808"}, {"grey3", "#080808"}, {"gray4", "#0a0a0a"}, {"grey4", "#0a0a0a"}, {"gray5", "#0d0d0d"}, {"grey5", "#0d0d0d"}, {"gray6", "#0f0f0f"}, {"grey6", "#0f0f0f"}, {"gray7", "#121212"}, {"grey7", "#121212"}, {"gray8", "#141414"}, {"grey8", "#141414"}, {"gray9", "#171717"}, {"grey9", "#171717"}, {"gray10", "#1a1a1a"}, {"grey10", "#1a1a1a"}, {"gray11", "#1c1c1c"}, {"grey11", "#1c1c1c"}, {"gray12", "#1f1f1f"}, {"grey12", "#1f1f1f"}, {"gray13", "#212121"}, {"grey13", "#212121"}, {"gray14", "#242424"}, {"grey14", "#242424"}, {"gray15", "#262626"}, {"grey15", "#262626"}, {"gray16", "#292929"}, {"grey16", "#292929"}, {"gray17", "#2b2b2b"}, {"grey17", "#2b2b2b"}, {"gray18", "#2e2e2e"}, {"grey18", "#2e2e2e"}, {"gray19", "#303030"}, {"grey19", "#303030"}, {"gray20", "#333333"}, {"grey20", "#333333"}, {"gray21", "#363636"}, {"grey21", "#363636"}, {"gray22", "#383838"}, {"grey22", "#383838"}, {"gray23", "#3b3b3b"}, {"grey23", "#3b3b3b"}, {"gray24", "#3d3d3d"}, {"grey24", "#3d3d3d"}, {"gray25", "#404040"}, {"grey25", "#404040"}, {"gray26", "#424242"}, {"grey26", "#424242"}, {"gray27", "#454545"}, {"grey27", "#454545"}, {"gray28", "#474747"}, {"grey28", "#474747"}, {"gray29", "#4a4a4a"}, {"grey29", "#4a4a4a"}, {"gray30", "#4d4d4d"}, {"grey30", "#4d4d4d"}, {"gray31", "#4f4f4f"}, {"grey31", "#4f4f4f"}, {"gray32", "#525252"}, {"grey32", "#525252"}, {"gray33", "#545454"}, {"grey33", "#545454"}, {"gray34", "#575757"}, {"grey34", "#575757"}, {"gray35", "#595959"}, {"grey35", "#595959"}, {"gray36", "#5c5c5c"}, {"grey36", "#5c5c5c"}, {"gray37", "#5e5e5e"}, {"grey37", "#5e5e5e"}, {"gray38", "#616161"}, {"grey38", "#616161"}, {"gray39", "#636363"}, {"grey39", "#636363"}, {"gray40", "#666666"}, {"grey40", "#666666"}, {"gray41", "#696969"}, {"grey41", "#696969"}, {"gray42", "#6b6b6b"}, {"grey42", "#6b6b6b"}, {"gray43", "#6e6e6e"}, {"grey43", "#6e6e6e"}, {"gray44", "#707070"}, {"grey44", "#707070"}, {"gray45", "#737373"}, {"grey45", "#737373"}, {"gray46", "#757575"}, {"grey46", "#757575"}, {"gray47", "#787878"}, {"grey47", "#787878"}, {"gray48", "#7a7a7a"}, {"grey48", "#7a7a7a"}, {"gray49", "#7d7d7d"}, {"grey49", "#7d7d7d"}, {"gray50", "#7f7f7f"}, {"grey50", "#7f7f7f"}, {"gray51", "#828282"}, {"grey51", "#828282"}, {"gray52", "#858585"}, {"grey52", "#858585"}, {"gray53", "#878787"}, {"grey53", "#878787"}, {"gray54", "#8a8a8a"}, {"grey54", "#8a8a8a"}, {"gray55", "#8c8c8c"}, {"grey55", "#8c8c8c"}, {"gray56", "#8f8f8f"}, {"grey56", "#8f8f8f"}, {"gray57", "#919191"}, {"grey57", "#919191"}, {"gray58", "#949494"}, {"grey58", "#949494"}, {"gray59", "#969696"}, {"grey59", "#969696"}, {"gray60", "#999999"}, {"grey60", "#999999"}, {"gray61", "#9c9c9c"}, {"grey61", "#9c9c9c"}, {"gray62", "#9e9e9e"}, {"grey62", "#9e9e9e"}, {"gray63", "#a1a1a1"}, {"grey63", "#a1a1a1"}, {"gray64", "#a3a3a3"}, {"grey64", "#a3a3a3"}, {"gray65", "#a6a6a6"}, {"grey65", "#a6a6a6"}, {"gray66", "#a8a8a8"}, {"grey66", "#a8a8a8"}, {"gray67", "#ababab"}, {"grey67", "#ababab"}, {"gray68", "#adadad"}, {"grey68", "#adadad"}, {"gray69", "#b0b0b0"}, {"grey69", "#b0b0b0"}, {"gray70", "#b3b3b3"}, {"grey70", "#b3b3b3"}, {"gray71", "#b5b5b5"}, {"grey71", "#b5b5b5"}, {"gray72", "#b8b8b8"}, {"grey72", "#b8b8b8"}, {"gray73", "#bababa"}, {"grey73", "#bababa"}, {"gray74", "#bdbdbd"}, {"grey74", "#bdbdbd"}, {"gray75", "#bfbfbf"}, {"grey75", "#bfbfbf"}, {"gray76", "#c2c2c2"}, {"grey76", "#c2c2c2"}, {"gray77", "#c4c4c4"}, {"grey77", "#c4c4c4"}, {"gray78", "#c7c7c7"}, {"grey78", "#c7c7c7"}, {"gray79", "#c9c9c9"}, {"grey79", "#c9c9c9"}, {"gray80", "#cccccc"}, {"grey80", "#cccccc"}, {"gray81", "#cfcfcf"}, {"grey81", "#cfcfcf"}, {"gray82", "#d1d1d1"}, {"grey82", "#d1d1d1"}, {"gray83", "#d4d4d4"}, {"grey83", "#d4d4d4"}, {"gray84", "#d6d6d6"}, {"grey84", "#d6d6d6"}, {"gray85", "#d9d9d9"}, {"grey85", "#d9d9d9"}, {"gray86", "#dbdbdb"}, {"grey86", "#dbdbdb"}, {"gray87", "#dedede"}, {"grey87", "#dedede"}, {"gray88", "#e0e0e0"}, {"grey88", "#e0e0e0"}, {"gray89", "#e3e3e3"}, {"grey89", "#e3e3e3"}, {"gray90", "#e5e5e5"}, {"grey90", "#e5e5e5"}, {"gray91", "#e8e8e8"}, {"grey91", "#e8e8e8"}, {"gray92", "#ebebeb"}, {"grey92", "#ebebeb"}, {"gray93", "#ededed"}, {"grey93", "#ededed"}, {"gray94", "#f0f0f0"}, {"grey94", "#f0f0f0"}, {"gray95", "#f2f2f2"}, {"grey95", "#f2f2f2"}, {"gray96", "#f5f5f5"}, {"grey96", "#f5f5f5"}, {"gray97", "#f7f7f7"}, {"grey97", "#f7f7f7"}, {"gray98", "#fafafa"}, {"grey98", "#fafafa"}, {"gray99", "#fcfcfc"}, {"grey99", "#fcfcfc"}, {"gray100", "#ffffff"}, {"grey100", "#ffffff"}, {0} }; const char* ColorRep::nameToRGB(const char* colormap, const char* name) { MWassert(colormap); MWassert(name); #if OCSMALL int i; for (i = 0; cc[i].name; ++i) { if (strcmp(cc[i].name, name) == 0) { return cc[i].value; } } #else if (!Session::installLocation()) { int i; for (i = 0; cc[i].name; ++i) { if (strcmp(cc[i].name, name) == 0) { return cc[i].value; } } }else{ if (COLORMAP_FILE == NULL) { const char* loc = Session::installLocation(); const char* leafname = "/colormap.ini"; COLORMAP_FILE = new char[ strlen(loc) + strlen(leafname) + 1]; strcpy(COLORMAP_FILE, loc); strcat(COLORMAP_FILE, leafname); } static char rgbName[10]; if (GetPrivateProfileString(colormap, name, "", rgbName, 10, COLORMAP_FILE)) { return rgbName; } else { int i; for (i = 0; cc[i].name; ++i) { if (strcmp(cc[i].name, name) == 0) { return cc[i].value; } } } } #endif return NULL; } const Color* ColorRep::rgbToColor(const char* name) { if (name[0] == '#') { int r; int g; int b; sscanf(&(name[1]), "%2x", &r); sscanf(&(name[3]), "%2x", &g); sscanf(&(name[5]), "%2x", &b); const Color* c = new Color( (ColorIntensity) (r/255.0), (ColorIntensity) (g/255.0), (ColorIntensity) (b/255.0), 1.0); return c; } return nil; } // ####################################################################### // ################# class Color // ####################################################################### // The following data is used to create 16 stipple patterns used when the // alpha value of the color is set to something other than 1.0. static unsigned char stippleData[16][8] = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, { 0x11, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00 }, { 0x11, 0x00, 0x44, 0x00, 0x11, 0x00, 0x44, 0x00 }, { 0x55, 0x00, 0x44, 0x00, 0x55, 0x00, 0x44, 0x00 }, { 0x55, 0x00, 0x55, 0x00, 0x55, 0x00, 0x55, 0x00 }, { 0x55, 0x22, 0x55, 0x00, 0x55, 0x22, 0x55, 0x00 }, { 0x55, 0x22, 0x55, 0x88, 0x55, 0x22, 0x55, 0x88 }, { 0x55, 0xAA, 0x55, 0x88, 0x55, 0xAA, 0x55, 0x88 }, { 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA }, { 0x77, 0xAA, 0x55, 0xAA, 0x77, 0xAA, 0x55, 0xAA }, { 0x77, 0xAA, 0xDD, 0xAA, 0x77, 0xAA, 0xDD, 0xAA }, { 0xFF, 0xAA, 0xDD, 0xAA, 0xFF, 0xAA, 0xDD, 0xAA }, { 0xFF, 0xAA, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF, 0xAA }, { 0xFF, 0xBB, 0xFF, 0xAA, 0xFF, 0xBB, 0xFF, 0xAA }, { 0xFF, 0xBB, 0xFF, 0xEE, 0xFF, 0xBB, 0xFF, 0xEE }, { 0xFF, 0xFF, 0xFF, 0xEE, 0xFF, 0xFF, 0xFF, 0xEE }, }; Color::Color( ColorIntensity r, // red component of color ColorIntensity g, // green component of color ColorIntensity b, // blue component of color float alpha, ColorOp op) { int red = (int) (r * 255); int green = (int) (g * 255); int blue = (int) (b * 255); impl_ = new ColorRep(red, green, blue); impl_->op = op; // ---- set stipple pattern if dither desired ---- impl_->alpha = alpha; if ((alpha > 0.9999) && (alpha < 1.0001)) { impl_->stipple = NULL; } else { int index = int(alpha * 16); index = (index > 15) ? 15 : index; index = (index < 0) ? 0 : index; impl_->stipple = new Bitmap(stippleData[index], 8, 8); } } Color::Color( const Color& color, float alpha, ColorOp op) { COLORREF cref = color.impl_->msColor(); int red = GetRValue(cref); int green = GetGValue(cref); int blue = GetBValue(cref); impl_ = new ColorRep(red, blue, green); impl_->op = op; // ---- set stipple pattern if dither desired ---- impl_->alpha = alpha; if ((alpha > 0.9999) && (alpha < 1.0001)) { impl_->stipple = NULL; } else { int index = int(alpha * 16); index = (index > 15) ? 15 : index; index = (index < 0) ? 0 : index; impl_->stipple = new Bitmap(stippleData[index], 8, 8); } } Color::~Color() { delete impl_->stipple; delete impl_; } void Color::intensities( Display*, ColorIntensity& r, ColorIntensity& g, ColorIntensity& b) const { intensities(r, g, b); } void Color::intensities( ColorIntensity& r, ColorIntensity& g, ColorIntensity& b) const { COLORREF cref = impl_->msColor(); r = (ColorIntensity) (((float) GetRValue(cref)) / 255.0); g = (ColorIntensity) (((float) GetGValue(cref)) / 255.0); b = (ColorIntensity) (((float) GetBValue(cref)) / 255.0); } float Color::alpha() const { return impl_->alpha; } const Color* Color::brightness(float adjust) const { ColorIntensity r, g, b; intensities(r, g, b); if (adjust >= 0) { r += (1 - r) * adjust; g += (1 - g) * adjust; b += (1 - b) * adjust; } else { float f = (float) (adjust + 1.0); r *= f; g *= f; b *= f; } return new Color(r, g, b); } bool Color::distinguished(const Color* c) const { return distinguished(Session::instance()->default_display(), c); } bool Color::distinguished(Display*, const Color* color) const { COLORREF cref = color->impl_->msColor(); int red = GetRValue(cref); int green = GetGValue(cref); int blue = GetBValue(cref); COLORREF bogus; return ( globalPalette.findEntry(red,green,blue,bogus) ) ? false : true; } // --------------------------------------------------------------------------- // Lookup color by name. This is intended to look things up by the X11 // style name, which is partially supported under the Windows implementation. // If the name starts with a '#' then we translate the hex numbers to rgb // values directly. Otherwise, we attempt to look up the color name in // the default colormap. // --------------------------------------------------------------------------- const Color* Color::lookup(Display*, const char* name) { if (name) { // ---- check for rgb specification ---- if (name[0] == '#') return ColorRep::rgbToColor(name); // ---- must be a color name ---- const char* rgb; if (rgb = ColorRep::nameToRGB("default", name)) { return ColorRep::rgbToColor(rgb); } } return nil; } const Color* Color::lookup(Display* d, const String& s) { // Since the value is not expected to be null terminiated, we simply // pass it through to the function that expects a (const char*) arg. return lookup(d, s.string()); } bool Color::find( const Display* display, const String& name, ColorIntensity& r, ColorIntensity& g, ColorIntensity& b) { NullTerminatedString nm(name); return find(display, nm.string(), r, g, b); } bool Color::find( const Display*, const char* name, ColorIntensity& r, ColorIntensity& g, ColorIntensity& b) { const char* rgb; if (rgb = ColorRep::nameToRGB("default", name)) { if (rgb[0] == '#') { int ir; int ig; int ib; sscanf(&(rgb[1]), "%2x", &ir); sscanf(&(rgb[3]), "%2x", &ig); sscanf(&(rgb[5]), "%2x", &ib); r = (ColorIntensity) (ir/255.0); g = (ColorIntensity) (ig/255.0); b = (ColorIntensity) (ib/255.0); return true; } } return false; } neuron-7.6.3/src/lib/IV-Win/cursor.cpp000077500000000000000000000141551340731477100175040ustar00rootroot00000000000000#include <../../config.h> /* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ========================================================================= // // cursor.c // // MS-Windows implementation of the InterViews cursor class. // // // // ======================================================================== #include #include #include #include #include #include #include #include #include #include static const CursorPattern textPat = { 0x0000, 0x4400, 0x2800, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x2800, 0x4400, 0x0000 }; static const CursorPattern textMask = { 0x0000, 0xCC00, 0x7800, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x7800, 0xCC00, 0x0000, }; static const CursorPattern noPat = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; Cursor* defaultCursor; Cursor* arrow; Cursor* crosshairs; Cursor* ltextCursor; Cursor* rtextCursor; Cursor* hourglass; Cursor* upperleft; Cursor* upperright; Cursor* lowerleft; Cursor* lowerright; Cursor* noCursor; /* * Define the builtin cursors. */ #if defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ > __SIZEOF_LONG__ #define cp2int (int)(unsigned long long) #elif defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ > __SIZEOF_INT__ #define cp2int (int)(unsigned long) #else #define cp2int (int) #endif void Cursor::init() { // // The MS include file define MAKEINTRESOURCE to cast to a string, which // is not the integer that it really is (which we expect as a constructor // argument. Therefore, we cast the IDC_XXX values to an int. // arrow = new Cursor(cp2int IDC_ARROW); crosshairs = new Cursor(cp2int IDC_CROSS); ltextCursor = new Cursor(4, 8, textPat, textMask); rtextCursor = new Cursor(0, 8, textPat, textMask); hourglass = new Cursor(cp2int IDC_WAIT); upperleft = new Cursor(cp2int IDC_SIZENWSE); upperright = new Cursor(cp2int IDC_SIZENESW); lowerleft = new Cursor(cp2int IDC_SIZENESW); lowerright = new Cursor(cp2int IDC_SIZENWSE); noCursor = new Cursor(0, 0, noPat, noPat); defaultCursor = arrow; } // ----------------------------------------------------------------------- // constructors and destructors for the Cursor class. // ----------------------------------------------------------------------- /* * Create a cursor a specific pattern and mask (16x16 in size) */ Cursor::Cursor( short xoff, short yoff, const int* p, const int* m, const Color*, // foreground color const Color *) // background color { rep_ = new CursorRep(xoff, yoff, p, m); } /* * Create a cursor from bitmaps. */ Cursor::Cursor( const Bitmap* pat, const Bitmap* mask, const Color* , // foreground color - unsupported const Color* ) // background color - unsupported { rep_ = new CursorRep(*pat->rep(), *mask->rep()); } /* * Create a cursor from a font. */ Cursor::Cursor( const Font*, // font to use int , // data character int , // mask character const Color* , // foreground color const Color* ) // background color { // !!!! currently unsupported !!!!! WindowRep::errorMessage("TBD - cursor from a font"); } /* * Create a cursor from the predefined cursor font. */ Cursor::Cursor( int n, // resource id const Color*, // foreground color const Color*) // background color { rep_ = new CursorRep(n); } Cursor::Cursor( const char* n) { rep_ = new CursorRep(n); } Cursor::~Cursor() { delete rep_; } // ####################################################################### // ################## class CursorRep // ####################################################################### CursorRep::CursorRep(int id) { // ---- load an user defined cursor resource ---- // MODIFIED by NL for WIN32s: // must use NULL as the HINSTANCE, when trying to load standard // windows cursors. cursor = LoadCursor(NULL, MAKEINTRESOURCE(id)); // OLD CODE // char buff[25]; // sprintf(buff, "#%d", id); // HINSTANCE inst = theApp.hinst; // cursor = LoadCursor(inst, buff); } CursorRep::CursorRep(const char* id) { // ---- load a predefined cursor ---- cursor = LoadCursor(NULL, id); } CursorRep::CursorRep( BitmapRep& data, BitmapRep& mask) { HINSTANCE inst = theApp.hinst; cursor = CreateCursor(inst, data.hot_x_, data.hot_y_, data.bm_.bmWidth, data.bm_.bmHeight, mask.bm_.bmBits, data.bm_.bmBits); } CursorRep::CursorRep( short hot_x, short hot_y, const int* data, const int* mask) { HINSTANCE inst = theApp.hinst; int cx = GetSystemMetrics(SM_CXCURSOR); int cy = GetSystemMetrics(SM_CYCURSOR); int n = cx*cy/16; short* m = new short[n]; short* d = new short[n]; int i, j; for (i=0, j=0; i < 16; i++) { m[j] = mask[i]; m[j+1] = 0xffff; d[j] = data[i]; d[j+1] = 0; j += 2; } while (j < n) { m[j] = 0xffff; d[j] = 0; j++; } cursor = CreateCursor(inst, hot_x, hot_y, /*16*/ cx, /*16*/ cy, m, d); delete [] m; delete [] d; } CursorRep::~CursorRep() { char buf[100]; DestroyCursor(cursor); } neuron-7.6.3/src/lib/IV-Win/display.cpp000066400000000000000000000267731340731477100176420ustar00rootroot00000000000000#include <../../config.h> /* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ======================================================================= // // // // // ======================================================================== #include #include #include #include #include #include #include #include #include class DisplayRep { public: DisplayRep(); ~DisplayRep(); public: PixelCoord pwidth_; PixelCoord pheight_; Coord width_; Coord height_; Style* style_; }; DisplayRep::DisplayRep() { style_ = nil; } DisplayRep::~DisplayRep() { } // ####################################################################### // ################# class Display // ####################################################################### static int pixel_twips_; static int logpixelsx_, logpixelsy_; Coord display_xsize_, display_ysize_; extern Style* iv_display_style_; static float fudge_; //#include "/nrn/src/winio/debug.h" static void set_pixel_twips(HDC hdc) { #if 1 // int pw = GetDeviceCaps(hdc, HORZRES); // width of screen in pixels // int ph = GetDeviceCaps(hdc, VERTRES); // height of screen in pixels int pw = GetSystemMetrics(SM_CXVIRTUALSCREEN); // width of screen in pixels int ph = GetSystemMetrics(SM_CYVIRTUALSCREEN); // width of screen in pixels logpixelsx_ = GetDeviceCaps(hdc, LOGPIXELSX);//pixels/logical inch logpixelsy_ = -GetDeviceCaps(hdc, LOGPIXELSY);//pixels/logical inch display_xsize_ = Coord(pw)/logpixelsx_*72.; // screen width in points display_ysize_ = Coord(ph)/logpixelsy_*72.; // screen height in points pixel_twips_ = 1440; // a twip is 1/20th of a point fudge_ = 1.; #else logpixelsx_ = GetDeviceCaps(hdc, LOGPIXELSX);//pixels/logical inch logpixelsy_ = -GetDeviceCaps(hdc, LOGPIXELSY);//pixels/logical inch // DebugMessage("logpixelsx logpixelsy %d %d\n", logpixelsx_, // logpixelsy_); // DebugMessage("HORZSIZE VERTSIZE %d %d\n", // GetDeviceCaps(hdc, HORZSIZE), GetDeviceCaps(hdc, VERTSIZE)); Coord x1, x2; POINT p; p.x = 72 * 20; p.y = 72 * 20; MWassert(SetMapMode(hdc, MM_ANISOTROPIC)); MWassert(SetWindowExtEx(hdc, 1440, 1440, NULL)); MWassert(SetViewportExtEx(hdc, logpixelsx_, logpixelsy_, NULL)); MWassert( LPtoDP(hdc, &p, 1) ); x1 = Coord(p.x)/72.; p.x = 72 * 20; p.y = 72 * 20; MWassert(SetMapMode(hdc, MM_TWIPS)); MWassert( LPtoDP(hdc, &p, 1) ); x2 = Coord(p.x)/72.; fudge_ = x1/x2; display_xsize_ = Coord(GetDeviceCaps(hdc, HORZRES)) * 72./Coord(p.x); display_ysize_ = Math::abs(Coord(GetDeviceCaps(hdc, VERTRES)) * 72./Coord(p.y)); //DebugMessage("HORZRES = %d VERTRES = %d\n", //GetDeviceCaps(hdc, HORZRES), GetDeviceCaps(hdc, VERTRES)); double mswin_scale = 1.0; pixel_twips_ = 1440; pixel_twips_ = int(1440.*1200./double(GetDeviceCaps(hdc, HORZRES))); Style* s = iv_display_style_; if (s->find_attribute("mswin_scale", mswin_scale)) { pixel_twips_ = int(1440. * mswin_scale + .01); }else if (GetDeviceCaps(hdc, HORZRES) < 900) { char buf[512]; const char* il = Session::installLocation(); if (!il) il = ""; sprintf(buf, "This is a low resolution screen and there \ is no mswin_scale resource in %s\\app-defa\\intervie.\n\ Select \"Yes\" to choose\n\ *mswin_scale: %g\n\ for this session. \"No\" to choose a scale of 1.0", il, pixel_twips_/1440.); if (IDNO == MessageBox(NULL, buf, "*mswin_scale: x", MB_YESNO)) { pixel_twips_ = 1440; } }else{ pixel_twips_ = 1440; } #endif } int iv_mswin_to_pixel(int winpix) { return int(double(winpix)*double(pixel_twips_)/1440. + .01); } int iv_pixel_to_mswin(int pixel) { return int(double(pixel)*1440./double(pixel_twips_) + .01); } void dpy_setmapmode(HDC hdc) { // if the MM_TWIPS map mode is used then on a dual screen // with windows 2000, the pixels/point is twice what it should be. if (0 && pixel_twips_ == 1440) { MWassert(SetMapMode(hdc, MM_TWIPS)); return; }else{ MWassert(SetMapMode(hdc, MM_ANISOTROPIC)); MWassert(SetWindowExtEx(hdc, pixel_twips_, pixel_twips_, NULL)); MWassert(SetViewportExtEx(hdc, logpixelsx_, logpixelsy_, NULL)); } } extern void iv_rescale_map(); extern void iv_rescale_unmap(); void iv_display_scale(float scale) { Display*d = Session::instance()->default_display(); if (0 && scale <= 1.01) { pixel_twips_ = 1440; }else{ float scl = scale * fudge_; pixel_twips_ = int(1440. * scl); } iv_rescale_unmap(); d->rescale(); iv_rescale_map(); } void iv_display_scale(Coord x, Coord y) { // scale so fits onto screen float x1 = x/display_xsize_; float y1 = y/display_ysize_; float scale = ((x1 > y1) ? x1 : y1); scale = (scale < 1.01) ? 1. : scale; iv_display_scale(scale); } void Display::rescale() { HDC hdc = GetDC(NULL); MWassert(hdc); dpy_setmapmode(hdc); POINT p; p.x = 72 * 20; p.y = 72 * 20; MWassert( LPtoDP(hdc, &p, 1) ); x_point_ = Coord(p.x) / Coord(72.0); y_point_ = (Coord) Math::abs( Coord(p.y) / Coord(72.0) ); x_pixel_ = Coord(72.0) / Coord(p.x); y_pixel_ = (Coord) Math::abs( Coord(72.0) / Coord(p.y) ); // ---- determine display size ---- // rep_->pwidth_ = GetDeviceCaps(hdc, HORZRES); // rep_->pheight_ = GetDeviceCaps(hdc, VERTRES); rep_->pwidth_ = GetSystemMetrics(SM_CXVIRTUALSCREEN); rep_->pheight_ = GetSystemMetrics(SM_CYVIRTUALSCREEN); rep_->width_ = to_coord( rep_->pwidth_, Dimension_X); rep_->height_ = to_coord( rep_->pheight_, Dimension_Y); ReleaseDC(NULL, hdc); // DebugMessage("rescale pw ph w h %d %d %g %g\n", // rep_->pwidth_, rep_->pheight_, rep_->width_, rep_->height_); } Display::Display(DisplayRep* d) { rep_ = d; //DebugMessage("Display::Display\n"); HDC hdc = GetDC(NULL); MWassert(hdc); // MWassert( SetMapMode(hdc, MM_TWIPS) ); set_pixel_twips(hdc); dpy_setmapmode(hdc); // // set conversion factors, these are different between the X and Y // dimension generally (and definitely in MS-Windows), so this is // handled differently than the InterViews distribution. The logical // to device point conversion function is used to convert an inch worth // of printer points from page space to device space to determine what // the scale factors are. // POINT p; p.x = 72 * 20; p.y = 72 * 20; MWassert( LPtoDP(hdc, &p, 1) ); x_point_ = Coord(p.x) / Coord(72.0); y_point_ = (Coord) Math::abs( Coord(p.y) / Coord(72.0) ); x_pixel_ = Coord(72.0) / Coord(p.x); y_pixel_ = (Coord) Math::abs( Coord(72.0) / Coord(p.y) ); // ---- determine display size ---- // rep_->pwidth_ = GetDeviceCaps(hdc, HORZRES); // rep_->pheight_ = GetDeviceCaps(hdc, VERTRES); rep_->pwidth_ = GetSystemMetrics(SM_CXVIRTUALSCREEN); rep_->pheight_ = GetSystemMetrics(SM_CYVIRTUALSCREEN); rep_->width_ = to_coord( rep_->pwidth_, Dimension_X); rep_->height_ = to_coord( rep_->pheight_, Dimension_Y); ReleaseDC(NULL, hdc); // DebugMessage("Display pw ph w h %d %d %g %g\n", // rep_->pwidth_, rep_->pheight_, rep_->width_, rep_->height_); } Display* Display::open(const String&) { return open((const char*) 0); } Display* Display::open() { return open(nil); } Display* Display::open(const char*) { DisplayRep* d = new DisplayRep; return new Display(d); } void Display::close() { } Display::~Display() { DisplayRep* d = rep(); Resource::unref_deferred(d->style_); delete d; } int Display::fd() const { return 0; } Coord Display::width() const { return rep()->width_; } Coord Display::height() const { return rep()->height_; } PixelCoord Display::pwidth() const { return rep()->pwidth_; } PixelCoord Display::pheight() const { return rep()->pheight_; } /* * Convert millimeters to points. We use 72.0 pts/in and 25.4 mm/in. */ static inline double mm_to_points(double mm) { return (72.0 / 25.4) * mm; } Coord Display::a_width() const { DisplayRep& d = *rep(); return d.width_; } Coord Display::a_height() const { DisplayRep& d = *rep(); return d.height_; } bool Display::defaults(String&) const { return false; } void Display::style(Style* s) { DisplayRep& d = *rep(); Resource::ref(s); Resource::unref(d.style_); d.style_ = s; } Style* Display::style() const { return rep()->style_; } void Display::set_screen(int) { } void Display::repair() { } void Display::flush() { } void Display::sync() { } void Display::ring_bell(int) { #if 0 MessageBeep(-1); #else // since arg is unsigned int avoid warning even though MS // recommends -1 MessageBeep(~0); #endif } void Display::set_key_click(int) { } void Display::set_auto_repeat(bool) { } void Display::set_pointer_feedback(int, int) { } void Display::move_pointer( Coord, // x coordinate Coord) // y coordinate { // although you can move the pointer... it's only useful when there // is no mouse attached. The instant the mouse is touched the pointer // goes back to where it was. An assertion failure is done if there // is an attempt to warp the pointer since this really isn't portable // to Windows. MWassert(0); } SelectionManager* Display::primary_selection() { return nil; //find_selection("PRIMARY"); } SelectionManager* Display::secondary_selection() { return nil; //find_selection("SECONDARY"); } SelectionManager* Display::clipboard_selection() { return nil; //find_selection("CLIPBOARD"); } SelectionManager* Display::find_selection(const char*) { return nil; //find_selection(String(name)); } SelectionManager* Display::find_selection(const String&) { return nil; } /* * Read the next event if one is pending. Otherwise, return false. * Window::receive will be called on the target window for the event, * if the window is known and is valid. Because we don't keep track * of subwindows, it is possible to get an event for a subwindow after * the main window has been unmapped. We must ignore such events. */ bool Display::get(Event&) { MWassert(0); return false; } void Display::put(const Event&) { MWassert(0); } /* * Check to see if the display connection just shut down. */ bool Display::closed() { return false; } /* * Add a handler to the grabber list. The handler is ref'd to ensure * that it is not deallocated while on the list. */ void Display::grab(Window*, Handler* h) { Event e; e.grab(h); } /* * Remove a handler from the grabber list. * This function has no effect if the handler is not presently on the list. * If the handler is on the list, it is unref'd. */ void Display::ungrab(Handler* h, bool) { Event e; e.ungrab(h); } /* * Return the most recent grabber, or nil if the list is empty. */ Handler* Display::grabber() const { Event e; return e.grabber(); } /* * Check whether a given handler is on the grabber list. */ bool Display::is_grabbing(Handler* h) const { Event e; return e.is_grabbing(h); } neuron-7.6.3/src/lib/IV-Win/event.cpp000066400000000000000000000253231340731477100173040ustar00rootroot00000000000000#include <../../config.h> /* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ======================================================================= // // // // MS-Windows implementation of the InterViews Event classes. The // flow of control is significantly different from X11 in MS-Windows. // Messages come from a callback rather than read from a socket, and the // messages are distributed to a WindowRep object. Therefore, the events // are actually created by a WindowRep-based object which then turns // around and calls Event::handle(), which is what Session::run did after // it read an event from the socket. The end result should be identical, // unless an application called anything other than Session::run to do // it's event dispatching. // // // ======================================================================== #include #include #include #include #include #include #include #include #include #include declarePtrList(MWhandlerPtrList, Handler) implementPtrList(MWhandlerPtrList, Handler) // ---- grabbing event handler list ---- static MWhandlerPtrList grabberList(100); Event::Event() { rep_ = new EventRep; } Event::Event(const Event& e) { rep_ = new EventRep; copy_rep(e); } Event::~Event() { if (rep_) delete rep_; } Event& Event::operator =(const Event& e) { copy_rep(e); return *this; } void Event::copy_rep(const Event& e) { *rep_ = *e.rep_; } void Event::display(Display*) { } Display* Event::display() const { return rep_->windowOf()->display(); } void Event::window(Window*) { // This is unsupported under the MS-Windows version. When the event // was received, it was already known exactly which window the event // was for, and changing it is dangerous. Supporting this call caused // strange behavior, so it has been changed to do nothing!! } Window* Event::window() const { return rep_->windowOf(); } // ----------------------------------------------------------------------- // The following operations deal with events coming from a UNIX style file // (actually socket) where events can be read, pushed back, or tested to // see if any new ones are pending. These have only minimal support under // MS-Windows and somewhat different. The event cannot be manipulated // after a read, handle must be called. // // These should not be used anyway... the programmer should be running // things with Session::run() and using the Dispatch class for any other // forms of event handling. // ----------------------------------------------------------------------- bool Event::pending() const { WindowRep::errorMessage("Event::pending - unsupported"); return false; } void Event::read() { WindowRep::errorMessage("Event::read - unsupported"); //Session::instance()->read(*this); } bool Event::read(long , long ) { Event::read(); //return Session::instance()->read(s, u, *this); return false; } void Event::unread() { WindowRep::errorMessage("Event::unread - unsupported"); //rep()->display_->put(*this); } void Event::poll() { // used to query the mouse position, which could be synthsized, but // for now it's unimplimented... I consider this a rather unclean // interface to begin with. WindowRep::errorMessage("Event::poll - unsupported"); } // ----------------------------------------------------------------------- // Find an event handler for the window associated with this event. // ----------------------------------------------------------------------- Handler* Event::handler() const { Handler* h = nil; Window* w = rep_->windowOf(); if (w != nil) { h = w->target(*this); } return h; } // ----------------------------------------------------------------------- // Go process this event with the current handler. In the MS-Windows // version, this is not done directly. The EventRep::handlerCallback() // does the actual work, but this function queues up the event (really // MS-Windows message) so that it will come through the WndProc(). // // The event must be the one used the Session::read() (or Event::read()), // so that the message is sitting in the MSG structure. // ----------------------------------------------------------------------- void Event::handle() { TranslateMessage(&(rep_->msg)); DispatchMessage(&(rep_->msg)); } // ----------------------------------------------------------------------- // event handler grabs // ----------------------------------------------------------------------- void Event::grab(Handler* h) const { // ---- push on grabber stack ---- Resource::ref(h); grabberList.append(h); } void Event::ungrab(Handler* h) const { // ---- remove from collection of grabbers ---- for (ListUpdater(MWhandlerPtrList) i(grabberList); i.more(); i.next()) { Handler* curr_h = i.cur(); if (curr_h == h) { i.remove_cur(); Resource::unref(h); break; } } } Handler* Event::grabber() const { if (grabberList.count() == 0) return nil; return grabberList.item(0); } bool Event::is_grabbing(Handler* h) const { for (ListItr(MWhandlerPtrList) i(grabberList); i.more(); i.next()) { Handler* curr_h = i.cur(); if (curr_h == h) { return true; } } return false; } // ----------------------------------------------------------------------- // Return the type of event. Since all the work is done at the time the // event is synthesized, this simply returns the event type that was // stashed in the EventRep. // ----------------------------------------------------------------------- EventType Event::type() const { return rep_->typeOf(); } unsigned long Event::time() const { return GetMessageTime(); } // ----------------------------------------------------------------------- // The pointer locations have already been determined, so we simply return // them here. // ----------------------------------------------------------------------- Coord Event::pointer_x() const { Display* dpy = display(); return dpy->to_coord(rep_->windowXpos(), Dimension_X); } Coord Event::pointer_y() const { Display* dpy = display(); return dpy->to_coord(rep_->windowYpos(), Dimension_Y); } Coord Event::pointer_root_x() const { Display* dpy = display(); return dpy->to_coord(rep_->displayXpos(), Dimension_X); } Coord Event::pointer_root_y() const { Display* dpy = display(); return dpy->to_coord(rep_->displayYpos(), Dimension_Y); } EventButton Event::pointer_button() const { return rep_->buttonOf(); } unsigned int Event::keymask() const { WindowRep::errorMessage("Event::keymask() - unsupported"); return 0; } // ------------------------------------------------------------------------- // key tests - It is presumed that this query is being made in response // to some key/pointer event, in which case the wParam of the message would // hold valid information. // ------------------------------------------------------------------------- bool Event::control_is_down() const { return (rep_->wparamOf() & MK_CONTROL) ? true : false; } bool Event::shift_is_down() const { return (rep_->wparamOf() & MK_SHIFT) ? true : false; } bool Event::left_is_down() const { return (rep_->wparamOf() & MK_LBUTTON) ? true : false; } bool Event::middle_is_down() const { return (rep_->wparamOf() & MK_MBUTTON) ? true : false; } bool Event::right_is_down() const { return (rep_->wparamOf() & MK_RBUTTON) ? true : false; } bool Event::capslock_is_down() const { return false; } bool Event::meta_is_down() const { return false; } unsigned char Event::keycode() const { if (rep_->typeOf() == key) return rep_->keycode(); else return 0; } // from 0x20 to 0x2F unsigned int Event::mapkey(char* buff, unsigned int bufflen) const { if (bufflen) { buff[0] = (char)rep_->wparamOf(); return 1; } return 0; } unsigned long Event::keysym() const { // TBD MWassert(0); return 0; } // ####################################################################### // ########################## class EventRep // ####################################################################### void EventRep::setMessage(Window* w, UINT m, WPARAM wp, LPARAM lp) { // ---- stash raw data ---- window_ = w; message_ = m; wparam_ = wp; lparam_ = lp; // ---- check for pointer position ---- if (message_ == WM_MOUSEMOVE) { ptrX_ = LOWORD(lparam_); ptrY_ = HIWORD(lparam_); } } PixelCoord EventRep::displayXpos() const { POINT pt; // point to be converted. HWND h = window_->rep()->msWindow(); // handle of MS-Windows window pt.x = (ptrX_ > 32768) ? ptrX_- 0x10000 : ptrX_; // x in client coords pt.y = ptrY_; // y in client coords ClientToScreen(h, &pt); return pt.x; } PixelCoord EventRep::displayYpos() const { POINT pt; // point to be converted HWND h = window_->rep()->msWindow(); // handle of MS-Windows window pt.x = ptrX_; // x in client coords pt.y = (ptrY_ > 32768) ? ptrY_ - 0x10000 : ptrY_; // x in client coords ClientToScreen(h, &pt); Display* d = window_->display(); MWassert(d); int height = d->pheight(); return (height - pt.y); } unsigned char EventRep::keycode() { return wparam_; } // ----------------------------------------------------------------------- // This function used to be Event::handle(), but the functionality is // really a callback in the MS-Windows version because that's the way // Windows likes to operate. When a message comes in for a window that // is use input related, this function gets called, which invokes the // current handler. // ----------------------------------------------------------------------- void EventRep::handleCallback(Event& e) { Handler* h = e.grabber(); if (h == nil) { h = e.handler(); } if (h != nil) { bool b = Resource::defer(true); h->ref(); h->event(e); h->unref(); Resource::flush(); Resource::defer(b); } } neuron-7.6.3/src/lib/IV-Win/font.cpp000066400000000000000000000565561340731477100171450ustar00rootroot00000000000000#include <../../config.h> /* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ========================================================================= // // // // MS-Windows dependent Font representation. The font information is stored // in a LOGFONT structure until the font is needed, at which time it can be // created with CreateFontIndirect(). // // The user is given a constructor with a LOGFONT structure to use as a // reference. This is primarily for flexibility where one doesn't care // about portability (one really shouldn't use the FontRep directly). The // user is cautioned however that there is no guarantee the fields won't // be overwritten (lfEscapement and lfOrientation may change for example). // // // ======================================================================== /* * PORTIONS OF THIS FILE ARE BASED UPON THE InterViews 3.1 DISTRIBUTION * WHICH CARRIED THE FOLLOWING COPYRIGHT: * * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ // ---- libc includes ---- #include #include // ---- InterViews includes ---- #include #include #include #include #include #include #include // ---- font family name list type ----- declarePtrList(MWfamilyPtrList, char) implementPtrList(MWfamilyPtrList, char) MWfamilyPtrList FontFamilyRep::name_list_(10); // ------------------------------------------------------------------ // window used to determine font dimensions. This is needed because // character width information may be needed before any windows have // been created by this library (This is the case with InterViews // which builds up the entire glyph hierarchy before creating the // window to hold it). The desktop window is used for this purpose. // ------------------------------------------------------------------ HWND FontRep::fontWindow() { return GetDesktopWindow(); } // ------------------------------------------------------------------ // This function delivers a default FontRep structure... presumably // because we couldn't determine/create what was really desired and // we are forced to have a valid font. // // This function basically lets the MS-Windows font-mapping mechanism // get as close as it can, and uses a default point size of 12. // ------------------------------------------------------------------ inline FontRep* defaultFontRep(const char* nm) { FontRep* rep = new FontRep(nm, 12 * 20); return rep; } static void nofont(const char* name) { printf("nofont: |%s|\n", name); static bool seen = 0; if (!seen) { seen = true; char buf[512]; sprintf(buf, "Can't find font:\n%s\nUsing default font. This is the\ last time this message will be seen in this session", name); MessageBox(NULL, buf, "Missing Font", MB_OK); } } // ------------------------------------------------------------------ // Preferred constructor... provides a simple interface to creating // fonts as they are typically desired. // ------------------------------------------------------------------ FontRep::FontRep( const char* face_name, // name of typeface int height, // desired height of the font int style_flags) // desired style attributes { char_widths_ = nil; hfont_ = nil; font_.lfWidth = 0; font_.lfEscapement = 0; font_.lfOrientation = 0; font_.lfWeight = 0; font_.lfItalic = 0; font_.lfUnderline = 0; font_.lfStrikeOut = 0; font_.lfCharSet = 0; font_.lfOutPrecision = OUT_TT_PRECIS; font_.lfClipPrecision = 0; font_.lfQuality = 0; font_.lfPitchAndFamily = 0; // ---- set style ---- if (style_flags & bold) font_.lfWeight = FW_BOLD; if (style_flags & italic) font_.lfItalic = 1; if (style_flags & underline) font_.lfUnderline = 1; if (style_flags & strikeout) font_.lfStrikeOut = 1; // ---- required fields ---- font_.lfHeight = height; strncpy(font_.lfFaceName, face_name, LF_FACESIZE-1); font_.lfFaceName[LF_FACESIZE-1] = 0; } FontRep::~FontRep() { if(hfont_ != nil) DeleteObject(hfont_); hfont_ = nil; delete char_widths_; } // ----------------------------------------------------------------------- // Makes sure that the font has been associated with a device, and // associates it with the main window if it has not already been // associated with a device. This should be successfully called before // any attempt is made to fetch metric data. // ----------------------------------------------------------------------- void dpy_setmapmode(HDC); bool FontRep::CheckAssociation() { if (char_widths_ == nil) { // has not been associated with anything yet HWND hwnd = fontWindow(); HDC hdc = GetDC(hwnd); MWassert(hdc); // MWassert( SetMapMode(hdc, MM_TWIPS) ); dpy_setmapmode(hdc); bool success = AssociateWith(hdc); ReleaseDC(hwnd, hdc); return success; } return true; } // ------------------------------------------------------------------- // Associates the font metric data with the given device context. // Returns the success of finding all of the data. // ------------------------------------------------------------------- bool FontRep::AssociateWith( HDC hdc) // device context to use (for printer) { if(hfont_ == nil) hfont_ = CreateFontIndirect(&font_); HFONT old_fnt; bool status = false; // ---- make this font active for check ---- if ((hfont_ != nil) && ((old_fnt = (HFONT) SelectObject(hdc, hfont_))!=0)) { status = true; // ---- fetch the font metrics ---- if (!GetTextMetrics(hdc, &metrics)) status = false; // ---- fetch character width metrics ---- if (status == true) { int nchars = 0; if (char_widths_ == nil) { nchars = metrics.tmLastChar - metrics.tmFirstChar + 1; char_widths_ = new float[nchars]; MWassert(char_widths_); } ABC width; // int nWidth; // char mbuf[256]; // sprintf(mbuf, "%d %s", metrics.tmFirstChar, TypefaceName()); // MessageBox(NULL, mbuf, "idemo", MB_OK); for (int i = 0; i < nchars; i++) { if( GetCharABCWidths(hdc, metrics.tmFirstChar + i, metrics.tmFirstChar + i, &width) ) { char_widths_ [i] = float(width.abcA + width.abcB + width.abcC); } /* else if (GetCharWidth(hdc, metrics.tmFirstChar + i, metrics.tmFirstChar + i, &nWidth) ) { char_widths_ [i] = float(nWidth); } */ else { char_widths_ [i] = float(metrics.tmAveCharWidth); } } } // ---- release the font and restore original ---- SelectObject(hdc, old_fnt); } return status; } // ---------------------------------------------------------------------- // return the width of the given character, or -1 if there is a problem. // The widths are in terms of the display context which the font was // associated with. // ---------------------------------------------------------------------- float FontRep::CharWidth(int ch) { // --- check it ---- MWassert(CheckAssociation()); ch = ch - metrics.tmFirstChar; int nchars = metrics.tmLastChar - metrics.tmFirstChar + 1; // --- fetch it ---- if( ((ch >= 0) && (ch < nchars)) ) return char_widths_[ch]; else return 0; } // ----------------------------------------------------------------------- // Scale the font. This will work as a result of scaling the height in // the LOGFONT structure because True-Type fonts are used, which will scale // to whatever is asked for. A side effect of scaling however, is that // all the metrics need to be recalculated. Since metrics are associated // with a particular device under windows, we need a device context to use. // ----------------------------------------------------------------------- void FontRep::Scale( float s) // scale to set to { font_.lfHeight = (int) (font_.lfHeight * s); // ---- recalculate the metrics ---- HWND hwnd = fontWindow(); HDC hdc = GetDC(hwnd); MWassert(hdc); // MWassert( SetMapMode(hdc, MM_TWIPS) ); dpy_setmapmode(hdc); MWassert( AssociateWith(hdc) ); ReleaseDC(hwnd, hdc); } // ################################################################### // ################## class Font // ################################################################### // ----------------------------------------------------------------------- // The following function attempts to extract font information out of a // string. This is a really poor interface, and is provided only for // compatibility with the X11 version. The font handling really needs to // be improved. // // The type of string searched for is of the following form: // // *facename*style*--size* // // This format will be emitted by the FontFamily class when used with // MS-Windows. This form can also be used with X11 as it will uniquely // match most fonts. Any other string will cause the function to return a // null pointer (indicating failure). // ----------------------------------------------------------------------- static FontRep* StringToFont(const String& name) { int start_mark; // start of a range int end_mark; // end of a range if (name[0] != '*') return 0; // ---- extract the facename ---- if ((end_mark = name.search(1, '*')) < 0) return 0; NullTerminatedString facename = name.substr(1, end_mark - 1); // ---- extract the style ---- start_mark = end_mark + 1; if (start_mark >= name.length()) return 0; if ((end_mark = name.search(start_mark, '*')) < 0) return 0; NullTerminatedString stylename = name.substr(start_mark, end_mark - start_mark); // ---- extract the size ---- start_mark = end_mark + 1; if (start_mark >= name.length()) return 0; if ((end_mark = name.search(start_mark, '*')) < 0) return 0; if (name[start_mark+1] != '-') return 0; NullTerminatedString sizename = name.substr(start_mark+2, end_mark-(start_mark+2)); // ---- create the FontRep instance ---- int size; // point size int style; // style value sizename.convert(size); if (stylename == String("normal")) style = FontRep::normal; else if (stylename == String("bold")) style = FontRep::bold; else if (stylename == String("italic")) style = FontRep::italic; else style = FontRep::normal; FontRep* rep = new FontRep(facename.string(), size * 20, style); return rep; } // ----------------------------------------------------------------------- // The following are the constructors and destructors for the Font class. // The string is limited to a format that StringToFont() can understand. // The font can be scaled internally by FontRep since only TrueType fonts // are used by FontRep. // ----------------------------------------------------------------------- Font::Font(const String& name, float scale) { // printf("font4 %s\n", name.string()); FontRep* rep = StringToFont(name); if (! rep) { nofont(name.string()); NullTerminatedString nm(name); rep = defaultFontRep(nm.string()); } MWassert(rep); impl_ = (FontImpl*) rep; if (scale != 1.0) { rep->Scale(scale); } } Font::Font(const char* name, float scale) { //printf("font3 %s\n", name); FontRep* rep = StringToFont(String(name)); if (! rep) { nofont(name); rep = defaultFontRep(name); } MWassert(rep); impl_ = (FontImpl*) rep; if (scale != 1.0) { rep->Scale(scale); } } Font::Font(FontImpl* i) { impl_ = i; } Font::~Font() { FontRep* rep = (FontRep*) impl_; delete rep; } // This has no meaning in the MS-Windows implimentation void Font::cleanup() { } // ----------------------------------------------------------------------- // Get/Create a font from a name. MS-Windows has it's own mapping scheme // that always returns a font of some sort. It seems reasonable to provide // a font here even if we can't exactly match, since there is a seperate // function to determine if the font exists. // ----------------------------------------------------------------------- const Font* Font::lookup(const String& name) { FontRep* rep; if ((rep = StringToFont(name)) != nil) { return new Font((FontImpl*)rep); } else { nofont(name.string()); NullTerminatedString nm(name); rep = defaultFontRep(nm.string()); return new Font((FontImpl*)rep); } } const Font* Font::lookup(const char* name) { FontRep* rep; if ((rep = StringToFont(String(name))) != nil) { return new Font((FontImpl*)rep); } else { nofont(name); rep = defaultFontRep(name); return new Font((FontImpl*)rep); } } // ----------------------------------------------------------------------- // Determine if the named font exists. Initially, this is just a test of // whether or not the name parses into something reasonable, but it needs // to also be compared to the fontlist of available TrueType fonts. There // is no display in MS-Windows (ie no networked graphics), so it is ignored. // ----------------------------------------------------------------------- bool Font::exists(Display*, const String& name) { FontRep* rep = StringToFont(name); if (rep != nil) { delete rep; return true; } return false; } bool Font::exists(Display*, const char* name) { FontRep* rep = StringToFont(String(name)); if (rep != nil) { delete rep; return true; } return false; } FontRep* Font::rep(Display*) const { return (FontRep*) impl_; } const char* Font::name() const { FontRep* rep = (FontRep*) impl_; if (rep) return rep->TypefaceName(); return nil; } const char* Font::encoding() const { #ifdef IS_IMPLIMENTED FontRep* f = impl_->default_rep(); return f->encoding_ == nil ? nil : f->encoding_->string(); #endif return nil; } Coord Font::size() const { // The size is stored in terms of twips, so we divide by 20 to get it // back to points. FontRep* rep = (FontRep*) impl_; return Coord(rep->Height()) / Coord(20); } // --------------------------------------------------------------------------- // Get the bounding box information for the font. The FontRep actually // has more information than available in the FontBoundingBox, so applications // that need more info can access FontRep info directly, but this will // affect portability. // --------------------------------------------------------------------------- void Font::font_bbox( FontBoundingBox& b) const // return information { FontRep* rep = (FontRep*) impl_; MWassert(rep); TEXTMETRIC& tm = rep->Metrics(); Coord TWIPS(20.0); b.left_bearing_ = Coord(tm.tmOverhang) / TWIPS; b.right_bearing_ = Coord(tm.tmMaxCharWidth + tm.tmOverhang) / TWIPS; b.width_ = Coord(tm.tmMaxCharWidth) / TWIPS; b.ascent_ = Coord(tm.tmAscent) / TWIPS; b.descent_ = Coord(tm.tmDescent) / TWIPS; b.font_ascent_ = b.ascent_; b.font_descent_ = b.descent_; } void Font::char_bbox( long c, // character to measure FontBoundingBox& b) const // return information { if (c < 0) { b.left_bearing_ = 0; b.right_bearing_ = 0; b.width_ = 0; b.ascent_ = 0; b.descent_ = 0; b.font_ascent_ = 0; b.font_descent_ = 0; return; } FontRep* rep = (FontRep*) impl_; MWassert(rep); TEXTMETRIC& tm = rep->Metrics(); Coord TWIPS(20.0); b.left_bearing_ = Coord(tm.tmOverhang) / TWIPS; b.right_bearing_ = Coord(tm.tmMaxCharWidth + tm.tmOverhang) / TWIPS; b.width_ = width(c); b.ascent_ = Coord(tm.tmAscent) / TWIPS; b.descent_ = Coord(tm.tmDescent) / TWIPS; b.font_ascent_ = b.ascent_; b.font_descent_ = b.descent_; } void Font::string_bbox( const char* s, // string to measure length of int len, // number of characters in string FontBoundingBox& b) const // return information { FontRep* rep = (FontRep*) impl_; MWassert(rep); TEXTMETRIC& tm = rep->Metrics(); Coord TWIPS(20.0); b.left_bearing_ = Coord( tm.tmOverhang) / TWIPS; // b.right_bearing_ = Coord( tm.tmMaxCharWidth + tm.tmOverhang) / TWIPS; b.width_ = width(s, len); //Added by hines b.right_bearing_ = b.width_ + Coord(tm.tmOverhang) / TWIPS; // b.ascent_ = Coord(tm.tmAscent) / TWIPS; b.descent_ = Coord(tm.tmDescent) / TWIPS; b.font_ascent_ = b.ascent_; b.font_descent_ = b.descent_; } Coord Font::width(long c) const { FontRep* rep = (FontRep*) impl_; if ((rep == nil) || (c < 0)) { return 0; } return Coord(rep->CharWidth((int) c)) / Coord(20); } Coord Font::width( const char* s, // string to measure int len) const // number of characters in string { FontRep* rep = (FontRep*) impl_; MWassert(rep); // ---- associate with main window for metrics ---- int i; Coord swidth = 0; for (i=0; idefault_rep(); XFontStruct* xf = f->font_; int xoffset = f->display_->to_pixels(Coord(offset * f->scale_)); if (xf->min_bounds.width == xf->max_bounds.width) { cw = xf->min_bounds.width; n = xoffset / cw; coff = xoffset % cw; } else { w = 0; for (p = s, n = 0; *p != '\0' && n < len; ++p, ++n) { cw = XTextWidth(xf, p, 1); w += cw; if (w > xoffset) { break; } } coff = xoffset - w + cw; } if (between && coff > cw/2) { ++n; } return Math::min(n, len); #endif return 0; } /* anachronisms */ #ifdef IS_IMPLIMENTED int Font::Baseline() const { FontBoundingBox b; font_bbox(b); return impl_->default_rep()->display_->to_pixels(b.descent()) - 1; } int Font::Height() const { FontBoundingBox b; font_bbox(b); return impl_->default_rep()->display_->to_pixels(b.ascent() + b.descent()); } int Font::Width(const char* s) const { return impl_->default_rep()->display_->to_pixels(width(s, strlen(s))); } int Font::Width(const char* s, int len) const { return impl_->default_rep()->display_->to_pixels(width(s, len)); } int Font::Index(const char* s, int offset, bool between) const { return impl_->default_rep()->display_->to_pixels( index(s, strlen(s), float(offset), between) ); } int Font::Index(const char* s, int len, int offset, bool between) const { return impl_->default_rep()->display_->to_pixels( index(s, len, float(offset), between) ); } bool Font::FixedWidth() const { FontRep* f = impl_->default_rep(); XFontStruct* xf = f->font_; return xf->min_bounds.width == xf->max_bounds.width; } #endif // ####################################################################### // ##################### class FontFamily // ####################################################################### // ----------------------------------------------------------------------- // constructors and destructors. The X11 version passes a full name of a // font back on font() queries... and the FontRep owns the storage, so we // free up the storage of these mocked up names upon deletion. // ----------------------------------------------------------------------- FontFamilyRep::FontFamilyRep(const char* name) { // ---- record the name ---- int len = strlen(name); family_name_ = new char[len + 1]; strcpy(family_name_, name); } FontFamilyRep::~FontFamilyRep() { int len = name_list_.count(); int i; // ---- delete stored font names ---- for (i=0; ifont(size, style, name, scale); } neuron-7.6.3/src/lib/IV-Win/ivclean.cpp000077500000000000000000000111171340731477100176030ustar00rootroot00000000000000#include <../../config.h> /* Copyright (C) 2002 Michael Hines This file contains programs and data originally developed by Michael Hines This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* ivclean.cpp is probably obsolete now. It was needed for mswin 3.1 on exit to avoid leaking of windows resources. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include extern void ivcleanup_add_window(Window*); extern void ivcleanup_remove_window(Window*); extern void ivcleanup_after_window(Window*); declarePtrList(DWList, Window) implementPtrList(DWList, Window) static DWList dwl_; static DWList after_list_; extern "C" { void ivcleanup(); int iv_windows_exist(); } //extern void cleanup_new_fnt(); int iv_windows_exist() { return (dwl_.count() + after_list_.count()) ? 1 : 0; } void ivcleanup() { return; // MessageBox(NULL, "ivcleanup()", "ivclean.cpp", MB_OK); while (dwl_.count()) { Window* w = dwl_.item(0); delete w; } while (after_list_.count()) { Window* w = after_list_.item(0); delete w; } // delete arrow; // delete crosshairs; // worked for a few days then complaints from bchk delete ltextCursor; delete rtextCursor; // delete hourglass; // delete upperleft; // delete upperright; // delete lowerleft; // delete lowerright; delete noCursor; delete WidgetKit::instance(); delete LayoutKit::instance(); delete Session::instance(); // cleanup_new_fnt(); } void ivcleanup_add_window(Window* w) { //return; //MessageBox(NULL, "ivcleanup_add_window", "xxx", MB_OK); dwl_.append(w); } void ivcleanup_remove_window(Window* w) { //return; long i, cnt = dwl_.count(); for (i=0; i < cnt; ++i) { if (w == dwl_.item(i)) { //MessageBox(NULL, "ivcleanup_remove_window - removed", "xxx", MB_OK); dwl_.remove(i); return; } } cnt = after_list_.count(); for (i=0; i < cnt; ++i) { if (w == after_list_.item(i)) { after_list_.remove(i); return; } } } void ivcleanup_after_window(Window* w) { //return; // sometimes a window references this window. So if this happens // to be deleted first then when the referencing window deletes // it, then error. This semi-prevents this from happening. // It would be better if Window was a Resource but that is // a serious modification to InterViews. ivcleanup_remove_window(w); after_list_.append(w); } static Extension* ext; void iv_rescale_map() { Display& d = *Session::instance()->default_display(); long i, cnt = dwl_.count(); RECT r; Window* w; //printf("iv_rescale_map %d\n", cnt); for (i=0; i < cnt; ++i) { w = dwl_.item(i); long dummy; if (w->style() && w->style()->find_attribute("nrn_virtual_screen", dummy)) { GetWindowRect(dwl_.item(i)->rep()->msWindow(), &r); w->resize(); MoveWindow(w->rep()->msWindow(), r.left, r.top, r.right - r.left, r.bottom - r.top, TRUE); }else{ r.left = d.to_pixels(ext[i].left(), Dimension_X); r.right = d.to_pixels(ext[i].right(), Dimension_X); r.top = d.to_pixels(ext[i].top(), Dimension_Y); r.bottom = d.to_pixels(ext[i].bottom(), Dimension_Y); MoveWindow(w->rep()->msWindow(), r.left, r.top, r.right - r.left, r.bottom - r.top, TRUE); } } delete [] ext; } void iv_rescale_unmap() { Display& d = *Session::instance()->default_display(); long i, cnt = dwl_.count(); //printf("iv_rescale_unmap %d\n", cnt); ext = new Extension[cnt]; RECT r; for (i=0; i < cnt; ++i) { GetWindowRect(dwl_.item(i)->rep()->msWindow(), &r); ext[i].set_xy(nil, d.to_coord(r.left, Dimension_X), d.to_coord(r.bottom, Dimension_Y), d.to_coord(r.right, Dimension_X), d.to_coord(r.top, Dimension_Y) ); } } neuron-7.6.3/src/lib/IV-Win/mprinter.cpp000066400000000000000000000172521340731477100200250ustar00rootroot00000000000000#include <../../config.h> /* Copyright (C) 2002 Michael Hines This file contains programs and data originally developed by Michael Hines This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* mprinter.cpp Allow use of Window's printer. Code hacked from the Mac version. */ #include #include #include #include #include //#include "/nrn/src/mswin/winio/debug.h" class MacPrinterCanvas : public MWcanvas16 { public: MacPrinterCanvas(); virtual ~MacPrinterCanvas(); bool get(); void start(float scale); void finish(); void setup(bool); virtual Window* window() const; virtual void size(Coord width, Coord height); virtual void psize(int width, int height); virtual void resize(Coord, Coord, Coord, Coord); virtual Coord width() const; virtual Coord height() const; virtual PixelCoord pwidth() const; virtual PixelCoord pheight() const; virtual PixelCoord to_pixels(Coord x, DimensionName)const; virtual Coord to_coord(PixelCoord x, DimensionName)const; private: HDC GetPrinterDC(); virtual void setmapmode(HDC); private: HDC hdc; int hres_, vres_, lpx_, lpy_; float scale_; }; MacPrinterCanvas::MacPrinterCanvas() { hdc = nil; setup(false); } MacPrinterCanvas::~MacPrinterCanvas() { if (hdc) { DeleteDC(hdc); } } Window* MacPrinterCanvas::window()const { //DebugMessage("MacPrinter::window()\n"); return nil; } void MacPrinterCanvas::size(Coord, Coord) {}; void MacPrinterCanvas::psize(int, int) {}; void MacPrinterCanvas::resize(Coord, Coord, Coord, Coord) {} Coord MacPrinterCanvas::width() const { return Coord(hres_)/float(lpx_)*72.; } Coord MacPrinterCanvas::height() const { return Coord(vres_)/float(lpy_)*72.; } PixelCoord MacPrinterCanvas::pwidth() const { return hres_; } PixelCoord MacPrinterCanvas::pheight() const { return vres_; } PixelCoord MacPrinterCanvas::to_pixels(Coord x, DimensionName)const { return int(x/72.*lpx_); } Coord MacPrinterCanvas::to_coord(PixelCoord x, DimensionName)const { return Coord(x)*float(lpx_)/72.; } MacPrinter::MacPrinter(ostream*) : Printer(nil){ c = new MacPrinterCanvas(); } MacPrinter::~MacPrinter() { delete c; } Window* MacPrinter::window()const { //DebugMessage("MacPrinter::window()\n"); return nil; } void MacPrinter::setup(bool b) { c->setup(b); } void MacPrinterCanvas::setup(bool) {} void MacPrinterCanvas::setmapmode(HDC hdc) { int s = int(1440./scale_); MWassert(SetMapMode(hdc, MM_ANISOTROPIC)); //MWassert(SetWindowExtEx(hdc, 1440, 1440, NULL)); MWassert(SetWindowExtEx(hdc, s, s, NULL)); MWassert(SetViewportExtEx(hdc, GetDeviceCaps(hdc, LOGPIXELSX), -GetDeviceCaps(hdc, LOGPIXELSY), NULL)); } HDC MacPrinterCanvas::GetPrinterDC(){ #if 1 PRINTDLG pd; // Initialize PRINTDLG ZeroMemory(&pd, sizeof(PRINTDLG)); pd.lStructSize = sizeof(PRINTDLG); pd.hwndOwner = NULL; pd.hDevMode = NULL; // Don't forget to free or store hDevMode pd.hDevNames = NULL; // Don't forget to free or store hDevNames pd.Flags = PD_USEDEVMODECOPIESANDCOLLATE | PD_RETURNDC; pd.nCopies = 1; pd.nFromPage = 0xFFFF; pd.nToPage = 0xFFFF; pd.nMinPage = 1; pd.nMaxPage = 0xFFFF; if (PrintDlg(&pd)==TRUE) { return pd.hDC; } #else static char szPrinter[80]; char* szDevice, *szDriver, *szOutput; szDevice=szPrinter; GetProfileString("windows", "device", ",,,", szPrinter, 80); if (NULL != (szDevice = strtok(szPrinter, ",")) && NULL != (szDriver = strtok(NULL, ", ")) //&& NULL != (szOutput = strtok(NULL, ", ")) ) { return CreateDC(szDriver, szDevice, NULL, NULL); } #endif return 0; } void MacPrinter::prolog(float scale) {c->start(scale);} void MacPrinter::prolog(const char*) {c->start(1.);} bool MacPrinter::get() { return c->get(); } bool MacPrinterCanvas::get() { if (!hdc) { hdc = GetPrinterDC(); } if (!hdc) { //DebugMessage("hdc = null\n"); return false; } hres_ = GetDeviceCaps(hdc, HORZRES); vres_ = GetDeviceCaps(hdc, VERTRES); lpx_ = GetDeviceCaps(hdc, LOGPIXELSX); lpy_ = GetDeviceCaps(hdc, LOGPIXELSY); return true; } void MacPrinterCanvas::start(float scale) { static char szMsg[] = "NEURON"; scale_ = scale; if (!get()) { return; } //if (!Escape(hdc, STARTDOC, sizeof szMsg-1, szMsg, NULL)) { //DebugMessage("STARTDOC failed\n"); // abort(); //} DOCINFO di; di.cbSize = sizeof(DOCINFO); di.lpszDocName = "NEURON"; di.lpszOutput = NULL; StartDoc(hdc, &di); StartPage(hdc); // SetMapMode(hdc, MM_TWIPS); int a = GetMapMode(hdc); SIZE b; GetViewportExtEx(hdc, &b); POINT c; GetViewportOrgEx(hdc, &c); XFORM d; GetWorldTransform(hdc, &d); if (a < -10) { return; } damage_all(); RECT r; //SetRectRgn(&r, 0, 0, hres_/2, vres_/2); r.left = 0; r.top=0; r.right = hres_; r.bottom=vres_; beginPaint(hdc, r); //SelectClipRgn(hdc, NULL); //d.eM11 = d.eM22 *= 2.; //SetWorldTransform(hdc, &d); } void MacPrinter::epilog() {c->finish();} void MacPrinterCanvas::finish() { if (!hdc) {return;} endPaint(); //if (!Escape(hdc, NEWFRAME, 0, NULL, NULL)) { //DebugMessage("NEWFRAME failed\n"); // abort(); //} //if (!Escape(hdc, ENDDOC, 0, NULL, NULL)) { //DebugMessage("ENDDOC failed\n"); // abort(); //} EndPage(hdc); EndDoc(hdc); DeleteDC(hdc); hdc = 0; } void MacPrinter::resize(Coord, Coord, Coord, Coord) {} Coord MacPrinter::width() const {return c->width();} Coord MacPrinter::height() const {return c->height();} PixelCoord MacPrinter::pwidth() const {return c->pwidth();} PixelCoord MacPrinter::pheight() const {return c->pheight();} void MacPrinter::character( const Font* f, // font to use long ch, // character to print Coord width, // width of the character const Color* co, // color to use Coord x, // x-coordinate Coord y) // y-coordinate { c->character(f, ch, width, co, x, y); } void MacPrinter::transformer(const Transformer& t){c->transformer(t);} const Transformer& MacPrinter::transformer() const {return c->transformer();} void MacPrinter::comment(const char* text) {} void MacPrinter::page(const char* label) {} void MacPrinter::push_transform() {c->push_transform();} void MacPrinter::pop_transform() {c->pop_transform();} void MacPrinter::transform(const Transformer& t) {c->transform(t);} void MacPrinter::push_clipping(bool) {c->push_clipping();} void MacPrinter::pop_clipping() {c->pop_clipping();} void MacPrinter::new_path() {c->new_path();} void MacPrinter::move_to(Coord x, Coord y) {c->move_to(x,y);} void MacPrinter::line_to(Coord x, Coord y) {c->line_to(x,y);} void MacPrinter::curve_to( Coord x, Coord y, Coord x1, Coord y1, Coord x2, Coord y2 ) {c->curve_to(x,y,x1,y1,x2,y2);} void MacPrinter::close_path() {c->close_path();} void MacPrinter::stroke(const Color* color, const Brush* brush) {c->stroke(color,brush);} void MacPrinter::fill(const Color* color) {c->fill(color);} void MacPrinter::clip() {c->clip();} void MacPrinter::stencil( const Bitmap* mask, const Color* color, Coord x, Coord y ) {c->stencil(mask,color,x,y);} void MacPrinter::image(const Raster* raster, Coord x, Coord y) {c->image(raster,x,y);} neuron-7.6.3/src/lib/IV-Win/mwapp.cpp000077500000000000000000000041611340731477100173070ustar00rootroot00000000000000#include <../../config.h> /* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include // ---- ansi/posix includes ---- #include #include #include // If not a DLL, a global application is used #ifndef __DLL__ MWapp theApp; #endif //MWapp* MWapp::registeredApps = NULL; // ####################################################################### // ##################### MWapp class // ####################################################################### MWapp::MWapp() { hinst = 0; pinst = 0; cmdLine = 0; cmdShow = 0; } MWapp::~MWapp() { } void MWapp::setModule(HINSTANCE h, HINSTANCE p, const char* cmd, int show) { hinst = h; pinst = p; cmdLine = cmd; cmdShow = show; } // ----------------------------------------------------------------------- // main event loop // ----------------------------------------------------------------------- int MWapp::run() { MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return 0; } // ----------------------------------------------------------------------- // application name // ----------------------------------------------------------------------- const char* MWapp::appName() { return "TBD"; } void MWapp::appName(const char*) { } neuron-7.6.3/src/lib/IV-Win/mwlib.cpp000077500000000000000000000070611340731477100172770ustar00rootroot00000000000000#include <../../config.h> /* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ======================================================================= // // // // General definitions for the MW library, a library implementing an // object oriented structure on top of MS-Windows. // // // ======================================================================== // ---- local includes ---- #include #include #include #ifndef WIN32 #include #endif // ---- ansi/posix includes ---- #include #include // ---------------------------------------------------------------------- // Visual assertion message. This is provided in response to the // failure of an assertion test... ie it's a bug trap. // ---------------------------------------------------------------------- void mwAssertion( const char* msg, // message to display const char* file, // file where it happened unsigned int line) // line where it happened { char buff[135]; sprintf(buff,"at line %u, file %s: `%s'", line, file, msg); MessageBeep(0); if (MessageBox(0, buff, "Assertion Failed", MB_OKCANCEL | MB_ICONSTOP | MB_TASKMODAL) != IDOK) { exit(1); } } #ifndef WIN32 // ---------------------------------------------------------------------- // global new and delete operators // ---------------------------------------------------------------------- MMgpAlloc allocator; void* operator new(size_t size) { #ifdef __LARGE__ return allocator.alloc(size); #else NOT SUPPORTED #endif } void operator delete(void* ptr) { if (ptr) { #ifdef __LARGE__ allocator.free(ptr); #else NOT SUPPORTED #endif } } #endif /* WIN32 */ // -------------------------------------------------------------------- // style debug stuff. // -------------------------------------------------------------------- void dumpStyle(Style* s, const char* path) { const NullTerminatedString nm(*s->name()); // style name long i; // tmp index char buff[512]; // ---- load the attributes ---- long nattr = s->attribute_count(); for (i = 0; i < nattr; i++) { String an; String av; if (s->attribute(i, an, av)) { NullTerminatedString aname(an); NullTerminatedString avalue(av); const char* adjusted = aname.string(); while (*(adjusted) == '*') adjusted++; sprintf(buff,"%s*%s: %s\n", path, adjusted, avalue.string()); OutputDebugString(buff); } } // ---- do all child styles ---- long nchild = s->children(); for (i = 0; i < nchild; i++) { Style* c = s->child(i); const NullTerminatedString cnm(*c->name()); // style name if (c) { sprintf(buff,"%s*%s", path, cnm.string()); dumpStyle(c, buff); } } } neuron-7.6.3/src/lib/IV-Win/raster.cpp000077500000000000000000000131701340731477100174630ustar00rootroot00000000000000#include <../../config.h> /* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ========================================================================= // // // // MS-Windows implementation of the InterViews Raster class. // // A memory device context is used to store the raster. The peek and poke // operations simply get translated to calls that get and set pixel values // the the memory device context. // // ======================================================================== #include #include #include #include #include #include Raster::Raster( unsigned long width, // width of bitmap in pixels unsigned long height) // height of bitmap in pixels { // // Create a memory device context of the size needed for the bitmap, // that is compatible with the desktop for later blt operations. // This form of raster is completely uninitialized, and must be filled // with poke() calls. // HDC hdc = GetDC(NULL); rep_ = new RasterRep(hdc); SelectObject(rep_->deviceContext(), CreateCompatibleBitmap(hdc, width, height)); ReleaseDC(NULL, hdc); rep_->width_ = width; rep_->height_ = height; } Raster::Raster(const Raster& ras) { // // copy constructor. We basically create another memory device context // compatible with the current one and copy the contents with a blt. // rep_ = new RasterRep(ras.rep()->deviceContext()); BitBlt(rep_->deviceContext(), 0, 0, ras.pwidth(), ras.pheight(), ras.rep()->deviceContext(), 0, 0, SRCCOPY); rep_->width_ = ras.pwidth(); rep_->height_ = ras.pheight(); } Raster::~Raster() { delete rep_; } // ------------------------------------------------------------------------- // These function simply query the resolution of the memory device context. // The width() and height() functions also scale for the resolution of the // current display in the session. // ------------------------------------------------------------------------- Coord Raster::width() const { Display* d = Session::instance()->default_display(); return d->to_coord(rep_->width_, Dimension_X); } Coord Raster::height() const { Display* d = Session::instance()->default_display(); return d->to_coord(rep_->height_, Dimension_Y); } unsigned long Raster::pwidth() const { return rep_->width_; } unsigned long Raster::pheight() const { return rep_->height_; } // ----------------------------------------------------------------------- // should provide reasonable return values. // ----------------------------------------------------------------------- Coord Raster::left_bearing() const { return Coord(0); } Coord Raster::right_bearing() const { return width(); } Coord Raster::ascent() const { return height(); } Coord Raster::descent() const { return Coord(0); } // ----------------------------------------------------------------------- // Pixel access. Note the the orgin of the Raster is the lower left // corner, but for the MS-Windows bitmap it is the upper left corner // so translation is done for pixel access. // ----------------------------------------------------------------------- void Raster::peek( unsigned long x, // x coordinate of pixel queried unsigned long y, // y coordinate of pixel queried ColorIntensity& red, ColorIntensity& green, ColorIntensity& blue, float& alpha) const { // ---- get the pixel value ---- COLORREF pixelColor = GetPixel(rep_->deviceContext(), x, rep_->height_-y); // --- convert from RGB to intensity ---- ColorIntensity scaleFactor(255.0); red = GetRValue(pixelColor) / scaleFactor; green = GetGValue(pixelColor) / scaleFactor; blue = GetBValue(pixelColor) / scaleFactor; alpha = 1.0; } void Raster::poke( unsigned long x, unsigned long y, ColorIntensity red, ColorIntensity green, ColorIntensity blue, float alpha) { // ---- get the desired RGB components ---- ColorIntensity scaleFactor(255.0); int r = (int) (red * scaleFactor); int g = (int) (green * scaleFactor); int b = (int) (blue * scaleFactor); // ---- make sure it's in the palette ---- // In MS-Windows the palette stuff works even if there isn't a palette // as long as you don't use palette index values. ColorRep::defaultPalette()->addEntry(r, g, b); // ---- set the pixel ---- COLORREF pixelColor = PALETTERGB( LOBYTE(r), LOBYTE(g), LOBYTE(b)); SetPixel(rep_->deviceContext(), x, rep_->height_ - y, pixelColor); } void Raster::flush() const { // This is a no-op for the MS-Windows implementation. } // ##################################################################### // ###################### class RasterRep // ##################################################################### RasterRep::RasterRep(HDC hdc) { hdcMem = CreateCompatibleDC(hdc); } RasterRep::~RasterRep() { DeleteDC(hdcMem); } neuron-7.6.3/src/lib/IV-Win/session.cpp000066400000000000000000000615521340731477100176520ustar00rootroot00000000000000#include <../../config.h> /* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ======================================================================= // // // // Session management for an application. This class is a clearing house // for the control part of an application. // // // ======================================================================== /* * THIS FILE CONTAINS PORTIONS OF THE InterViews 3.1 DISTRIBUTION THAT * CONTAINED THE FOLLOWING COPYRIGHT: * * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #ifdef CYGWIN #include #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef CYGWIN #include #include #include #include #include #else #include #endif Session* SessionRep::instance_; extern "C" { int bad_install_ok = 0; } const char* SECTION_NAME = "InterViews"; // This is the name of the section in the WIN.INI file where the // configuration information should be fetched from. The .ini files // are used in Win32 so that things will work with Win32s. const char* LOCATION_KEY = "location"; // This is the key used to fetch the value of the location of the // top of the configuration directory. Things like application // defaults live at this location. const char* APPDEF_DEFAULT = SECTION_NAME; // Name of the default application defaults file. This should contain // style definitions that are defaults for the entire library. const char* APPDEF_DEFAULT_ALT = "intervie"; // win3.1 install and using NT const char* APPDEF_DIRECTORY = "app-defaults"; // This is the name of the directory where the default style information // lives. In X-Windows this is called app-defaults. Each application // is expected to have a file in this directory to establish reasonable // default behavior. const char* APPDEF_DIR_ALT = "app-defa"; // win3.1 install and using NT static char* INSTALL_LOCATION = NULL; // pathname of the installation location.... determined by reading the // win.ini file and querying the location key. // ----------------------------------------------------------------------- // Predefined command-line options. // ----------------------------------------------------------------------- static OptionDesc defoptions[] = { { "-background", "*background", OptionValueNext }, { "-bg", "*background", OptionValueNext }, { "-dbuf", "*double_buffered", OptionValueImplicit, "on" }, { "-display", "*display", OptionValueNext }, { "-dpi", "*dpi", OptionValueNext }, { "-fg", "*foreground", OptionValueNext }, { "-flat", "*flat", OptionValueNext }, { "-fn", "*font", OptionValueNext }, { "-font", "*font", OptionValueNext }, { "-foreground", "*foreground", OptionValueNext }, { "-geometry", "*geometry", OptionValueNext }, { "-iconic", "*iconic", OptionValueImplicit, "on" }, { "-monochrome", "*gui", OptionValueImplicit, "monochrome" }, { "-motif", "*gui", OptionValueImplicit, "Motif" }, { "-mswin", "*gui", OptionValueImplicit, "mswin" }, { "-name", "*name", OptionValueNext }, { "-nodbuf", "*double_buffered", OptionValueImplicit, "off" }, { "-noshape", "*shaped_windows", OptionValueImplicit, "off" }, { "-openlook", "*gui", OptionValueImplicit, "OpenLook" }, { "-reverse", "*reverseVideo", OptionValueImplicit, "on" }, { "-rv", "*reverseVideo", OptionValueImplicit, "on" }, { "-shape", "*shaped_windows", OptionValueImplicit, "on" }, { "-smotif", "*gui", OptionValueImplicit, "SGIMotif" }, { "-synchronous", "*synchronous", OptionValueImplicit, "on" }, { "+synchronous", "*synchronous", OptionValueImplicit, "off" }, { "-title", "*title", OptionValueNext }, { "-visual", "*visual", OptionValueNext }, { "-visual_id", "*visual_id", OptionValueNext }, { "-xrm", nil, OptionPropertyNext }, #ifdef sgi { "-malloc", "*malloc_debug", OptionValueImplicit, "on" }, #endif { nil } }; #ifdef CYGWIN /* * in cygwin, this is a no-op -- just a way of using select to wait for events */ static int windows_messages_fd = -1; // file number for select for windows messages class SessionIOHandler : public IOHandler { public: SessionIOHandler(SessionRep*, Display*); virtual int inputReady(int); private: SessionRep* session_; Display* display_; }; SessionIOHandler::SessionIOHandler(SessionRep* s, Display* d) { session_ = s; display_ = d; } int SessionIOHandler::inputReady(int) { // session_->handle_display_input(display_); return 0; } #endif // ####################################################################### // ##################### SessionRep class // ####################################################################### SessionRep::SessionRep() { #ifdef WIN32 // The nice thing about NT is that you don't have to have the WinMain() // style of program entry... so under NT we enter under main so we get // a normal main(int,char**) and our source can go unchanged. Also, this // way printf and friends work as well :-). // // The only side effect is that the module instance handle is still // needed, so we set it here. theApp.hinst = GetModuleHandle(NULL); #endif } SessionRep::~SessionRep() { delete name_; Resource::unref(style_); delete argv_; } // ----------------------------------------------------------------------- // Set the style information for the given display (which is ignored by // the MS-Windows version since there is only one display! The Windows // version uses the profile string out of the users win.ini file to locate // the file containing the application defaults // ----------------------------------------------------------------------- // Hines: need to read the style in app-defa/intervie before // creating a display since we need to deal with mswin_scale. Style* iv_display_style_; // see display.cpp void SessionRep::set_style(Display* d) { Style* s; #if !OCSMALL if (Session::installLocation()) { char buf[512]; sprintf(buf, "%s\\%s\\%s", Session::installLocation(), APPDEF_DIRECTORY, APPDEF_DEFAULT); FILE* f; if ((f = fopen(buf, "r")) == (FILE*)0) { char buf2[512]; sprintf(buf2, "%s\\%s\\%s", Session::installLocation(), APPDEF_DIR_ALT, APPDEF_DEFAULT_ALT); if ((f = fopen(buf2, "r")) == (FILE*)0) { #ifdef CYGWIN // if we don't find the app defaults, just don't read them! s = new Style(*style_); load_props(s, props_, -5); iv_display_style_ = s; s->ref(); #else char buf3[1024]; sprintf(buf3, "Can't open InterViews resources file in either\n%s or\n%s", buf, buf2); MessageBox(NULL, buf3, "Invalid Installation", MB_OK); abort(); #endif } APPDEF_DIRECTORY = APPDEF_DIR_ALT; APPDEF_DEFAULT = APPDEF_DEFAULT_ALT; } fclose(f); s = new Style(*style_); load_app_defaults(s, APPDEF_DEFAULT, -5); load_props(s, props_, -10); load_app_defaults(s, classname_, -5); }else #endif { s = new Style(*style_); load_props(s, props_, -5); } iv_display_style_ = s; s->ref(); //d->style(s); } void SessionRep::load_app_defaults(Style* s, const char* leafName, int priority) { const char* topDir = Session::installLocation(); if (topDir) { char subPath[80]; sprintf(subPath,"/%s/%s", APPDEF_DIRECTORY, leafName); load_path(s, topDir, subPath, priority); } } // ----------------------------------------------------------------------- // Property parsing errors // ----------------------------------------------------------------------- void SessionRep::missing_colon(const String& s) { char buff[135]; const char* property = s.string(); sprintf(buff, "Missing colon in property: %s", property); WindowRep::errorMessage(buff); // NOT REACHED } void SessionRep::bad_property_name(const String& s) { char buff[135]; const char* property = s.string(); sprintf(buff, "Bad property name: %s", property); WindowRep::errorMessage(buff); // NOT REACHED } void SessionRep::bad_property_value(const String& s) { char buff[135]; const char* property = s.string(); sprintf(buff, "Bad property value: %s", property); WindowRep::errorMessage(buff); // NOT REACHED } // ----------------------------------------------------------------------- // Use ICCCM rules to find an application's instance name from the command // line or an environment variable. // ----------------------------------------------------------------------- String* SessionRep::find_name() { String name; if (find_arg(String("-name"), name)) { return new String(name); } if (argc_ > 0) { String s(argv_[0]); int slash = s.rindex('/'); if (slash >= 0) { s = s.right(slash + 1); } return new String(s); } return new String("noname"); } // ----------------------------------------------------------------------- // Open the default display and initialize its style information. For the // MS-Windows version, this doesn't do much since there is only one display. // ----------------------------------------------------------------------- void SessionRep::init_display() { #if defined(CYGWIN) || defined(MINGW) bad_install_ok = true; // we're going to be ok with this! #endif set_style(nil); display_ = Display::open(); display_->style(iv_display_style_); connect(display_); } void SessionRep::connect(Display* d) { #ifdef CYGWIN windows_messages_fd = open("/dev/windows", O_RDONLY); if(windows_messages_fd < 0) { printf("error: could not connect to /dev/windows device for windows messages\n"); return; } Dispatcher::instance().link (windows_messages_fd, Dispatcher::ReadMask, new SessionIOHandler(this, d)); #endif // set_style(d); } // ----------------------------------------------------------------------- // Report that an argument is bad and exit. A caller of this function // may assume that it does not return. // // We also assume that arg is null-terminated (because it came // from argv). // ----------------------------------------------------------------------- void SessionRep::bad_arg(const char* fmt, const String& arg) { char buff[135]; sprintf(buff, fmt, arg.string()); WindowRep::errorMessage(buff); // NOT REACHED } // ####################################################################### // ##################### Session (unportable part) // ####################################################################### // ----------------------------------------------------------------------- // This function is an extension of the InterViews distribution. // A pathname of location of the installation directory tree is // returned, that can be used to locate various pieces of configuration // information (such as application defaults). // // This location is found under MS-Windows using the win.ini file (Uses // the Win16 interface so that Win32s works... which doesn't support the // registry at this time). // ----------------------------------------------------------------------- const char* Session::installLocation() { static int first = 1; if (first && INSTALL_LOCATION == NULL) { first = 0; // ---- get the location of the configuration directory ---- const int topLen = 256; char buff[topLen]; // maybe it hasn't been installed. So try NEURONHOME first // in case, say, we are running from a cd-rom. char* nh = getenv("NEURONHOME"); int len = 0; if (nh) { sprintf(buff, "%s\\iv", nh); DIR* dirp = opendir(buff); if (dirp) { closedir(dirp); len = strlen(buff); } } if (len == 0) { len = GetProfileString(SECTION_NAME, LOCATION_KEY, "", buff, topLen); } if (len == 0) { // // The installation directory can't be found... so we bail out // here because all sorts of things won't work when this is the // case. // if (!bad_install_ok) { sprintf(buff,"win.ini is missing `%s' in section `%s'", LOCATION_KEY, SECTION_NAME); MessageBox(0, buff, "Invalid Installation", MB_OK | MB_ICONSTOP | MB_TASKMODAL); abort(); } } else { INSTALL_LOCATION = new char[len + 1]; strncpy(INSTALL_LOCATION, buff, len); INSTALL_LOCATION [len] = 0; } } return INSTALL_LOCATION; } // ----------------------------------------------------------------------- // The following are initially completely unsupported under MS-Windows. // Some crude support could be accomplished here, but this interface really // should be discouraged! // ----------------------------------------------------------------------- void Session::read(Event& e) { #ifdef CYGWIN if(windows_messages_fd >= 0) { // if we have set select to monitor /dev/windows, then we can use one event loop! // if we have waiting messages, process them! MSG msg; if(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { // if we got a windows event, process it LPMSG emsg = &(e.rep()->msg); rep_->done_ = (GetMessage(emsg, NULL, 0, 0)) ? false : true; return; } // otherwise, wait for a msg Dispatcher::instance().dispatch();// wait till we get an event to process // if it is a windows message, do that if(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { // if we got a windows event, process it LPMSG emsg = &(e.rep()->msg); rep_->done_ = (GetMessage(emsg, NULL, 0, 0)) ? false : true; } // otherwise do nothing! } else { long sec = 0; long usec = 100; Dispatcher::instance().dispatch(sec, usec); // send any keyboard events #endif LPMSG msg = &(e.rep()->msg); rep_->done_ = (GetMessage(msg, NULL, 0, 0)) ? false : true; // but then it blocks here at getmessage, so keyboard events need to be // enabled by touching a window and thereby generating events. // need to somehow have all events go through single select-like function // but GetMessage doesn't work on console input, and select doesnt! #ifdef CYGWIN } #endif } /* * Read an event as above, but time out after a given (sec, usec) delay. * Return true if an event was read, false if the time-out expired. */ bool Session::read(long, long, Event&) { WindowRep::errorMessage("Session::read - unsupported"); // NOT REACHED return false; } /* * Check for a pending event, returning it if there is one. */ bool SessionRep::check(Event&) { WindowRep::errorMessage("Session::check - unsupported"); return false; } /* * Put an event back from whence it came. */ void Session::unread(Event&) { WindowRep::errorMessage("Session::unread - unsupported"); } /* * Poll an event (implies the event already has an associated display). */ void Session::poll(Event&) { WindowRep::errorMessage("Session::poll - unsupported"); } // ####################################################################### // ############### Session class (portable part) // ####################################################################### Session::Session( const char* classname, int& argc, char** argv, const OptionDesc* opts, const PropertyData* initprops) { SessionRep::instance_ = this; rep_ = new SessionRep(); rep_->init(classname, argc, argv, opts, initprops); } Session::~Session() { delete rep_; } Session* Session::instance() { return SessionRep::instance_; } const char* Session::name() const { return rep_->name_->string(); } const char* Session::classname() const { return rep_->classname_; } int Session::argc() const { return rep_->argc_; } char** Session::argv() const { return rep_->argv_; } Style* Session::style() const { SessionRep* s = rep_; if (s->display_ != nil) return s->display_->style(); return s->style_; } // ----------------------------------------------------------------------- // These have no equivalent in MS-Windows as there is no network-based // graphics available. // ----------------------------------------------------------------------- void Session::default_display(Display*) { } Display* Session::default_display() const { return rep_->display_; } Display* Session::connect(const String&) { return rep_->display_; } Display* Session::connect(const char*) { return rep_->display_; } void Session::disconnect(Display*) { #ifdef CYGWIN if(windows_messages_fd >= 0) { Dispatcher::instance().unlink(windows_messages_fd); close(windows_messages_fd); windows_messages_fd = -1; } #endif } // ----------------------------------------------------------------------- // Event loops // ----------------------------------------------------------------------- int Session::run() { Event e; bool& done = rep_->done_; done = false; do { read(e); e.handle(); } while (!done); return 0; } int Session::run_window(Window* w) { w->map(); return run(); } void Session::quit() { rep_->done_ = true; // PostQuitMessage(1); } void Session::unquit() { rep_->done_ = false; } /* * Return loop status. */ bool Session::done() const { return rep_->done_; } /* * Check if an event is pending on any display. */ bool Session::pending() const { // WindowRep::errorMessage("Session::pending - unsupported"); // return false; MSG msg; return PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE); } // ----------------------------------------------------------------------- // Initialize.... loading the styles based upon command line arguments // and the application defaults settings. // ----------------------------------------------------------------------- void SessionRep::init( const char* name, int& argc, char** argv, const OptionDesc* opts, const PropertyData* initprops) { done_ = false; argc_ = argc; argv_ = new char*[argc + 1]; for (int i = 0; i < argc; i++) { argv_[i] = argv[i]; } argv_[argc_] = nil; init_style(name, initprops); if (opts != nil) { parse_args(argc, argv, opts); } parse_args(argc, argv, defoptions); init_display(); // ---- build default cursors ---- Cursor::init(); #ifdef sgi if (style_->value_is_on("malloc_debug")) { mallopt(M_DEBUG, 1); } #endif } /* * Parse the argument list, setting any properties that are specified * by the option list. Matching arguments are removed (in-place) * from the argument list. */ void SessionRep::parse_args(int& argc, char** argv, const OptionDesc* opts) { int i; int newargc = 1; char* newargv[1024]; newargv[0] = argv[0]; for (i = 1; i < argc; i++) { bool matched = false; String arg(argv[i]); for (const OptionDesc* o = &opts[0]; o->name != nil; o++) { if (match(arg, *o, i, argc, argv)) { matched = true; break; } } if (!matched) { newargv[newargc] = argv[i]; ++newargc; } } if (newargc < argc) { for (i = 1; i < newargc; i++) { argv[i] = newargv[i]; } argc = newargc; argv[argc] = nil; } } /* * See if the given argument matches the option description. */ bool SessionRep::match( const String& arg, const OptionDesc& o, int& i, int argc, char** argv) { String opt(o.name); if (arg != opt) { if (o.style == OptionValueAfter) { int n = opt.length(); if (opt == arg.left(n)) { style_->attribute(String(o.path), arg.right(n)); return true; } } return false; } String name, value; extract(arg, o, i, argc, argv, name, value); style_->attribute(name, value); return true; } /* * Extract an attribute from a given argument. */ void SessionRep::extract( const String& arg, const OptionDesc& o, int& i, int argc, char** argv, String& name, String& value) { int colon; switch (o.style) { case OptionPropertyNext: value = next_arg(i, argc, argv, "missing property after '%s'", arg); colon = value.index(':'); if (colon < 0) { bad_arg("missing ':' in '%s'", value); } else { name = value.left(colon); value = value.right(colon+1); } break; case OptionValueNext: name = o.path; value = next_arg(i, argc, argv, "missing value after '%s'", arg); break; case OptionValueImplicit: name = o.path; value = o.value; break; case OptionValueIsArg: name = o.path; value = arg; break; case OptionValueAfter: bad_arg("missing value in '%s'", arg); break; } } /* * Make sure there is another argument--if not generate an error. */ String SessionRep::next_arg( int& i, int argc, char** argv, const char* message, const String& arg) { ++i; if (i == argc) { bad_arg(message, arg); } return String(argv[i]); } /* * Find the value for a specific argument. */ bool SessionRep::find_arg( const String& arg, String& value) { int last = argc_ - 1; for (int i = 1; i < last; i++) { if (arg == argv_[i]) { value = String(argv_[i+1]); return true; } } return false; } /* * Initialize style information for the session. */ void SessionRep::init_style( const char* name, const PropertyData* props) { classname_ = name; name_ = find_name(); style_ = new Style(*name_); Resource::ref(style_); style_->alias(classname_); props_ = props; } void SessionRep::load_props( Style* s, const PropertyData* props, int priority) { if (props != nil) { for (const PropertyData* p = &props[0]; p->path != nil; p++) { s->attribute(String(p->path), String(p->value), priority); } } } void SessionRep::load_path( Style* s, const char* head, const char* tail, int priority) { String h(head); String t(tail); char* buff = new char[strlen(head) + strlen(tail) + 1]; sprintf(buff, "%s%s", head, tail); load_file(s, buff, priority); delete [] buff; } void SessionRep::load_file( Style* s, const char* filename, int priority) { InputFile* f = InputFile::open(String(filename)); if (f == nil) { return; } const char* start; int len = f->read(start); if (len > 0) { load_list(s, String(start, len), priority); } f->close(); delete f; } void SessionRep::load_list( Style* s, const String& str, int priority) { const char* p = str.string(); const char* q = p + str.length(); const char* start = p; for (; p < q; p++) { if (*p == '\n') { if (p > start && *(p-1) != '\\') { const char* q = p; if (*(q-1) == '\r') {q--;} load_property(s, String(start, (int)(q - start)), priority); start = p + 1; } } } } void SessionRep::load_property( Style* s, const String& prop, int priority) { String p(strip(prop)); if (p.length() == 0 || p[0] == '!') { return; } int colon = p.index(':'); if (colon < 0) { missing_colon(p); } else { String name(strip(p.left(colon))); String value(strip(p.right(colon + 1))); if (name.length() <= 0) { bad_property_name(name); } else if (value.length() <= 0) { bad_property_value(value); } else { s->attribute(name, value, priority); } } } String SessionRep::strip(const String& s) { int i = 0; int len = s.length(); for (i = 0; i < len && isspace(s[i]); i++); int j = len - 1; for (; j >= 0 && isspace(s[j]); j--); return s.substr(i, j - i + 1); } neuron-7.6.3/src/lib/IV-Win/window.cpp000066400000000000000000001660611340731477100174770ustar00rootroot00000000000000#include <../../config.h> /* Copyright (C) 1993 Tim Prinzing Copyright (C) 2002 Tim Prinzing, Michael Hines This file contains programs and data originally developed by Tim Prinzing with minor changes and improvements by Michael Hines. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ======================================================================= // // // // MS-Windows implementation of the InterViews Window classes. The // WndProc callback procedure is used to dispatch the received messages // to their associated WindowRep instance. The common messages have a // corresponding function in the WindowRep class. Those messages not // directly turned into function calls have the opportunity to be trapped // by reimplimenting the WindowRep::WndProc function which handles any // unrecognized messages. // // // ======================================================================== /* * THIS FILE CONTAINS PORTIONS OF THE InterViews 3.1 DISTRIBUTION THAT * CONTAINED THE FOLLOWING COPYRIGHT: * * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // #include "\nrn\src\winio\debug.h" #include // ---- templates ---- declarePtrList(MWcursorPtrList, Cursor) implementPtrList(MWcursorPtrList, Cursor) declareTable(MWcontrolTable, long, MWchild*) implementTable(MWcontrolTable, long, MWchild*) declareTable(MWcontrolHWND, HWND, MWchild*) implementTable(MWcontrolHWND, HWND, MWchild*) // --- global event for rapid processing ---- static Event* input_e = 0; static EventRep* input_er = 0; // Names of the classes that get registered by InterViews applications. const char* WINDOW_CLASSNAME = "ivWindow"; const char* POPUP_CLASSNAME = "ivPopupWindow"; const char* TOPLEVEL_CLASSNAME = "ivTopLevelWindow"; // Properties used to hold the pointer to the C++ window object that is // associated with the MS-Windows window. const char* PROP_PTR = "mw_ptr"; // ####################################################################### // ################## MS-Window to C++ window object translation // ####################################################################### // ----------------------------------------------------------------------- // This is the callback function through which MS-Windows communicates // back to the application. We extract a pointer to the associated // InterViews Window objects from two properties stored in the MS-Window. // If the properties can't be found, then the window doesn't have a // c++ object associated with it. // // ----------------------------------------------------------------------- #if defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ > __SIZEOF_LONG__ #define cp2int (unsigned long long) #else #define cp2int /**/ #endif LRESULT CALLBACK WndProc(HWND hwnd, UINT iMessage, WPARAM wParam, LPARAM lParam) { // Pointer to the (C++ object that is the) window. MWwindow* pWindow = (MWwindow*) GetProp(hwnd, PROP_PTR); if ((pWindow == 0) || (iMessage == WM_DESTROY)) { return DefWindowProc( hwnd, iMessage, wParam, lParam ); } else { return pWindow->WndProc( iMessage, wParam, lParam ); } } // ####################################################################### // ################# MWcreateParams class // ####################################################################### MWcreateParams::MWcreateParams() { title = 0; width = CW_USEDEFAULT; // width of the window height = CW_USEDEFAULT; // height of the window x = CW_USEDEFAULT; // x-coordinate screen position y = CW_USEDEFAULT; // y-coordinate screen position parent = 0; // window parent (if any) id = 0; // control id style = WS_OVERLAPPED; // default window style const char* defaultClassname = Session::instance()->classname(); classname = 0; classStyle = CS_HREDRAW | CS_VREDRAW; // ----- default names ---- titleOf(defaultClassname); classnameOf(defaultClassname); } MWcreateParams::~MWcreateParams() { delete [] title; delete [] classname; } void MWcreateParams::titleOf(const char* t) { MWassert(t); if (title) delete [] title; title = new char[strlen(t)+1]; strcpy(title, t); } const char* MWcreateParams::titleOf() { return title; } void MWcreateParams::classnameOf(const char* nm) { MWassert(nm); if (classname) delete [] classname; classname = new char[strlen(nm)+1]; strcpy(classname, nm); } const char* MWcreateParams::classnameOf() { return classname; } // ####################################################################### // ################# MWwindow class // ####################################################################### // ----------------------------------------------------------------------- // constructors and destructors // ----------------------------------------------------------------------- MWwindow::MWwindow() { hwnd = 0; params = new MWcreateParams; } MWwindow::~MWwindow() { delete params; } // ----------------------------------------------------------------------- // The windows callback function forwards the message translation to this // function, which passes common messages to member functions and passes // any unrecognized messages to the windows default handler. // ----------------------------------------------------------------------- long MWwindow::WndProc(UINT message, WPARAM wParam, LPARAM lParam) { // ---- process the message ---- switch(message) { case WM_CREATE: break; case WM_CLOSE: PostQuitMessage(0); break; default: return DefWindowProc(hwnd, message, wParam, lParam); } return 0; } // ----------------------------------------------------------------------- // Window binding functions. bind() actually creates the window and binds // it to this object. unbind() removes the attachment to the MS-Windows // window and destroys it. // ----------------------------------------------------------------------- // mingw + launch python needs all windows to be bound from a specific // thread. #if defined(MINGW) extern "C" { int (*iv_bind_enqueue_)(void(*)(void*), void*); static void wmap1(void* v) { Window* w = (Window*)v; w->map(); } static void hide1(void* v) { HWND hwnd = (HWND)v; ShowWindow(hwnd, SW_HIDE); } static void unbind1(void* v) { HWND hwnd = (HWND)v; RemoveProp(hwnd, PROP_PTR); DestroyWindow(hwnd); } static void mwmap1(void* v) { HWND hwnd = (HWND)v; ShowWindow(hwnd, SW_SHOW); UpdateWindow(hwnd); } } #endif void MWwindow::bind() { // ---- if already bound... nothing to do ---- if (hwnd) return; // ---- make sure window class is registered ---- HINSTANCE hInstance = theApp.hinst; registerClass(hInstance); // ---- create the window ---- hwnd = CreateWindowEx( params->styleEx, // extended style information params->classnameOf(), // See registerClass() call. params->titleOf(), // Text for window title bar. params->style, // Window style. params->x, // horizontal position. params->y, // vertical position. params->width, // window width. params->height, // window height. params->parent, // parent of this window. (HMENU)((intptr_t)params->id), // control id hInstance, // This instance owns this window. (LPSTR) this // pointer to c++ object ); MWassert(hwnd); // --- free parameters now that they aren't used ---- delete params; params = 0; // ---- store our pointer in the properties ---- MWassert(SetProp(hwnd, PROP_PTR, (HANDLE) this)); } void MWwindow::unbind() { if (!hwnd) { // MessageBox(NULL,"MWwindow::unbind has no binding", "zzz", MB_OK); return; } #if defined(MINGW) // if not correct thread enqueue and unmap will be called later if (iv_bind_enqueue_ && (*iv_bind_enqueue_)(unbind1, hwnd)) { //printf("MWwindow::unbind defer hwnd=%p\n", hwnd); hwnd = 0; return; } #endif //printf("MWwindow::unbind %p\n", this); // ---- remove properties... stops C++ messages ----- RemoveProp(hwnd, PROP_PTR); // ---- tell MS-Windows to toss it ---- DestroyWindow(hwnd); hwnd = 0; } // ----------------------------------------------------------------------- // Register the MS-Windows window class with Windows. This is supposed to // only be done once, so we first check to see if it exists. // ----------------------------------------------------------------------- void MWwindow::registerClass( HINSTANCE hInstance) // application instance { MWassert(hInstance); WNDCLASS wc; const char* className = params->classnameOf(); MWassert(className); if (GetClassInfo(hInstance, className, &wc) == 0) { // ---- class not yet registered ---- wc.style = params->classStyle; wc.lpfnWndProc = ::WndProc; wc.cbClsExtra = 0; // Reserve extra bytes for each instance of the window. // These are used to store a pointer to the C++ object associated // with the MS-Windows window. wc.cbWndExtra = sizeof(MWwindow*); wc.hInstance = hInstance; wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = className; // Register the window class RegisterClass(&wc); } } // ----------------------------------------------------------------------- // Window mapping functions. map() will map the window to the display. // unmap() will remove the window from the display (hide it). isMapped() // will test whether or not the window is visible. // ----------------------------------------------------------------------- bool MWwindow::map() { if (hwnd) { #if defined(MINGW) if (iv_bind_enqueue_ && (*iv_bind_enqueue_)(mwmap1, hwnd)) { return 1; } #endif ShowWindow(hwnd, SW_SHOW); UpdateWindow(hwnd); return 1; } return 0; } void MWwindow::unmap() { //printf("enter MWwindow::unmap()\n"); if (hwnd) #if defined(MINGW) // if not correct thread enqueue and unmap will be called later if (iv_bind_enqueue_ && (*iv_bind_enqueue_)(hide1, hwnd)) { //printf("MWwindow::unmap ShowWindow defer hwnd=%p\n", hwnd); return; } #endif ShowWindow(hwnd, SW_HIDE); //printf("leave MWwindow::unmap()\n"); } bool MWwindow::isMapped() { if (hwnd) return IsWindowVisible(hwnd); else return 0; } // ####################################################################### // ################# WindowRep class // ####################################################################### // ----------------------------------------------------------------------- // A window is needed to calculate font metrics and such, so the first // window created gets registered as the "main window", and is used for // such purposes by the MS-Windows specific layer. // ----------------------------------------------------------------------- static WindowRep* rep = nil; HWND WindowRep::mainWindow() { return (rep) ? rep->msWindow() : nil; } // ----------------------------------------------------------------------- // crude error handler... notifies user and bails out. Needs to be // refined in the future for better behavior. // ----------------------------------------------------------------------- void WindowRep::errorMessage(const char* msg) { HWND hwnd = mainWindow(); MessageBox(hwnd, msg, "InterViews Fatal Error", MB_ICONSTOP); exit(1); } // ----------------------------------------------------------------------- // constructors and destructors // ----------------------------------------------------------------------- WindowRep::WindowRep(Window* w) { win = w; styleOf(WS_OVERLAPPED); styleOfEx(0); palette = ColorRep::defaultPalette(); left_ = CW_USEDEFAULT; bottom_ = CW_USEDEFAULT; cursor_stack_ = new MWcursorPtrList; cursor_ = NULL; controls = NULL; cntrlHWND = NULL; frontBuff = NULL; doubleBuffered = true; offscreen_ = false; // --- stash first window created ---- if (!rep) rep = this; // Create the global event used by WMinput() if it hasn't yet // been allocated. if (! input_e) { input_e = new Event; input_er = (input_e) ? input_e->rep() : 0; if (!input_e || !input_er) WindowRep::errorMessage("allocation failure"); } // ---- double-buffer initialize --- back_bitmap_ = nil; } WindowRep::~WindowRep() { // --- release resources ---- if (back_bitmap_) DeleteObject(back_bitmap_); if (frontBuff) ReleaseDC(msWindow(), frontBuff); } // ----------------------------------------------------------------------- // When binding to the MS-Window, we also bind // this WindowRep to the CanvasRep, so that it can handle things like // invalidation of parts of the window. // // The Window class (and all derived classes) stash their desired window // dimensions into the canvas, so we get our desired size from there. // ----------------------------------------------------------------------- void WindowRep::bind() { // ---- bind to the CanvasRep ---- MWcanvas* c = (MWcanvas*) win->canvas_; c->bind(this); // ---- update window properties ---- int winHeight = c->to_pixels( win->height(), Dimension_Y ); int winWidth = c->to_pixels( win->width(), Dimension_X ); widthOf(winWidth); heightOf(winHeight); if (bottom_ == CW_USEDEFAULT) yposOf(CW_USEDEFAULT); else { MWassert(ivWindowOf()); Display* d = ivWindowOf()->display(); MWassert(d); yposOf(bottom_ - winHeight); } xposOf(left_); // ---- bind to MS-Window ---- MWwindow::bind(); } // ----------------------------------------------------------------------- // double-buffer management // ----------------------------------------------------------------------- void WindowRep::rebuffer() { // --- release old double-buffer resources ---- if (back_bitmap_) DeleteObject(back_bitmap_); // ---- create new double-buffer resources ---- PixelCoord width = win->canvas_->pwidth(); PixelCoord height = win->canvas_->pheight(); HWND hwnd = msWindow(); HDC winDC = GetDC(hwnd); back_bitmap_ = CreateCompatibleBitmap(winDC, width, height); ReleaseDC(hwnd, winDC); } void WindowRep::frontBuffer() { RECT clientArea; GetClientRect(hwnd, &clientArea); frontBuff = GetDC(hwnd); MWassert(win); MWassert(win->canvas_); MWcanvas* c = (MWcanvas*) win->canvas_; c->beginPaint(frontBuff, clientArea); } void WindowRep::backBuffer() { if (frontBuff) { // ---- update the affected part of the display ---- if (doubleBuffered) { MWassert(win); MWassert(win->canvas_); MWcanvas* c = (MWcanvas*) win->canvas_; c->endPaint(); // --- freshen the off-screen bitmap ---- RECT updateArea; GetClientRect(hwnd, &updateArea); HDC backBuff = CreateCompatibleDC(frontBuff); SelectObject(backBuff, back_bitmap_); SelectClipRgn(frontBuff, NULL); SelectClipRgn(backBuff, NULL); BitBlt(backBuff, updateArea.left, updateArea.top, updateArea.right - updateArea.left, updateArea.bottom - updateArea.top, frontBuff, updateArea.left, updateArea.top, SRCCOPY); DeleteDC(backBuff); } ReleaseDC(hwnd, frontBuff); frontBuff = NULL; } } // ----------------------------------------------------------------------- // The windows callback function forwards the message translation to this // function, which passes common messages to member functions and passes // any unrecognized messages to the windows default handler. // ----------------------------------------------------------------------- long WindowRep::WndProc(UINT message, WPARAM wParam, LPARAM lParam) { // ----- check if derived class wants to trap it ----- if (win) { // --- fill in the event record ---- input_er->setMessage(win, message, wParam, lParam); input_er->result = 0L; // ---- see the window wants to grab the event --- if (win->receive(*input_e)) { return input_er->result; } else { // ---- process input messages ---- long id; HWND h = NULL; switch(message) { case WM_PAINT: WMpaint(wParam, lParam); break; case WM_ERASEBKGND: break; case WM_LBUTTONDOWN: if (wParam & MK_CONTROL) { WMinput(wParam, lParam, Event::down, Event::middle); //}else if (wParam & MK_CONTROL) { //WMinput(wParam, lParam, Event::down, Event::right); }else{ WMinput(wParam, lParam, Event::down, Event::left); } break; case WM_LBUTTONUP: if (wParam & MK_CONTROL) { WMinput(wParam, lParam, Event::up, Event::middle); //}else if (wParam & MK_CONTROL) { //WMinput(wParam, lParam, Event::up, Event::right); }else{ WMinput(wParam, lParam, Event::up, Event::left); } break; case WM_MBUTTONDOWN: WMinput(wParam, lParam, Event::down, Event::middle); break; case WM_MBUTTONUP: WMinput(wParam, lParam, Event::up, Event::middle); break; case WM_RBUTTONDOWN: WMinput(wParam, lParam, Event::down, Event::right); break; case WM_RBUTTONUP: WMinput(wParam, lParam, Event::up, Event::right); break; case WM_MOUSEMOVE: WMinput(wParam, lParam, Event::motion, Event::none); break; case WM_CHAR: WMinput(wParam, lParam, Event::key, Event::none); break; case WM_SIZE: WMsize(wParam, lParam); break; case WM_MOVE: if (offscreen_) { //printf("redraw for move\n"); WMsize(wParam, lParam); } break; case WM_COMMAND: id = LOWORD(wParam); return childEvent(id, *input_e); case WM_HSCROLL: case WM_VSCROLL: #ifdef WIN16 h = (HWND) HIWORD(lParam); #else h = (HWND) lParam; #endif if (h != 0) return childEventHWND(h, *input_e); break; case WM_PALETTECHANGED: if ((HWND) wParam == hwnd) break; case WM_QUERYNEWPALETTE: { HDC hdc = GetDC(hwnd); int i = palette->realizeInto(hdc, FALSE); if (i) InvalidateRect(hwnd, NULL, FALSE); ReleaseDC(hwnd, hdc); return i; } case WM_KEYDOWN: { // extern bool iv_user_keydown(long); // if (iv_user_keydown(wParam)){ // break; // } if (wParam >0x22 && wParam <0x2F) { int key = 0; switch (wParam) { case VK_DELETE: key = 'D'; break; case VK_LEFT: key = 'B'; break; case VK_RIGHT: key = 'F'; break; case VK_HOME: key = 'A'; break; case VK_END: key = 'E'; break; } if (key) { WMinput(key&0x1F, lParam, Event::key, Event::none); break; } } } default: return MWwindow::WndProc(message, wParam, lParam); } return 0; } } // This shouldn't happen... a WindowRep without it's associated Window. // If it does, the window will still limp along with the default message // handler. return DefWindowProc( hwnd, message, wParam, lParam ); } // ----------------------------------------------------------------------- // process a WM_PAINT message for this window // ----------------------------------------------------------------------- long WindowRep::WMpaint(WPARAM, LPARAM) { HDC hdc; // display context to use HDC hdcBuff; // double buffer display context RECT updateArea; // update area in window MWassert(win); MWassert(win->canvas_); // // This unsafe cast is ok since it's to the base class of all canvas // types used under windows. // MWcanvas* c = (MWcanvas*) win->canvas_; if (frontBuff) { // ---- immediate mode already in effect ---- HRGN hrgn; hrgn = CreateRectRgnIndirect(&updateArea); SelectClipRgn(frontBuff, hrgn); DeleteObject(hrgn); if (win->glyph_) win->glyph_->draw(win->canvas_, win->allocation_); } else { // ---- get the update area and device context ---- if (GetUpdateRect(hwnd, &updateArea, FALSE)) { // // !!!! Windows bug workaround !!!!! // For some reason the update area is sometimes off, which causes // clipping to be incorrect on updates. A result of this is that // BeginPaint() can't be used because it sets clipping to the // wrong value. It needs to be called for windows to work however, // so it is done after the rendering has been done. It seems // like something else would be the cause and this be the effect, // but the InvalidateRect() calls have been checked and look good. // updateArea.right++; updateArea.bottom++; updateArea.left = Math::max(int(0), int(updateArea.left-1)); updateArea.top = Math::max(int(0), int(updateArea.top-1)); // ---- prepare canvas for painting ---- bool doPaint; HDC hdcPaint = GetDC(hwnd); palette->realizeInto(hdcPaint, TRUE); if (doubleBuffered) { hdcBuff = CreateCompatibleDC(hdcPaint); SelectObject(hdcBuff, back_bitmap_); palette->realizeInto(hdcBuff, TRUE); hdc = hdcBuff; doPaint = c->any_damage(); } else { hdc = hdcPaint; doPaint = true; } // ---- actual painting ---- if (doPaint) { // DebugEndSection((void *)10342, "Other"); // DebugStartSection(c, "Canvas"); c->beginPaint(hdc, updateArea); // DebugEndSection(c, "Canvas"); // ---- have the glyph hierarchy draw itself ---- // DebugStartSection(win, "Window"); if (win->glyph_) win->glyph_->draw(c, win->allocation_); // DebugEndSection(win, "Window"); // ---- clean up cavas resources ---- // DebugStartSection(c, "Canvas"); c->endPaint(); #if 0 DebugEndSection(c, "Canvas"); int n; float f; n = DebugGetSectionTime(c, "Canvas", &f); DebugMessage("Canvas %x : TotalTime = %d, percent of time = %.3f\n", c, n, f); n = DebugGetSectionTime(win, "Window", &f); DebugMessage("Window %x : TotalTime = %d, percent of time = %.3f\n", win, n, f); n = DebugGetSectionTime((void *)10342, "Other", &f); DebugMessage("Other : TotalTime = %d, percent of time = %.3f\n\n", n, f); DebugStartSection((void *)10342, "Other"); #endif } // ---- cleanup ---- if (doubleBuffered) { // ---- update the affected part of the display ---- SelectClipRgn(hdcPaint, NULL); SelectClipRgn(hdcBuff, NULL); //DebugMessage GetUpdateRect(hwnd, &updateArea, FALSE); POINT pt[2]; pt[0].x = updateArea.left; pt[0].y = updateArea.top; pt[1].x = updateArea.right; pt[1].y = updateArea.bottom; MWassert( DPtoLP(hdcBuff, pt, 2) ); StretchBlt(hdcPaint, updateArea.left, updateArea.top, updateArea.right - updateArea.left, updateArea.bottom - updateArea.top, hdcBuff, pt[0].x, pt[0].y, (pt[1].x - pt[0].x), (pt[1].y - pt[0].y), SRCCOPY); DeleteDC(hdcBuff); } // MODIFIED by NL for WIN32s: // this seems like a bug. didn't release one of the DCs before ReleaseDC(hwnd, hdcPaint); // hack to get around incorrect update area problem PAINTSTRUCT ps; BeginPaint(hwnd, &ps); EndPaint(hwnd, &ps); } } // check if any part of window off screen RECT r; GetWindowRect(hwnd, &r); Display* d = win->display(); if (r.right > d->pwidth() || r.bottom > d->pheight() || r.top < 0 || r.left < 0) { offscreen_ = true; }else { offscreen_ = false; } return 0; } // ----------------------------------------------------------------------- // process a mouse/keyboard event. A global object is used to decrease the // construction/destruction time since mouse movement will generate a lot // of these! "input_er" is a pointer to the EventRep of the global Event // "input_e". No pointer checks are made as the library will bail out if // the Event and associated EventRep can't be constructed in the first // place. // ----------------------------------------------------------------------- long WindowRep::WMinput( WPARAM wParam, // windows word parameter LPARAM lParam, // windows long parameter int t, // type of event int b) // which button { // ---- fill in the information ---- input_er->window_ = win; input_er->type_ = t; input_er->button_ = b; input_er->wparam_ = wParam; input_er->lparam_ = lParam; // ---- go process it ---- EventRep::handleCallback(*input_e); return 0; } // ----------------------------------------------------------------------- // Process a window resize message... basically allocating the associated // glyph and damaging the new area. This is driven by the WM_SIZE messge // which is sent by the system telling us what our allocated size is. // ----------------------------------------------------------------------- long WindowRep::WMsize(WPARAM, LPARAM) { RECT clientArea; GetClientRect(hwnd, &clientArea); if (clientArea.right < 1 || clientArea.bottom < 1) { // happens when iconify on win95 desktop. Used to end // in floating exception in scene2view return 0; } int width = clientArea.right; int height = clientArea.bottom; // ---- invalidate stored canvases ---- win->glyph_->undraw(); // ---- initialize for allocation ---- win->canvas_->psize(width, height); if (request_on_resize_) { Box::full_request(true); win->glyph_->request(win->shape_); Box::full_request(false); } const Requirement& rx = win->shape_.requirement(Dimension_X); const Requirement& ry = win->shape_.requirement(Dimension_Y); Coord xsize = win->canvas_->width(); Coord ysize = win->canvas_->height(); Coord ox = xsize * rx.alignment(); Coord oy = ysize * ry.alignment(); win->allocation_.allot(Dimension_X, Allotment(ox, xsize, ox / xsize)); win->allocation_.allot(Dimension_Y, Allotment(oy, ysize, oy / ysize)); Extension ext; ext.clear(); // ---- tell the glyphs what they have been allocated ---- win->glyph_->allocate(win->canvas_, win->allocation_, ext); // ---- rebuild the buffer --- rebuffer(); win->canvas_->damage_all(); return 0; } // ----------------------------------------------------------------------- // The following are to support child-window controls. // // WMcommand distributes command messages to the C++ object that correponds // to the child-window control that is trying to tell us something. // // registerControl() Registers a predefined control, or custom control // (really any child window) with this window. This allows the window to // route child window callbacks to their C++ control object which handles // distribution of the callbacks. // // There is an HWND version as well as id, because some controls (such as // a scrollbar) have only a handle to their window available from the // incoming messages. // ----------------------------------------------------------------------- long WindowRep::childEvent(long id, Event& e) { MWchild* c; // If a hash table exists, then try to look up the pointer to the C++ // control object and invoke the WMcommand function. if (controls) { if (controls->find(c, id)) { c->receive(e); return 0; } } return 1; } void WindowRep::registerControl(long id, MWchild* c) { // ---- make sure there's a hash table ---- // We don't allocate the table unless child window controls are actually // being used. If we get a request to register, than they obviously are // being used and we allocate the hash table if it hasn't already been // allocated. if (! controls) { controls = new MWcontrolTable(20); MWassert(controls); } // ---- add the association to the table ---- controls->insert(id, c); } long WindowRep::childEventHWND(HWND h, Event& e) { MWchild* c; // If a hash table exists, then try to look up the pointer to the C++ // control object and invoke the WMcommand function. if (cntrlHWND) { if (cntrlHWND->find(c, h)) { c->receive(e); return 0; } } return 1; } void WindowRep::registerControlHWND(HWND h, MWchild* c) { // ---- make sure there's a hash table ---- // We don't allocate the table unless child window controls are actually // being used. If we get a request to register, than they obviously are // being used and we allocate the hash table if it hasn't already been // allocated. if (! cntrlHWND) { cntrlHWND = new MWcontrolHWND(20); MWassert(cntrlHWND); } // ---- add the association to the table ---- cntrlHWND->insert(h, c); } // // ####################################################################### // ##################### Window class // ####################################################################### extern void ivcleanup_add_window(Window*); extern void ivcleanup_remove_window(Window*); extern void ivcleanup_after_window(Window*); Window::Window(Glyph* g) { rep_ = new WindowRep(this); rep_->request_on_resize_ = false; // // The type of canvas created depends upon the capabilities of the // platform being used. This can be done at runtime to allow the // same binary for Win32s and Win32. // DWORD vers = HIWORD(GetVersion()); if (vers & 0x8000) { // running Win32s on Windows 3.1 canvas_ = new MWcanvas16; } else { // running Windows NT // canvas_ = new MWcanvas32; canvas_ = new MWcanvas16; } glyph_ = g; glyph_->ref(); style_ = nil; focus_in_ = nil; focus_out_ = nil; rep_->windowClass(WINDOW_CLASSNAME); rep_->classStyle(CS_HREDRAW | CS_VREDRAW); ivcleanup_add_window(this); } Window::Window(WindowRep* w) { rep_ = w; ivcleanup_add_window(this); } Window::~Window() { //printf("Window::~Window %p\n", this); if (bound()) { Window::unbind(); } delete rep_; rep_ = nil; // // An undraw() message must be passed down the glyph hierarchy to // disassociate the canvas with it before deletion of the canvas... and // ultimately the glyphs which might have kept a pointer to the canvas. // if (glyph_) glyph_->undraw(); Resource::unref_deferred(glyph_); delete canvas_; Resource::unref_deferred(style_); Resource::unref_deferred(focus_in_); Resource::unref_deferred(focus_out_); //Resource::unref_deferred(wm_delete); ivcleanup_remove_window(this); } void Window::repair() { } // ----------------------------------------------------------------------- // attribute functions of window // ----------------------------------------------------------------------- void Window::style(Style* s) { Resource::ref(s); Resource::unref(style_); style_ = s; } Style* Window::style() const { return style_; } void Window::display(Display*) { // no such thing under MS-Windows } Display* Window::display() const { Session* s = Session::instance(); MWassert(s); return s->default_display(); } // ----------------------------------------------------------------------- // cursor functions // ----------------------------------------------------------------------- void Window::cursor(Cursor* c) { WindowRep& w = *rep(); w.cursor_ = c; if (c == nil) { HCURSOR hc = LoadCursor(NULL, IDC_ARROW); #if defined(GCLP_HCURSOR) SetClassLongPtr(rep()->msWindow(), GCLP_HCURSOR, (LONG_PTR)hc); #else SetClassLong(rep()->msWindow(), GCL_HCURSOR, (long)hc); #endif SetCursor(hc); } else { HCURSOR hc = c->rep()->cursorOf(); #if defined(GCLP_HCURSOR) (HCURSOR)SetClassLongPtr(rep()->msWindow(), GCLP_HCURSOR, (LONG_PTR)hc); #else (HCURSOR)SetClassLong(rep()->msWindow(), GCL_HCURSOR, (long)hc); #endif SetCursor(hc); } } Cursor* Window::cursor() const { return rep()->cursor_; } void Window::push_cursor() { WindowRep& w = *rep(); w.cursor_stack_->prepend(w.cursor_); } void Window::pop_cursor() { WindowRep& w = *rep(); if (w.cursor_stack_->count() > 0) { cursor(w.cursor_stack_->item(0)); w.cursor_stack_->remove(0); } } // ----------------------------------------------------------------------- // window placement functions // ----------------------------------------------------------------------- void Window::place(Coord left, Coord bottom) { WindowRep& w = *rep(); if (w.bound()) { move(left, bottom); } else { Display* d = display(); w.left_ = d->to_pixels(left, Dimension_X); w.bottom_ = d->pheight() - d->to_pixels(bottom, Dimension_Y); } } void Window::pplace(IntCoord pleft, IntCoord pbottom) { WindowRep& w = *rep(); if (w.bound()) { move((Coord) pleft, (Coord) pbottom); } else { w.left_ = pleft; w.bottom_ = display()->pheight() - pbottom; } } // Align the window around the current origin using the given alignment. // As typical with InterViews, the alignment is from 0 to 1. An alignment // of 0 would keep the origin the same, and an alignment of 1 would shift // the origin to the other side. void Window::align(float x, float y) { if (!is_mapped()) {default_geometry();} Coord l = left(); Coord b = bottom(); l = l - (width() * x); b = b - (height() * y); place(l, b); } // Return the x-coordinate of the left side of the window in terms // of InterViews display coordinates. Coord Window::left() const { WindowRep& w = *rep(); Display* d = display(); if (w.bound()) { // ---- get the MS-Windows screen coordinates ---- HWND hwnd = w.msWindow(); RECT winRect; GetWindowRect(hwnd, &winRect); return d->to_coord(winRect.left, Dimension_X); } else { return d->to_coord(w.left_, Dimension_X); } } // Return the y-coordinate of the bottom side of the window in terms // of InterViews display coordinates. This is opposite the coordinate // system used by MS-Windows, and is therefore adjusted. Coord Window::bottom() const { WindowRep& w = *rep(); Display* d = display(); if (w.bound()) { // ---- find the Windows screen coordinates ---- HWND hwnd = w.msWindow(); RECT winRect; GetWindowRect(hwnd, &winRect); // ---- convert to InterViews coordinates ---- MWassert(d); return (d->height() - d->to_coord(winRect.bottom, Dimension_Y)); } else { return d->height() - d->to_coord(w.bottom_, Dimension_Y); } } void iv_window_coords(const Event& e, Window* w1, Coord& x1, Coord& y1) { // given event return coords in w1 if (e.window() == w1) { x1 = e.pointer_x(); y1 = e.pointer_y(); }else{ x1 = e.pointer_root_x() - w1->left(); // off by w1 left decoration y1 = e.pointer_root_y() - w1->bottom(); // off by w1 bottom decor RECT rw, rc; HWND h = w1->rep()->msWindow(); GetWindowRect(h, &rw); GetClientRect(h, &rc); POINT pt; pt.x = rc.left; pt.y = rc.bottom; ClientToScreen(h, &pt); int xdec = pt.x - rw.left; int ydec = pt.y - rw.bottom; x1 -= w1->display()->to_coord(xdec, Dimension_X); y1 -= w1->display()->to_coord(ydec, Dimension_Y); } } // ----------------------------------------------------------------------- // Window dimensions. The canvas is queried to get the dimensions as the // WindowRep class keeps the canvas up-to-date with respect to size. To // set the size, one uses the style attributes in the typical X11 manner // which is emulated with the ".ini" files in MS-Windows. // ----------------------------------------------------------------------- Coord Window::width() const { return canvas_->width(); } Coord Window::height() const { return canvas_->height(); } // ----------------------------------------------------------------------- // Window mapping functions // // Many operations upon the real window are postponed until a request is // made to map the window to the display. At this point, any attributes // desired of the window have already been set, and we are ready to really // create the window and map it. If the window is already bound to an // MS-Window, than we simply map it. // ----------------------------------------------------------------------- void Window::map() { // ---- check to see if we are already mapped ---- if (is_mapped()) return; // ---- check to see if we are bound to an MS-Windows window ---- if (!bound()) { #if defined(MINGW) // if not correct thread enqueue and map will be called later if (iv_bind_enqueue_ && (*iv_bind_enqueue_)(wmap1, this)) { return; } #endif if (style_ == nil) style(new Style(Session::instance()->style())); configure(); default_geometry(); compute_geometry(); set_props(); bind(); } #if 1 // ensure top on screen if window small enough Coord above = display()->height()-(bottom() + canvas()->height()); // dont ask me why the above does not work with the // managedwindow height() if (above < 0. && ((bottom() + above) > 0) ) { // DebugMessage("%g %g %g %g\n", bottom(), canvas()->height(),height(), display()->height()-(bottom() + height())); place(left(), bottom() + above); } #endif do_map(); } void Window::unmap() { //printf("enter Window::unmap %p\n", this); if (is_mapped()) { WindowRep& w = *rep(); glyph_->undraw(); w.unmap(); } //printf("leave Window::unmap()\n"); } bool Window::is_mapped() const { WindowRep& w = *rep(); return w.isMapped(); } // ----------------------------------------------------------------------- // Binding functions. // // These functions bind and unbind the InterViews windows with their real // associated windows in the window-system dependant world. // ----------------------------------------------------------------------- void Window::bind() { WindowRep& w = *rep(); w.bind(); } void Window::unbind() { WindowRep& w = *rep(); if (glyph_) glyph_->undraw(); w.unbind(); } bool Window::bound() const { WindowRep& w = *rep(); return w.bound(); } // ----------------------------------------------------------------------- void Window::set_attributes() { } /* * Search for a handler for the given event. * For events that have no associated pointer location, return nil. * Otherwise, use pick on the glyph to find a handler. */ Handler* Window::target(const Event& e) const { Hit hit(&e); glyph_->pick(canvas_, allocation_, 0, hit); Handler* h = hit.handler(); #if 0 if (h != nil && (e.grabber() == nil || e.is_grabbing(h))) { return h; } #endif return h;} // ----------------------------------------------------------------------- // Look at an event that has been received for this window. We directly // dispatch focus and delete events. The events come in from the // WindowRep object and get dispatched to this function which can be // re-implimented by derived classes (which should call their base class // if they don't handle a message). // // If the event was used, true is returned. If the event was not something // recognized, then false is returned. This is a difference from the SGI // distribution, but is necessary because MS-Windows provides a default // handler for those messages not directly processed. There will be no // effect on existing code since it will not be looking for a return value. // ----------------------------------------------------------------------- bool Window::receive(const Event& e) { UINT msg = e.rep()->messageOf(); switch(msg) { case WM_SETFOCUS: if (focus_in_) { Event fie(e); focus_in_->event(fie); } break; case WM_KILLFOCUS: if (focus_out_) { Event foe(e); focus_out_->event(foe); } break; default: return false; } return true; } // ----------------------------------------------------------------------- // Pointer grabs // // grab_pointer() grabs control of the display pointer and uses the given // cursor when it is outside the window. ungrab_pointer() relases the // control over the pointer and allows it to be used by other windows. // ----------------------------------------------------------------------- void Window::grab_pointer(Cursor* c) const { WindowRep& w = *rep(); HWND hwnd = w.msWindow(); SetCapture(hwnd); if (c) { Window* win = (Window*) this; win->cursor(c); } } void Window::ungrab_pointer() const { ReleaseCapture(); } void Window::raise() { HWND hwnd = rep_->msWindow(); SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } void Window::lower() { HWND hwnd = rep_->msWindow(); SetWindowPos(hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } // Move the window to the position given by the InterViews display // coordinates for the left and bottom. These must be converted to // MS-Windows screen coordinates, which are different in the y-axis. void Window::move(Coord left, Coord bottom) { HWND hwnd = rep_->msWindow(); Display* d = display(); MWassert(d); // ----- determine current size ---- // int width = canvas_->pwidth(); // int height = canvas_->pheight(); RECT r; GetWindowRect(hwnd, &r); int width = r.right - r.left; int height = r.bottom - r.top; int y = (d->pheight() - d->to_pixels(bottom, Dimension_Y)) - height; int x = d->to_pixels(left, Dimension_X); // ---- move the window ---- MoveWindow(hwnd, x, y, width, height, TRUE); } void Window::resize() { HWND hwnd = rep_->msWindow(); RECT curr_pos; GetWindowRect(hwnd, &curr_pos); // ----- determine desired size ---- int width = canvas_->pwidth(); int height = canvas_->pheight(); // ---- resize the window ---- MoveWindow(hwnd, curr_pos.left, curr_pos.top, width, height, TRUE); } // Protected operation called by map() void Window::configure() { if (style_) rep()->doubleBuffer(style_->value_is_on("double_buffered")); } // Protected operation called by map(). // // Determines the desired geometry by sending the request() protocol // down through the glyph hierarchy. void Window::default_geometry() { if (glyph_ && canvas_) { glyph_->request(shape_); Coord width = shape_.requirement(Dimension_X).natural(); Coord height = shape_.requirement(Dimension_Y).natural(); canvas_->size(width, height); } else { WindowRep::errorMessage("Window::default_geometry"); // NOT REACHED } } // Protected operation called by map() void Window::compute_geometry() { } // protected function called by map() void Window::set_props() { } // protected function called by map() void Window::do_map() { WindowRep& w = *rep(); w.map(); } // ####################################################################### // ##################### class ManagedWindow // ####################################################################### ManagedWindow::ManagedWindow(Glyph* g) : Window(g) { mrep_ = new ManagedWindowRep(this); mrep_->wm_delete_ = nil; mrep_->group_leader_ = nil; mrep_->transient_for_ = nil; mrep_->icon_ = nil; mrep_->icon_bitmap_ = nil; mrep_->icon_mask_ = nil; } ManagedWindow::~ManagedWindow() { delete mrep_; } // ----------------------------------------------------------------------- // The ManagedWindow is a window visible the the window management // facilities of the window system. In MS-Windows these would be // captioned windows. The size of these windows is different from the // size of the canvas which represents the client area. We query the // system metrics to determine the size of the borders and caption to // determine the size of the window relative to the canvas. // ----------------------------------------------------------------------- Coord ManagedWindow::width() const { int xAdjust = 2 * GetSystemMetrics(SM_CXFRAME); return canvas_->width() + canvas_->to_coord(xAdjust, Dimension_X); } Coord ManagedWindow::height() const { int yAdjust = GetSystemMetrics(SM_CYCAPTION) + (2 * GetSystemMetrics(SM_CYFRAME)); return canvas_->height() + canvas_->to_coord(yAdjust, Dimension_Y); } // ----------------------------------------------------------------------- // Handle window events. // ----------------------------------------------------------------------- bool ManagedWindow::receive(const Event& e) { EventRep* er = e.rep(); switch(er->messageOf()) { case WM_GETMINMAXINFO: mrep_->WMminmax(er->wparamOf(), er->lparamOf()); break; case WM_CLOSE: mrep_->WMclose(er->wparamOf(), er->lparamOf()); break; default: return false; } return true; } ManagedWindow* ManagedWindow::icon() const { return rep()->icon_; } Bitmap* ManagedWindow::icon_bitmap() const { return rep()->icon_bitmap_; } Bitmap* ManagedWindow::icon_mask() const { return rep()->icon_mask_; } void ManagedWindow::icon(ManagedWindow* i) { ManagedWindowRep& w = *rep(); w.icon_ = i; //w.do_set(this, &ManagedWindowRep::set_icon); } void ManagedWindow::icon_bitmap(Bitmap* b) { ManagedWindowRep& w = *rep(); w.icon_bitmap_ = b; //w.do_set(this, &ManagedWindowRep::set_icon_bitmap); } void ManagedWindow::icon_mask(Bitmap* b) { ManagedWindowRep& w = *rep(); w.icon_mask_ = b; //w.do_set(this, &ManagedWindowRep::set_icon_mask); } void ManagedWindow::iconify() { WindowRep& w = *Window::rep(); HWND hwnd = w.msWindow(); ShowWindow(hwnd, SW_MINIMIZE); } void ManagedWindow::deiconify() { WindowRep& w = *Window::rep(); HWND hwnd = w.msWindow(); ShowWindow(hwnd, SW_RESTORE); } void ManagedWindow::resize() { default_geometry(); Window::resize(); } // ----------------------------------------------------------------------- // Install "focus in" and "focus out" handlers. Activation of these // handlers is through Window::receive(). // ----------------------------------------------------------------------- void ManagedWindow::focus_event(Handler* in, Handler* out) { Resource::ref(in); Resource::ref(out); Resource::unref(focus_in_); Resource::unref(focus_out_); focus_in_ = in; focus_out_ = out; } void ManagedWindow::wm_delete(Handler* h) { Resource::ref(h); Resource::unref(mrep_->wm_delete_); mrep_->wm_delete_ = h; } void ManagedWindow::set_props() { // ---- try to set the title ---- Style* s = style(); MWassert(s); String v; if (s->find_attribute("name", v) || s->find_attribute("title", v)) { NullTerminatedString ns(v); rep_->windowTitle(ns.string()); } } // ---------------------------------------------------------------------- // The X-Windows function XParseGeometry() appears at the end of this // file and is used to parse the geometry specifications. // ---------------------------------------------------------------------- const int NoValue = 0; const int XValue = 1; const int YValue = 2; const int WidthValue = 4; const int HeightValue = 8; const int XNegative = 16; const int YNegative = 32; int XParseGeometry (const char*, int*, int*, unsigned int*, unsigned int*); void ManagedWindow::compute_geometry() { Style* s = style(); MWassert(s); String v; if (s->find_attribute("geometry", v)) { NullTerminatedString g(v); WindowRep& wr = *Window::rep(); Canvas& c = * canvas(); Display& d = * display(); unsigned int spec = 0; unsigned int xw, xh; int xpos, ypos; spec = XParseGeometry(g.string(), &xpos, &ypos, &xw, &xh); if ((spec & WidthValue) != 0) { c.psize(xw, c.pheight()); } if ((spec & HeightValue) != 0) { c.psize(c.pwidth(), xh); } if ((spec & XValue) != 0) { if ((spec & XNegative) != 0) wr.left_ = d.pwidth() + xpos; else wr.left_ = xpos; } if ((spec & YValue) != 0) { if ((spec & YNegative) != 0) wr.bottom_ = d.pheight() + ypos - c.pheight(); else wr.bottom_ = ypos + c.pheight(); } } } // ####################################################################### // ############### class ManagedWindowRep // ####################################################################### ManagedWindowRep::ManagedWindowRep(ManagedWindow* w) { win = w; } ManagedWindowRep::~ManagedWindowRep() { } // ----------------------------------------------------------------------- // MS-Windows sends this message to determine how it can resize the window, // so we let it know based upon the information from the last request() // query of the glyph hierarchy. // ----------------------------------------------------------------------- long ManagedWindowRep::WMminmax(WPARAM, LPARAM lParam) { MINMAXINFO* mmi = (MINMAXINFO*) lParam; Requirement& rx = win->shape_.requirement(Dimension_X); Requirement& ry = win->shape_.requirement(Dimension_Y); #if 1 // the original unsigned int xAdjust = 2 * (GetSystemMetrics(SM_CXBORDER) + GetSystemMetrics(SM_CXFRAME)); unsigned int yAdjust = GetSystemMetrics(SM_CYBORDER) + GetSystemMetrics(SM_CYCAPTION) + (2 * GetSystemMetrics(SM_CYFRAME)); #else // this suddenly increased the window size when moved unsigned int xAdjust = GetSystemMetrics(SM_CXMINTRACK); unsigned int yAdjust = GetSystemMetrics(SM_CYMINTRACK); #endif Display* dpy = win->display(); MWassert(dpy); mmi->ptMinTrackSize.x = Math::max(2 + xAdjust, dpy->to_pixels(rx.natural() - rx.shrink(), Dimension_X) + xAdjust); mmi->ptMinTrackSize.y = Math::max(2 + yAdjust, dpy->to_pixels(ry.natural() - ry.shrink(), Dimension_Y) + yAdjust); mmi->ptMaxTrackSize.x = Math::min( (unsigned int) GetSystemMetrics(SM_CXMAXTRACK), dpy->to_pixels(rx.natural() + rx.stretch(), Dimension_X) + xAdjust); mmi->ptMaxTrackSize.y = Math::min( (unsigned int) GetSystemMetrics(SM_CYMAXTRACK), dpy->to_pixels(ry.natural() + ry.stretch(), Dimension_Y) + yAdjust); mmi->ptMaxSize.x = mmi->ptMaxTrackSize.x; mmi->ptMaxSize.y = mmi->ptMaxTrackSize.y; return 0; } long ManagedWindowRep::WMclose(WPARAM, LPARAM) { Handler* handler = wm_delete_; if (handler == nil) { Session::instance()->quit(); } else { Event e; handler->event(e); } return 0; } // ####################################################################### // ################### class ApplicationWindow // ####################################################################### ApplicationWindow::ApplicationWindow(Glyph* g) : ManagedWindow(g) { rep_->styleOf(WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN); } ApplicationWindow::~ApplicationWindow() { } void ApplicationWindow::compute_geometry() { #ifdef IS_IMPLIMENTED WindowRep& wr = *Window::rep(); CanvasRep& c = *wr.canvas_->rep(); Display& d = *wr.display_; unsigned int spec = 0; String v; if (wr.style_ != nil && wr.style_->find_attribute("geometry", v)) { NullTerminatedString g(v); unsigned int xw, xh; spec = XParseGeometry(g.string(), &wr.xpos_, &wr.ypos_, &xw, &xh); const unsigned int userplace = XValue | YValue; if ((spec & userplace) == userplace) { wr.placed_ = true; } if ((spec & WidthValue) != 0) { c.pwidth_ = PixelCoord(xw); c.width_ = d.to_coord(c.pwidth_, Dimension_X); } if ((spec & HeightValue) != 0) { c.pheight_ = PixelCoord(xh); c.height_ = d.to_coord(c.pheight_, Dimension_Y); } if ((spec & XValue) != 0 && (spec & XNegative) != 0) { wr.xpos_ = d.pwidth() + wr.xpos_ - c.pwidth_; } if ((spec & YValue) != 0 && (spec & YNegative) != 0) { wr.ypos_ = d.pheight() + wr.ypos_ - c.pheight_; } } #endif ManagedWindow::compute_geometry(); } void ApplicationWindow::set_props() { ManagedWindow::set_props(); } // ####################################################################### // ############### class TopLevelWindow // ####################################################################### TopLevelWindow::TopLevelWindow(Glyph* g) : ManagedWindow(g) { rep_->styleOf(WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN); // toplevel is basically just the same as application -- need the special buttons and stuff // rep_->styleOf(WS_CAPTION | WS_OVERLAPPED | WS_THICKFRAME); // rep_->styleOfEx(NULL); // rep_->windowClass(TOPLEVEL_CLASSNAME); // rep_->classStyle(CS_HREDRAW | CS_VREDRAW); } TopLevelWindow::~TopLevelWindow() { } void TopLevelWindow::group_leader(Window* primary) { ManagedWindow::rep()->group_leader_ = primary; } Window* TopLevelWindow::group_leader() const { return ManagedWindow::rep()->group_leader_; } void TopLevelWindow::set_props() { ManagedWindow::set_props(); } // ####################################################################### // ############### class TransientWindow // ####################################################################### TransientWindow::TransientWindow(Glyph* g) : TopLevelWindow(g) { } TransientWindow::~TransientWindow() { } void TransientWindow::transient_for(Window* primary) { ManagedWindow::rep()->transient_for_ = primary; if (primary) { HWND pw = primary->Window::rep()->msWindow(); if (!bound()) { Window::rep()->parentOf(pw); } } } Window* TransientWindow::transient_for() const { return ManagedWindow::rep()->transient_for_; } /* * Don't do the normal geometry property lookup, etc. for transients. */ void TransientWindow::configure() { Window::configure(); } void TransientWindow::set_attributes() { Style& s = *style(); s.alias("TransientWindow"); TopLevelWindow::set_attributes(); } // ####################################################################### // ################### class PopupWindow // ####################################################################### PopupWindow::PopupWindow(Glyph* g) : Window(g) { rep_->styleOf(WS_POPUP); rep_->windowClass(POPUP_CLASSNAME); rep_->classStyle(CS_HREDRAW | CS_VREDRAW); // This must be called here so that the size of the canvas gets set // before the window gets manipulated. The menu functionality starts // trying to align the window around some point which would fail because // the canvas had no size. Note that this won't call a derived version // of default_geometry() (although it will later in time in the base class // implementation), so it's not a great solution. default_geometry(); ivcleanup_after_window(this); } PopupWindow::~PopupWindow() { } void PopupWindow::set_attributes() { Style& s = *style(); s.alias("PopupWindow"); Window::set_attributes(); } bool PopupWindow::receive(const Event& e) { UINT msg = e.rep()->messageOf(); switch(msg) { case WM_PAINT: // Apparently, popup windows don't receive a size message... and // the WindowRep processing of it fetches the client rect rather than // use the parameters, so we manually call WMresize() with bogus // parameters. We still want the normal processing of the message // so we return false. rep_->WMsize(0,0); break; } return false; } // ######################################################################### // // XParseGeometry - this function comes from the source to X-Windows that // parses a geometry specification. This ensures that the MS-Windows // version parses the specification in the same way. The mask values are // dummied up to be independant of the X11 include files. // // ######################################################################### /* Copyright Massachusetts Institute of Technology 1985, 1986, 1987 */ /* $XConsortium: XParseGeom.c,v 11.18 91/02/21 17:23:05 rws Exp $ */ /* 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. */ /* * XParseGeometry parses strings of the form * "=x{+-}{+-}", where * width, height, xoffset, and yoffset are unsigned integers. * Example: "=80x24+300-49" * The equal sign is optional. * It returns a bitmask that indicates which of the four values * were actually found in the string. For each value found, * the corresponding argument is updated; for each value * not found, the corresponding argument is left unchanged. */ static int ReadInteger(char* string, char** NextString) { register int Result = 0; int Sign = 1; if (*string == '+') string++; else if (*string == '-') { string++; Sign = -1; } for (; (*string >= '0') && (*string <= '9'); string++) { Result = (Result * 10) + (*string - '0'); } *NextString = string; if (Sign >= 0) return (Result); else return (-Result); } int XParseGeometry ( const char *string, int *x, int *y, unsigned int *width, /* RETURN */ unsigned int *height) /* RETURN */ { int mask = NoValue; register char *strind; unsigned int tempWidth, tempHeight; int tempX, tempY; char *nextCharacter; if ( (string == NULL) || (*string == '\0')) return(mask); if (*string == '=') string++; /* ignore possible '=' at beg of geometry spec */ strind = (char *)string; if (*strind != '+' && *strind != '-' && *strind != 'x') { tempWidth = ReadInteger(strind, &nextCharacter); if (strind == nextCharacter) return (0); strind = nextCharacter; mask |= WidthValue; } if (*strind == 'x' || *strind == 'X') { strind++; tempHeight = ReadInteger(strind, &nextCharacter); if (strind == nextCharacter) return (0); strind = nextCharacter; mask |= HeightValue; } if ((*strind == '+') || (*strind == '-')) { if (*strind == '-') { strind++; tempX = -ReadInteger(strind, &nextCharacter); if (strind == nextCharacter) return (0); strind = nextCharacter; mask |= XNegative; } else { strind++; tempX = ReadInteger(strind, &nextCharacter); if (strind == nextCharacter) return(0); strind = nextCharacter; } mask |= XValue; if ((*strind == '+') || (*strind == '-')) { if (*strind == '-') { strind++; tempY = -ReadInteger(strind, &nextCharacter); if (strind == nextCharacter) return(0); strind = nextCharacter; mask |= YNegative; } else { strind++; tempY = ReadInteger(strind, &nextCharacter); if (strind == nextCharacter) return(0); strind = nextCharacter; } mask |= YValue; } } /* If strind isn't at the end of the string the it's an invalid geometry specification. */ if (*strind != '\0') return (0); if (mask & XValue) *x = tempX; if (mask & YValue) *y = tempY; if (mask & WidthValue) *width = tempWidth; if (mask & HeightValue) *height = tempHeight; return (mask); } neuron-7.6.3/src/lib/IV-X11/000077500000000000000000000000001340731477100152665ustar00rootroot00000000000000neuron-7.6.3/src/lib/IV-X11/glcontext.cpp000066400000000000000000000153731340731477100200120ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * GLContext -- glyph for 3D drawing */ #ifdef GL #include "wtable.h" #include #include #include #include #include #include #include #include #include #include #undef String #include /* * Copied from to avoid including Xlib.h directly. */ #define GLX_NORMAL 0x1000 #define GLX_RGB 0x0001 #define GLX_DOUBLE 0x0002 #define GLX_VISUAL 0x0007 #define GLX_COLORMAP 0x0008 #define GLX_WINDOW 0x0009 class GLContextImpl { private: friend GLContext; Canvas* canvas_; Allocation allocation_; GLWindow* window_; void make_gl_window(Canvas*, const Allocation&); }; class GLWindow : public Window { public: GLWindow(Glyph*, Window* parent); virtual ~GLWindow(); virtual void place(Coord x, Coord y); virtual void bind(); virtual void repair(); private: Window* parent_; GLXconfig default_[3]; GLXconfig* config_; Visual* visual_; unsigned int depth_; XColormap colormap_; bool double_buffered_; static void config(GLXconfig&, int buffer, int mode, int arg); void setup_glx_config(); void create_window(); }; GLContext::GLContext(Glyph* g) : MonoGlyph(g) { GLContextImpl* gl = new GLContextImpl; impl_ = gl; gl->canvas_ = nil; gl->window_ = nil; } GLContext::~GLContext() { delete impl_->window_; delete impl_; } void GLContext::draw(Canvas* c, const Allocation& a) const { GLContextImpl* gl = impl_; if (gl->canvas_ != c || !a.equals(gl->allocation_, 1e-2)) { delete gl->window_; Window* pw = c->window(); GLWindow* w = new GLWindow(body(), pw); gl->window_ = w; const Allotment& ax = a.x_allotment(); const Allotment& ay = a.y_allotment(); w->canvas()->size(ax.span(), ay.span()); w->place(ax.origin(), ay.origin()); w->bind(); gl->canvas_ = c; gl->allocation_ = a; return; } Extension ext; ext.clear(); ext.set(c, a); if (c->damaged(ext)) { Window* w = gl->window_; c->damage_area(ext); Coord x0 = a.left(), y0 = a.bottom(); w->canvas()->damage( ext.left() - x0, ext.bottom() - y0, ext.right() - x0, ext.top() - y0 ); w->repair(); } } GLWindow::GLWindow(Glyph* g, Window* parent) : Window(g) { parent_ = parent; Display* d = parent->display(); display(d); Style* s = new Style(d->style()); s->alias("GLWindow"); double_buffered_ = s->value_is_on("double_buffered"); s->attribute("double_buffered", "off"); style(s); } GLWindow::~GLWindow() { WindowRep* w = rep(); GLXunlink(w->display_->rep()->display_, w->xwindow_); } void GLWindow::place(Coord x, Coord y) { Window::place(x, y); WindowRep& w = *rep(); Display& d = *w.display_; w.xpos_ = d.to_pixels(w.left_); w.ypos_ = ( parent_->canvas()->pheight() - d.to_pixels(w.bottom_) - canvas()->pheight() ); } void GLWindow::bind() { setup_glx_config(); create_window(); } void GLWindow::setup_glx_config() { config(default_[0], GLX_NORMAL, GLX_RGB, TRUE); config(default_[1], GLX_NORMAL, GLX_DOUBLE, double_buffered_); config(default_[2], 0, 0, 0); DisplayRep& d = *display()->rep(); config_ = GLXgetconfig(d.display_, d.screen_, default_); WindowVisual* wv = WindowVisual::find_visual(display(), style()); visual_ = wv->visual(); depth_ = wv->depth(); for (GLXconfig* cf = config_; cf->buffer != 0; cf++) { if (cf->buffer == GLX_NORMAL && cf->mode == GLX_COLORMAP) { colormap_ = (long)cf->arg; } if (cf->buffer == GLX_NORMAL && cf->mode == GLX_VISUAL) { XVisualInfo vinfo; vinfo.screen = d.screen_; vinfo.visualid = (long)cf->arg; int nv = 0; XVisualInfo* visuals = XGetVisualInfo( d.display_, VisualScreenMask | VisualIDMask, &vinfo, &nv ); if (visuals != nil) { if (nv > 0) { visual_ = visuals[0].visual; depth_ = visuals[0].depth; } XFree((char*)visuals); } } } } void GLWindow::create_window() { WindowRep* w = rep(); Canvas* c = w->canvas_; DisplayRep* d = w->display_->rep(); XDisplay* dpy = d->display_; WindowTable* t = d->wtable_; XWindow xw = w->xwindow_; if (xw != WindowRep::unbound) { t->remove(xw); } Window::set_attributes(); w->xattrmask_ &= ~CWDontPropagate; w->xattrs_.do_not_propagate_mask = 0; w->xattrmask_ |= CWColormap; w->xattrs_.colormap = colormap_; w->xattrs_.event_mask = ExposureMask | StructureNotifyMask; xw = XCreateWindow( dpy, parent_->rep()->xwindow_, w->xpos_, w->ypos_, c->pwidth(), c->pheight(), /* border width */ 0, depth_, w->xclass_, visual_, w->xattrmask_, &w->xattrs_ ); c->rep()->xdrawable_ = xw; t->insert(xw, this); w->xwindow_ = xw; w->xtoplevel_ = w->toplevel_->rep()->xwindow_; for (GLXconfig* cf = config_; cf->buffer != 0; cf++) { if (cf->buffer == GLX_NORMAL && cf->mode == GLX_WINDOW) { cf->arg = (int)xw; break; } } GLXlink(dpy, config_); XMapRaised(d->display_, xw); } void GLWindow::repair() { WindowRep* w = rep(); CanvasRep* c = w->canvas_->rep(); if (c->damaged_) { GLXwinset(w->display_->rep()->display_, w->xwindow_); w->glyph_->draw(w->canvas_, w->allocation_); if (double_buffered_) { swapbuffers(); } c->clear_damage(); } } void GLWindow::config(GLXconfig& cf, int buffer, int mode, int arg) { cf.buffer = buffer; cf.mode = mode; cf.arg = arg; } #endif neuron-7.6.3/src/lib/IV-X11/session.cpp000066400000000000000000000426521340731477100174660ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Session - coordinate control flow and display management */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef sgi #include #endif /* * These attributes must be defined somewhere. */ static PropertyData defpropvalues[] = { { "*background", "#ffffff" }, { "*foreground", "#000000" }, { "*font", "fixed" }, { nil } }; /* * Predefined command-line options. */ static OptionDesc defoptions[] = { { "-background", "*background", OptionValueNext }, { "-bg", "*background", OptionValueNext }, { "-dbuf", "*double_buffered", OptionValueImplicit, "on" }, { "-display", "*display", OptionValueNext }, { "-dpi", "*dpi", OptionValueNext }, { "-fg", "*foreground", OptionValueNext }, { "-flat", "*flat", OptionValueNext }, { "-fn", "*font", OptionValueNext }, { "-font", "*font", OptionValueNext }, { "-foreground", "*foreground", OptionValueNext }, { "-geometry", "*geometry", OptionValueNext }, { "-iconic", "*iconic", OptionValueImplicit, "on" }, { "-monochrome", "*gui", OptionValueImplicit, "monochrome" }, { "-motif", "*gui", OptionValueImplicit, "Motif" }, { "-name", "*name", OptionValueNext }, { "-nodbuf", "*double_buffered", OptionValueImplicit, "off" }, { "-noshape", "*shaped_windows", OptionValueImplicit, "off" }, { "-openlook", "*gui", OptionValueImplicit, "OpenLook" }, { "-reverse", "*reverseVideo", OptionValueImplicit, "on" }, { "-rv", "*reverseVideo", OptionValueImplicit, "on" }, { "-shape", "*shaped_windows", OptionValueImplicit, "on" }, { "-smotif", "*gui", OptionValueImplicit, "SGIMotif" }, { "-synchronous", "*synchronous", OptionValueImplicit, "on" }, { "+synchronous", "*synchronous", OptionValueImplicit, "off" }, { "-title", "*title", OptionValueNext }, { "-visual", "*visual", OptionValueNext }, { "-visual_id", "*visual_id", OptionValueNext }, { "-xrm", nil, OptionPropertyNext }, #ifdef sgi { "-malloc", "*malloc_debug", OptionValueImplicit, "on" }, #endif { nil } }; /* * Session representation. */ declarePtrList(DisplayList,Display) implementPtrList(DisplayList,Display) class SessionRep { private: friend class Session; SessionRep(); ~SessionRep(); public: void handle_display_input(Display*); private: int argc_; char** argv_; bool done_; bool readinput_; const char* classname_; String* name_; Style* style_; const PropertyData* props_; Display* default_; DisplayList* displays_; static Session* instance_; void init( const char*, int& argc, char** argv, const OptionDesc*, const PropertyData* ); void parse_args(int& argc, char** argv, const OptionDesc*); bool match( const String& arg, const OptionDesc& o, int& i, int argc, char** argv ); void extract( const String& arg, const OptionDesc& o, int& i, int argc, char** argv, String& name, String& value ); void bad_arg(const char* fmt, const String& arg); String next_arg( int& i, int argc, char** argv, const char* message, const String& ); bool find_arg(const String& name, String& value); void init_style(const char*, const PropertyData*); String* find_name(); void load_props(Style*, const PropertyData*, int priority); void load_app_defaults(Style*, int priority); void load_environment(Style*, int priority); void load_path(Style*, const char*, const char*, int priority); void load_path( Style*, const char*, const char*, const char*, int priority ); const char* home(); void init_display(); void connect(Display*); void set_style(Display*); bool check(Event&); }; Session* SessionRep::instance_; /* * SessionIOHandler is a helper class to translate input ready for a * display fd into a call to SessionRep::handle_display_input(Display*); */ class SessionIOHandler : public IOHandler { public: SessionIOHandler(SessionRep*, Display*); virtual int inputReady(int); private: SessionRep* session_; Display* display_; }; SessionIOHandler::SessionIOHandler(SessionRep* s, Display* d) { session_ = s; display_ = d; } int SessionIOHandler::inputReady(int) { session_->handle_display_input(display_); return 0; } Session::Session( const char* classname, int& argc, char** argv, const OptionDesc* opts, const PropertyData* initprops ) { SessionRep::instance_ = this; rep_ = new SessionRep(); rep_->init(classname, argc, argv, opts, initprops); } Session::~Session() { delete rep_; } Session* Session::instance() { return SessionRep::instance_; } const char* Session::name() const { return rep_->name_->string(); } const char* Session::classname() const { return rep_->classname_; } int Session::argc() const { return rep_->argc_; } char** Session::argv() const { return rep_->argv_; } Style* Session::style() const { SessionRep* s = rep_; if (s->default_ != nil) { return s->default_->style(); } return s->style_; } void Session::default_display(Display* d) { rep_->default_ = d; } Display* Session::default_display() const { return rep_->default_; } Display* Session::connect(const String& display_name) { Display* d = Display::open(display_name); if (d != nil) { rep_->connect(d); } return d; } Display* Session::connect(const char* display_name) { Display* d = Display::open(display_name); if (d != nil) { rep_->connect(d); } return d; } void Session::disconnect(Display* d) { DisplayList& list = *(rep_->displays_); long n = list.count(); for (long i = 0; i < n; i++) { if (list.item(i) == d) { Dispatcher::instance().unlink(d->fd()); d->close(); list.remove(i); break; } } } void SessionRep::handle_display_input(Display* d) { if (d->closed()) { done_ = true; return; } if (readinput_) { /* * I know this loop would better be expressed as a while loop, * but my silly compiler doesn't understand it in that form. */ Event e; for (;;) { if (!d->get(e)) { break; } e.handle(); } } } /* * Main session loop: read events and handle them. */ int Session::run() { Event e; bool& done = rep_->done_; done = false; do { read(e); e.handle(); } while (!done); return 0; } /* * Map window and run. */ int Session::run_window(Window* w) { w->map(); return run(); } /* * Exit the main session loop. */ void Session::quit() { rep_->done_ = true; } void Session::unquit() { rep_->done_ = false; } /* * Return loop status. */ bool Session::done() const { return rep_->done_; } /* * Check if an event is pending on any display. */ bool Session::pending() const { Event e; bool b = rep_->check(e); if (b) { e.unread(); } return b; } /* * Read an event. Could be from any open display. * The redundant-looking test of rep_->done_ is necessary * because check might change the value of done_. */ void Session::read(Event& e) { bool save = rep_->readinput_; rep_->readinput_ = false; while (!rep_->done_ && !rep_->check(e) && !rep_->done_) { Dispatcher::instance().dispatch(); } rep_->readinput_ = save; } /* * Read an event as above, but time out after a given (sec, usec) delay. * Return true if an event was read, false if the time-out expired. */ bool Session::read(long sec, long usec, Event& e) { long sec_left = sec; long usec_left = usec; bool save = rep_->readinput_; rep_->readinput_ = false; while (!rep_->done_ && !rep_->check(e) && !rep_->done_) { if (!(sec_left > 0 || usec_left > 0)) { rep_->readinput_ = save; return false; } Dispatcher::instance().dispatch(sec_left, usec_left); } rep_->readinput_ = save; return true; } /* * Check for a pending event, returning it if there is one. */ bool SessionRep::check(Event& e) { DisplayList& list = *displays_; long n = list.count(); for (long i = 0; i < n; i++) { Display* d = list.item(i); if (d->get(e)) { return true; } } return false; } /* * Put an event back from whence it came. */ void Session::unread(Event& e) { e.unread(); } /* * Poll an event (implies the event already has an associated display). */ void Session::poll(Event& e) { e.poll(); } SessionRep::SessionRep() { done_ = false; readinput_ = true; displays_ = new DisplayList; } SessionRep::~SessionRep() { delete name_; Resource::unref(style_); for (ListItr(DisplayList) i(*displays_); i.more(); i.next()) { Display* d = i.cur(); delete d; } delete displays_; delete [] argv_; } void SessionRep::init( const char* name, int& argc, char** argv, const OptionDesc* opts, const PropertyData* initprops ) { argc_ = argc; argv_ = new char*[argc + 1]; for (int i = 0; i < argc; i++) { argv_[i] = argv[i]; } argv_[argc_] = nil; init_style(name, initprops); if (opts != nil) { parse_args(argc, argv, opts); } parse_args(argc, argv, defoptions); init_display(); Cursor::init(); #if 0 #ifdef sgi if (style_->value_is_on("malloc_debug")) { mallopt(M_DEBUG, 1); } #endif #endif } /* * Parse the argument list, setting any properties that are specified * by the option list. Matching arguments are removed (in-place) * from the argument list. */ void SessionRep::parse_args(int& argc, char** argv, const OptionDesc* opts) { int i; int newargc = 1; char* newargv[1024]; newargv[0] = argv[0]; for (i = 1; i < argc; i++) { bool matched = false; String arg(argv[i]); for (const OptionDesc* o = &opts[0]; o->name != nil; o++) { if (match(arg, *o, i, argc, argv)) { matched = true; break; } } if (!matched) { newargv[newargc] = argv[i]; ++newargc; } } if (newargc < argc) { for (i = 1; i < newargc; i++) { argv[i] = newargv[i]; } argc = newargc; argv[argc] = nil; } } /* * See if the given argument matches the option description. */ bool SessionRep::match( const String& arg, const OptionDesc& o, int& i, int argc, char** argv ) { String opt(o.name); if (arg != opt) { if (o.style == OptionValueAfter) { int n = opt.length(); if (opt == arg.left(n)) { style_->attribute(String(o.path), arg.right(n)); return true; } } return false; } String name, value; extract(arg, o, i, argc, argv, name, value); style_->attribute(name, value); return true; } /* * Extract an attribute from a given argument. */ void SessionRep::extract( const String& arg, const OptionDesc& o, int& i, int argc, char** argv, String& name, String& value ) { int colon; switch (o.style) { case OptionPropertyNext: value = next_arg(i, argc, argv, "missing property after '%s'", arg); colon = value.index(':'); if (colon < 0) { bad_arg("missing ':' in '%s'", value); } else { name = value.left(colon); value = value.right(colon+1); } break; case OptionValueNext: name = o.path; value = next_arg(i, argc, argv, "missing value after '%s'", arg); break; case OptionValueImplicit: name = o.path; value = o.value; break; case OptionValueIsArg: name = o.path; value = arg; break; case OptionValueAfter: bad_arg("missing value in '%s'", arg); break; } } /* * Report that an argument is bad and exit. A caller of this function * may assume that it does not return. * * We also assume that arg is null-terminated (because it came * from argv). */ void SessionRep::bad_arg(const char* fmt, const String& arg) { fflush(stdout); fprintf(stderr, fmt, arg.string()); putc('\n', stderr); exit(1); } /* * Make sure there is another argument--if not generate an error. */ String SessionRep::next_arg( int& i, int argc, char** argv, const char* message, const String& arg ) { ++i; if (i == argc) { bad_arg(message, arg); } return String(argv[i]); } /* * Find the value for a specific argument. */ bool SessionRep::find_arg(const String& arg, String& value) { int last = argc_ - 1; for (int i = 1; i < last; i++) { if (arg == argv_[i]) { value = String(argv_[i+1]); return true; } } return false; } /* * Initialize style information for the session. */ void SessionRep::init_style(const char* name, const PropertyData* props) { classname_ = name; name_ = find_name(); style_ = new Style(*name_); Resource::ref(style_); style_->alias(classname_); props_ = props; } /* * Set the style information for the given display. * First, copy the current style (just the parsed command-line arguments), * then add the environment style, display defaults, app defaults, * session properties, and default properties. */ void SessionRep::set_style(Display* d) { Style* s = new Style(*style_); load_props(s, defpropvalues, -5); load_path(s, IV_LIBALL, "/app-defaults/InterViews", -5); load_props(s, props_, -5); load_app_defaults(s, -5); String str; if (d->defaults(str)) { s->load_list(str, -5); } else { load_path(s, home(), "/.Xdefaults", -5); } load_environment(s, -5); d->style(s); } void SessionRep::load_props( Style* s, const PropertyData* props, int priority ) { if (props != nil) { for (const PropertyData* p = &props[0]; p->path != nil; p++) { s->attribute(String(p->path), String(p->value), priority); } } } void SessionRep::load_app_defaults(Style* s, int priority) { load_path(s, X_LIBDIR, "/X11/app-defaults/", classname_, priority); load_path(s, IV_LIBALL, "/app-defaults/", classname_, priority); const char* xres = getenv("XAPPLRESDIR"); if (xres != nil) { load_path(s, xres, "/", classname_, priority); } else { load_path(s, home(), "/", classname_, priority); } } void SessionRep::load_environment(Style* s, int priority) { const char* xenv = getenv("XENVIRONMENT"); if (xenv != nil) { s->load_file(String(xenv), priority); } else { load_path(s, ".Xdefaults-", Host::name(), priority); } } void SessionRep::load_path( Style* s, const char* head, const char* tail, int priority ) { String h(head); String t(tail); char* buf = new char[h.length() + t.length() + 1]; sprintf(buf, "%s%s", h.string(), t.string()); s->load_file(String(buf), priority); delete [] buf; } const char* SessionRep::home() { const char* home = getenv("HOME"); if (home == nil) { home = "."; } return home; } void SessionRep::load_path( Style* s, const char* head, const char* middle, const char* tail, int priority ) { String h(head); String m(middle); String t(tail); char* buf = new char[h.length() + m.length() + t.length() + 1]; sprintf(buf, "%s%s%s", h.string(), m.string(), t.string()); s->load_file(String(buf), priority); delete [] buf; } /* * Use ICCCM rules to find an application's instance name * from the command line or an environment variable. */ String* SessionRep::find_name() { String name; if (find_arg(String("-name"), name)) { return new String(name); } const char* res_name = getenv("RESOURCE_NAME"); if (res_name != nil) { return new String(res_name); } if (argc_ > 0) { String s(argv_[0]); int slash = s.rindex('/'); if (slash >= 0) { s = s.right(slash + 1); } return new String(s); } return new String("noname"); } /* * Open the default display and initialize its style information. */ void SessionRep::init_display() { String name; if (style_->find_attribute(String("display"), name)) { default_ = Display::open(name); } else { default_ = Display::open(); } if (default_ == nil) { if (name.length() > 0) { fprintf( stderr, "can't open display %.*s\n", name.length(), name.string() ); } else { fprintf(stderr, "can't open DISPLAY\n"); } exit(1); } connect(default_); } void SessionRep::connect(Display* d) { set_style(d); Dispatcher::instance().link( d->fd(), Dispatcher::ReadMask, new SessionIOHandler(this, d) ); displays_->append(d); } neuron-7.6.3/src/lib/IV-X11/wtable.h000077500000000000000000000026711340731477100167260ustar00rootroot00000000000000/* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * X Window -> WindowInfo lookup table */ #ifndef iv_wtable_h #define iv_wtable_h #include #include #include class Window; declareTable(WindowTable,XWindow,Window*) #endif neuron-7.6.3/src/lib/IV-X11/xbitmap.cpp000066400000000000000000000211321340731477100174350ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * X11-dependent bitmap code */ #include #include #include #include #include #include #include #include #include #include #include Bitmap::Bitmap() { rep_ = nil; } Bitmap* Bitmap::open(const char* filename) { Display* d = Session::instance()->default_display(); DisplayRep* r = d->rep(); unsigned int w, h; Pixmap p; int x0, y0; if ( XReadBitmapFile( r->display_, r->root_, filename, &w, &h, &p, &x0, &y0 ) != BitmapSuccess ) { return nil; } Bitmap* bm = new Bitmap; BitmapRep* b = new BitmapRep; bm->rep_ = b; b->display_ = d; b->pwidth_ = w; b->pheight_ = h; b->width_ = d->to_coord(w); b->height_ = d->to_coord(h); b->pixmap_ = p; if (x0 == -1 && y0 == -1) { b->left_ = 0; b->right_ = d->to_coord(w); b->bottom_ = 0; b->top_ = d->to_coord(h); } else { b->left_ = d->to_coord(-x0); b->right_ = d->to_coord(w - x0); b->bottom_ = d->to_coord(y0 - h); b->top_ = d->to_coord(y0); } return bm; } Bitmap::Bitmap( const void* data, unsigned int w, unsigned int h, int x0, int y0 ) { Display* d = Session::instance()->default_display(); DisplayRep* r = d->rep(); BitmapRep* b = new BitmapRep; rep_ = b; b->display_ = d; b->pwidth_ = w; b->pheight_ = h; b->width_ = d->to_coord(w); b->height_ = d->to_coord(h); if (x0 == -1 && y0 == -1) { b->left_ = 0; b->right_ = d->to_coord(w); b->bottom_ = 0; b->top_ = d->to_coord(h); } else { b->left_ = d->to_coord(-x0); b->right_ = d->to_coord(w - x0); b->bottom_ = d->to_coord(y0 - h); b->top_ = d->to_coord(y0); } if (data != nil) { b->pixmap_ = XCreateBitmapFromData( r->display_, r->root_, (char*)data, w, h ); } else { b->pixmap_ = XCreatePixmap(r->display_, r->root_, w, h, 1); GC gc = XCreateGC(r->display_, b->pixmap_, 0, nil); XSetForeground(r->display_, gc, 0); XFillRectangle(r->display_, b->pixmap_, gc, 0, 0, w, h); XFreeGC(r->display_, gc); } } Bitmap::Bitmap(const Font* f, long c, float scale) { Display* d = Session::instance()->default_display(); DisplayRep* r = d->rep(); XDisplay* dpy = r->display_; BitmapRep* b = new BitmapRep; rep_ = b; int w, h; int x, y; XFontStruct* info = f->rep(d)->font_; if ( c >= info->min_char_or_byte2 && c <= info->max_char_or_byte2 && info->per_char != nil ) { long i = c - info->min_char_or_byte2; w = info->per_char[i].rbearing - info->per_char[i].lbearing; h = info->per_char[i].ascent + info->per_char[i].descent; x = info->per_char[i].lbearing; y = info->per_char[i].ascent; } else { w = info->max_bounds.rbearing - info->min_bounds.lbearing; h = info->max_bounds.ascent + info->max_bounds.descent; x = info->min_bounds.lbearing; y = info->max_bounds.ascent; } int pw = Math::max(1, int(w * scale)); int ph = Math::max(1, int(h * scale)); w = Math::max(1, w); h = Math::max(1, h); Pixmap map = XCreatePixmap(dpy, r->root_, w, h, 1); GC gc = XCreateGC(dpy, map, 0, nil); XSetFont(dpy, gc, info->fid); XSetForeground(dpy, gc, 0); XFillRectangle(dpy, map, gc, 0, 0, pw, ph); XSetForeground(dpy, gc, 1); char ch = char(c); XDrawString(dpy, map, gc, -x, y, &ch, 1); if (scale != 1.0) { XImage* source = XGetImage(dpy, map, 0, 0, w, h, 0x01, ZPixmap); XFreePixmap(dpy, map); map = XCreatePixmap(dpy, r->root_, pw, ph, 1); XFillRectangle(dpy, map, gc, 0, 0, pw, ph); XImage* dest = XGetImage(dpy, map, 0, 0, pw, ph, 0x01, ZPixmap); for (int dy = 0; dy < ph; ++dy) { int sy = int(float(dy) / scale); for (int dx = 0; dx < pw; ++dx) { int sx = int(float(dx) / scale); XPutPixel( dest, dx, ph - 1 - dy, XGetPixel(source, sx, h - 1 - sy) ); } } XPutImage(dpy, map, gc, dest, 0, 0, 0, 0, pw, ph); XDestroyImage(source); XDestroyImage(dest); } XFreeGC(dpy, gc); b->display_ = d; b->pixmap_ = map; b->pwidth_ = pw; b->pheight_ = ph; b->width_ = d->to_coord(pw); b->height_ = d->to_coord(ph); b->left_ = d->to_coord(x) * scale; b->right_ = d->to_coord(x + w) * scale; b->top_ = d->to_coord(y) * scale; b->bottom_ = d->to_coord(y - h) * scale; } Bitmap::Bitmap(const Bitmap& bm) { rep_ = new BitmapRep(bm.rep_, BitmapRep::copy); flush(); } Bitmap::~Bitmap() { delete rep_; } Coord Bitmap::width() const { return rep()->width_; } Coord Bitmap::height() const { return rep()->height_; } unsigned int Bitmap::pwidth() const { return rep()->pwidth_; } unsigned int Bitmap::pheight() const { return rep()->pheight_; } Coord Bitmap::left_bearing() const { return -rep()->left_; } Coord Bitmap::right_bearing() const { return rep()->right_; } Coord Bitmap::ascent() const { return rep()->top_; } Coord Bitmap::descent() const { return -rep()->bottom_; } void Bitmap::poke(bool set, int x, int y) { BitmapRep* b = rep(); b->fill(); unsigned long p = set ? 1 : 0; XPutPixel(rep()->image_, x, b->pheight_ - 1 - y, p); b->modified_ = true; } bool Bitmap::peek(int x, int y) const { BitmapRep* b = rep(); b->fill(); unsigned long pixel = XGetPixel(b->image_, x, b->pheight_ - 1 - y); return pixel != 0; } void Bitmap::flush() const { rep()->flush(); } /* class BitmapRep */ BitmapRep::BitmapRep() { image_ = nil; modified_ = false; } /* * The second parameter requests a simple transformation, but * we don't support that anymore. It got broken somewhere along the line * and no one complained, so presumably no one will mind if it is ignored * completely. The only exception is inverse, which is straightforward. */ BitmapRep::BitmapRep(BitmapRep* b, unsigned int t) { display_ = b->display_; DisplayRep* r = display_->rep(); image_ = nil; modified_ = true; left_ = b->left_; right_ = b->right_; bottom_ = b->bottom_; top_ = b->top_; width_ = b->width_; height_ = b->height_; pwidth_ = b->pwidth_; pheight_ = b->pheight_; pixmap_ = XCreatePixmap(r->display_, r->root_, pwidth_, pheight_, 1); b->fill(); fill(); for (register int bx = 0; bx < pwidth_; bx++) { for (register int by = 0; by < pheight_; by++) { unsigned long pixel; if (bx >= 0 && bx < b->pwidth_ && by >= 0 && by < b->pheight_) { pixel = XGetPixel(b->image_, bx, b->pheight_ - by - 1); } else { pixel = 0; } if (t == inv) { pixel = !pixel; } XPutPixel(image_, bx, pheight_ - by - 1, pixel); } } } BitmapRep::~BitmapRep() { if (image_ != nil) { XDestroyImage(image_); } if (pixmap_ != nil) { XFreePixmap(display_->rep()->display_, pixmap_); } } void BitmapRep::fill() { if (image_ == nil) { image_ = XGetImage( display_->rep()->display_, pixmap_, 0, 0, pwidth_, pheight_, 0x01, ZPixmap ); } } void BitmapRep::flush() { if (modified_) { modified_ = false; XDisplay* dpy = display_->rep()->display_; GC gc = XCreateGC(dpy, pixmap_, 0, nil); XPutImage(dpy, pixmap_, gc, image_, 0, 0, 0, 0, pwidth_, pheight_); XFreeGC(dpy, gc); } } neuron-7.6.3/src/lib/IV-X11/xbrush.cpp000077500000000000000000000103451340731477100173130ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include #include #include declarePtrList(BrushRepList,BrushRep) implementPtrList(BrushRepList,BrushRep) class BrushImpl { private: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif friend class Brush; Coord width; char* dash_list; int dash_count; BrushRepList* replist; }; Brush::Brush(Coord w) { init(nil, 0, w); } Brush::Brush(const int* p, int c, Coord w) { init(p, c, w); } Brush::Brush(int pat, Coord w) { int dash[16]; int count; calc_dashes(pat, dash, count); init(dash, count, w); } Brush::~Brush() { BrushRepList& list = *impl_->replist; for (ListItr(BrushRepList) i(list); i.more(); i.next()) { BrushRep* r = i.cur(); delete r; } delete [] impl_->dash_list; delete impl_->replist; delete impl_; } void Brush::calc_dashes(int pat, int* dash, int& count) { unsigned int p = pat & 0xffff; if (p == 0 || p == 0xffff) { count = 0; } else { const unsigned int MSB = 1 << 15; while ((p & MSB) == 0) { p <<= 1; } if (p == 0x5555 || p == 0xaaaa) { dash[0] = 1; dash[1] = 3; count = 2; } else if (p == 0xaaaa) { dash[0] = 1; dash[1] = 1; count = 2; } else if (p == 0xcccc) { dash[0] = 2; dash[1] = 2; count = 2; } else if (p == 0xeeee) { dash[0] = 3; dash[1] = 1; count = 2; } else { unsigned int m = MSB; int index = 0; while (m != 0) { /* count the consecutive one bits */ int length = 0; while (m != 0 && (p & m) != 0) { ++length; m >>= 1; } dash[index++] = length; /* count the consecutive zero bits */ length = 0; while (m != 0 && (p & m) == 0) { ++length; m >>= 1; } if (length > 0) { dash[index++] = length; } } count = index; } } } void Brush::init(const int* pattern, int count, Coord w) { BrushImpl* b = new BrushImpl; impl_ = b; b->width = w; b->dash_count = count; if (count > 0) { b->dash_list = new char[count]; for (int i = 0; i < count; ++i) { b->dash_list[i] = char(pattern[i]); } } else { b->dash_list = nil; } b->replist = new BrushRepList; } BrushRep* Brush::rep(Display* d) const { BrushRep* r; BrushRepList& list = *impl_->replist; for (ListItr(BrushRepList) i(list); i.more(); i.next()) { r = i.cur(); if (r->display_ == d) { return r; } } r = new BrushRep; r->display_ = d; r->dash_list_ = impl_->dash_list; r->dash_count_ = impl_->dash_count; r->width_ = d->to_pixels(impl_->width); list.append(r); return r; } Coord Brush::width() const { return impl_->width; } int Brush::dash_count() const { return impl_->dash_count; } int Brush::dash_list(int i) const { return int(impl_->dash_list[i]); } /* anachronism */ unsigned int Brush::Width() const { return rep(Session::instance()->default_display())->width_; } neuron-7.6.3/src/lib/IV-X11/xcanvas.cpp000066400000000000000000001173451340731477100174500ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef __DECCXX struct _XRegion; #endif declarePtrList(TransformerStack,Transformer) implementPtrList(TransformerStack,Transformer) declarePtrList(ClippingStack,_XRegion) implementPtrList(ClippingStack,_XRegion) /* class Canvas */ Canvas::Canvas() { CanvasRep* c = new CanvasRep; rep_ = c; TextRenderInfo* t = &CanvasRep::text_; PathRenderInfo* p = &CanvasRep::path_; if (t->text_ == nil) { t->text_ = new char[1000]; t->cur_text_ = t->text_; t->items_ = new XTextItem[100]; } if (p->point_ == nil) { p->point_ = new XPoint[10]; p->cur_point_ = p->point_; p->end_point_ = p->point_ + 10; } c->drawbuffer_ = CanvasRep::unbound; c->copybuffer_ = CanvasRep::unbound; c->drawgc_ = nil; c->copygc_ = nil; c->brush_ = nil; c->brush_width_ = 0; c->dash_list_ = nil; c->dash_count_ = 0; c->color_ = nil; c->pixel_ = 0; c->stipple_ = 0; c->font_ = nil; c->text_twobyte_ = false; c->text_reencode_ = false; c->clipping_ = XCreateRegion(); c->empty_ = XCreateRegion(); c->transformers_ = new TransformerStack; c->clippers_ = new ClippingStack; Transformer* identity = new Transformer; c->transformers_->append(identity); c->transformed_ = false; c->display_ = nil; c->window_ = nil; c->xdrawable_ = CanvasRep::unbound; c->width_ = 0; c->height_ = 0; c->pwidth_ = 0; c->pheight_ = 0; c->damaged_ = false; c->on_damage_list_ = false; c->repairing_ = false; c->status_ = unmapped; } Canvas::~Canvas() { CanvasRep* c = rep(); c->unbind(); for (ListItr(TransformerStack) i(*c->transformers_); i.more(); i.next()) { Transformer* t = i.cur(); delete t; } delete c->transformers_; XDestroyRegion(c->clipping_); XDestroyRegion(c->empty_); delete c->clippers_; delete c; rep_ = nil; } void Canvas::size(Coord width, Coord height) { CanvasRep* c = rep(); c->width_ = width; c->height_ = height; Display* d = c->display_; if (d != nil) { c->pwidth_ = d->to_pixels(width); c->pheight_ = d->to_pixels(height); } } void Canvas::psize(PixelCoord pwidth, PixelCoord pheight) { CanvasRep& c = *rep(); c.pwidth_ = pwidth; c.pheight_ = pheight; Display* d = c.display_; if (d != nil) { c.width_ = d->to_coord(pwidth); c.height_ = d->to_coord(pheight); } } Coord Canvas::width() const { return rep()->width_; } Coord Canvas::height() const { return rep()->height_; } PixelCoord Canvas::pwidth() const { return rep()->pwidth_; } PixelCoord Canvas::pheight() const { return rep()->pheight_; } PixelCoord Canvas::to_pixels(Coord p, DimensionName) const { return rep()->display_->to_pixels(p); } Coord Canvas::to_coord(PixelCoord p, DimensionName) const { return rep()->display_->to_coord(p); } Coord Canvas::to_pixels_coord(Coord p, DimensionName) const { const Display& d = *rep()->display_; return d.to_coord(d.to_pixels(p)); } void Canvas::push_transform() { CanvasRep* c = rep(); c->flush(); TransformerStack& s = *c->transformers_; Transformer* m = new Transformer(*s.item(s.count() - 1)); s.append(m); } void Canvas::pop_transform() { CanvasRep* c = rep(); c->flush(); TransformerStack& s = *c->transformers_; long i = s.count() - 1; if (i == 0) { /* * We pushed the first matrix during initialization, * so we must be underflowing the stack. Should be an exception. */ return; } Transformer* m = s.item(i); delete m; s.remove(i); c->transformed_ = !c->matrix().identity(); } void Canvas::transform(const Transformer& t) { CanvasRep* c = rep(); c->flush(); c->matrix().premultiply(t); c->transformed_ = !c->matrix().identity(); } void Canvas::transformer(const Transformer& t) { CanvasRep* c = rep(); c->flush(); c->matrix() = t; c->transformed_ = !t.identity(); } const Transformer& Canvas::transformer() const { CanvasRep* c = rep(); return c->matrix(); } /* * There doesn't appear to be any way to copy a region other than * to union it with an empty region. */ void Canvas::push_clipping() { CanvasRep* c = rep(); c->flush(); Region old_clip = c->clipping_; Region new_clip = XCreateRegion(); XUnionRegion(old_clip, c->empty_, new_clip); c->clippers_->append(old_clip); c->clipping_ = new_clip; } void Canvas::pop_clipping() { CanvasRep* c = rep(); c->flush(); ClippingStack& s = *c->clippers_; long n = s.count(); if (n == 0) { /* stack underflow--should raise exception */ return; } Region clip = c->clipping_; XDestroyRegion(clip); clip = s.item(n - 1); s.remove(n - 1); c->clipping_ = clip; XDisplay* dpy = c->display_->rep()->display_; GC gc = c->drawgc_; if (XEmptyRegion(clip)) { XSetClipMask(dpy, gc, None); } else { XSetRegion(dpy, gc, clip); } } void Canvas::front_buffer() { CanvasRep& c = *rep(); if (c.copybuffer_ != CanvasRep::unbound) { c.drawbuffer_ = c.copybuffer_; } } void Canvas::back_buffer() { CanvasRep& c = *rep(); if (c.copybuffer_ != CanvasRep::unbound) { c.drawbuffer_ = c.xdrawable_; } } static bool rectangular( int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3 ) { return ( (x0 == x1 && y1 == y2 && x2 == x3 && y3 == y0) || (x0 == x3 && y3 == y2 && x2 == x1 && y1 == y0) ); } static bool xrect(const XPoint* p, unsigned int n) { return ( n == 5 && p[0].x == p[4].x && p[0].y == p[4].y && rectangular( p[0].x, p[0].y, p[1].x, p[1].y, p[2].x, p[2].y, p[3].x, p[3].y ) ); } static const float smoothness = 10.0; static bool straight( const Transformer& tx, Coord x0, Coord y0, Coord x1, Coord y1, Coord x2, Coord y2, Coord x3, Coord y3 ) { Coord tx0, tx1, tx2, tx3; Coord ty0, ty1, ty2, ty3; tx.transform(x0, y0, tx0, ty0); tx.transform(x1, y1, tx1, ty1); tx.transform(x2, y2, tx2, ty2); tx.transform(x3, y3, tx3, ty3); float f = ( (tx1 + tx2) * (ty0 - ty3) + (ty1 + ty2) * (tx3 - tx0) + 2 * (tx0 * ty3 - ty0 * tx3) ); return (f * f) < smoothness; } static inline Coord mid(Coord a, Coord b) { return (a + b) / 2; } static char _txkey (int i) { if (i >= 0) { return ( i<32 ? i : i<160 ? 24 + (i>>2) : i<672 ? 54 + (i>>4) : 127 ); } else { return ( i>-32 ? i : i>-160 ? -24 - (i>>2) : i>-672 ? -54 - (i>>4) : -127 ); } } static int tx_key(const Transformer& tx, Coord x, Coord y) { Coord x1, y1, x2, y2, x3, y3; tx.transform(0, 0, x1, y1); tx.transform(0, y, x2, y2); tx.transform(x, 0, x3, y3); int k1 = _txkey(int(x2 - x1)) & 0xff; int k2 = _txkey(int(y2 - y1 - y)) & 0xff; int k3 = _txkey(int(x3 - x1 - x)) & 0xff; int k4 = _txkey(int(y3 - y1)) & 0xff; return (k1 << 24) + (k2 << 16) + (k3 << 8) + k4; } void Canvas::new_path() { PathRenderInfo* p = &CanvasRep::path_; p->curx_ = 0; p->cury_ = 0; XPoint* xp = p->point_; xp->x = 0; xp->y = 0; p->cur_point_ = xp; } void Canvas::move_to(Coord x, Coord y) { CanvasRep* c = rep(); PathRenderInfo* p = &CanvasRep::path_; p->curx_ = x; p->cury_ = y; Coord tx, ty; if (c->transformed_) { c->matrix().transform(x, y, tx, ty); } else { tx = x; ty = y; } Display* d = c->display_; XPoint* xp = p->point_; #if 0 xp->x = d->to_pixels(tx); xp->y = c->pheight_ - d->to_pixels(ty); #else long ix = d->to_pixels(tx); long iy = c->pheight_ - d->to_pixels(ty); if (ix > 30000) {ix = 30000; } else if (ix < -30000) { ix = -30000;} if (iy > 30000) {iy = 30000; } else if (iy < -30000) { iy = -30000;} xp->x = ix; xp->y = iy; #endif p->cur_point_ = xp + 1; } static XPoint* next_point(PathRenderInfo* p) { if (p->cur_point_ == p->end_point_) { int old_size = p->cur_point_ - p->point_; int new_size = 2 * old_size; XPoint* new_path = new XPoint[new_size]; for (int i = 0; i < old_size; i++) { new_path[i] = p->point_[i]; } delete [] p->point_; p->point_ = new_path; p->cur_point_ = p->point_ + old_size; p->end_point_ = p->point_ + new_size; } XPoint* xp = p->cur_point_; p->cur_point_ = xp + 1; return xp; } void Canvas::line_to(Coord x, Coord y) { CanvasRep* c = rep(); PathRenderInfo* p = &CanvasRep::path_; p->curx_ = x; p->cury_ = y; Coord tx, ty; if (c->transformed_) { c->matrix().transform(x, y, tx, ty); } else { tx = x; ty = y; } Display* d = c->display_; XPoint* xp = next_point(p); #if 0 xp->x = d->to_pixels(tx); xp->y = c->pheight_ - d->to_pixels(ty); #else long ix = d->to_pixels(tx); long iy = c->pheight_ - d->to_pixels(ty); if (ix > 30000) {ix = 30000; } else if (ix < -30000) { ix = -30000;} if (iy > 30000) {iy = 30000; } else if (iy < -30000) { iy = -30000;} xp->x = ix; xp->y = iy; #endif } void Canvas::curve_to( Coord x, Coord y, Coord x1, Coord y1, Coord x2, Coord y2 ) { CanvasRep* c = rep(); PathRenderInfo* p = &CanvasRep::path_; Coord px = p->curx_; Coord py = p->cury_; if (straight(c->matrix(), px, py, x1, y1, x2, y2, x, y)) { line_to(x, y); } else { Coord xx = mid(x1, x2); Coord yy = mid(y1, y2); Coord x11 = mid(px, x1); Coord y11 = mid(py, y1); Coord x22 = mid(x2, x); Coord y22 = mid(y2, y); Coord x12 = mid(x11, xx); Coord y12 = mid(y11, yy); Coord x21 = mid(xx, x22); Coord y21 = mid(yy, y22); Coord cx = mid(x12, x21); Coord cy = mid(y12, y21); curve_to(cx, cy, x11, y11, x12, y12); curve_to(x, y, x21, y21, x22, y22); } } void Canvas::close_path() { PathRenderInfo* p = &CanvasRep::path_; XPoint* startp = p->point_; XPoint* xp = next_point(p); xp->x = startp->x; xp->y = startp->y; } void Canvas::stroke(const Color* color, const Brush* b) { CanvasRep* c = rep(); PathRenderInfo* p = &CanvasRep::path_; int n = p->cur_point_ - p->point_; if (n < 2) { return; } c->flush(); c->color(color); c->brush(b); XDisplay* dpy = c->display_->rep()->display_; XDrawable d = c->drawbuffer_; GC gc = c->drawgc_; XPoint* pt = p->point_; if (n == 2) { XDrawLine(dpy, d, gc, pt[0].x, pt[0].y, pt[1].x, pt[1].y); } else if (xrect(pt, n)) { int x = Math::min(pt[0].x, pt[2].x); int y = Math::min(pt[0].y, pt[2].y); int w = Math::abs(pt[0].x - pt[2].x); int h = Math::abs(pt[0].y - pt[2].y); XDrawRectangle(dpy, d, gc, x, y, w, h); } else { XDrawLines(dpy, d, gc, pt, n, CoordModeOrigin); } } void Canvas::line( Coord x1, Coord y1, Coord x2, Coord y2, const Color* c, const Brush* b ) { new_path(); move_to(x1, y1); line_to(x2, y2); stroke(c, b); } static void rect_path(Canvas* c, Coord l, Coord b, Coord r, Coord t) { c->new_path(); c->move_to(l, b); c->line_to(l, t); c->line_to(r, t); c->line_to(r, b); c->close_path(); } void Canvas::rect( Coord l, Coord b, Coord r, Coord t, const Color* c, const Brush* br ) { rect_path(this, l, b, r, t); stroke(c, br); } void Canvas::fill(const Color* color) { CanvasRep* c = rep(); PathRenderInfo* p = &CanvasRep::path_; int n = p->cur_point_ - p->point_; if (n <= 2) { return; } c->flush(); c->color(color); XDisplay* dpy = c->display_->rep()->display_; XDrawable d = c->drawbuffer_; GC gc = c->drawgc_; XPoint* pt = p->point_; if (xrect(pt, n)) { int x = Math::min(pt[0].x, pt[2].x); int y = Math::min(pt[0].y, pt[2].y); int w = Math::abs(pt[0].x - pt[2].x); int h = Math::abs(pt[0].y - pt[2].y); XFillRectangle(dpy, d, gc, x, y, w, h); } else { XFillPolygon(dpy, d, gc, pt, n, Complex, CoordModeOrigin); } } void Canvas::fill_rect(Coord l, Coord b, Coord r, Coord t, const Color* c) { rect_path(this, l, b, r, t); fill(c); } void Canvas::clip() { CanvasRep* c = rep(); c->flush(); PathRenderInfo* p = &CanvasRep::path_; int n = p->cur_point_ - p->point_; if (n <= 2) { return; } Region clip; XPoint* pt = p->point_; if (xrect(pt, n)) { XRectangle xr; xr.x = Math::min(pt[0].x, pt[2].x); xr.y = Math::min(pt[0].y, pt[2].y); xr.width = Math::abs(pt[0].x - pt[2].x); xr.height = Math::abs(pt[0].y - pt[2].y); clip = XCreateRegion(); XUnionRectWithRegion(&xr, c->empty_, clip); } else { clip = XPolygonRegion(pt, n, EvenOddRule); } if (!XEmptyRegion(c->clipping_)) { Region intersect = XCreateRegion(); XIntersectRegion(c->clipping_, clip, intersect); XDestroyRegion(clip); clip = intersect; } XDestroyRegion(c->clipping_); c->clipping_ = clip; XSetRegion(c->dpy(), c->drawgc_, clip); } void Canvas::clip_rect(Coord l, Coord b, Coord r, Coord t) { rect_path(this, l, b, r, t); clip(); } static const int adobe_to_iso8859[] = { 0000, 0001, 0002, 0003, 0004, 0005, 0006, 0007, 0010, 0011, 0012, 0013, 0014, 0015, 0016, 0017, 0020, 0021, 0022, 0023, 0024, 0025, 0026, 0027, 0030, 0031, 0032, 0033, 0034, 0035, 0036, 0037, 0040, 0041, 0042, 0043, 0044, 0045, 0046, 0047, 0050, 0051, 0052, 0053, 0054, 0055, 0056, 0057, 0060, 0061, 0062, 0063, 0064, 0065, 0066, 0067, 0070, 0071, 0072, 0073, 0074, 0075, 0076, 0077, 0100, 0101, 0102, 0103, 0104, 0105, 0106, 0107, 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117, 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127, 0130, 0131, 0132, 0133, 0134, 0135, 0136, 0137, 0140, 0141, 0142, 0143, 0144, 0145, 0146, 0147, 0150, 0151, 0152, 0153, 0154, 0155, 0156, 0157, 0160, 0161, 0162, 0163, 0164, 0165, 0166, 0167, 0170, 0171, 0172, 0173, 0174, 0175, 0176, 0177, 0200, 0201, 0202, 0203, 0204, 0205, 0206, 0207, 0210, 0211, 0212, 0213, 0214, 0215, 0216, 0217, 0220, 0221, 0222, 0223, 0224, 0225, 0226, 0227, 0230, 0231, 0232, 0233, 0234, 0235, 0236, 0237, 0240, 0241, 0242, 0243, 0057, 0245, 0000, 0247, 0244, 0264, 0042, 0253, 0000, 0000, 0000, 0000, 0000, 0055, 0000, 0000, 0267, 0000, 0266, 0052, 0000, 0000, 0042, 0273, 0137, 0000, 0000, 0277, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0055, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000 }; declareTable2(CharBitmapTable,const Font*,long,const Bitmap*) implementTable2(CharBitmapTable,const Font*,long,const Bitmap*) static CharBitmapTable* _char_bitmaps; static const Bitmap* char_bitmap(Display* d, const Font* font, long c) { if (_char_bitmaps == nil) { _char_bitmaps = new CharBitmapTable(1024); } const Bitmap* b; if (!_char_bitmaps->find(b, font, c)) { b = new Bitmap(font, c, font->rep(d)->scale_); _char_bitmaps->insert(font, c, b); } return b; } void Canvas::character( const Font* f, long ch, Coord width, const Color* color, Coord x, Coord y ) { CanvasRep* c = rep(); int int_ch = int(ch); bool is_flush = !isprint(int_ch); if (f != nil && f != c->font_) { c->flush(); c->font(f); } if (color != nil && color != c->color_) { c->flush(); c->color(color); } Transformer& m = c->matrix(); if (!c->font_is_scaled_ && (!c->transformed_ || tx_key(m, width, width) == 0) ) { TextRenderInfo* tr = &CanvasRep::text_; if (is_flush || y != tr->cury_ || !Math::equal(x, tr->curx_, float(0.1)) ) { c->flush(); } char* cp = tr->cur_text_; if (cp == tr->text_) { Coord tx = x; Coord ty = y; if (c->transformed_) { m.transform(tx, ty); } tr->canvas_ = c; tr->drawgc_ = c->drawgc_; Display* d = c->display_; tr->x0_ = d->to_pixels(tx); tr->y0_ = c->pheight_ - d->to_pixels(ty); tr->width_ = 0; } tr->width_ += width; tr->curx_ = x + width; tr->cury_ = y; if (c->text_twobyte_) { *cp++ = char((ch & 0xff00) >> 8); *cp++ = char(ch & 0xff); } else if (c->text_reencode_) { *cp++ = adobe_to_iso8859[ch & 0xff]; } else { *cp++ = char(ch & 0xff); } tr->cur_text_ = cp; if (ch == ' ') { tr->spaces_ += 1; if (cp > tr->text_ + 1) { c->flush(); } } if (is_flush) { c->flush(); } } else if (ch != ' ') { c->flush(); stencil(char_bitmap(c->display_, f, ch), color, x, y); } } declareTable2(TxBitmapTable,const Bitmap*,int,BitmapRep*) implementTable2(TxBitmapTable,const Bitmap*,int,BitmapRep*) static TxBitmapTable* _tx_bitmaps; static BitmapRep* tx_bitmap(const Bitmap* b, const Transformer& tx) { int key = tx_key(tx, b->width(), b->height()); if (key == 0) { return b->rep(); } else { if (_tx_bitmaps == nil) { _tx_bitmaps = new TxBitmapTable(1024); } BitmapRep* rep; if (!_tx_bitmaps->find(rep, b, key)) { Display* d = b->rep()->display_; rep = new BitmapRep; Transformer v(tx); Coord x0, y0; v.transform(0, 0, x0, y0); v.translate(-x0, -y0); Coord x1, x2, x3, x4; Coord y1, y2, y3, y4; v.transform(-b->left_bearing(), -b->descent(), x1, y1); v.transform(-b->left_bearing(), b->ascent(), x2, y2); v.transform(b->right_bearing(), b->ascent(), x3, y3); v.transform(b->right_bearing(), -b->descent(), x4, y4); Coord xmax = Math::max(x1, x2, x3, x4); Coord xmin = Math::min(x1, x2, x3, x4); Coord ymax = Math::max(y1, y2, y3, y4); Coord ymin = Math::min(y1, y2, y3, y4); int width = d->to_pixels(xmax) - d->to_pixels(xmin); int height = d->to_pixels(ymax) - d->to_pixels(ymin); if (width <= 0) { width = 1; } if (height <= 0) { height = 1; } XDisplay* dpy = d->rep()->display_; BitmapRep* srep = b->rep(); XImage* source = XGetImage( dpy, srep->pixmap_, 0, 0, srep->pwidth_, srep->pheight_, 0x01, ZPixmap ); Pixmap map = XCreatePixmap(dpy, d->rep()->root_, width, height, 1); GC xgc = XCreateGC(dpy, map, 0, nil); XSetForeground(dpy, xgc, 0); XFillRectangle(dpy, map, xgc, 0, 0, width, height); XImage* dest = XGetImage( dpy, map, 0, 0, width, height, 0x01, ZPixmap ); int dx0 = d->to_pixels(-xmin); int dy0 = d->to_pixels(-ymin); int sx0 = d->to_pixels(b->left_bearing()); int sy0 = d->to_pixels(b->descent()); for (int dy = 0; dy < height; ++dy) { Coord tx1, ty1, tx2, ty2; v.inverse_transform(- dx0, dy - dy0, tx1, ty1); v.inverse_transform(width - dx0, dy - dy0, tx2, ty2); float delta_x = (tx2 - tx1) / width; float delta_y = (ty2 - ty1) / width; int sx, sy; for (int dx = 0; dx < width; ++dx) { sx = int(tx1) + sx0; sy = int(ty1) + sy0; if ( sx >= 0 && sx < srep->pwidth_ && sy >= 0 && sy < srep->pheight_ ) { XPutPixel( dest, dx, height - 1 - dy, XGetPixel(source, sx, srep->pheight_ - 1 - sy) ); } tx1 = tx1 + delta_x; ty1 = ty1 + delta_y; } } XPutImage(dpy, map, xgc, dest, 0, 0, 0, 0, width, height); XFreeGC(dpy, xgc); XDestroyImage(source); XDestroyImage(dest); rep->display_ = d; rep->pixmap_ = map; rep->pwidth_ = width; rep->pheight_ = height; rep->width_ = xmax - xmin; rep->height_ = ymax - ymin; rep->left_ = xmin; rep->right_ = xmax; rep->bottom_ = ymin; rep->top_ = ymax; _tx_bitmaps->insert(b, key, rep); } return rep; } } void Canvas::stencil( const Bitmap* mask, const Color* color, Coord x, Coord y ) { CanvasRep& c = *rep(); c.flush(); XDisplay* dpy = c.dpy(); XDrawable d = c.drawbuffer_; Transformer& m = c.matrix(); mask->flush(); BitmapRep* info = tx_bitmap(mask, m); Coord tx, ty; if (c.transformed_) { m.transform(x, y, tx, ty); } else { tx = x; ty = y; } Display* disp = c.display_; int pleft = disp->to_pixels(tx + info->left_); int ptop = c.pheight_ - disp->to_pixels(ty + info->top_); XGCValues gcv; unsigned long valuemask = 0; valuemask |= GCFunction; gcv.function = GXand; valuemask |= GCForeground; gcv.foreground = 0; valuemask |= GCBackground; gcv.background = AllPlanes; valuemask |= GCGraphicsExposures; gcv.graphics_exposures = False; GC xgc = XCreateGC(dpy, d, valuemask, &gcv); XCopyGC(dpy, c.drawgc_, GCClipMask, xgc); XCopyPlane( dpy, info->pixmap_, d, xgc, 0, 0, info->pwidth_, info->pheight_, pleft, ptop, 1 ); gcv.function = GXxor; gcv.foreground = color->rep(c.window_->rep()->visual_)->xcolor_.pixel; gcv.background = 0; valuemask &= ~GCGraphicsExposures; XChangeGC(dpy, xgc, valuemask, &gcv); XCopyPlane( dpy, info->pixmap_, d, xgc, 0, 0, info->pwidth_, info->pheight_, pleft, ptop, 1 ); XFreeGC(dpy, xgc); } declareTable2(TxRasterTable,const Raster*,int,RasterRep*) implementTable2(TxRasterTable,const Raster*,int,RasterRep*) static TxRasterTable* _tx_rasters; static RasterRep* tx_raster(const Raster* r, const Transformer& tx, Coord xt, Coord yt, Coord cw, Coord ch) { int key = tx_key(tx, r->width(), r->height()); if (key == 0) { return r->rep(); } else { if (_tx_rasters == nil) { _tx_rasters = new TxRasterTable(1024); } RasterRep* rep; if (!_tx_rasters->find(rep, r, key)) { Display* d = r->rep()->display_; DisplayRep& dr = *d->rep(); Transformer v(tx); Coord x0, y0; v.transform(0, 0, x0, y0); v.translate(-x0, -y0); Coord x1, x2, x3, x4; Coord y1, y2, y3, y4; v.transform(-r->left_bearing(), -r->descent(), x1, y1); v.transform(-r->left_bearing(), r->ascent(), x2, y2); v.transform(r->right_bearing(), r->ascent(), x3, y3); v.transform(r->right_bearing(), -r->descent(), x4, y4); Coord xmax = Math::max(x1, x2, x3, x4); Coord xmin = Math::min(x1, x2, x3, x4); Coord ymax = Math::max(y1, y2, y3, y4); Coord ymin = Math::min(y1, y2, y3, y4); if (xmin + xt < 0) { xmin = -xt; } if (xmax + xt > cw) {xmax = cw - xt;} if (ymin + yt < 0) { ymin = -yt;} if (ymax + yt > ch) {ymax = ch - yt;} int width = d->to_pixels(xmax) - d->to_pixels(xmin); int height = d->to_pixels(ymax) - d->to_pixels(ymin); if (width <= 0) { width = 1; } if (height <= 0) { height = 1; } XDisplay* dpy = dr.display_; RasterRep* srep = r->rep(); XImage* source = XGetImage( dpy, srep->pixmap_, 0, 0, srep->pwidth_, srep->pheight_, AllPlanes, ZPixmap ); Pixmap map = XCreatePixmap( dpy, dr.root_, width, height, dr.default_visual_->depth() ); GC xgc = XCreateGC(dpy, map, 0, nil); XSetForeground(dpy, xgc, 0); XFillRectangle(dpy, map, xgc, 0, 0, width, height); XImage* dest = XGetImage( dpy, map, 0, 0, width, height, AllPlanes, ZPixmap ); int dx0 = d->to_pixels(-xmin); int dy0 = d->to_pixels(-ymin); int sx0 = d->to_pixels(r->left_bearing()); int sy0 = d->to_pixels(r->descent()); for (int dy = 0; dy < height; ++dy) { Coord tx1, ty1, tx2, ty2; v.inverse_transform(- dx0, dy - dy0, tx1, ty1); v.inverse_transform(width - dx0, dy - dy0, tx2, ty2); float delta_x = (tx2 - tx1) / width; float delta_y = (ty2 - ty1) / width; int sx, sy; for (int dx = 0; dx < width; ++dx) { sx = int(tx1) + sx0; sy = int(ty1) + sy0; if ( sx >= 0 && sx < srep->pwidth_ && sy >= 0 && sy < srep->pheight_ ) { XPutPixel( dest, dx, height - 1 - dy, XGetPixel(source, sx, srep->pheight_ - 1 - sy) ); } tx1 = tx1 + delta_x; ty1 = ty1 + delta_y; } } XPutImage(dpy, map, xgc, dest, 0, 0, 0, 0, width, height); XFreeGC(dpy, xgc); XDestroyImage(source); XDestroyImage(dest); rep = new RasterRep; rep->display_ = d; rep->pixmap_ = map; rep->pwidth_ = width; rep->pheight_ = height; rep->width_ = xmax - xmin; rep->height_ = ymax - ymin; rep->left_ = xmin; rep->right_ = xmax; rep->bottom_ = ymin; rep->top_ = ymax; //printf("width=%d height=%d\n", width, height); //printf("xmin=%g xmax=%g ymin=%g ymax=%g xt=%g yt=%g cw=%g ch=%g\n", xmin, xmax, ymin, ymax, // xt, yt, cw, ch); // _tx_rasters->insert(r, key, rep); } return rep; } } void Canvas::image(const Raster* image, Coord x, Coord y) { CanvasRep* c = rep(); c->flush(); XDisplay* dpy = c->dpy(); GC gc = c->drawgc_; Transformer& m = c->matrix(); Display* d = c->display_; Coord tx, ty; if (c->transformed_) { m.transform(x, y, tx, ty); } else { tx = x; ty = y; } image->flush(); RasterRep* info = tx_raster(image, m, tx, ty, width(), height()); if (!info) { return; } int pleft = d->to_pixels(tx + info->left_); int ptop = c->pheight_ - d->to_pixels(ty + info->top_); /* * We assume that graphics exposures are off in the gc. */ XCopyArea( dpy, info->pixmap_, c->drawbuffer_, gc, 0, 0, info->pwidth_, info->pheight_, pleft, ptop ); if (info != image->rep()) { XFreePixmap(info->display_->rep()->display_, info->pixmap_); delete info; } } Window* Canvas::window() const { return rep()->window_; } /* * Damage coordinates are always absolute with respect to the canvas, * so they are not transformed. */ void Canvas::damage(const Extension& ext) { damage(ext.left(), ext.bottom(), ext.right(), ext.top()); } void Canvas::damage(Coord left, Coord bottom, Coord right, Coord top) { CanvasRep& c = *rep(); CanvasDamage& damage = c.damage_; if (c.damaged_) { damage.left = Math::min(damage.left, left); damage.bottom = Math::min(damage.bottom, bottom); damage.right = Math::max(damage.right, right); damage.top = Math::max(damage.top, top); } else { damage.left = left; damage.bottom = bottom; damage.right = right; damage.top = top; } c.new_damage(); } bool Canvas::damaged(const Extension& ext) const { return damaged(ext.left(), ext.bottom(), ext.right(), ext.top()); } bool Canvas::damaged( Coord left, Coord bottom, Coord right, Coord top ) const { CanvasRep& c = *rep(); CanvasDamage& damage = c.damage_; return ( c.damaged_ && left < damage.right && right > damage.left && bottom < damage.top && top > damage.bottom ); } void Canvas::damage_area(Extension& ext) { CanvasRep& c = *rep(); CanvasDamage& damage = c.damage_; ext.set_xy(nil, damage.left, damage.bottom, damage.right, damage.top); } void Canvas::damage_all() { CanvasRep& c = *rep(); CanvasDamage& damage = c.damage_; damage.left = 0; damage.bottom = 0; damage.right = c.width_; damage.top = c.height_; c.new_damage(); } bool Canvas::any_damage() const { return rep()->damaged_; } void Canvas::restrict_damage(const Extension& ext) { restrict_damage(ext.left(), ext.bottom(), ext.right(), ext.top()); } void Canvas::restrict_damage( Coord left, Coord bottom, Coord right, Coord top ) { CanvasRep& c = *rep(); c.clear_damage(); damage(left, bottom, right, top); if (c.repairing_) { c.start_repair(); } } /* * Force a portion of the canvas to be redrawn. This is typically caused * by an X expose event. If there is no damage and we have a buffer * with a copy of the canvas, then we can just copy it to the draw buffer. * Otherwise, we just damage the area. */ void Canvas::redraw(Coord left, Coord bottom, Coord right, Coord top) { CanvasRep& c = *rep(); if (!c.damaged_ && c.copybuffer_ != CanvasRep::unbound) { Display& d = *c.display_; int ptop = d.to_pixels(top); int x = d.to_pixels(left); int y = c.pheight_ - ptop; unsigned int w = d.to_pixels(right) - x; unsigned int h = ptop - d.to_pixels(bottom); XCopyArea( c.dpy(), c.drawbuffer_, c.copybuffer_, c.copygc_, x, y, w, h, x, y ); } else { damage(left, bottom, right, top); } } void Canvas::repair() { CanvasRep& c = *rep(); c.clear_damage(); } /* class CanvasRep */ /* * We must (re)bind the drawbuffer to the canvas' drawable whenever * it changes size or is set to a new xid. This allows us * to (re)allocate a backbuffer pixmap when double-buffering. * We set the canvas' xdrawable to the backbuffer. */ void CanvasRep::bind(bool double_buffered) { CanvasRep& c = *this; XDisplay* dpy = c.display_->rep()->display_; XGCValues gcv; gcv.graphics_exposures = False; if (double_buffered) { c.drawbuffer_ = XCreatePixmap( dpy, c.xdrawable_, c.pwidth_, c.pheight_, c.window_->rep()->visual_->depth() ); c.copybuffer_ = c.xdrawable_; c.copygc_ = XCreateGC(dpy, c.copybuffer_, GCGraphicsExposures, &gcv); c.xdrawable_ = c.drawbuffer_; } else { c.drawbuffer_ = c.xdrawable_; c.copybuffer_ = CanvasRep::unbound; } c.drawgc_ = XCreateGC(dpy, c.drawbuffer_, GCGraphicsExposures, &gcv); } /* * If double-buffering, free the backbuffer and set the canvas' xdrawable * back to the frontbuffer. */ void CanvasRep::unbind() { CanvasRep& c = *this; if (c.display_ != nil) { XDisplay* dpy = c.dpy(); if (c.copybuffer_ != CanvasRep::unbound) { XFreePixmap(dpy, c.drawbuffer_); c.xdrawable_ = c.copybuffer_; c.copybuffer_ = CanvasRep::unbound; if (c.copygc_ != nil) { XFreeGC(dpy, c.copygc_); c.copygc_ = nil; } } if (c.drawgc_ != nil) { XFreeGC(dpy, c.drawgc_); c.drawgc_ = nil; } } c.drawbuffer_ = CanvasRep::unbound; Resource::unref(c.brush_); Resource::unref(c.color_); Resource::unref(c.font_); c.brush_ = nil; c.color_ = nil; c.font_ = nil; } #undef restrict #define restrict my_restrict //keyword on cray static inline void restrict(int& c, int a, int b) { if (c < a) { c = a; } else if (c > b) { c = b; } } bool CanvasRep::start_repair() { CanvasRep& c = *this; if (!c.damaged_) { return false; } XRectangle& clip = c.clip_; CanvasDamage& damage = c.damage_; Display& d = *c.display_; int d_left = d.to_pixels(damage.left); int d_bottom = d.to_pixels(damage.bottom); int d_right = d.to_pixels(damage.right); int d_top = d.to_pixels(damage.top); restrict(d_left, 0, pwidth_); restrict(d_bottom, 0, pheight_); restrict(d_right, 0, pwidth_); restrict(d_top, 0, pheight_); clip.x = d_left; clip.y = c.pheight_ - d_top; clip.width = d_right - d_left; clip.height = d_top - d_bottom; XUnionRectWithRegion(&clip, c.empty_, c.clipping_); XSetClipRectangles(dpy(), c.drawgc_, 0, 0, &clip, 1, YXBanded); c.repairing_ = true; return true; } void CanvasRep::finish_repair() { CanvasRep& c = *this; c.flush(); c.swapbuffers(); c.damaged_ = false; c.on_damage_list_ = false; c.repairing_ = false; } void CanvasRep::flush() { TextRenderInfo* t = &CanvasRep::text_; if (t == nil) { return; } unsigned int nchars = t->cur_text_ - t->text_; if (nchars != 0) { CanvasRep& c = *this; XDisplay* dpy = c.dpy(); XDrawable d = t->canvas_->drawbuffer_; GC gc = t->drawgc_; if (t->spaces_ == 0 || c.text_twobyte_) { if (c.text_twobyte_) { XDrawString16( dpy, d, gc, t->x0_, t->y0_, (XChar2b*)t->text_, nchars/2 ); } else { XDrawString(dpy, d, gc, t->x0_, t->y0_, t->text_, nchars); } } else { int width = XTextWidth(c.xfont_, t->text_, nchars); int delta = c.display_->to_pixels(t->width_) - width; int item = 0; int count = 0; t->items_[item].chars = t->text_; t->items_[item].delta = 0; t->items_[item].font = None; char* text_end = t->cur_text_; for (char* cp = t->text_; cp < text_end; cp++) { if (*cp == ' ') { int d = delta / (t->spaces_ - item); delta -= d; t->items_[item].nchars = count; ++item; t->items_[item].chars = cp; t->items_[item].delta = d; t->items_[item].font = None; count = 0; } ++count; } t->items_[item].nchars = count; XDrawText( dpy, d, gc, t->x0_, t->y0_, t->items_, item + 1 ); } t->cur_text_ = t->text_; t->spaces_ = 0; } } void CanvasRep::swapbuffers() { CanvasRep& c = *this; if (c.copybuffer_ == CanvasRep::unbound) { /* not double-buffering */ return; } XRectangle& clip = c.clip_; XCopyArea( c.dpy(), c.drawbuffer_, c.copybuffer_, c.copygc_, clip.x, clip.y, clip.width, clip.height, clip.x, clip.y ); } XDisplay* CanvasRep::dpy() const { return display_->rep()->display_; } Transformer& CanvasRep::matrix() const { TransformerStack& s = *transformers_; return *(s.item(s.count() - 1)); } void CanvasRep::color(const Color* color) { CanvasRep& c = *this; if (color != nil && color != c.color_) { Resource::ref(color); Resource::unref(c.color_); c.color_ = color; XDisplay* dpy = c.dpy(); WindowVisual* wv = c.window_->rep()->visual_; GC gc = c.drawgc_; ColorRep& cr = *color->rep(wv); c.pixel_ = cr.xcolor_.pixel; c.op_ = cr.op_; c.stipple_ = cr.stipple_; if (cr.masking_) { XSetForeground(dpy, gc, 1); } else if (c.op_ == GXxor) { XSetForeground(dpy, gc, wv->iv_xor(c.window_->style())); } else { XSetForeground(dpy, gc, c.pixel_); } XSetFunction(dpy, gc, c.op_); if (c.stipple_ != 0) { XSetStipple(dpy, gc, c.stipple_); XSetFillStyle(dpy, gc, FillStippled); } else { XSetFillStyle(dpy, gc, FillSolid); } } } void CanvasRep::brush(const Brush* b) { CanvasRep* c = this; if (b != nil && b != c->brush_) { Resource::ref(b); Resource::unref(c->brush_); c->brush_ = b; XDisplay* dpy = c->dpy(); GC gc = c->drawgc_; BrushRep* br = b->rep(c->display_); c->brush_width_ = br->width_; c->dash_list_ = br->dash_list_; c->dash_count_ = br->dash_count_; if (c->dash_list_ == nil) { XSetLineAttributes( dpy, gc, c->brush_width_, LineSolid, CapButt, JoinMiter ); } else { XSetLineAttributes( dpy, gc, c->brush_width_, LineOnOffDash, CapButt, JoinMiter ); XSetDashes(dpy, gc, 0, c->dash_list_, c->dash_count_); } } } void CanvasRep::font(const Font* f) { CanvasRep& c = *this; if (f != nil && f != c.font_) { Resource::ref(f); Resource::unref(c.font_); FontRep* fr = f->rep(c.display_); c.font_ = f; XFontStruct* xf = fr->font_; c.xfont_ = xf; c.text_twobyte_ = xf->min_byte1 > 0 || xf->max_byte1 > 0; const char* coding = f->Font::encoding(); c.text_reencode_ = coding != nil && strcmp(coding, "ISO8859") == 0; if (fr->unscaled_) { c.font_is_scaled_ = false; } else { c.font_is_scaled_ = true; float tolerance = 0.15; Window* w = c.window_; if (w != nil) { Style* s = w->style(); if (s != nil) { s->find_attribute("fontScaleTolerance", tolerance); } } c.font_is_scaled_ = ( fr->scale_ < (1 - tolerance) || fr->scale_ > (1 + tolerance) ); } XSetFont(c.dpy(), c.drawgc_, xf->fid); } } void CanvasRep::new_damage() { Window* w = window_; damaged_ = true; if (!on_damage_list_ && w != nil && w->bound()) { on_damage_list_ = true; display_->rep()->needs_repair(w); } } void CanvasRep::clear_damage() { damaged_ = false; on_damage_list_ = false; } /* * These are at the end of the file to workaround a cfront 2.0 problem. */ TextRenderInfo CanvasRep::text_; PathRenderInfo CanvasRep::path_; /* Canvas anachronisms */ unsigned int Canvas::Width() const { return pwidth(); } unsigned int Canvas::Height() const { return pheight(); } CanvasLocation Canvas::status() const { return rep()->status_; } #include void Canvas::SetBackground(const Color* c) { Window* ww = window(); if (ww != nil) { WindowRep& w = *ww->rep(); XSetWindowBackground( w.display_->rep()->display_, w.xwindow_, c->rep(w.visual_)->xcolor_.pixel ); } } neuron-7.6.3/src/lib/IV-X11/xcolor.cpp000066400000000000000000000212241340731477100173010ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include #include declarePtrList(ColorRepList,ColorRep) implementPtrList(ColorRepList,ColorRep) inline unsigned long key_to_hash(String& s) { return s.hash(); } declareTable2(NameToColor,Display*,UniqueString,const Color*) implementTable2(NameToColor,Display*,UniqueString,const Color*) class ColorImpl { private: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif friend class Color; ColorIntensity red; ColorIntensity green; ColorIntensity blue; float alpha; ColorOp op; ColorRepList* replist; UniqueString ctable_name; Display* ctable_display; static NameToColor* ctable_; }; NameToColor* ColorImpl::ctable_; Color::Color( ColorIntensity r, ColorIntensity g, ColorIntensity b, float alpha, ColorOp op ) { ColorImpl* c = new ColorImpl; impl_ = c; c->red = r; c->green = g; c->blue = b; c->alpha = alpha; c->op = op; c->ctable_display = nil; c->replist = new ColorRepList; } Color::Color(const Color& color, float alpha, ColorOp op) { ColorImpl* c = new ColorImpl; impl_ = c; c->red = color.impl_->red; c->green = color.impl_->green; c->blue = color.impl_->blue; c->alpha = alpha; c->op = op; c->ctable_display = nil; c->replist = new ColorRepList; } Color::~Color() { ColorImpl* c = impl_; if (c->ctable_display != nil) { c->ctable_->remove(c->ctable_display, c->ctable_name); } for (ListItr(ColorRepList) i(*c->replist); i.more(); i.next()) { destroy(i.cur()); } delete c->replist; delete c; } /* * Shorthand for find + constructor. */ const Color* Color::lookup(Display* d, const String& s) { NameToColor* t = ColorImpl::ctable_; if (t == nil) { t = new NameToColor(128); ColorImpl::ctable_ = t; } UniqueString u(s); const Color* c; if (t->find(c, d, u)) { return c; } ColorIntensity r, g, b; if (find(d, u, r, g, b)) { c = new Color(r, g, b); t->insert(d, u, c); c->impl_->ctable_display = d; c->impl_->ctable_name = u; return c; } return nil; } const Color* Color::lookup(Display* d, const char* name) { return lookup(d, String(name)); } bool Color::distinguished(const Color* c) const { return distinguished(Session::instance()->default_display(), c); } void Color::intensities( ColorIntensity& r, ColorIntensity& g, ColorIntensity& b ) const { intensities(Session::instance()->default_display(), r, g, b); } float Color::alpha() const { return impl_->alpha; } ColorOp Color::op() const { return impl_->op; } ColorRep* Color::rep(WindowVisual* wv) const { for (ListItr(ColorRepList) i(*impl_->replist); i.more(); i.next()) { ColorRep* c = i.cur(); if (c->visual_ == wv) { return c; } } ColorImpl* c = impl_; ColorRep* r = create(wv, c->red, c->green, c->blue, c->alpha, c->op); impl_->replist->append(r); return r; } void Color::remove(WindowVisual* wv) const { for (ListUpdater(ColorRepList) i(*impl_->replist); i.more(); i.next()) { ColorRep* c = i.cur(); if (c->visual_ == wv) { i.remove_cur(); break; } } } static char stipple_data[][4] = { {'\000','\000','\000','\000'}, {'\001','\000','\000','\000'}, {'\001','\000','\004','\000'}, {'\005','\000','\004','\000'}, {'\005','\000','\005','\000'}, {'\005','\002','\005','\000'}, {'\005','\002','\005','\010'}, {'\005','\012','\005','\010'}, {'\005','\012','\005','\012'}, {'\007','\012','\005','\012'}, {'\007','\012','\015','\012'}, {'\017','\012','\015','\012'}, {'\017','\012','\017','\012'}, {'\017','\013','\017','\012'}, {'\017','\013','\017','\016'}, {'\017','\017','\017','\016'} }; static Pixmap stipple[16]; static Pixmap make_stipple(WindowVisual* wv, float alpha) { int index = Math::max(0, Math::min(int(alpha * 16), 15)); if (stipple[index] == None) { stipple[index] = XCreateBitmapFromData( wv->display(), RootWindow(wv->display(), wv->screen()), stipple_data[index], 4, 4 ); } return stipple[index]; } ColorRep* Color::create( WindowVisual* wv, ColorIntensity r, ColorIntensity g, ColorIntensity b, float alpha, ColorOp op ) const { unsigned short red = (unsigned short)Math::round(r * float(0xffff)); unsigned short green = (unsigned short)Math::round(g * float(0xffff)); unsigned short blue = (unsigned short)Math::round(b * float(0xffff)); register ColorRep* c = new ColorRep; wv->find_color(red, green, blue, c->xcolor_); c->visual_ = wv; switch (op) { case Copy: c->op_ = GXcopy; c->masking_ = false; break; case Xor: c->op_ = GXxor; c->masking_ = false; break; case Invisible: c->op_ = GXnoop; c->masking_ = false; break; } c->stipple_ = ((alpha > 0.9999 && alpha < 1.0001) ? None : make_stipple(wv, alpha) ); return c; } bool Color::find( const Display* display, const String& name, ColorIntensity& r, ColorIntensity& g, ColorIntensity& b ) { NullTerminatedString ns(name); XColor xc; DisplayRep& d = *display->rep(); if (XParseColor( d.display_, d.default_visual_->colormap(), ns.string(), &xc) ) { r = float(xc.red) / float(0xffff); g = float(xc.green) / float(0xffff); b = float(xc.blue) / float(0xffff); return true; } return false; } bool Color::find( const Display* display, const char* name, ColorIntensity& r, ColorIntensity& g, ColorIntensity& b ) { return find(display, String(name), r, g, b); } void Color::destroy(ColorRep* r) { delete r; } bool Color::distinguished(Display* d, const Color* color) const { WindowVisual* wv = d->rep()->default_visual_; XColor& xc = rep(wv)->xcolor_; ColorRep* c = color->rep(wv); XColor& color_xc = c->xcolor_; return ( xc.red != color_xc.red || xc.green != color_xc.green || xc.blue != color_xc.blue ); } void Color::intensities( Display* d, ColorIntensity& r, ColorIntensity& g, ColorIntensity& b ) const { WindowVisual* wv = d->rep()->default_visual_; XColor& xc = rep(wv)->xcolor_; r = float(xc.red) / float(0xffff); g = float(xc.green) / float(0xffff); b = float(xc.blue) / float(0xffff); } const Color* Color::brightness(float adjust) const { ColorIntensity r, g, b; intensities(r, g, b); if (adjust >= 0) { r += (1 - r) * adjust; g += (1 - g) * adjust; b += (1 - b) * adjust; } else { float f = adjust + 1.0; r *= f; g *= f; b *= f; } return new Color(r, g, b); } /* anachronisms */ Color::Color(int ir, int ig, int ib) { ColorImpl* c = new ColorImpl; impl_ = c; c->red = float(ir) / float(0xffff); c->green = float(ig) / float(0xffff); c->blue = float(ib) / float(0xffff); c->alpha = 1.0; c->op = Copy; } void Color::Intensities(int& ir, int& ig, int& ib) const { ColorIntensity r, g, b; intensities(Session::instance()->default_display(), r, g, b); ir = Math::round(float(0xffff) * r); ig = Math::round(float(0xffff) * g); ib = Math::round(float(0xffff) * b); } int Color::PixelValue() const { Display& d = *Session::instance()->default_display(); WindowVisual* wv = d.rep()->default_visual_; return rep(wv)->xcolor_.pixel; } neuron-7.6.3/src/lib/IV-X11/xcursor.cpp000077500000000000000000000200221340731477100174760ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Input cursors. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static const CursorPattern textPat = { 0x0000, 0x4400, 0x2800, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x2800, 0x4400, 0x0000 }; static const CursorPattern textMask = { 0x0000, 0xCC00, 0x7800, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x7800, 0xCC00, 0x0000, }; static const CursorPattern noPat = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; Cursor* defaultCursor; Cursor* arrow; Cursor* crosshairs; Cursor* ltextCursor; Cursor* rtextCursor; Cursor* hourglass; Cursor* upperleft; Cursor* upperright; Cursor* lowerleft; Cursor* lowerright; Cursor* noCursor; /* * Define the builtin cursors. */ void Cursor::init() { arrow = new Cursor(XC_left_ptr); crosshairs = new Cursor(XC_crosshair); ltextCursor = new Cursor(4, 8, textPat, textMask); rtextCursor = new Cursor(0, 8, textPat, textMask); hourglass = new Cursor(XC_watch); upperleft = new Cursor(XC_ul_angle); upperright = new Cursor(XC_ur_angle); lowerleft = new Cursor(XC_ll_angle); lowerright = new Cursor(XC_lr_angle); noCursor = new Cursor(0, 0, noPat, noPat); defaultCursor = arrow; } /* * Create a cursor a specific pattern and mask. */ Cursor::Cursor( short xoff, short yoff, const int* p, const int* m, const Color* fg, const Color * bg ) { rep_ = new CursorRepData(xoff, yoff, p, m, fg, bg); } /* * Create a cursor from bitmaps. */ Cursor::Cursor( const Bitmap* pat, const Bitmap* mask, const Color* fg, const Color* bg ) { rep_ = new CursorRepBitmap(pat, mask, fg, bg); } /* * Create a cursor from a font. */ Cursor::Cursor( const Font* font, int pat, int mask, const Color* fg, const Color* bg ) { rep_ = new CursorRepFont(font, pat, mask, fg, bg); } /* * Create a cursor from the predefined cursor font. */ Cursor::Cursor(int n, const Color* fg, const Color* bg) { rep_ = new CursorRepXFont(n, fg, bg); } Cursor::~Cursor() { delete rep_; } /* class CursorRep */ CursorRep::CursorRep(const Color* fg, const Color* bg) { Resource::ref(fg); fg_ = fg; Resource::ref(bg); bg_ = bg; display_ = nil; xcursor_ = 0; } CursorRep::~CursorRep() { if (xcursor_ != 0) { XFreeCursor(display_->rep()->display_, xcursor_); } Resource::unref(fg_); Resource::unref(bg_); } XCursor CursorRep::xid(Display* d, WindowVisual* wv) { if (display_ != d) { if (xcursor_ != 0) { XFreeCursor(display_->rep()->display_, xcursor_); } Style* s = d->style(); if (fg_ == nil) { fg_ = make_color( d, s, "pointerColor", "foreground", "Foreground", "#000000" ); } if (bg_ == nil) { bg_ = make_color( d, s, "pointerColorBackground", "background", "Background", "#ffffff" ); } make_xcursor(d, wv); display_ = d; } return xcursor_; } const Color* CursorRep::make_color( Display* d, Style* s, const char* str1, const char* str2, const char* str3, const char* default_value ) { const Color* c = nil; String v; if (s->find_attribute(str1, v) || s->find_attribute(str2, v) || s->find_attribute(str3, v) ) { c = Color::lookup(d, v); } if (c == nil) { c = Color::lookup(d, default_value); } Resource::ref(c); return c; } /* class CursorRepData */ CursorRepData::CursorRepData( short x_hot, short y_hot, const int* pat, const int* mask, const Color* fg, const Color* bg ) : CursorRep(fg, bg) { x_ = x_hot; y_ = y_hot; pat_ = pat; mask_ = mask; } CursorRepData::~CursorRepData() { } void CursorRepData::make_xcursor(Display* d, WindowVisual* wv) { XDisplay* dpy = d->rep()->display_; XWindow root = d->rep()->root_; Pixmap p = make_cursor_pixmap(dpy, root, pat_); Pixmap m = make_cursor_pixmap(dpy, root, mask_); xcursor_ = XCreatePixmapCursor( dpy, p, m, &fg_->rep(wv)->xcolor_, &bg_->rep(wv)->xcolor_, x_, cursorHeight - 1 - y_ ); XFreePixmap(dpy, p); XFreePixmap(dpy, m); } /* * Create the pixmap for a cursor. These are always 16x16, unlike * fill patterns, which are 32x32. */ Pixmap CursorRepData::make_cursor_pixmap( XDisplay* dpy, XWindow root, const int* scanline ) { Pixmap dst = XCreatePixmap(dpy, root, cursorWidth, cursorHeight, 1); GC g = XCreateGC(dpy, dst, 0, nil); XSetForeground(dpy, g, 0); XSetFillStyle(dpy, g, FillSolid); XFillRectangle(dpy, dst, g, 0, 0, cursorWidth, cursorHeight); XSetForeground(dpy, g, 1); register int i, j; register unsigned s1, s2; for (i = 0; i < cursorHeight; i++) { s1 = scanline[i]; s2 = 1; for (j = 0; j < cursorWidth; j++) { if ((s1 & s2) != 0) { XDrawPoint(dpy, dst, g, cursorWidth - 1 - j, i); } s2 <<= 1; } } XFreeGC(dpy, g); return dst; } /* class CursorRepBitmap */ CursorRepBitmap::CursorRepBitmap( const Bitmap* pat, const Bitmap* mask, const Color* fg, const Color* bg ) : CursorRep(fg, bg) { Resource::ref(pat); pat_ = pat; Resource::ref(mask); mask_ = mask; } CursorRepBitmap::~CursorRepBitmap() { Resource::unref(pat_); Resource::unref(mask_); } void CursorRepBitmap::make_xcursor(Display* d, WindowVisual* wv) { BitmapRep* b = pat_->rep(); xcursor_ = XCreatePixmapCursor( d->rep()->display_, b->pixmap_, mask_->rep()->pixmap_, &fg_->rep(wv)->xcolor_, &bg_->rep(wv)->xcolor_, d->to_pixels(-b->left_), d->to_pixels(b->height_ - 1 + b->bottom_) ); } /* class CursorRepFont */ CursorRepFont::CursorRepFont( const Font* font, int pat, int mask, const Color* fg, const Color* bg ) : CursorRep(fg, bg) { Resource::ref(font); font_ = font; pat_ = pat; mask_ = mask; } CursorRepFont::~CursorRepFont() { Resource::unref(font_); } void CursorRepFont::make_xcursor(Display* d, WindowVisual* wv) { XFontStruct* i = font_->rep(d)->font_; xcursor_ = XCreateGlyphCursor( d->rep()->display_, i->fid, i->fid, pat_, mask_, &fg_->rep(wv)->xcolor_, &bg_->rep(wv)->xcolor_ ); } /* class CursorRepXFont */ CursorRepXFont::CursorRepXFont( int code, const Color* fg, const Color* bg ) : CursorRep(fg, bg) { code_ = code; } CursorRepXFont::~CursorRepXFont() { } void CursorRepXFont::make_xcursor(Display* d, WindowVisual* wv) { XDisplay* dpy = d->rep()->display_; xcursor_ = XCreateFontCursor(dpy, code_); XRecolorCursor( dpy, xcursor_, &fg_->rep(wv)->xcolor_, &bg_->rep(wv)->xcolor_ ); } neuron-7.6.3/src/lib/IV-X11/xdrag.cpp000066400000000000000000000641501340731477100171050ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1992,1993 Redwood Design Automation * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the name of * Redwood Design Automation may not be used in any advertising or publicity * relating to the software without the specific, prior written permission of * Redwood Design Automation. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL REDWOOD DESIGN AUTOMATION BE LIABLE FOR ANY SPECIAL, * INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT * ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if !defined(HAVE_SSTREAM) #include #endif #include #include // how is this done portably? it is used to generate a name unique to // this process. extern "C" { pid_t getpid(); } /* class DragBox */ class DragBox : public Background { public: DragBox(Glyph* body, const Color* color); virtual void everDrawn(bool drawn); virtual bool everDrawn(); virtual void draw(Canvas* canvas, const Allocation& allocation) const; protected: bool everDrawn_; }; DragBox::DragBox(Glyph* body, const Color* color) : Background(body, color) { everDrawn_ = false; } void DragBox::everDrawn(bool drawn) { everDrawn_ = drawn; } bool DragBox::everDrawn() { return everDrawn_; } void DragBox::draw(Canvas* canvas, const Allocation& allocation) const { Background::draw(canvas, allocation); DragBox* self = (DragBox*) this; self->everDrawn_ = true; } /* class DragAtoms */ class DragAtoms { public: DragAtoms(); bool enter(const XEvent&); bool motion(const XEvent&); bool leave(const XEvent&); bool drop(const XEvent&); bool enter(const Event&); bool motion(const Event&); bool leave(const Event&); bool drop(const Event&); Atom enter(XDisplay*); Atom motion(XDisplay*); Atom leave(XDisplay*); Atom drop(XDisplay*); Atom drag(XDisplay*); protected: void cache(XDisplay*); XDisplay* display_; Atom enter_; Atom motion_; Atom leave_; Atom drop_; Atom drag_; }; static const char* dragName = "IV_DRAG"; static const char* enterName = "IV_ENTER"; static const char* motionName = "IV_MOTION"; static const char* leaveName = "IV_LEAVE"; static const char* dropName = "IV_DROP"; static int dropUid = 0; static DragAtoms* dragAtoms; static void setDragProperty( XDisplay* display, XEvent& xevent, XWindow destination, Atom messageType, int x, int y, const char* value = 0, int length = 0 ) { Atom property = None; if (length != 0) { char buffer[256]; #if defined(HAVE_SSTREAM) ostringstream name(buffer); name << dragName << "_" << Host::name() << "_" << getpid() << "_" << dropUid++; property = XInternAtom(display, name.str().c_str(), False); #else ostrstream name(buffer, 256); name << dragName << "_" << Host::name() << "_" << getpid() << "_" << dropUid++ << ends; property = XInternAtom(display, name.str(), False); #endif XChangeProperty( display, destination, property, XA_STRING, 8, PropModePrepend, (unsigned char*)value, length ); } xevent.xclient.type = ClientMessage; xevent.xclient.window = destination; xevent.xclient.display = display; xevent.xclient.message_type = messageType; xevent.xclient.format = 32; xevent.xclient.data.l[0] = x; xevent.xclient.data.l[1] = y; xevent.xclient.data.l[2] = destination; xevent.xclient.data.l[3] = property; xevent.xclient.data.l[4] = length; } static void getDragProperty(XEvent& xevent, char*& buffer, int& length) { length = 0; buffer = 0; long len = xevent.xclient.data.l[4]; if (! len) { return; } XDisplay* display = xevent.xclient.display; XWindow xwindow = xevent.xclient.data.l[2]; Atom property = xevent.xclient.data.l[3]; Atom actual_type; int actual_format; unsigned long nitems; unsigned long bytes_after; if ( XGetWindowProperty( display, xwindow, property, 0, len, True, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, (unsigned char**) &buffer ) == Success ) { length = int(len); } } static bool understandsDragging(XDisplay* xdisplay, XWindow xwindow) { if (xwindow == None) { return false; } Atom actual_type; int actual_format; unsigned long nitems; unsigned long bytes_after; unsigned char* buffer = nil; if ( XGetWindowProperty( xdisplay, xwindow, dragAtoms->drag(xdisplay), 0, 0, False, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, (unsigned char**)&buffer ) != Success ) { return false; } if (buffer) { XFree((caddr_t)buffer); } return actual_type != None; } static XWindow translate(XDisplay* display, XWindow root, int& x, int& y) { XWindow dest = None; XWindow prev = root; XWindow child; int nx, ny; XTranslateCoordinates(display, root, root, x, y, &nx, &ny, &child); while (child != None) { dest = child; XTranslateCoordinates(display, prev, dest, x, y, &nx, &ny, &child); x = nx; y = ny; prev = dest; } return understandsDragging(display, dest) ? dest : None; } static XWindow translate( XDisplay* display, XWindow root, XWindow under, int& x, int& y ) { XWindow parent; XWindow *children; unsigned int kids; Status status; status = XQueryTree(display, root, &root, &parent, &children, &kids); if (status == 0) { return None; } int i; for (i = kids - 1; i >= 0 && children[i] != under ; --i); for (--i; i >= 0; --i) { XWindowAttributes attributes; XGetWindowAttributes(display, children[i], &attributes); if (attributes.map_state == IsViewable && attributes.x <= x && attributes.x + attributes.width >= x && attributes.y <= y && attributes.y + attributes.height >= y ) { break; } } if (i < 0) { return None; } XWindow dest = None; XWindow prev = root; XWindow child = children[i]; XFree((caddr_t) children); int nx, ny; while (child != None) { dest = child; XTranslateCoordinates(display, prev, dest, x, y, &nx, &ny, &child); x = nx; y = ny; prev = dest; } return understandsDragging(display, dest) ? dest : None; } /* class XDrag */ bool XDrag::isDrag(const XEvent& xevent) { return ( dragAtoms->enter(xevent) || dragAtoms->motion(xevent) || dragAtoms->leave(xevent) || dragAtoms->drop(xevent) ); } void XDrag::locate(const XEvent& xevent, int& x, int& y) { x = int(xevent.xclient.data.l[0]); y = int(xevent.xclient.data.l[1]); } /* class DragAtoms */ DragAtoms::DragAtoms() { display_ = nil; enter_ = nil; motion_ = nil; leave_ = nil; drop_ = nil; drag_ = nil; } void DragAtoms::cache(XDisplay* display) { if (display_ == display) { return; } display_ = display; enter_ = XInternAtom(display, enterName, False); motion_ = XInternAtom(display, motionName, False); leave_ = XInternAtom(display, leaveName, False); drop_ = XInternAtom(display, dropName, False); drag_ = XInternAtom(display, dragName, False); } bool DragAtoms::enter(const XEvent& xevent) { if (xevent.type != ClientMessage) { return false; } cache(xevent.xclient.display); return enter_ && xevent.xclient.message_type == enter_; } bool DragAtoms::motion(const XEvent& xevent) { if (xevent.type != ClientMessage) { return false; } cache(xevent.xclient.display); return motion_ && xevent.xclient.message_type == motion_; } bool DragAtoms::leave(const XEvent& xevent) { if (xevent.type != ClientMessage) { return false; } cache(xevent.xclient.display); return leave_ && xevent.xclient.message_type == leave_; } bool DragAtoms::drop(const XEvent& xevent) { if (xevent.type != ClientMessage) { return false; } cache(xevent.xclient.display); return drop_ && xevent.xclient.message_type == drop_; } bool DragAtoms::enter(const Event& event) { return enter(event.rep()->xevent_); } bool DragAtoms::motion(const Event& event) { return motion(event.rep()->xevent_); } bool DragAtoms::leave(const Event& event) { return leave(event.rep()->xevent_); } bool DragAtoms::drop(const Event& event) { return drop(event.rep()->xevent_); } Atom DragAtoms::enter(XDisplay* display) { cache(display); return enter_; } Atom DragAtoms::motion(XDisplay* display) { cache(display); return motion_; } Atom DragAtoms::leave(XDisplay* display) { cache(display); return leave_; } Atom DragAtoms::drop(XDisplay* display) { cache(display); return drop_; } Atom DragAtoms::drag(XDisplay* display) { cache(display); return drag_; } /* class DragMethod */ class DragMethod { public: virtual XWindow setup(XDisplay*, Event&, Drag*) = 0; virtual bool moveWindow(XDisplay*, XWindow, int x, int y) = 0; virtual void cleanup(XDisplay*, XWindow) = 0; }; /* class DragMethodCursor */ class DragMethodCursor : public DragMethod { public: virtual XWindow setup(XDisplay*, Event&, Drag*); virtual bool moveWindow(XDisplay*, XWindow, int x, int y); virtual void cleanup(XDisplay*, XWindow); }; /* class DragMethodWindow */ class DragMethodWindow : public DragMethod { public: virtual XWindow setup(XDisplay*, Event&, Drag*); virtual bool moveWindow(XDisplay*, XWindow, int x, int y); virtual void cleanup(XDisplay*, XWindow); Window* dragWindow_; int dx_; int dy_; int wlx_; int wly_; }; /* class DragRep */ class DragRep { public: DragRep(Drag* drag); ~DragRep(); bool event(Event& event); Drag* drag_; bool dragable_; Handler* target_; Coord x_; Coord y_; DragMethod* method_; DragMethodCursor methodCursor_; DragMethodWindow methodWindow_; }; /* class DragHandler */ class DragHandler : public Handler { public: DragHandler(DragRep* dragRep); virtual bool event(Event& event); protected: DragRep* dragRep_; }; /* class Drag */ Drag::Drag(Glyph* glyph) : MonoGlyph(glyph) { if (!dragAtoms) { dragAtoms = new DragAtoms(); } rep_ = new DragRep(this); } Drag::~Drag() { delete rep_; rep_ = 0; } void Drag::dragable(bool dragable) { rep_->dragable_ = dragable; } bool Drag::dragable() const { return rep_->dragable_; } void Drag::allocate(Canvas* c, const Allocation& a, Extension& ext) { rep_->x_ = a.left(); rep_->y_ = a.top(); MonoGlyph::allocate(c, a, ext); } void Drag::pick(Canvas* c, const Allocation& a, int depth, Hit& hit) { const Event* event = hit.event(); if (event != nil && hit.left() <= a.right() && hit.right() >= a.left() && hit.bottom() <= hit.top() && hit.top() >= a.bottom() && caught(*event) ) { hit.target(depth, this, 0, rep_->target_); } MonoGlyph::pick(c, a, depth + 1, hit); } void Drag::dragType(char*& value, int& length) { value = 0; length = 0; } void Drag::dragOffset(Event& event, int& dx, int& dy) { dx = int(event.pointer_x() - rep_->x_ + 1); dy = int(rep_->y_ - event.pointer_y() + 1); } bool Drag::caught(const Event& event) const { return ( rep_->dragable_ && (event.type() == Event::down) && event.pointer_button() == Event::middle ); } bool Drag::commit(const Event& event) const { return event.type() == Event::up; } bool Drag::abort(const Event& event) const { return event.type() == Event::down; } DragRep* Drag::rep() const { return rep_; } /* class DragMethodCursor */ XWindow DragMethodCursor::setup(XDisplay* display, Event& event, Drag*) { int x, y; XWindow root; XWindow child; int wx, wy; unsigned int keys; XQueryPointer( display, event.rep()->window_->rep()->xwindow_, &root, &child, &x, &y, &wx, &wy, &keys ); XWindow window; XSetWindowAttributes at; at.override_redirect = true; window = XCreateWindow( display, root, 0, 0, event.display()->rep()->pwidth_, event.display()->rep()->pheight_, 0, (int) CopyFromParent, InputOnly, CopyFromParent, CWOverrideRedirect, &at ); XMapWindow(display, window); return window; } bool DragMethodCursor::moveWindow(XDisplay*, XWindow, int, int) { return false; } void DragMethodCursor::cleanup(XDisplay* display, XWindow window) { XDestroyWindow(display, window); } /* class DragMethodWindow */ XWindow DragMethodWindow::setup(XDisplay* display, Event& event, Drag* drag) { drag->dragOffset(event, dx_, dy_); WidgetKit* kit = WidgetKit::instance(); DragBox* dragBox = new DragBox(drag->dragGlyph(), kit->background()); dragWindow_ = new PopupWindow(dragBox); Style* dragStyle = new Style; dragStyle->attribute("saveUnder", "true"); dragWindow_->style(dragStyle); int x, y; XWindow root; XWindow child; int wx, wy; unsigned int keys; // What we really want is for the window to appear with the drag glyph // already drawn (it looks really bad if that is not done). // // This is how it seems like we should be able to do it: // 1) bind the interviews window to an X window // 2) repair the interviews window // 3) flush the X display connection // 4) sync with the X display // 5) map the X window // // But we can't bind then map the interviews window, so the following is a // hack that seems to work. XSynchronize(display, true); XQueryPointer( display, event.rep()->window_->rep()->xwindow_, &root, &child, &x, &y, &wx, &wy, &keys ); Requisition requisition; dragBox->request(requisition); dragWindow_->place( event.display()->to_coord(x - dx_), event.display()->height() - event.display()->to_coord(y - dy_) - requisition.requirement(Dimension_Y).natural() ); dragWindow_->map(); XWindow window = dragWindow_->rep()->xwindow_; Event dummyEvent; dummyEvent.display(event.display()); while (! dragBox->everDrawn()) { if (dummyEvent.read(0, 10) && drag->commit(dummyEvent)) { cleanup(display, window); XSynchronize(display, false); return None; } } XSynchronize(display, false); XQueryPointer(display, window, &root, &child, &x, &y, &wx, &wy, &keys); int wlx1 = x - dx_; int wly1 = y - dy_; XMoveWindow(display, window, wlx1, wly1); return window; } bool DragMethodWindow::moveWindow( XDisplay* display, XWindow window, int x, int y ) { // check to see if motion was due to pointer moving or window moving. if ((wlx_ == (x - dx_)) && (wly_ == (y - dy_))) { return false; } wlx_ = x - dx_; wly_ = y - dy_; XMoveWindow(display, window, wlx_, wly_); return true; } void DragMethodWindow::cleanup(XDisplay*, XWindow) { dragWindow_->unmap(); delete dragWindow_; } /* class DragRep */ DragRep::DragRep(Drag* drag) : drag_(drag), dragable_(true) { target_ = new DragHandler(this); Resource::ref(target_); } DragRep::~DragRep() { Resource::unref(target_); target_ = nil; drag_ = 0; } bool DragRep::event(Event& event) { Resource::ref(drag_); if (drag_->dragGlyph()) { method_ = &methodWindow_; } else { method_ = &methodCursor_; } Display* disp = event.display(); XDisplay* display = disp->rep()->display_; XWindow window = method_->setup(display, event, drag_); if (window == None) { Resource::unref(drag_); return true; } int x, y; XWindow root; XWindow child; int wx, wy; unsigned int keys; XQueryPointer(display, window, &root, &child, &x, &y, &wx, &wy, &keys); XCursor cursor = None; Cursor* c = drag_->dragCursor(); if (c) { cursor = c->rep()->xid(disp, disp->rep()->default_visual_); } Event dragEvent; dragEvent.display(disp); if ( XGrabPointer( display, window, False, (unsigned int) ( ButtonMotionMask | ButtonPressMask | ButtonReleaseMask ), GrabModeAsync, GrabModeAsync, None, cursor, CurrentTime ) != GrabSuccess ) { // if we can't grab the pointer then we can't track the pointer properly // so just give up. return true; } XWindow last = None; bool aborted = false; int lx = x; int ly = y; // send a drag enter event to the window that the pointer is over. last = translate(display, root, window, lx, ly); if (last != None) { char* value; int length; drag_->dragType(value, length); XEvent xevent; setDragProperty( display, xevent, last, dragAtoms->enter(display), lx, ly, value, length ); XSendEvent(display, last, False, NoEventMask, &xevent); } lx = 0; ly = 0; do { dragEvent.read(); if (dragEvent.type() == Event::motion) { // cout << "d: " << dragEvent.rep()->xevent_.xmotion.serial << endl; // there seems to be a bug in 3.1 where this is not always done! -denis // the effect is that the motion event coordinates are out of order and // the window jumps around the screen to old locations. -dens dragEvent.rep()->acknowledge_motion(); x = dragEvent.rep()->xevent_.xmotion.x_root; y = dragEvent.rep()->xevent_.xmotion.y_root; // check to see if motion was due to pointer or window. method_->moveWindow(display, window, x, y); // translate ignores the drag window. int zx = x; int zy = y; XWindow zone = translate(display, root, window, zx, zy); if ((last != None) && (last != zone)) { // send drag leave to last window that was dragged over. XEvent xevent; setDragProperty( display, xevent, last, dragAtoms->leave(display), zx, zy ); XSendEvent(display, last, False, NoEventMask, &xevent); } if (zone != None) { // send drag motion (or enter) to window that pointer is // being moved over. XEvent xevent; char* value; int length; drag_->dragType(value, length); Atom messageType = (last != zone) ? dragAtoms->enter(display) : dragAtoms->motion(display); setDragProperty( display, xevent, zone, messageType, zx, zy, value, length ); XSendEvent(display, zone, False, NoEventMask, &xevent); } last = zone; lx = zx; ly = zy; } else if (drag_->abort(dragEvent)) { if (last != None) { // send drag abort to window that pointer is over. XEvent xevent; setDragProperty( display, xevent, last, dragAtoms->leave(display), lx, ly ); XSendEvent(display, last, False, NoEventMask, &xevent); } aborted = true; } else if (dragAtoms->enter(dragEvent) || dragAtoms->motion(dragEvent) || dragAtoms->leave(dragEvent) || dragAtoms->drop(dragEvent) ) { // deliver drag events to a drag zone in this session. dragEvent.handle(); } } while (! (drag_->commit(dragEvent) || aborted)); XUngrabPointer(display, CurrentTime); method_->cleanup(display, window); if (!(aborted || last == None)) { char* value; int length; drag_->dragData(value, length); XEvent xevent; setDragProperty( display, xevent, last, dragAtoms->drop(display), lx, ly, value, length ); XSendEvent(display, last, False, NoEventMask, &xevent); } Resource::unref(drag_); return true; } /* class DragHandler */ DragHandler::DragHandler(DragRep* dragRep) : dragRep_(dragRep) { } bool DragHandler::event(Event& event) { return dragRep_->event(event); } /* class DragZoneRep */ class DragZoneRep { public: DragZoneRep(DragZone* dragZone); ~DragZoneRep(); bool caught(const Event&) const; bool event(Event&); DragZone* dragZone_; bool sensitive_ : 1; bool grabbing_ : 1; Handler* target_; Canvas* canvas_; Allocation allocation_; Extension extension_; }; /* class DragZoneHandler */ class DragZoneHandler : public Handler { public: DragZoneHandler(DragZoneRep* dragZoneRep); virtual bool event(Event&); protected: DragZoneRep* dragZoneRep_; }; /* class DragZone */ DragZone::DragZone(Glyph* glyph) : MonoGlyph(glyph) { if (!dragAtoms) { dragAtoms = new DragAtoms(); } rep_ = new DragZoneRep(this); } DragZone::~DragZone() { delete rep_; rep_ = 0; } void DragZone::sensitive(bool sensitive) { rep_->sensitive_ = sensitive; } bool DragZone::sensitive() const { return rep_->sensitive_; } void DragZone::enter(Event&, const char*, int) { } void DragZone::motion(Event&) { } void DragZone::leave(Event&) { } void DragZone::allocate(Canvas* c, const Allocation& a, Extension& ext) { MonoGlyph::allocate(c, a, ext); rep_->canvas_ = c; rep_->allocation_ = a; rep_->extension_ = ext; } void DragZone::pick(Canvas* c, const Allocation& a, int depth, Hit& hit) { const Event* event = hit.event(); if (event != nil && hit.left() <= a.right() && hit.right() >= a.left() && hit.bottom() <= a.top() && hit.top() >= a.bottom() && rep_->caught(*event) ) { hit.target(depth, this, 0, rep_->target_); } MonoGlyph::pick(c, a, depth + 1, hit); } DragZoneRep* DragZone::rep() const { return rep_; } /* class DragZoneRep */ DragZoneRep::DragZoneRep(DragZone* dragZone) : dragZone_(dragZone) { target_ = new DragZoneHandler(this); Resource::ref(target_); sensitive_ = true; grabbing_ = false; } DragZoneRep::~DragZoneRep() { Resource::unref(target_); target_ = nil; } bool DragZoneRep::caught(const Event& event) const { if (! sensitive_) { return false; } return ( dragAtoms->enter(event) || dragAtoms->motion(event) || dragAtoms->leave(event) || dragAtoms->drop(event) ); } bool DragZoneRep::event(Event& event) { Glyph* glyph = dragZone_->body(); Hit hit(&event); glyph->pick(canvas_, allocation_, 0, hit); Handler* handler = hit.handler(); if (handler != nil && handler != target_) { // event wasn't for us; ungrab and deliver event. dragZone_->leave(event); event.ungrab(target_); grabbing_ = false; event.handle(); return true; } XEvent& xevent = event.rep()->xevent_; if (dragAtoms->enter(event)) { if (!grabbing_) { event.grab(target_); grabbing_ = true; } char* type; int length; getDragProperty(xevent, type, length); dragZone_->enter(event, type, length); if (type != nil) { XFree(type); } return true; } if (dragAtoms->motion(event)) { char* type; int length; getDragProperty(xevent, type, length); Coord x = event.pointer_x(); Coord y = event.pointer_y(); bool in = ( extension_.left() <= x && x <= extension_.right() && extension_.bottom() <= y && y <= extension_.top() ); if (in && !grabbing_) { event.grab(target_); grabbing_ = true; dragZone_->enter(event, type, length); } if (in) { dragZone_->motion(event); } if (!in && grabbing_) { dragZone_->leave(event); event.ungrab(target_); grabbing_ = false; event.handle(); } if (type) { XFree(type); } return true; } if (dragAtoms->leave(event)) { if (grabbing_) { event.ungrab(target_); grabbing_ = false; } dragZone_->leave(event); return true; } if (! dragAtoms->drop(event)) { return true; } if (grabbing_) { event.ungrab(target_); grabbing_ = false; } char* buffer; int length; getDragProperty(xevent, buffer, length); dragZone_->drop(event, buffer, length); if (buffer != nil) { XFree(buffer); } return true; } /* class DragZoneHandler */ DragZoneHandler::DragZoneHandler(DragZoneRep* dragZoneRep) : dragZoneRep_(dragZoneRep) { } bool DragZoneHandler::event(Event& event) { return dragZoneRep_->event(event); } /* class DragZoneSinkHandler */ class DragZoneSinkHandler : public Handler { public: DragZoneSinkHandler(DragZoneSink* dragZoneSink); virtual bool event(Event& event); protected: DragZoneSink* dragZoneSink_; }; DragZoneSinkHandler::DragZoneSinkHandler(DragZoneSink* dragZoneSink) : dragZoneSink_(dragZoneSink) { } bool DragZoneSinkHandler::event(Event& event) { return dragZoneSink_->event(event); } /* class DragZoneSink */ DragZoneSink::DragZoneSink(Glyph* glyph) : DragZone(glyph) { dragPublished_ = false; target_ = new DragZoneSinkHandler(this); Resource::ref(target_); } DragZoneSink::~DragZoneSink() { Resource::unref(target_); } void DragZoneSink::drop(Event&, const char*, int) { } void DragZoneSink::draw(Canvas* canvas, const Allocation& allocation) const { DragZone::draw(canvas, allocation); // publish that this X window as capable of understanding drag messages. if (! dragPublished_) { Window* window = canvas->window(); if (window) { WindowRep* rep = window->rep(); XDisplay* xdisplay = rep->dpy(); XWindow xwindow = rep->xwindow_; XChangeProperty( xdisplay, xwindow, dragAtoms->drag(xdisplay), XA_STRING, 8, PropModePrepend, 0, 0 ); DragZoneSink* self = (DragZoneSink*) this; self->dragPublished_ = true; } } } void DragZoneSink::pick(Canvas* c, const Allocation& a, int depth, Hit& hit) { MonoGlyph::pick(c, a, depth, hit); const Event* event = hit.event(); if (event != nil && ( dragAtoms->enter(*event) || dragAtoms->motion(*event) || dragAtoms->leave(*event) || dragAtoms->drop(*event) ) ) { hit.target(depth, this, 0, target_); } } bool DragZoneSink::event(Event& event) { if (dragAtoms->enter(event) || dragAtoms->motion(event) || dragAtoms->drop(event)) { char* type; int length; XEvent& xevent = event.rep()->xevent_; getDragProperty(xevent, type, length); if (type != nil) { XFree(type); } } return true; } neuron-7.6.3/src/lib/IV-X11/xevent.cpp000066400000000000000000000247141340731477100173130ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * X11-dependent event-reading code */ #include "wtable.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include bool (*ivoc_snapshot_)(const Event*); Event::Event() { if (sizeof(EventRep) <= sizeof(free_store_)) { rep_ = (EventRep*)free_store_; } else { rep_ = new EventRep; } EventRep& e = *rep_; e.display_ = nil; e.window_ = nil; e.xevent_.type = LASTEvent; e.pointer_x_ = 0; e.pointer_y_ = 0; e.clear(); /* backward compatibility */ target = nil; timestamp = 0; eventType = undefined; x = 0; y = 0; control = false; meta = false; shift = false; shiftlock = false; leftmouse = false; middlemouse = false; rightmouse = false; button = 0; len = 0; keystring = keydata; w = nil; wx = 0; wy = 0; } Event::Event(const Event& e) { if (sizeof(EventRep) <= sizeof(free_store_)) { rep_ = (EventRep*)free_store_; } else { rep_ = new EventRep; } *this = e; } Event::~Event() { if (rep_ != (EventRep*)free_store_) { delete rep_; } } Event& Event::operator =(const Event& e) { copy_rep(e); target = e.target; timestamp = e.timestamp; eventType = e.eventType; x = e.x; y = e.y; control = e.control; meta = e.meta; shift = e.shift; shiftlock = e.shiftlock; leftmouse = e.leftmouse; middlemouse = e.middlemouse; rightmouse = e.rightmouse; button = e.button; len = e.len; if (e.keystring == e.keydata) { keystring = keydata; strncpy(keydata, e.keydata, e.len); } else { keystring = e.keystring; } w = e.w; wx = e.wx; wy = e.wy; return *this; } void Event::copy_rep(const Event& e) { *rep_ = *e.rep_; } void Event::display(Display* d) { rep()->display_ = d; } Display* Event::display() const { return rep()->display_; } void Event::window(Window* w1) { rep()->window_ = w1; } Window* Event::window() const { return rep()->window_; } bool Event::pending() const { Event e; if (rep()->display_->get(e)) { rep()->display_->put(e); return true; } return false; } void Event::read() { Session::instance()->read(*this); } bool Event::read(long s, long u) { return Session::instance()->read(s, u, *this); } void Event::unread() { rep()->display_->put(*this); } void Event::poll() { EventRep& e = *rep(); if (e.display_ == nil) { if (e.window_ == nil) { e.display_ = Session::instance()->default_display(); } else { e.display_ = e.window_->display(); } } DisplayRep& d = *(e.display_->rep()); XMotionEvent& m = e.xevent_.xmotion; if (e.window_ == nil) { m.window = d.root_; } else { m.window = e.window_->rep()->xwindow_; } XQueryPointer( d.display_, m.window, &m.root, &m.subwindow, &m.x_root, &m.y_root, &m.x, &m.y, &m.state ); m.type = MotionNotify; e.clear(); } Handler* Event::handler() const { Handler* h = nil; Window* w1 = rep()->window_; if (w1 != nil) { h = w1->target(*this); } return h; } void Event::handle() { Handler* h = nil; if (rep()->xevent_.type != KeyPress) { h = grabber(); }else if (ivoc_snapshot_ && (*ivoc_snapshot_)(this)) { return; } if (h == nil) { h = handler(); } if (h != nil) { bool b = Resource::defer(true); h->ref(); h->event(*this); h->unref(); Resource::flush(); Resource::defer(b); } } void Event::grab(Handler* h) const { EventRep& e = *rep(); e.display_->grab(e.window_, h); } void Event::ungrab(Handler* h) const { rep()->display_->ungrab(h); } Handler* Event::grabber() const { return rep()->display_->grabber(); } bool Event::is_grabbing(Handler* h) const { return rep()->display_->is_grabbing(h); } EventType Event::type() const { switch (rep()->xevent_.type) { case MotionNotify: case EnterNotify: case LeaveNotify: return motion; case ButtonPress: return down; case ButtonRelease: return up; case KeyPress: return key; default: return other_event; } } unsigned long Event::time() const { XEvent& xe = rep()->xevent_; switch (xe.type) { case MotionNotify: case EnterNotify: case LeaveNotify: return xe.xmotion.time; case ButtonPress: case ButtonRelease: return xe.xbutton.time; case KeyPress: return xe.xkey.time; default: return CurrentTime; } } Coord Event::pointer_x() const { EventRep& e = *rep(); e.locate(); return e.pointer_x_; } Coord Event::pointer_y() const { EventRep& e = *rep(); e.locate(); return e.pointer_y_; } Coord Event::pointer_root_x() const { EventRep& e = *rep(); e.locate(); return e.pointer_root_x_; } Coord Event::pointer_root_y() const { EventRep& e = *rep(); e.locate(); return e.pointer_root_y_; } EventButton Event::pointer_button() const { XEvent& xe = rep()->xevent_; switch (xe.type) { case ButtonPress: case ButtonRelease: switch (xe.xbutton.button) { case Button1: return left; case Button2: return middle; case Button3: return right; default: return other_button; } default: return none; } } unsigned int Event::keymask() const { XEvent& xe = rep()->xevent_; switch (xe.type) { case MotionNotify: return xe.xmotion.state; case ButtonPress: case ButtonRelease: return xe.xbutton.state; case KeyPress: return xe.xkey.state; case EnterNotify: case LeaveNotify: return xe.xcrossing.state; default: /* is this really correct? */ return 0; } } static bool check_key(const Event* e, unsigned long mask) { return (e->keymask() & mask) != 0; } bool Event::control_is_down() const { return check_key(this, ControlMask); } bool Event::meta_is_down() const { return check_key(this, Mod1Mask); } bool Event::shift_is_down() const { return check_key(this, ShiftMask); } bool Event::capslock_is_down() const { return check_key(this, LockMask); } bool Event::left_is_down() const { return check_key(this, Button1Mask); } bool Event::middle_is_down() const { return check_key(this, Button2Mask); } bool Event::right_is_down() const { return check_key(this, Button3Mask); } unsigned char Event::keycode() const { XEvent& xe = rep()->xevent_; if (xe.type == KeyPress) { return xe.xkey.keycode; } return 0; } unsigned long Event::keysym() const { XEvent& xe = rep()->xevent_; if (xe.type == KeyPress) { return XLookupKeysym(&xe.xkey, 0); } return XK_VoidSymbol; } unsigned int Event::mapkey(char* buf, unsigned int len1) const { unsigned int n = 0; XEvent& xe = rep()->xevent_; if (xe.type == KeyPress) { n = XLookupString(&xe.xkey, buf, len1, nil, nil); /* * R5 internationalization might make this superfluous. */ if (meta_is_down()) { for (unsigned int i = 0; i < n; i++) { buf[i] |= 0200; } } } return n; } /** class EventRep **/ void EventRep::clear() { location_valid_ = false; } Atom wm_delete_window_; void EventRep::locate() { if (!location_valid_ && window_ != nil) { PixelCoord x=0, y=0, root_x = 0, root_y = 0; bool has_root_location = true; XEvent& xe = xevent_; switch (xe.type) { case MotionNotify: x = xe.xmotion.x; y = xe.xmotion.y; root_x = xe.xmotion.x_root; root_y = xe.xmotion.y_root; break; case ButtonPress: case ButtonRelease: x = xe.xbutton.x; y = xe.xbutton.y; root_x = xe.xbutton.x_root; root_y = xe.xbutton.y_root; break; case KeyPress: x = xe.xkey.x; y = xe.xkey.y; root_x = xe.xkey.x_root; root_y = xe.xkey.y_root; break; case EnterNotify: case LeaveNotify: x = xe.xcrossing.x; y = xe.xcrossing.y; root_x = xe.xcrossing.x_root; root_y = xe.xcrossing.y_root; break; case ClientMessage: /* drag & drop */ if(!wm_delete_window_) { wm_delete_window_ = XInternAtom(Session::instance()->default_display()->rep()->display_, "WM_DELETE_WINDOW", False); } if (xe.xclient.data.l[0] == wm_delete_window_) { break; } if (!XDrag::isDrag(xe)) { has_pointer_location_ = false; return; } XDrag::locate(xe, x, y); has_root_location = false; break; default: has_pointer_location_ = false; return; } has_pointer_location_ = true; pointer_x_ = display_->to_coord(x); pointer_y_ = display_->to_coord(window_->canvas()->pheight() - y); pointer_root_x_ = display_->to_coord(root_x); pointer_root_y_ = display_->to_coord(display_->pheight() - root_y); location_valid_ = true; /* * As a side effect, the pointer location tells us the root-relative * location of the window. */ if (has_root_location) { window_->rep()->move(window_, root_x - x, root_y - y); } } } bool EventRep::has_pointer_location() { locate(); return has_pointer_location_; } void EventRep::acknowledge_motion() { XMotionEvent& m = xevent_.xmotion; XQueryPointer( display_->rep()->display_, m.window, &m.root, &m.subwindow, &m.x_root, &m.y_root, &m.x, &m.y, &m.state ); } neuron-7.6.3/src/lib/IV-X11/xfont.cpp000066400000000000000000000465431340731477100171440ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * X11 font implementation */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include /** class FontImpl **/ declarePtrList(FontList,Font) implementPtrList(FontList,Font) declarePtrList(FontRepList,FontRep) implementPtrList(FontRepList,FontRep) inline unsigned long key_to_hash(UniqueString& s) { return s.hash(); } class KnownFonts { public: FontList fonts; FontRepList fontreps; void delta(); }; void KnownFonts::delta() { } declareTable(NameToKnownFonts,UniqueString,KnownFonts*) implementTable(NameToKnownFonts,UniqueString,KnownFonts*) class FontImpl { private: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif friend class Font; friend class FontRep; FontImpl(const String&, float); ~FontImpl(); void remove(const Font*); static NameToKnownFonts* fonts(); FontRep* rep(Display*); FontRep* default_rep(); void new_rep(KnownFonts*, FontRep*); void attach(FontRep*); static const Font* lookup(Display*, const String&, float); static FontRep* find_rep(FontRepList&, Display*, float); static FontRep* create(Display*, const String&, float); static const Font* new_font(const String&, float, KnownFonts*, FontRep*); static KnownFonts* known(KnownFonts*, const UniqueString&); UniqueString* name_; float scale_; FontRepList* replist_; KnownFonts* entry_; static NameToKnownFonts* fonts_; }; NameToKnownFonts* FontImpl::fonts_; FontImpl::FontImpl(const String& s, float scale) { name_ = new UniqueString(s); scale_ = scale; entry_ = nil; replist_ = new FontRepList; } FontImpl::~FontImpl() { for (ListItr(FontRepList) i(*replist_); i.more(); i.next()) { Resource::unref(i.cur()); } delete replist_; delete name_; } void FontImpl::remove(const Font* f) { if (entry_ != nil) { for (ListUpdater(FontList) i(entry_->fonts); i.more(); i.next()) { if (i.cur() == f) { i.remove_cur(); break; } } if (entry_->fonts.count() == 0 && entry_->fontreps.count() == 0) { fonts_->remove(*name_); delete entry_; } } entry_ = nil; } NameToKnownFonts* FontImpl::fonts() { if (fonts_ == nil) { fonts_ = new NameToKnownFonts(256); } return fonts_; } /* * Find a fontrep for the given display. First check the list * associated with this font. Then lookup the font name and see * if there is an associated fontrep (attached to another * font object). */ FontRep* FontImpl::rep(Display* d) { FontRep* r; for (ListItr(FontRepList) i(*replist_); i.more(); i.next()) { r = i.cur(); if (r->display_ == d) { return r; } } KnownFonts* k = nil; if (fonts()->find(k, *name_)) { r = find_rep(k->fontreps, d, scale_); if (r != nil) { attach(r); return r; } } r = create(d, *name_, scale_); if (r != nil) { new_rep(known(k, *name_), r); } return r; } FontRep* FontImpl::default_rep() { long n = replist_->count(); if (n != 0) { return replist_->item(n - 1); } return rep(Session::instance()->default_display()); } void FontImpl::new_rep(KnownFonts* k, FontRep* r) { r->entry_ = k; k->fontreps.append(r); attach(r); } void FontImpl::attach(FontRep* r) { replist_->append(r); Resource::ref(r); } const Font* FontImpl::lookup(Display* d, const String& name, float scale) { const Font* f; FontRep* r; KnownFonts* k = nil; UniqueString uname(name); if (fonts()->find(k, uname)) { for (ListItr(FontList) i(k->fonts); i.more(); i.next()) { f = i.cur(); if (Math::equal(f->impl_->scale_, scale, float(0.0001))) { return f; } } r = find_rep(k->fontreps, d, scale); if (r != nil) { return new_font(uname, scale, k, r); } } r = create(d, uname, scale); if (r == nil) { return nil; } k = known(k, uname); f = new_font(uname, scale, k, r); f->impl_->new_rep(k, r); f->impl_->entry_ = k; return f; } FontRep* FontImpl::find_rep(FontRepList& list, Display* d, float s) { for (ListItr(FontRepList) i(list); i.more(); i.next()) { FontRep* r = i.cur(); if (r->display_ == d && Math::equal(r->scale_, s, float(0.0001))) { return r; } } return nil; } FontRep* FontImpl::create(Display* d, const String& name, float scale) { static Atom XA_CHARSET_REGISTRY = 0; XDisplay* dpy = d->rep()->display_; NullTerminatedString s(name); XFontStruct* xf = XLoadQueryFont(dpy, s.string()); if (xf == nil) { return nil; } FontRep* f = new FontRep(d, xf, scale); unsigned long value; if (XGetFontProperty(xf, XA_FULL_NAME, &value) || XGetFontProperty(xf, XA_FAMILY_NAME, &value) ) { char* fullname = XGetAtomName(dpy, (Atom)value); f->name_ = new CopyString(fullname); XFree(fullname); } else { f->name_ = new CopyString(s.string()); } if (XA_CHARSET_REGISTRY == 0) { XA_CHARSET_REGISTRY = XInternAtom(dpy, "CHARSET_REGISTRY", False); } if (XGetFontProperty(xf, XA_CHARSET_REGISTRY, &value)) { char* registry = XGetAtomName(dpy, (Atom)value); f->encoding_ = new CopyString(registry); XFree(registry); } else { f->encoding_ = nil; } if (XGetFontProperty(xf, XA_POINT_SIZE, &value)) { f->size_ = float(value / 10) * f->scale_; } else { f->size_ = 0; } return f; } const Font* FontImpl::new_font( const String& name, float scale, KnownFonts* k, FontRep* r ) { Font* f = new Font(name, scale); f->impl_->attach(r); k->fonts.append(f); return f; } KnownFonts* FontImpl::known(KnownFonts* old_k, const UniqueString& name) { if (old_k != nil) { return old_k; } KnownFonts* k = new KnownFonts; fonts_->insert(name, k); return k; } /** class FontRep **/ FontRep::FontRep(Display* d, XFontStruct* xf, float scale) { display_ = d; font_ = xf; scale_ = scale; unscaled_ = (scale_ > 0.9999 && scale_ < 1.0001); entry_ = nil; } FontRep::~FontRep() { XFreeFont(display_->rep()->display_, font_); for (ListUpdater(FontRepList) i(entry_->fontreps); i.more(); i.next()) { if (i.cur() == this) { i.remove_cur(); break; } } delete name_; delete encoding_; } /** class Font **/ Font::Font(const String& name, float scale) { impl_ = new FontImpl(name, scale); } Font::Font(const char* name, float scale) { impl_ = new FontImpl(String(name), scale); } Font::Font(FontImpl* i) { impl_ = i; } Font::~Font() { delete impl_; } void Font::cleanup() { impl_->remove(this); } const Font* Font::lookup(const String& name) { return FontImpl::lookup( Session::instance()->default_display(), name, 1.0 ); } const Font* Font::lookup(const char* name) { return FontImpl::lookup( Session::instance()->default_display(), String(name), 1.0 ); } bool Font::exists(Display* d, const String& name) { return FontImpl::lookup(d, name, 1.0) != nil; } bool Font::exists(Display* d, const char* name) { return FontImpl::lookup(d, String(name), 1.0) != nil; } FontRep* Font::rep(Display* d) const { return impl_->rep(d); } const char* Font::name() const { FontRep* f = impl_->default_rep(); return f->name_->string(); } const char* Font::encoding() const { FontRep* f = impl_->default_rep(); return f->encoding_ == nil ? nil : f->encoding_->string(); } Coord Font::size() const { return impl_->default_rep()->size_; } void Font::font_bbox(FontBoundingBox& b) const { FontRep* f = impl_->default_rep(); float scale = f->scale_; XFontStruct* xf = f->font_; Display* d = f->display_; b.left_bearing_ = scale * d->to_coord(xf->max_bounds.lbearing); b.right_bearing_ = scale * d->to_coord(xf->max_bounds.rbearing); b.width_ = scale * d->to_coord(xf->max_bounds.width); b.ascent_ = scale * d->to_coord(xf->ascent); b.descent_ = scale * d->to_coord(xf->descent); b.font_ascent_ = b.ascent_; b.font_descent_ = b.descent_; } void Font::char_bbox(long c, FontBoundingBox& b) const { if (c < 0) { b.left_bearing_ = 0; b.right_bearing_ = 0; b.width_ = 0; b.ascent_ = 0; b.descent_ = 0; b.font_ascent_ = 0; b.font_descent_ = 0; return; } FontRep* f = impl_->default_rep(); float scale = f->scale_; XFontStruct* xf = f->font_; Display* d = f->display_; XCharStruct xc; XChar2b xc2b; xc2b.byte1 = (unsigned char)((c & 0xff00) >> 8); xc2b.byte2 = (unsigned char)(c & 0xff); int dir, asc, des; XTextExtents16(xf, &xc2b, 1, &dir, &asc, &des, &xc); b.left_bearing_ = scale * d->to_coord(-xc.lbearing); b.right_bearing_ = scale * d->to_coord(xc.rbearing); b.width_ = width(c); b.ascent_ = scale * d->to_coord(xc.ascent); b.descent_ = scale * d->to_coord(xc.descent); b.font_ascent_ = scale * d->to_coord(xf->ascent); b.font_descent_ = scale * d->to_coord(xf->descent); } void Font::string_bbox(const char* s, int len, FontBoundingBox& b) const { FontRep* f = impl_->default_rep(); float scale = f->scale_; XFontStruct* xf = f->font_; Display* d = f->display_; XCharStruct c; int dir, asc, des; XTextExtents(xf, s, len, &dir, &asc, &des, &c); b.left_bearing_ = scale * d->to_coord(-c.lbearing); b.right_bearing_ = scale * d->to_coord(c.rbearing); b.width_ = width(s, len); b.ascent_ = scale * d->to_coord(c.ascent); b.descent_ = scale * d->to_coord(c.descent); b.font_ascent_ = scale * d->to_coord(xf->ascent); b.font_descent_ = scale * d->to_coord(xf->descent); } Coord Font::width(long c) const { if (c < 0) { return 0; } FontRep* f = impl_->default_rep(); XChar2b xc2b; xc2b.byte1 = (unsigned char)((c & 0xff00) >> 8); xc2b.byte2 = (unsigned char)(c & 0xff); return f->scale_ * f->display_->to_coord(XTextWidth16(f->font_, &xc2b, 1)); } Coord Font::width(const char* s, int len) const { FontRep* f = impl_->default_rep(); return f->scale_ * f->display_->to_coord(XTextWidth(f->font_, s, len)); } int Font::index(const char* s, int len, float offset, bool between) const { const char* p; int n, w; int coff, cw; if (offset < 0 || *s == '\0' || len == 0) { return 0; } FontRep* f = impl_->default_rep(); XFontStruct* xf = f->font_; int xoffset = f->display_->to_pixels(Coord(offset * f->scale_)); if (xf->min_bounds.width == xf->max_bounds.width) { cw = xf->min_bounds.width; n = xoffset / cw; coff = xoffset % cw; } else { w = 0; for (p = s, n = 0; *p != '\0' && n < len; ++p, ++n) { cw = XTextWidth(xf, p, 1); w += cw; if (w > xoffset) { break; } } coff = xoffset - w + cw; } if (between && coff > cw/2) { ++n; } return Math::min(n, len); } /* anachronisms */ int Font::Baseline() const { FontBoundingBox b; font_bbox(b); return impl_->default_rep()->display_->to_pixels(b.descent()) - 1; } int Font::Height() const { FontBoundingBox b; font_bbox(b); return impl_->default_rep()->display_->to_pixels(b.ascent() + b.descent()); } int Font::Width(const char* s) const { return impl_->default_rep()->display_->to_pixels(width(s, strlen(s))); } int Font::Width(const char* s, int len) const { return impl_->default_rep()->display_->to_pixels(width(s, len)); } int Font::Index(const char* s, int offset, bool between) const { return impl_->default_rep()->display_->to_pixels( index(s, strlen(s), float(offset), between) ); } int Font::Index(const char* s, int len, int offset, bool between) const { return impl_->default_rep()->display_->to_pixels( index(s, len, float(offset), between) ); } bool Font::FixedWidth() const { FontRep* f = impl_->default_rep(); XFontStruct* xf = f->font_; return xf->min_bounds.width == xf->max_bounds.width; } /** class FontFamily **/ declarePtrList(FontFamilyRepList,FontFamilyRep) implementPtrList(FontFamilyRepList,FontFamilyRep) class FontFamilyImpl { private: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif friend class FontFamily; char* name; FontFamilyRepList* replist; }; static bool contains(const char* string, const char* substring) { int sublength = strlen(substring); int length = strlen(string) - sublength; for (int i = 0; i <= length; ++i) { int j; for (j = 0; j < sublength; ++j) { if (string[i+j] != substring[j]) { break; } } if (j == sublength) { return true; } } return false; } class FontNameSet { public: #ifdef _DELTA_EXTENSIONS #pragma __static_class #endif int value; const char* names[6]; }; static FontNameSet weight_names [] = { { 1, { "ultralight" } }, { 2, { "extralight" } }, { 3, { "light" } }, { 4, { "semilight", "book" } }, { 5, { "medium", "normal", "regular" } }, { 6, { "semibold", "demibold" } }, { 7, { "bold" } }, { 8, { "extrabold", "heavy" } }, { 9, { "ultrabold", "black" } }, { 0 } }; static FontNameSet width_names [] = { { 1, { "ultracondensed" } }, { 2, { "extracondensed" } }, { 3, { "condensed" } }, { 4, { "semicondensed" } }, { 5, { "medium", "normal", "regular" } }, { 6, { "semiexpanded", "demiexpanded" } }, { 7, { "expanded" } }, { 8, { "extraexpanded", "wide" } }, { 9, { "ultraexpanded", "extrawide" } }, { 0 } }; static FontNameSet slant_names [] = { { 1, { "reverseitalic", "reverseoblique" } }, { 2, { "roman", "normal", "regular" } }, { 3, { "italic", "oblique" } }, { 0 } }; static int name_value(const char* name, FontNameSet* values, int def) { int i = 0; while (values[i].value != 0) { int j = 0; while (values[i].names[j] != nil) { if (contains(name, values[i].names[j])) { return values[i].value; } ++j; } ++i; } return def; } FontFamily::FontFamily(const char* familyname) { impl_ = new FontFamilyImpl; impl_->name = new char[strlen(familyname) + 1]; strcpy(impl_->name, familyname); impl_->replist = new FontFamilyRepList; } FontFamily::~FontFamily() { FontFamilyRepList& list = *impl_->replist; for (long i = 0; i < list.count(); i++) { destroy(list.item(i)); } delete [] impl_->name; delete impl_->replist; delete impl_; } FontFamilyRep* FontFamily::rep(Display* d) const { FontFamilyRep* f; FontFamilyRepList& list = *impl_->replist; for (long i = 0; i < list.count(); i++) { FontFamilyRep* f = list.item(i); if (f->display_ == d) { return f; } } f = create(d); list.append(f); return f; } FontFamilyRep* FontFamily::create(Display* d) const { register FontFamilyRep* r = new FontFamilyRep; char buffer[256]; sprintf(buffer, "*-*-%s-*-*-*-*-75-75-*-*-*-*", impl_->name); char** fonts = XListFonts( d->rep()->display_, buffer, 100, &r->count_ ); r->display_ = d; r->names_ = new char*[r->count_]; r->weights_ = new int[r->count_]; r->slants_ = new int[r->count_]; r->widths_ = new int[r->count_]; r->sizes_ = new int[r->count_]; r->min_weight_ = 1000; r->max_weight_ = 0; r->min_slant_ = 1000; r->max_slant_ = 0; r->min_width_ = 1000; r->max_width_ = 0; r->min_size_ = 1000; r->max_size_ = 0; for (unsigned int i = 0; i < r->count_; ++i) { r->names_[i] = new char[strlen(fonts[i]) + 1]; strcpy(r->names_[i], fonts[i]); char weight[100]; char slant[100]; char width[100]; int size; sscanf( r->names_[i], "-%*[^-]-%*[^-]-%[^-]-%[^-]-%[^-]--%*[^-]-%d", weight, slant, width, &size ); r->weights_[i] = name_value(weight, weight_names, 5); String sl(slant); if (sl == "o" || sl == "i") { r->slants_[i] = 3; } else if (sl == "r") { r->slants_[i] = 2; } else if (sl == "ro" || sl == "ri") { r->slants_[i] = 1; } else { r->slants_[i] = 2; } r->widths_[i] = name_value(width, width_names, 5); r->sizes_[i] = size/10; r->min_width_ = Math::min(r->widths_[i], r->min_width_); r->max_width_ = Math::max(r->widths_[i], r->max_width_); r->min_weight_ = Math::min(r->weights_[i], r->min_weight_); r->max_weight_ = Math::max(r->weights_[i], r->max_weight_); r->min_slant_ = Math::min(r->slants_[i], r->min_slant_); r->max_slant_ = Math::max(r->slants_[i], r->max_slant_); r->min_size_ = Math::min(r->sizes_[i], r->min_size_); r->max_size_ = Math::max(r->sizes_[i], r->max_size_); } XFreeFontNames(fonts); return r; } void FontFamily::destroy(FontFamilyRep* r) { for (int i = 0; i < r->count_; ++i) { delete r->names_[i]; } delete [] r->names_; delete [] r->weights_; delete [] r->slants_; delete [] r->widths_; delete [] r->sizes_; } bool FontFamily::font(int size, const char*& name, float& scale) const { return font(size, "", name, scale); } bool FontFamily::font( int size, const char* style, const char*& name, float& scale ) const { int weight = name_value(style, weight_names, 5); int slant = name_value(style, slant_names, 2); int width = name_value(style, width_names, 5); int best_match = -1; int least_badness = 1000; FontFamilyRep* r = rep(Session::instance()->default_display()); for (int i = 0; i < r->count_; ++i) { int badness = 0; badness += Math::abs(r->weights_[i] - weight); badness += Math::abs(r->widths_[i] - width); badness += Math::abs(r->slants_[i] - slant); badness += Math::abs(r->sizes_[i] - size); if (badness < least_badness) { least_badness = badness; best_match = i; } } if (best_match == -1) { return false; } int best_size = r->sizes_[best_match]; name = r->names_[best_match]; scale = (size == best_size) ? 1.0 : float(size)/float(best_size); return true; } neuron-7.6.3/src/lib/IV-X11/xraster.cpp000077500000000000000000000121111340731477100174610ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * X11-dependent raster code */ #include #include #include #include #include #include #include #include Raster::Raster(unsigned long w, unsigned long h) { RasterRep* r = new RasterRep; rep_ = r; Display* d = Session::instance()->default_display(); r->display_ = d; r->modified_ = false; r->pwidth_ = (unsigned int)w; r->pheight_ = (unsigned int)h; r->width_ = d->to_coord(r->pwidth_); r->height_ = d->to_coord(r->pheight_); r->left_ = 0; r->bottom_ = 0; r->right_ = r->width_; r->top_ = r->height_; DisplayRep* dr = r->display_->rep(); XDisplay* dpy = dr->display_; r->pixmap_ = XCreatePixmap( dpy, dr->root_, r->pwidth_, r->pheight_, dr->default_visual_->depth() ); r->gc_ = XCreateGC(dpy, r->pixmap_, 0, nil); r->image_ = XGetImage( dpy, r->pixmap_, 0, 0, r->pwidth_, r->pheight_, AllPlanes, ZPixmap ); } Raster::Raster(const Raster& raster) { RasterRep* r = new RasterRep; rep_ = r; raster.flush(); RasterRep& rr = *(raster.rep()); r->display_ = rr.display_; r->modified_ = true; r->width_ = rr.width_; r->height_ = rr.height_; r->left_ = rr.left_; r->bottom_ = rr.bottom_; r->right_ = rr.right_; r->top_ = rr.top_; r->pwidth_ = rr.pwidth_; r->pheight_ = rr.pheight_; DisplayRep* dr = r->display_->rep(); XDisplay* dpy = dr->display_; r->pixmap_ = XCreatePixmap( dpy, dr->root_, r->pwidth_, r->pheight_, dr->default_visual_->depth() ); r->gc_ = XCreateGC(dpy, r->pixmap_, 0, nil); XCopyArea( dpy, rr.pixmap_, r->pixmap_, r->gc_, 0, 0, r->pwidth_, r->pheight_, 0, 0 ); r->image_ = XGetImage( dpy, r->pixmap_, 0, 0, r->pwidth_, r->pheight_, AllPlanes, ZPixmap ); } Raster::Raster(RasterRep* r) { rep_ = r; } Raster::~Raster() { RasterRep* r = rep(); XDisplay* dpy = r->display_->rep()->display_; XFreePixmap(dpy, r->pixmap_); XFreeGC(dpy, r->gc_); XDestroyImage(r->image_); delete r; } Coord Raster::width() const { return rep()->width_; } Coord Raster::height() const { return rep()->height_; } unsigned long Raster::pwidth() const { return rep()->pwidth_; } unsigned long Raster::pheight() const { return rep()->pheight_; } Coord Raster::left_bearing() const { return -rep()->left_; } Coord Raster::right_bearing() const { return rep()->right_; } Coord Raster::ascent() const { return rep()->top_; } Coord Raster::descent() const { return -rep()->bottom_; } void Raster::peek( unsigned long x, unsigned long y, ColorIntensity& red, ColorIntensity& green, ColorIntensity& blue, float& alpha ) const { register RasterRep* r = rep(); unsigned long pixel = XGetPixel( r->image_, (unsigned int)x, r->pheight_ - (unsigned int)y - 1 ); XColor xc; r->display_->rep()->default_visual_->find_color(pixel, xc); red = float(xc.red) / 0xffff; green = float(xc.green) / 0xffff; blue = float(xc.blue) / 0xffff; alpha = 1.0; } void Raster::poke( unsigned long x, unsigned long y, ColorIntensity red, ColorIntensity green, ColorIntensity blue, float ) { RasterRep* r = rep(); unsigned short sr = (unsigned short)(red * 0xffff); unsigned short sg = (unsigned short)(green * 0xffff); unsigned short sb = (unsigned short)(blue * 0xffff); XColor xc; r->display_->rep()->default_visual_->find_color(sr, sg, sb, xc); XPutPixel( r->image_, (unsigned int)x, r->pheight_ - (unsigned int)y - 1, xc.pixel ); r->modified_ = true; } void Raster::flush() const { RasterRep* r = rep(); if (r->modified_) { XPutImage( r->display_->rep()->display_, r->pixmap_, r->gc_, r->image_, 0, 0, 0, 0, r->pwidth_, r->pheight_ ); r->modified_ = false; } } neuron-7.6.3/src/lib/IV-X11/xreqerr.cpp000077500000000000000000000041741340731477100174730ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * X11-dependent request error handling */ #include #include #include static ReqErr* errhandler; ReqErr::ReqErr() { /* no constructor code currently necessary */ } ReqErr::~ReqErr() { if (errhandler == this) { errhandler = nil; } } void ReqErr::Error() { /* default is to do nothing */ } static int DoXError(XDisplay* errdisplay, XErrorEvent* e) { register ReqErr* r = errhandler; if (r != nil) { r->msgid = e->serial; r->code = e->error_code; r->request = e->request_code; r->detail = e->minor_code; r->id = (void*)e->resourceid; XGetErrorText(errdisplay, r->code, r->message, sizeof(r->message)); r->Error(); } return 0; } ReqErr* ReqErr::Install() { if (errhandler == nil) { XSetErrorHandler(DoXError); } ReqErr* r = errhandler; errhandler = this; return r; } neuron-7.6.3/src/lib/IV-X11/xselection.cpp000077500000000000000000000106601340731477100201550ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1992 Stanford University * Copyright (c) 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "wtable.h" #include #include #include #include #include #include #include #include #include #include /* * SelectionManager -- inter client communications mechanism */ SelectionManager::SelectionManager(Display* d, const char* name) { rep_ = new SelectionManagerRep(d, String(name)); } SelectionManager::SelectionManager(Display* d, const String& name) { rep_ = new SelectionManagerRep(d, name); } SelectionManager::~SelectionManager() { delete rep_; } void SelectionManager::own( SelectionHandler* convert, SelectionHandler* lose, SelectionHandler* done ) { SelectionManagerRep& s = *rep(); Atom a = XInternAtom(s.xdisplay_, s.name_->string(), true); XSetSelectionOwner(s.xdisplay_, a, s.owner_->rep()->xwindow_, CurrentTime); Resource::ref(convert); Resource::unref(s.convert_); s.convert_ = convert; Resource::ref(lose); Resource::unref(s.lose_); s.lose_ = lose; Resource::ref(done); Resource::unref(s.done_); s.done_ = done; } void SelectionManager::put_value(const void* data, int length, int format) { SelectionManagerRep& s = *rep(); XChangeProperty( s.xdisplay_, s.x_req_.requestor, s.x_req_.property, /* type */ XA_STRING, format, PropModeReplace, (const unsigned char*)data, length ); XEvent xe; XSelectionEvent& xs = xe.xselection; xs.type = SelectionNotify; xs.requestor = s.x_req_.requestor; xs.selection = s.x_req_.selection; xs.target = s.x_req_.target; xs.property = s.x_req_.property; xs.time = s.x_req_.time; XSendEvent(s.xdisplay_, xs.requestor, False, 0, &xe); } void SelectionManager::retrieve( const String&, SelectionHandler*, SelectionHandler* ) { /* unimplemented */ } void SelectionManager::get_value( String*&, void*&, int&, int& ) { /* unimplemented */ } SelectionManagerRep* SelectionManager::rep() const { return rep_; } /* class SelectionManagerRep */ SelectionManagerRep::SelectionManagerRep(Display* d, const String& name) { DisplayRep& dr = *d->rep(); xdisplay_ = dr.display_; name_ = new CopyString(name); owner_ = new PopupWindow(new Patch(nil)); WindowRep& wr = *owner_->rep(); wr.display_ = d; wr.xwindow_ = XCreateSimpleWindow( xdisplay_, dr.root_, 0, 0, 1, 1, 0, 0, 0 ); dr.wtable_->insert(wr.xwindow_, owner_); wr.xtoplevel_ = wr.xwindow_; convert_ = nil; lose_ = nil; done_ = nil; ok_ = nil; fail_ = nil; } SelectionManagerRep::~SelectionManagerRep() { delete name_; delete owner_; Resource::unref(convert_); Resource::unref(lose_); Resource::unref(done_); Resource::unref(ok_); Resource::unref(fail_); } void SelectionManagerRep::request( SelectionManager* s, const XSelectionRequestEvent& x ) { if (convert_ != nil) { x_req_ = x; convert_->handle(s); } } void SelectionManagerRep::notify(SelectionManager*, const XSelectionEvent&) { /* unimplemented */ } /* class SelectionHandler */ SelectionHandler::SelectionHandler(){} SelectionHandler::~SelectionHandler(){} neuron-7.6.3/src/lib/IV-X11/xwindow.cpp000066400000000000000000001521031340731477100174730ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * X11-dependent window and display implementation */ #include #include "wtable.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_STROPTS_H #include #endif #ifdef HAVE_SYS_CONF_H #include #endif /* no standard place for this */ // invoke if not gotten from or #if 0 extern "C" { extern int ioctl(int, int, ...); } #endif implementPtrList(WindowVisualList,WindowVisual) declarePtrList(WindowCursorStack,Cursor) implementPtrList(WindowCursorStack,Cursor) Window::Window(Glyph* g) { WindowRep* w = new WindowRep; rep_ = w; w->request_on_resize_ = false; w->glyph_ = g; w->glyph_->ref(); w->style_ = nil; w->display_ = nil; w->visual_ = nil; w->left_ = 0; w->bottom_ = 0; w->focus_in_ = nil; w->focus_out_ = nil; w->wm_delete_ = nil; w->xwindow_ = WindowRep::unbound; w->xattrmask_ = 0; w->xclass_ = InputOutput; w->placed_ = false; w->aligned_ = false; w->clear_mapping_info(); w->cursor_ = defaultCursor; w->cursor_stack_ = new WindowCursorStack; w->toplevel_ = this; w->canvas_ = new Canvas; w->canvas_->rep()->window_ = this; } /* * Construct a window with a given representation object, * thereby overriding the default representation. */ Window::Window(WindowRep* w) { rep_ = w; } /* * The virtual call to unbind cannot be overridden by a subclass * because we are calling it from the destructor. */ Window::~Window() { Window::unbind(); WindowRep& w = *rep(); Resource::unref_deferred(w.glyph_); Resource::unref_deferred(w.style_); Resource::unref_deferred(w.focus_in_); Resource::unref_deferred(w.focus_out_); Resource::unref_deferred(w.wm_delete_); delete w.canvas_; delete w.cursor_stack_; delete rep_; rep_ = nil; } Glyph* Window::glyph() const { WindowRep& w = *rep(); return w.glyph_; } void Window::style(Style* s) { WindowRep& w = *rep(); if (w.style_ != s) { Resource::ref(s); Resource::unref(w.style_); w.style_ = s; w.check_binding(this); } } Style* Window::style() const { WindowRep& w = *rep(); return w.style_; } void Window::display(Display* d) { WindowRep& w = *rep(); if (w.display_ != d) { w.check_binding(this); w.display_ = d; w.canvas_->rep()->display_ = d; } } Display* Window::display() const { WindowRep& w = *rep(); return w.display_; } Canvas* Window::canvas() const { WindowRep& w = *rep(); return w.canvas_; } void Window::cursor(Cursor* c) { WindowRep& w = *rep(); if (w.cursor_ != c) { w.check_binding(this); w.cursor_ = c; XWindow xw = w.xwindow_; if (xw != WindowRep::unbound) { XDisplay* dpy = w.dpy(); if (c == nil) { XUndefineCursor(dpy, xw); } else { XDefineCursor(dpy, xw, c->rep()->xid(w.display_, w.visual_)); } XFlush(dpy); } } } Cursor* Window::cursor() const { return rep()->cursor_; } void Window::push_cursor() { WindowRep& w = *rep(); w.cursor_stack_->prepend(w.cursor_); } void Window::pop_cursor() { WindowRep& w = *rep(); WindowCursorStack& s = *w.cursor_stack_; if (s.count() > 0) { cursor(s.item(0)); s.remove(0); } } void Window::place(Coord left, Coord bottom) { WindowRep& w = *rep(); if (!w.placed_ || !Math::equal(left, w.left_, float(1e-3)) || !Math::equal(bottom, w.bottom_, float(1e-3)) ) { w.check_binding(this); w.placed_ = true; w.left_ = left; w.bottom_ = bottom; } } void Window::pplace(IntCoord pleft, IntCoord pbottom) { WindowRep& w = *rep(); w.check_binding(this); w.placed_ = true; Display& d = *w.display_; w.left_ = d.to_coord(pleft); w.bottom_ = d.to_coord(pbottom); } void Window::align(float x, float y) { WindowRep& w = *rep(); if (!w.aligned_ || !Math::equal(x, w.xalign_, float(1e-3)) || !Math::equal(y, w.yalign_, float(1e-3)) ) { w.check_binding(this); w.aligned_ = true; w.xalign_ = x; w.yalign_ = y; } } Coord Window::left() const { WindowRep& w = *rep(); Display* d = w.display_; if (d == nil) { return w.left_; } w.check_position(this); return d->to_coord(w.xpos_); } Coord Window::bottom() const { WindowRep& w = *rep(); Display* d = w.display_; if (d == nil) { return w.bottom_; } w.check_position(this); return d->height() - d->to_coord(w.ypos_) - height(); } Coord Window::width() const { return rep()->canvas_->width(); } Coord Window::height() const { return rep()->canvas_->height(); } void Window::map() { WindowRep& w = *rep(); if (w.map_pending_ || is_mapped()) { return; } w.unmapped_ = false; if (bound()) { w.display_->rep()->wtable_->insert(w.xwindow_, this); } else { unbind(); if (w.display_ == nil) { display(Session::instance()->default_display()); } if (w.style_ == nil) { style(new Style(w.display_->style())); } configure(); default_geometry(); compute_geometry(); bind(); set_props(); } do_map(); } void Window::configure() { } void Window::default_geometry() { WindowRep& w = *rep(); const Display& d = *w.display_; w.glyph_->request(w.shape_); Coord width = w.shape_.requirement(Dimension_X).natural(); Coord height = w.shape_.requirement(Dimension_Y).natural(); w.canvas_->size(width, height); w.xpos_ = d.to_pixels(w.left_); w.ypos_ = d.pheight() - d.to_pixels(w.bottom_) - w.canvas_->pheight(); if (w.aligned_) { w.xpos_ -= d.to_pixels(w.xalign_ * width); w.ypos_ += d.to_pixels(w.yalign_ * height); } } void Window::compute_geometry() { } /* * Bind the current window description to its X counterpart, creating * the X window if necessary. */ void Window::bind() { WindowRep& w = *rep(); w.do_bind(this, w.display_->rep()->root_, w.xpos_, w.ypos_); } /* * Unbind the window from its X counterpart, removing the window * from the xid -> window table and making sure it is not on * the damage list. X will destroy subwindows automatically, * so there is no need to destroy the window if it has a parent. * In fact, it will cause an error if the windows are destroyed * out of order (parent destroyed before children). * * If the window is top-level, then we must undraw the associated glyph. * It is important that we remove the window from the lookup table * before calling undraw so that an interior glyph with a subwindow * can tell detect the top-level window is being unbound. */ void Window::unbind() { WindowRep& w = *rep(); Display* d = w.display_; if (d != nil && w.xwindow_ != WindowRep::unbound) { DisplayRep& r = *d->rep(); r.wtable_->remove(w.xwindow_); r.remove(this); if (w.toplevel_ == this) { w.glyph_->undraw(); XDestroyWindow(r.display_, w.xwindow_); } } w.xwindow_ = WindowRep::unbound; w.clear_mapping_info(); CanvasRep& c = *w.canvas_->rep(); c.unbind(); c.clear_damage(); } bool Window::bound() const { WindowRep& w = *rep(); return ( w.xwindow_ != WindowRep::unbound && ( (w.toplevel_ == this) || (w.find(w.xtoplevel_, w.display_->rep()->wtable_) == w.toplevel_) ) ); } void Window::set_attributes() { WindowRep& w = *rep(); if (w.visual_ == nil) { w.visual_ = WindowVisual::find_visual(w.display_, w.style_); } w.xattrmask_ |= CWBackPixmap; w.xattrs_.background_pixmap = None; /* * It is necessary to set the border pixel to avoid trying * to use the parent's border. The problem is the parent * might have a different visual. Of course, none of this really * matters because we always use a border width of zero! */ w.xattrmask_ |= CWBorderPixel; w.xattrs_.border_pixel = 0; if (w.style_->value_is_on("backingStore")) { w.xattrmask_ |= CWBackingStore; w.xattrs_.backing_store = WhenMapped; } if (w.style_->value_is_on("saveUnder")) { w.xattrmask_ |= CWSaveUnder; w.xattrs_.save_under = true; } w.xattrmask_ |= CWEventMask; w.xattrs_.event_mask = ( KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | PointerMotionHintMask | EnterWindowMask | LeaveWindowMask | ExposureMask | StructureNotifyMask | FocusChangeMask | OwnerGrabButtonMask ); /* * These events are caught at the top-level and not propagated * out to the root window (meaning the window manager). */ w.xattrmask_ |= CWDontPropagate; w.xattrs_.do_not_propagate_mask = ( KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask ); w.xattrmask_ |= CWColormap; w.xattrs_.colormap = w.visual_->colormap(); if (w.cursor_ != nil) { w.xattrmask_ |= CWCursor; w.xattrs_.cursor = w.cursor_->rep()->xid(w.display_, w.visual_); } } void Window::set_props() { } void Window::do_map() { WindowRep& w = *rep(); DisplayRep& d = *w.display_->rep(); XDisplay* dpy = d.display_; XColormap cmap = w.visual_->colormap(); if ((w.xattrmask_ & CWOverrideRedirect) != 0 && w.xattrs_.override_redirect && cmap != d.default_visual_->colormap() ) { XInstallColormap(dpy, cmap); } XMapRaised(dpy, w.xwindow_); w.map_pending_ = true; } void Window::unmap() { WindowRep& w = *rep(); if (w.map_pending_ || is_mapped()) { DisplayRep& d = *w.display_->rep(); w.glyph_->undraw(); XUnmapWindow(w.dpy(), w.xwindow_); d.wtable_->remove(w.xwindow_); d.remove(this); w.canvas_->rep()->clear_damage(); w.unmapped_ = true; w.wm_mapped_ = false; // added by cd1f 11-may-95 // for some reason this was occasionaly left on // and menus would not map thier windows correctly w.map_pending_ = false; } } bool Window::is_mapped() const { WindowRep& w = *rep(); return w.wm_mapped_; } /* * Look at an event that has been received for this window. * Here we handle map/expose/configure events. We also directly * dispatch focus and delete events. */ bool Window::receive(const Event& e) { WindowRep& w = *rep(); XEvent& xe = e.rep()->xevent_; Handler* handler = nil; SelectionManager* s; switch (xe.type) { case MapNotify: w.map_notify(this, xe.xmap); break; case UnmapNotify: w.unmap_notify(this, xe.xunmap); break; case Expose: w.expose(this, xe.xexpose); break; case ConfigureNotify: w.configure_notify(this, xe.xconfigure); break; case MotionNotify: /* allow next pointer motion */ e.rep()->acknowledge_motion(); break; case FocusIn: handler = w.focus_in_; break; case FocusOut: handler = w.focus_out_; break; case ClientMessage: if (xe.xclient.message_type == w.wm_protocols_atom() && xe.xclient.data.l[0] == w.wm_delete_atom() ) { handler = w.wm_delete_; if (handler == nil) { Session::instance()->quit(); } } break; case SelectionRequest: s = w.display_->primary_selection(); s->rep()->request(s, xe.xselectionrequest); break; case SelectionNotify: s = w.display_->primary_selection(); s->rep()->notify(s, xe.xselection); break; case EnterNotify: // printf("Window::receive EnterNotify"); break; } if (handler != nil) { Event writable_e(e); handler->event(writable_e); } return false; } /* * Search for a handler for the given event. * For events that have no associated pointer location, return nil. * Otherwise, use pick on the glyph to find a handler. */ Handler* Window::target(const Event& e) const { EventRep& r = *e.rep(); XEvent& xe = r.xevent_; if (xe.type == LeaveNotify || !r.has_pointer_location()) { return nil; } WindowRep& w = *rep(); Hit hit(&e); w.glyph_->pick(w.canvas_, w.allocation_, 0, hit); Handler* h = hit.handler(); if (h != nil && (e.grabber() == nil || e.type() == Event::key || e.is_grabbing(h)) ) { return h; } return nil; } /* * Grab control of the display pointer and use the given cursor * when it is outside the window. */ void Window::grab_pointer(Cursor* c) const { WindowRep& w = *rep(); XGrabPointer( w.dpy(), w.xwindow_, True, (unsigned int)( // w.xattrs_.event_mask & (PointerMotionMask | PointerMotionHintMask) w.xattrs_.event_mask & (ButtonPressMask | ButtonReleaseMask | PointerMotionMask | PointerMotionHintMask) ), /* pointer_mode */ GrabModeAsync, /* keyboard_mode */ GrabModeAsync, /* confine_to */ None, /* cursor */ c == nil ? None : c->rep()->xid(w.display_, w.visual_), CurrentTime ); } /* * Release control of the display pointer. */ void Window::ungrab_pointer() const { WindowRep& w = *rep(); XUngrabPointer(w.dpy(), CurrentTime); } /* * Redraw the damaged part of the window's canvas, if any. */ void Window::repair() { WindowRep& w = *rep(); CanvasRep& c = *w.canvas_->rep(); if (c.start_repair()) { w.glyph_->draw(w.canvas_, w.allocation_); c.finish_repair(); } } void Window::raise() { WindowRep& w = *rep(); XRaiseWindow(w.dpy(), w.xwindow_); } void Window::lower() { WindowRep& w = *rep(); XLowerWindow(w.dpy(), w.xwindow_); } void Window::move(Coord left, Coord bottom) { WindowRep& w = *rep(); Display& d = *w.display_; XMoveWindow( d.rep()->display_, w.xwindow_, d.to_pixels(left), d.pheight() - d.to_pixels(bottom) - w.canvas_->pheight() ); } void Window::resize() { WindowRep& w = *rep(); CanvasRep& c = *w.canvas_->rep(); XResizeWindow(w.dpy(), w.xwindow_, c.pwidth_, c.pheight_); w.needs_resize_ = true; } /** class ManagedWindow **/ ManagedWindow::ManagedWindow(Glyph* g) : Window(g) { ManagedWindowRep* w = new ManagedWindowRep; mrep_ = w; w->group_leader_ = nil; w->transient_for_ = nil; w->icon_ = nil; w->icon_bitmap_ = nil; w->icon_mask_ = nil; } ManagedWindow::~ManagedWindow() { ManagedWindowRep* w = mrep_; Resource::unref(w->icon_bitmap_); Resource::unref(w->icon_mask_); delete w; } ManagedWindow* ManagedWindow::icon() const { return rep()->icon_; } Bitmap* ManagedWindow::icon_bitmap() const { return rep()->icon_bitmap_; } Bitmap* ManagedWindow::icon_mask() const { return rep()->icon_mask_; } void ManagedWindow::icon(ManagedWindow* i) { ManagedWindowRep& w = *rep(); w.icon_ = i; w.do_set(this, &ManagedWindowRep::set_icon); } void ManagedWindow::icon_bitmap(Bitmap* b) { ManagedWindowRep& w = *rep(); Resource::ref(b); Resource::unref(w.icon_bitmap_); w.icon_bitmap_ = b; w.do_set(this, &ManagedWindowRep::set_icon_bitmap); } void ManagedWindow::icon_mask(Bitmap* b) { ManagedWindowRep& w = *rep(); Resource::ref(b); Resource::unref(w.icon_mask_); w.icon_mask_ = b; w.do_set(this, &ManagedWindowRep::set_icon_mask); } void ManagedWindow::iconify() { WindowRep& w = *Window::rep(); XWindow xw = w.xwindow_; if (xw != WindowRep::unbound) { XEvent xe; static Atom a = None; DisplayRep& r = *w.canvas_->rep()->display_->rep(); XDisplay* dpy = r.display_; if (a == None) { a = XInternAtom(dpy, "WM_CHANGE_STATE", False); } xe.type = ClientMessage; xe.xclient.type = ClientMessage; xe.xclient.display = dpy; xe.xclient.window = xw; xe.xclient.message_type = a; xe.xclient.format = 32; xe.xclient.data.l[0] = IconicState; XSendEvent( dpy, r.root_, False, SubstructureRedirectMask | SubstructureNotifyMask, &xe ); } } void ManagedWindow::deiconify() { WindowRep& w = *Window::rep(); XWindow xw = w.xwindow_; if (xw != WindowRep::unbound) { XMapWindow(w.dpy(), xw); } } void ManagedWindow::resize() { default_geometry(); ManagedWindowRep& w = *rep(); w.wm_normal_hints(this); Window::resize(); } void ManagedWindow::focus_event(Handler* in, Handler* out) { WindowRep& w = *Window::rep(); Resource::ref(in); Resource::ref(out); Resource::unref(w.focus_in_); Resource::unref(w.focus_out_); w.focus_in_ = in; w.focus_out_ = out; } void ManagedWindow::wm_delete(Handler* h) { WindowRep& w = *Window::rep(); Resource::ref(h); Resource::unref(w.wm_delete_); w.wm_delete_ = h; } void ManagedWindow::compute_geometry() { WindowRep& wr = *Window::rep(); CanvasRep& c = *wr.canvas_->rep(); Display& d = *wr.display_; if (c.pwidth_ <= 0) { c.width_ = 72; c.pwidth_ = d.to_pixels(c.width_); } if (c.pheight_ <= 0) { c.height_ = 72; c.pheight_ = d.to_pixels(c.height_); } } void ManagedWindow::set_props() { ManagedWindowRep& w = *rep(); w.wm_normal_hints(this); w.wm_name(this); w.wm_class(this); w.wm_protocols(this); w.wm_colormap_windows(this); w.wm_hints(this); } /** class ApplicationWindow **/ ApplicationWindow::ApplicationWindow(Glyph* g) : ManagedWindow(g) { } ApplicationWindow::~ApplicationWindow() { } void ApplicationWindow::compute_geometry() { WindowRep& wr = *Window::rep(); CanvasRep& c = *wr.canvas_->rep(); Display& d = *wr.display_; unsigned int spec = 0; String v; if (wr.style_ != nil && wr.style_->find_attribute("geometry", v)) { NullTerminatedString g(v); unsigned int xw, xh; spec = XParseGeometry(g.string(), &wr.xpos_, &wr.ypos_, &xw, &xh); const unsigned int userplace = XValue | YValue; if ((spec & userplace) == userplace) { wr.placed_ = true; } if ((spec & WidthValue) != 0) { c.pwidth_ = PixelCoord(xw); c.width_ = d.to_coord(c.pwidth_); } if ((spec & HeightValue) != 0) { c.pheight_ = PixelCoord(xh); c.height_ = d.to_coord(c.pheight_); } if ((spec & XValue) != 0 && (spec & XNegative) != 0) { wr.xpos_ = d.pwidth() + wr.xpos_ - c.pwidth_; } if ((spec & YValue) != 0 && (spec & YNegative) != 0) { wr.ypos_ = d.pheight() + wr.ypos_ - c.pheight_; } } ManagedWindow::compute_geometry(); } void ApplicationWindow::set_props() { WindowRep& w = *Window::rep(); Session& s = *Session::instance(); Display* d = w.display_; if (d == nil) { d = s.default_display(); } XSetCommand(d->rep()->display_, w.xwindow_, s.argv(), s.argc()); ManagedWindow::set_props(); } /** class TopLevelWindow **/ TopLevelWindow::TopLevelWindow(Glyph* g) : ManagedWindow(g) { } TopLevelWindow::~TopLevelWindow() { } void TopLevelWindow::group_leader(Window* primary) { ManagedWindowRep& w = *rep(); w.group_leader_ = primary; w.do_set(this, &ManagedWindowRep::set_group_leader); } Window* TopLevelWindow::group_leader() const { return rep()->group_leader_; } void TopLevelWindow::set_props() { ManagedWindow::set_props(); } /** class TransientWindow **/ TransientWindow::TransientWindow(Glyph* g) : TopLevelWindow(g) { } TransientWindow::~TransientWindow() { } void TransientWindow::transient_for(Window* primary) { ManagedWindowRep& w = *rep(); w.transient_for_ = primary; w.do_set(this, &ManagedWindowRep::set_transient_for); } Window* TransientWindow::transient_for() const { return rep()->transient_for_; } /* * Don't do the normal geometry property lookup, etc. for transients. */ void TransientWindow::configure() { Window::configure(); } void TransientWindow::set_attributes() { Style& s = *style(); s.alias("TransientWindow"); TopLevelWindow::set_attributes(); } /** class PopupWindow **/ PopupWindow::PopupWindow(Glyph* g) : Window(g) { } PopupWindow::~PopupWindow() { } void PopupWindow::set_attributes() { Style& s = *style(); s.alias("PopupWindow"); Window::set_attributes(); WindowRep& w = *rep(); w.xattrmask_ |= CWOverrideRedirect; w.xattrs_.override_redirect = True; } /** class IconWindow **/ IconWindow::IconWindow(Glyph* g) : ManagedWindow(g) { } IconWindow::~IconWindow() { } void IconWindow::do_map() { } /** class WindowRep **/ /* * Hopefully, these atoms will have the same values on all displays. */ XDisplay* WindowRep::dpy() { return display_->rep()->display_; } Atom WindowRep::wm_delete_atom_ = None; Atom WindowRep::wm_delete_atom() { if (wm_delete_atom_ == None) { wm_delete_atom_ = XInternAtom(dpy(), "WM_DELETE_WINDOW", False); } return wm_delete_atom_; } Atom WindowRep::wm_protocols_atom_ = None; Atom WindowRep::wm_protocols_atom() { if (wm_protocols_atom_ == None) { wm_protocols_atom_ = XInternAtom(dpy(), "WM_PROTOCOLS", False); } return wm_protocols_atom_; } void WindowRep::clear_mapping_info() { xtoplevel_ = WindowRep::unbound; needs_resize_ = false; resized_ = false; moved_ = false; unmapped_ = false; wm_mapped_ = false; map_pending_ = false; } void WindowRep::map_notify(Window*, XMapEvent&) { needs_resize_ = true; wm_mapped_ = true; map_pending_ = false; /* for backward compatibility */ canvas_->rep()->status_ = Canvas::mapped; } /* * We can only see an unmap if it is generated external (e.g., * by a window manager). Application unmaps will unbind the window, * thus removing it from the xid->window table. */ void WindowRep::unmap_notify(Window*, XUnmapEvent&) { glyph_->undraw(); wm_mapped_ = false; /* for backward compatibility */ canvas_->rep()->status_ = Canvas::unmapped; } /* * Handle an expose event. Because window managers generate a variety * of event sequences in response to maps, We defer the first resize * until when a window is first exposed. */ void WindowRep::expose(Window* w, XExposeEvent& xe) { unsigned int pw = canvas_->pwidth(); unsigned int ph = canvas_->pheight(); if (needs_resize_) { needs_resize_ = false; resize(w, pw, ph); } else { Display* d = display_; Coord l = d->to_coord(xe.x); Coord r = l + d->to_coord(xe.width); Coord t = d->to_coord(ph - xe.y); Coord b = t - d->to_coord(xe.height); canvas_->redraw(l, b, r, t); } } /* * Handle an X ConfigureNotify event. If the window has been configured * once already, then only resize it if the new size is different. * If it hasn't been configured once, then note the size and we'll take * care of it when the first expose event is handled. */ void WindowRep::configure_notify(Window* w, XConfigureEvent& xe) { moved_ = true; if (resized_) { if (xe.width != canvas_->pwidth() || xe.height != canvas_->pheight()) { resize(w, xe.width, xe.height); } } else { canvas_->psize(xe.width, xe.height); needs_resize_ = true; } } /* * Note that a window has moved. */ void WindowRep::move(Window*, int x, int y) { xpos_ = x; ypos_ = y; moved_ = false; } /* * Resize a window, allocating the associated glyph and * damaging the new area. */ void WindowRep::resize(Window* w, unsigned int xwidth, unsigned int xheight) { if (request_on_resize_) { Box::full_request(true); glyph_->request(shape_); Box::full_request(false); } canvas_->psize(xwidth, xheight); canvas_->damage_all(); const Requirement& rx = shape_.requirement(Dimension_X); const Requirement& ry = shape_.requirement(Dimension_Y); Coord xsize = canvas_->width(); Coord ysize = canvas_->height(); Coord ox = xsize * rx.alignment(); Coord oy = ysize * ry.alignment(); allocation_.allot(Dimension_X, Allotment(ox, xsize, ox / xsize)); allocation_.allot(Dimension_Y, Allotment(oy, ysize, oy / ysize)); Extension ext; ext.clear(); init_renderer(w); if (resized_) { glyph_->undraw(); } glyph_->allocate(canvas_, allocation_, ext); resized_ = true; } void WindowRep::check_position(const Window*) { if (moved_) { DisplayRep& d = *display_->rep(); int x, y; XWindow xw; XTranslateCoordinates( d.display_, xwindow_, d.root_, 0, 0, &x, &y, &xw ); xpos_ = x; ypos_ = y; moved_ = false; } } void WindowRep::check_binding(Window* w) { if (unmapped_) { w->unbind(); } } void WindowRep::do_bind(Window* w, XWindow parent, int left, int top) { CanvasRep& c = *canvas_->rep(); DisplayRep& d = *display_->rep(); XDisplay* dpy = d.display_; WindowTable& t = *d.wtable_; if (xwindow_ != WindowRep::unbound) { t.remove(xwindow_); } w->set_attributes(); xwindow_ = XCreateWindow( dpy, parent, left, top, canvas_->pwidth(), canvas_->pheight(), /* border width */ 0, visual_->depth(), xclass_, visual_->visual(), xattrmask_, &xattrs_ ); c.xdrawable_ = xwindow_; t.insert(xwindow_, w); xtoplevel_ = toplevel_->rep()->xwindow_; } void WindowRep::init_renderer(Window* w) { CanvasRep& c = *w->canvas()->rep(); c.unbind(); c.bind(style_->value_is_on("double_buffered")); } Window* WindowRep::find(XWindow xw, WindowTable* t) { Window* window; if (t->find(window, xw)) { WindowRep& w = *window->rep(); Window* toplevel; if (t->find(toplevel, w.xtoplevel_) && toplevel == w.toplevel_) { return window; } } return nil; } /* class ManagedWindowRep */ void ManagedWindowRep::do_set(Window* window, HintFunction f) { WindowRep& w = *window->rep(); ManagedWindowHintInfo info; info.xwindow_ = w.xwindow_; if (info.xwindow_ != WindowRep::unbound) { info.style_ = w.style_; info.dpy_ = w.dpy(); info.hints_ = XGetWMHints(info.dpy_, info.xwindow_); if (info.hints_ == nil) { info.hints_ = XAllocWMHints(); } info.pwidth_ = w.canvas_->pwidth(); info.pheight_ = w.canvas_->pheight(); info.display_ = w.display_; if ((this->*f)(info)) { XSetWMHints(info.dpy_, info.xwindow_, info.hints_); } XFree((char*)info.hints_); } } bool ManagedWindowRep::set_name(ManagedWindowHintInfo& info) { if (info.style_ != nil) { Style& s = *info.style_; String v; if (s.find_attribute("name", v) || s.find_attribute("title", v)) { NullTerminatedString ns(v); XStoreName(info.dpy_, info.xwindow_, ns.string()); } } return false; } bool ManagedWindowRep::set_geometry(ManagedWindowHintInfo&) { /* unimplemented: should configure mapped windows */ return false; } bool ManagedWindowRep::set_group_leader(ManagedWindowHintInfo& info) { if (group_leader_ == nil) { info.hints_->flags &= ~WindowGroupHint; info.hints_->window_group = None; return true; } else { XWindow g = group_leader_->rep()->xwindow_; if (g != WindowRep::unbound) { info.hints_->flags |= WindowGroupHint; info.hints_->window_group = g; return true; } } return false; } bool ManagedWindowRep::set_transient_for(ManagedWindowHintInfo& info) { if (transient_for_ != nil) { XDrawable td = transient_for_->rep()->xwindow_; if (td != WindowRep::unbound) { XSetTransientForHint(info.dpy_, info.xwindow_, td); return true; } } return false; } bool ManagedWindowRep::set_icon(ManagedWindowHintInfo& info) { if (icon_ == nil) { info.hints_->flags &= ~IconWindowHint; info.hints_->icon_window = None; return true; } else { XWindow i = icon_->Window::rep()->xwindow_; if (i != WindowRep::unbound) { info.hints_->flags |= IconWindowHint; info.hints_->icon_window = i; return true; } } return false; } bool ManagedWindowRep::set_icon_name(ManagedWindowHintInfo& info) { if (info.style_ != nil) { Style& s = *info.style_; String v; if (s.find_attribute("iconName", v) || s.find_attribute("name", v)) { NullTerminatedString ns(v); XSetIconName(info.dpy_, info.xwindow_, ns.string()); } } return false; } bool ManagedWindowRep::set_icon_geometry(ManagedWindowHintInfo& info) { info.hints_->flags &= ~IconPositionHint; String g; if (!info.style_->find_attribute("iconGeometry", g)) { if (icon_ == nil) { return false; } Style* s = icon_->style(); if (s == nil || !s->find_attribute("geometry", g)) { return false; } } NullTerminatedString ns(g); int x = 0, y = 0; unsigned int w = info.pwidth_; unsigned int h = info.pheight_; if (icon_bitmap_ != nil) { w = icon_bitmap_->pwidth(); h = icon_bitmap_->pheight(); } if (icon_ != nil) { w = icon_->canvas()->pwidth(); h = icon_->canvas()->pheight(); } unsigned int p = XParseGeometry(ns.string(), &x, &y, &w, &h); Display& d = *info.display_; if ((p & XNegative) != 0) { x = d.pwidth() + x - w; } if ((p & YNegative) != 0) { y = d.pheight() + y - h; } if ((p & (XValue|YValue)) != 0) { info.hints_->flags |= IconPositionHint; info.hints_->icon_x = x; info.hints_->icon_y = y; return true; } return false; } bool ManagedWindowRep::set_icon_bitmap(ManagedWindowHintInfo& info) { if (icon_bitmap_ == nil) { info.hints_->flags &= ~IconPixmapHint; info.hints_->icon_pixmap = None; } else { info.hints_->flags |= IconPixmapHint; info.hints_->icon_pixmap = icon_bitmap_->rep()->pixmap_; } return true; } bool ManagedWindowRep::set_icon_mask(ManagedWindowHintInfo& info) { if (icon_mask_ == nil) { info.hints_->flags &= ~IconMaskHint; info.hints_->icon_mask = None; } else { info.hints_->flags |= IconMaskHint; info.hints_->icon_mask = icon_mask_->rep()->pixmap_; } return true; } bool ManagedWindowRep::set_all(ManagedWindowHintInfo& info) { Style* s = info.style_; XWMHints& h = *info.hints_; h.flags = InputHint; h.input = True; h.flags |= StateHint; h.initial_state = (s != nil && s->value_is_on("iconic")) ? IconicState : NormalState; set_name(info); set_geometry(info); set_group_leader(info); set_transient_for(info); set_icon_name(info); set_icon_geometry(info); set_icon(info); set_icon_bitmap(info); set_icon_mask(info); return true; } void ManagedWindowRep::wm_normal_hints(Window* window) { WindowRep& w = *window->rep(); const Display& d = *w.display_; unsigned int cpwidth = w.canvas_->pwidth(); unsigned int cpheight = w.canvas_->pheight(); XSizeHints sizehints; if (w.placed_) { sizehints.flags = USPosition | USSize; } else { sizehints.flags = PSize | PBaseSize; } /* obsolete as of R4, but kept for backward compatibility */ sizehints.x = w.xpos_; sizehints.y = w.ypos_; sizehints.width = cpwidth; sizehints.height = cpheight; sizehints.base_width = cpwidth; sizehints.base_height = cpheight; const Coord smallest = d.to_coord(2); const Coord x_largest = d.width(); const Coord y_largest = d.height(); Requirement& rx = w.shape_.requirement(Dimension_X); Requirement& ry = w.shape_.requirement(Dimension_Y); Coord min_width = Math::min( x_largest, Math::max(smallest, rx.natural() - rx.shrink()) ); Coord min_height = Math::min( y_largest, Math::max(smallest, ry.natural() - ry.shrink()) ); sizehints.flags |= PMinSize; sizehints.min_width = d.to_pixels(min_width); sizehints.min_height = d.to_pixels(min_height); Coord max_width = Math::max(smallest, rx.natural() + rx.stretch()); Coord max_height = Math::max(smallest, ry.natural() + ry.stretch()); if (max_width < x_largest || max_height < y_largest) { sizehints.flags |= PMaxSize; sizehints.max_width = d.to_pixels(Math::min(max_width, x_largest)); sizehints.max_height = d.to_pixels(Math::min(max_height, y_largest)); } /* PResizeInc: width_inc, height_inc */ /* PAspect: {min_aspect,max_aspect}.{x,y} */ XSetNormalHints(w.dpy(), w.xwindow_, &sizehints); } void ManagedWindowRep::wm_name(Window* window) { WindowRep& w = *window->rep(); Style* s = w.style_; String v; if (!s->find_attribute("name", v) && !s->find_attribute("title", v)) { s->attribute("name", Session::instance()->name()); s->find_attribute("name", v); } //String hostname(Host::name()); XChangeProperty( w.dpy(), w.xwindow_, XA_WM_NAME, XA_STRING, 8, PropModeReplace, //(unsigned char*)(hostname.string()), hostname.length() (unsigned char*)(v.string()), v.length() ); } void ManagedWindowRep::wm_class(Window* window) { WindowRep& w = *window->rep(); Style* s = w.style_; XClassHint classhint; String v("Noname"); if (!s->find_attribute("name", v)) { s->find_attribute("title", v); } NullTerminatedString ns(v); classhint.res_name = (char*)ns.string(); classhint.res_class = (char*)(Session::instance()->classname()); XSetClassHint(w.dpy(), w.xwindow_, &classhint); } void ManagedWindowRep::wm_protocols(Window* window) { WindowRep& w = *window->rep(); Atom a = w.wm_delete_atom(); XSetWMProtocols(w.dpy(), w.xwindow_, &a, 1); } void ManagedWindowRep::wm_colormap_windows(Window*) { /* we do not currently manipulate colormaps */ } void ManagedWindowRep::wm_hints(Window* window) { do_set(window, &ManagedWindowRep::set_all); } /* class WindowVisual */ declareTable(ColorTable,unsigned long,XColor) implementTable(ColorTable,unsigned long,XColor) class RGBTableEntry { public: unsigned short red_; unsigned short green_; unsigned short blue_; unsigned long hash() const; bool operator ==(const RGBTableEntry&) const; bool operator !=(const RGBTableEntry&) const; }; inline unsigned long key_to_hash(const RGBTableEntry& k) { return k.hash(); } unsigned long RGBTableEntry::hash() const { return (red_ >> 7) ^ (green_ >> 7) ^ (blue_ >> 7); } bool RGBTableEntry::operator ==(const RGBTableEntry& rgb) const { return red_ == rgb.red_ && green_ == rgb.green_ && blue_ == rgb.blue_; } bool RGBTableEntry::operator !=(const RGBTableEntry& rgb) const { return red_ != rgb.red_ || green_ != rgb.green_ || blue_ != rgb.blue_; } declareTable(RGBTable,RGBTableEntry,XColor) implementTable(RGBTable,RGBTableEntry,XColor) WindowVisual::WindowVisual(const WindowVisualInfo& info) { WindowVisualInfo& i = info_; i = info; if (i.visual_ == nil) { i.visual_ = DefaultVisual(i.display_, i.screen_); i.cmap_ = DefaultColormap(i.display_, i.screen_); } else { i.cmap_ = XCreateColormap( i.display_, RootWindow(i.display_, i.screen_), i.visual_, AllocNone ); } init_color_tables(); } WindowVisual::~WindowVisual() { delete ctable_; delete rgbtable_; delete [] localmap_; } WindowVisual* WindowVisual::find_visual(Display* d, Style* s) { WindowVisualInfo info; DisplayRep& dr = *d->rep(); XDisplay* dpy = dr.display_; info.display_ = dpy; info.screen_ = dr.screen_; info.depth_ = DefaultDepth(dpy, dr.screen_); WindowVisualList& wvlist = dr.visuals_; info.visual_ = wvlist.count() == 0 ? nil : dr.default_visual_->visual(); info.overlay_.id_ = 0x0; String v; int layer; if (s->find_attribute("visual_id", v)) { long id; if (v.convert(id)) { XVisualInfo xinfo; xinfo.visualid = id; find_visual_by_info(xinfo, VisualIDMask, info); } } else if (s->find_attribute("visual", v)) { find_visual_by_class_name(v, info); } else if (s->find_attribute("overlay", v) && find_layer(v, layer)) { for (ListItr(WindowVisualList) i(wvlist); i.more(); i.next()) { WindowVisual* wv = i.cur(); WindowOverlayInfo& ov = wv->info_.overlay_; if (ov.id_ != 0x0 && (layer == 0 || ov.layer_ == layer)) { return wv; } } find_overlay(layer, info); } WindowVisual* wv; for (ListItr(WindowVisualList) i(wvlist); i.more(); i.next()) { wv = i.cur(); if (wv->visual() == info.visual_) { return wv; } } wv = new WindowVisual(info); wvlist.append(wv); return wv; } /* * Lookup a visual by class name. */ struct VisualTable { const char* class_name; int class_tag; }; static VisualTable visual_classes[] = { { "TrueColor", TrueColor }, { "PseudoColor", PseudoColor }, { "StaticGray", StaticGray }, { "GrayScale", GrayScale }, { "StaticColor", StaticColor }, { "DirectColor", DirectColor }, { nil, -1 } }; void WindowVisual::find_visual_by_class_name( const String& name, WindowVisualInfo& info ) { for (VisualTable* v = &visual_classes[0]; v->class_name != nil; v++) { if (name == v->class_name) { XVisualInfo xinfo; xinfo.c_class = v->class_tag; find_visual_by_info(xinfo, VisualClassMask, info); return; } } } bool WindowVisual::find_layer(const String& v, int& layer) { if (v.convert(layer)) { return true; } if (v.case_insensitive_equal("true") || v.case_insensitive_equal("yes")) { layer = 0; return true; } return false; } /* * Look for an overlay visual. There is no X standard way to do this, * so we rely on the convention that the SERVER_OVERLAY_VISUALS property * on the root window contains a list of overlay visuals. Each visual * has 4 pieces of information: the visual id, the type of transparency, * the pixel or mask for transparency, and the overlay layer. Layers * are numbered from top-to-bottom. */ void WindowVisual::find_overlay(int layer, WindowVisualInfo& info) { XDisplay* dpy = info.display_; Atom actual_type; int actual_format; unsigned long nitems, bytes_after; WindowOverlayInfo* overlay_visuals = nil; if ( XGetWindowProperty( dpy, RootWindow(dpy, info.screen_), XInternAtom(dpy, "SERVER_OVERLAY_VISUALS", False), /* offset */ 0L, /* length */ (long)1000000, /* delete */ False, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, (unsigned char**)&overlay_visuals ) != Success ) { return; } if (actual_type != None && actual_format == 32 && nitems >= 4) { unsigned long noverlays = nitems >> 2; for (unsigned long i = 0; i < noverlays; i++) { if (layer == 0 || overlay_visuals[i].layer_ == layer) { /* * Alas, we must query the visual info to find out * the depth of the overlay. */ XVisualInfo xinfo; xinfo.visualid = overlay_visuals[i].id_; find_visual_by_info(xinfo, VisualIDMask, info); info.overlay_ = overlay_visuals[i]; break; } } } if (overlay_visuals != nil) { XFree((char*)overlay_visuals); } } /* * Look for a visual matching the given xinfo. */ void WindowVisual::find_visual_by_info( XVisualInfo& xinfo, long mask, WindowVisualInfo& info ) { xinfo.screen = info.screen_; int nvisuals = 0; XVisualInfo* visuals = XGetVisualInfo( info.display_, VisualScreenMask | mask, &xinfo, &nvisuals ); if (visuals != nil) { if (nvisuals > 0) { info.depth_ = visuals[0].depth; info.visual_ = visuals[0].visual; } XFree((char*)visuals); } } /* * Set up appropriate color mapping tables for the visual. * For TrueColor, we don't need an rgb->pixel table because we can * compute the pixel value directly. The pixel->rgb table (ctable_) * is used by Raster::peek. * * The table sizes are 512 = 2 (hash tables work best half full) times * 256 (most non-TrueColor systems are 8-bit). */ void WindowVisual::init_color_tables() { ctable_ = new ColorTable(512); localmap_ = nil; localmapsize_ = 0; Visual& v = *info_.visual_; switch (v.c_class) { case TrueColor: rgbtable_ = nil; set_shift(v.red_mask, red_, red_shift_); set_shift(v.green_mask, green_, green_shift_); set_shift(v.blue_mask, blue_, blue_shift_); break; default: rgbtable_ = new RGBTable(512); if (v.c_class == PseudoColor && v.map_entries < 16) { XColor xc; find_color(0, 0, 0, xc); find_color(0xffff, 0xffff, 0xffff, xc); } break; } } void WindowVisual::set_shift( unsigned long mask, unsigned long& v, unsigned long& shift ) { shift = 0; v = mask; while ((v & 0x1) == 0) { shift += 1; v >>= 1; } } /* * Compute a reasonable pixel for xor'ing. Note that this should be done * after the visual is selected to handle the DirectColor case correctly. */ inline unsigned int WindowVisual::MSB(unsigned long i) { return (i ^ (i>>1)) & i; } unsigned long WindowVisual::iv_xor(const Style& s) const { unsigned long p; String custom; if (s.find_attribute("RubberbandPixel", custom)) { long n = 1; custom.convert(n); p = n; } else if (info_.visual_->c_class == DirectColor) { p = ( MSB(info_.visual_->red_mask) | MSB(info_.visual_->green_mask) | MSB(info_.visual_->blue_mask) ); } else { XDisplay* dpy = info_.display_; int s = info_.screen_; p = BlackPixel(dpy, s) ^ WhitePixel(dpy, s); } return p; } /* * Find the X color information for a given pixel value. * If it is already in the color table, just retrieve. * Otherwise, we have to query X. */ void WindowVisual::find_color(unsigned long pixel, XColor& xc) { if (!ctable_->find(xc, pixel)) { xc.pixel = pixel; XQueryColor(info_.display_, info_.cmap_, &xc); ctable_->insert(pixel, xc); } } double WindowVisual::distance( unsigned short r, unsigned short g, unsigned short b, const XColor& xc ) { double scale = 1.0 / double(0x10000); double rr = (double(r) - double(xc.red)) * scale; double gg = (double(g) - double(xc.green)) * scale; double bb = (double(b) - double(xc.blue)) * scale; return rr*rr + gg*gg + bb*bb; } inline unsigned long WindowVisual::rescale( unsigned long value, unsigned long in_scale, unsigned long out_scale ) { return (value * out_scale + in_scale/2) / in_scale; } /* * Find the X color information for a specified rgb. * For a TrueColor visual, this is easy (computed directly from rgb values). * Otherwise, we have to do an XAllocColor if we haven't seen the rgb * combination before. If XAllocColor fails, then we read the colormap and * try to find the best match. Note this may cause havoc if the colormap * entries are read/write. */ void WindowVisual::find_color( unsigned short red, unsigned short green, unsigned short blue, XColor& xc ) { unsigned long r, g, b; switch (info_.visual_->c_class) { case TrueColor: r = rescale(red, 0xffff, red_); g = rescale(green, 0xffff, green_); b = rescale(blue, 0xffff, blue_); xc.pixel = ( (r << red_shift_) | (g << green_shift_) | (b << blue_shift_) ); xc.red = (unsigned short)rescale(r, red_, 0xffff); xc.green = (unsigned short)rescale(g, green_, 0xffff); xc.blue = (unsigned short)rescale(b, blue_, 0xffff); break; default: RGBTableEntry rgb; rgb.red_ = red; rgb.green_ = green; rgb.blue_ = blue; if (!rgbtable_->find(xc, rgb)) { if (localmapsize_ == 0) { xc.red = red; xc.green = green; xc.blue = blue; if (!XAllocColor(info_.display_, info_.cmap_, &xc)) { localmapsize_ = Math::min(info_.visual_->map_entries, 256); localmap_ = new XColor[localmapsize_]; for (unsigned long p = 0; p < localmapsize_; p++) { localmap_[p].pixel = p; } XQueryColors( info_.display_, info_.cmap_, localmap_, localmapsize_ ); } } if (localmapsize_ != 0) { unsigned long best = 0; double best_match = 0.0; bool matched = false; for (unsigned long p = 0; p < localmapsize_; p++) { const WindowOverlayInfo& ov = info_.overlay_; if (ov.id_ == 0x0 || ov.transparent_ != p) { double d = distance(red, green, blue, localmap_[p]); if (!matched || d < best_match) { best = p; best_match = d; matched = true; } } } xc = localmap_[best]; } rgbtable_->insert(rgb, xc); } } } /* class Display */ declarePtrList(DamageList,Window) implementPtrList(DamageList,Window) class GrabInfo { private: friend class Display; friend class DisplayRep; Window* window_; Handler* handler_; }; declareList(GrabList,GrabInfo) implementList(GrabList,GrabInfo) declarePtrList(SelectionList,SelectionManager) implementPtrList(SelectionList,SelectionManager) implementTable(WindowTable,XWindow,Window*) Display::Display(DisplayRep* d) { rep_ = d; } Display* Display::open(const String& s) { NullTerminatedString ns(s); return open(ns.string()); } Display* Display::open() { return open(nil); } Display* Display::open(const char* device) { XDisplay* dpy = XOpenDisplay(device); if (dpy == nil) { return nil; } DisplayRep* d = new DisplayRep; d->display_ = dpy; d->screen_ = DefaultScreen(d->display_); d->style_ = nil; d->grabbers_ = new GrabList; d->damaged_ = new DamageList; d->selections_ = new SelectionList; d->wtable_ = new WindowTable(256); return new Display(d); } void Display::close() { DisplayRep* d = rep(); XCloseDisplay(d->display_); } Display::~Display() { DisplayRep* d = rep(); Resource::unref_deferred(d->style_); for (ListItr(SelectionList) i(*d->selections_); i.more(); i.next()) { SelectionManager* s = i.cur(); delete s; } delete d->selections_; delete d->damaged_; delete d->grabbers_; delete d->wtable_; delete d; } int Display::fd() const { return ConnectionNumber(rep()->display_); } Coord Display::width() const { return rep()->width_; } Coord Display::height() const { return rep()->height_; } PixelCoord Display::pwidth() const { return rep()->pwidth_; } PixelCoord Display::pheight() const { return rep()->pheight_; } /* * Convert millimeters to points. We use 72.0 pts/in and 25.4 mm/in. */ static inline double mm_to_points(double mm) { return (72.0 / 25.4) * mm; } Coord Display::a_width() const { DisplayRep& d = *rep(); return Coord(mm_to_points(double(DisplayWidthMM(d.display_, d.screen_)))); } Coord Display::a_height() const { DisplayRep& d = *rep(); return Coord(mm_to_points(double(DisplayHeightMM(d.display_, d.screen_)))); } bool Display::defaults(String& s) const { const char* list = XResourceManagerString(rep_->display_); if (list != nil) { s = list; return true; } return false; } void Display::style(Style* s) { DisplayRep& d = *rep(); Resource::ref(s); Resource::unref(d.style_); d.style_ = s; set_screen(d.screen_); if (s->value_is_on("synchronous")) { XSynchronize(d.display_, True); } } Style* Display::style() const { return rep()->style_; } void Display::set_screen(int s) { DisplayRep& d = *rep(); XDisplay* dpy = d.display_; if (s < 0 || s >= ScreenCount(dpy)) { return; } d.screen_ = s; d.root_ = RootWindow(dpy, s); d.default_visual_ = WindowVisual::find_visual(this, d.style_); d.pwidth_ = DisplayWidth(dpy, s); d.pheight_ = DisplayHeight(dpy, s); d.set_dpi(x_pixel_); x_point_ = 1 / x_pixel_; y_pixel_ = x_pixel_; y_point_ = x_point_; d.width_ = to_coord(d.pwidth_); d.height_ = to_coord(d.pheight_); } void Display::repair() { DamageList& list = *rep()->damaged_; for (ListItr(DamageList) i(list); i.more(); i.next()) { i.cur()->repair(); } list.remove_all(); } void Display::flush() { XFlush(rep()->display_); } void Display::sync() { XSync(rep()->display_, 0); } void Display::ring_bell(int v) { XDisplay* dpy = rep()->display_; if (v > 100) { XBell(dpy, 100); } else if (v >= 0) { XBell(dpy, v); } } void Display::set_key_click(int v) { XKeyboardControl k; k.key_click_percent = v; XChangeKeyboardControl(rep()->display_, KBKeyClickPercent, &k); } void Display::set_auto_repeat(bool b) { XDisplay* dpy = rep()->display_; if (b) { XAutoRepeatOn(dpy); } else { XAutoRepeatOff(dpy); } } void Display::set_pointer_feedback(int t, int s) { XChangePointerControl(rep()->display_, True, True, s, 1, t); } void Display::move_pointer(Coord x, Coord y) { DisplayRep& d = *rep(); XWarpPointer( d.display_, None, d.root_, 0, 0, 0, 0, to_pixels(x), pheight() - to_pixels(y) ); } SelectionManager* Display::primary_selection() { return find_selection("PRIMARY"); } SelectionManager* Display::secondary_selection() { return find_selection("SECONDARY"); } SelectionManager* Display::clipboard_selection() { return find_selection("CLIPBOARD"); } SelectionManager* Display::find_selection(const char* name) { return find_selection(String(name)); } SelectionManager* Display::find_selection(const String& name) { SelectionManager* s; SelectionList& list = *rep()->selections_; for (ListItr(SelectionList) i(list); i.more(); i.next()) { s = i.cur(); if (*s->rep()->name_ == name) { return s; } } s = new SelectionManager(this, name); list.append(s); return s; } /* * Compute size of a pixel in printer points. If the "dpi" attribute * is specified, then we use it as dots per inch and convert to points. * Otherwise we use font metrics, not the (alleged) screen size, * because applications really care about how things measure * with respect to text. The default assumes that fonts are designed * for 75 dots/inch and printer points are 72.0 pts/inch. */ void DisplayRep::set_dpi(Coord& pixel) { String s; if (style_->find_attribute("dpi", s)) { long dpi; if (s.convert(dpi) && dpi != 0) { pixel = 72.0 / float(dpi); } } else { pixel = 72.0 / 75.0; } } /* * Read the next event if one is pending. Otherwise, return false. * Window::receive will be called on the target window for the event, * if the window is known and is valid. Because we don't keep track * of subwindows, it is possible to get an event for a subwindow after * the main window has been unmapped. We must ignore such events. */ bool Display::get(Event& event) { DisplayRep* d = rep(); EventRep& e = *(event.rep()); e.display_ = this; XDisplay* dpy = d->display_; XEvent& xe = e.xevent_; if (d->damaged_->count() != 0 && QLength(dpy) == 0) { repair(); } if (!XPending(dpy)) { return false; } XNextEvent(dpy, &xe); e.clear(); e.window_ = WindowRep::find(xe.xany.window, d->wtable_); if (e.window_ != nil) { e.window_->receive(event); } return true; } void Display::put(const Event& e) { XPutBackEvent(rep()->display_, &e.rep()->xevent_); } /* * Check to see if the display connection just shut down. */ #if !defined(FIONREAD) // && defined(sun) && defined(SVR4) #define FIONREAD I_NREAD #endif bool Display::closed() { XDisplay* dpy = rep()->display_; if (XEventsQueued(dpy, QueuedAfterReading) == 0) { /* need to detect whether partial event or connection closed */ int fd = ConnectionNumber(dpy); int pending = 0; if (ioctl(fd, FIONREAD, (char*)&pending) < 0 || pending == 0) { return true; } } return false; } /* * Add a handler to the grabber list. The handler is ref'd to ensure * that it is not deallocated while on the list. */ void Display::grab(Window* w, Handler* h) { GrabInfo g; g.window_ = w; Resource::ref(h); g.handler_ = h; rep()->grabbers_->prepend(g); } /* * Remove a handler from the grabber list. * This function has no effect if the handler is not presently on the list. * If the handler is on the list, it is unref'd. */ void Display::ungrab(Handler* h, bool all) { for (ListUpdater(GrabList) i(*rep()->grabbers_); i.more(); i.next()) { const GrabInfo& g = i.cur_ref(); if (g.handler_ == h) { i.remove_cur(); Resource::unref(h); if (!all) { break; } } } } /* * Return the most recent grabber, or nil if the list is empty. */ Handler* Display::grabber() const { GrabList& g = *rep()->grabbers_; return (g.count() == 0) ? nil : g.item(0).handler_; } /* * Check whether a given handler is on the grabber list. */ bool Display::is_grabbing(Handler* h) const { for (ListItr(GrabList) i(*rep()->grabbers_); i.more(); i.next()) { const GrabInfo& g = i.cur_ref(); if (g.handler_ == h) { return true; } } return false; } /* * Add a window to the damage list. */ void DisplayRep::needs_repair(Window* w) { damaged_->append(w); } /* * Remove a window from relevant display tables. */ void DisplayRep::remove(Window* w) { for (ListUpdater(DamageList) i(*damaged_); i.more(); i.next()) { if (i.cur() == w) { i.remove_cur(); break; } } /* * No easy way to delete multiple items during a single * list traversal. Sigh. */ bool done; do { done = true; for (ListUpdater(GrabList) i(*grabbers_); i.more(); i.next()) { const GrabInfo& g = i.cur_ref(); if (g.window_ == w) { i.remove_cur(); done = false; break; } } } while (!done); } neuron-7.6.3/src/lib/InterViews/000077500000000000000000000000001340731477100165005ustar00rootroot00000000000000neuron-7.6.3/src/lib/InterViews/action.cpp000077500000000000000000000053501340731477100204670ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include Action::Action() { } Action::~Action() { } declarePtrList(MacroActionList,Action) implementPtrList(MacroActionList,Action) Macro::Macro(Action* a0, Action* a1, Action* a2, Action* a3) : Action() { list_ = new MacroActionList; if (a0 != nil) { Resource::ref(a0); list_->append(a0); } if (a1 != nil) { Resource::ref(a1); list_->append(a1); } if (a2 != nil) { Resource::ref(a2); list_->append(a2); } if (a3 != nil) { Resource::ref(a3); list_->append(a3); } } Macro::~Macro() { for (ListItr(MacroActionList) i(*list_); i.more(); i.next()) { Action* a = i.cur(); Resource::unref(a); } delete list_; } void Macro::prepend(Action* a) { Resource::ref(a); list_->prepend(a); } void Macro::append(Action* a) { Resource::ref(a); list_->append(a); } void Macro::insert(MacroIndex i, Action* a) { Resource::ref(a); list_->insert(i, a); } void Macro::remove(MacroIndex i) { if (i >= 0 && i < list_->count()) { Action* a = list_->item(i); Resource::unref(a); list_->remove(i); } } MacroIndex Macro::count() const { return list_->count(); } Action* Macro::action(MacroIndex i) const { Action* a; if (i >= 0 && i < list_->count()) { a = list_->item(i); } else { a = nil; } return a; } void Macro::execute() { for (ListItr(MacroActionList) i(*list_); i.more(); i.next()) { Action* a = i.cur(); if (a != nil) { a->execute(); } } } neuron-7.6.3/src/lib/InterViews/adjust.cpp000077500000000000000000000106311340731477100205020ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Adjustable - object to scroll and/or zoom */ #include #include #include struct AdjustableInfo { private: friend class Adjustable; Observable* observable_; Coord small_; Coord large_; }; struct AdjustableImpl { private: friend class Adjustable; AdjustableInfo info_[CoordinateSpace::dimensions]; }; Adjustable::Adjustable() { impl_ = new AdjustableImpl; AdjustableImpl& a = *impl_; for (DimensionName d = 0; d < CoordinateSpace::dimensions; d++) { AdjustableInfo& i = a.info_[d]; i.observable_ = new Observable; i.small_ = 1; i.large_ = 0; } } Adjustable::~Adjustable() { AdjustableImpl& a = *impl_; for (DimensionName d = 0; d < CoordinateSpace::dimensions; d++) { delete a.info_[d].observable_; } delete impl_; } Observable* Adjustable::observable(DimensionName d) const { return impl_->info_[d].observable_; } void Adjustable::attach(DimensionName d, Observer* o) { observable(d)->attach(o); } void Adjustable::detach(DimensionName d, Observer* o) { observable(d)->detach(o); } Coord Adjustable::lower(DimensionName) const { return 0; } Coord Adjustable::upper(DimensionName d) const { return lower(d) + length(d); } Coord Adjustable::length(DimensionName d) const { return upper(d) - lower(d); } Coord Adjustable::cur_lower(DimensionName) const { return 0; } Coord Adjustable::cur_upper(DimensionName d) const { return cur_lower(d) + cur_length(d); } Coord Adjustable::cur_length(DimensionName d) const { return cur_upper(d) - cur_lower(d); } void Adjustable::small_scroll(DimensionName d, Coord c) { impl_->info_[d].small_ = c; } Coord Adjustable::small_scroll(DimensionName d) const { return impl_->info_[d].small_; } void Adjustable::large_scroll(DimensionName d, Coord c) { impl_->info_[d].large_ = c; } Coord Adjustable::large_scroll(DimensionName d) const { Coord s = impl_->info_[d].large_; if (Math::equal(s, float(0), float(1e-4))) { s = cur_length(d) - 1; } return s; } void Adjustable::begin_adjustment(DimensionName) { } void Adjustable::commit_adjustment(DimensionName) { } void Adjustable::abort_adjustment(DimensionName) { } void Adjustable::scroll_forward(DimensionName d) { scroll_to(d, cur_lower(d) + small_scroll(d)); } void Adjustable::scroll_backward(DimensionName d) { scroll_to(d, cur_lower(d) - small_scroll(d)); } void Adjustable::page_forward(DimensionName d) { scroll_to(d, cur_lower(d) + large_scroll(d)); } void Adjustable::page_backward(DimensionName d) { scroll_to(d, cur_lower(d) - large_scroll(d)); } void Adjustable::scroll_to(DimensionName, Coord) { } void Adjustable::scale_to(DimensionName, Coord) { } void Adjustable::zoom_to(float) { } void Adjustable::constrain(DimensionName d, Coord& new_lower) const { Coord a = lower(d); Coord b = upper(d) - cur_length(d); if (new_lower < a) { new_lower = a; } else if (new_lower > b) { new_lower = b; } } void Adjustable::notify(DimensionName d) const { observable(d)->notify(); } void Adjustable::notify_all() const { for (DimensionName d = 0; d < CoordinateSpace::dimensions; d++) { observable(d)->notify(); } } neuron-7.6.3/src/lib/InterViews/aggr.cpp000077500000000000000000000123241340731477100201310ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Aggregate - composite glyph */ #include #include #include #include #include class AggregateInfo { public: AggregateInfo(); Glyph* glyph_; Allocation allocation_; Extension extension_; }; declareList(AggregateInfo_List,AggregateInfo) implementList(AggregateInfo_List,AggregateInfo) AggregateInfo::AggregateInfo() { glyph_ = nil; } Aggregate::Aggregate(GlyphIndex size) : Glyph() { info_ = new AggregateInfo_List(size); } Aggregate::~Aggregate() { GlyphIndex count = info_->count(); for (GlyphIndex i = 0; i < count; ++i) { AggregateInfo& info = info_->item_ref(i); Resource::unref(info.glyph_); } delete info_; info_ = nil; } GlyphIndex Aggregate::count() const { return info_->count(); } Glyph* Aggregate::component(GlyphIndex index) const { return info_->item_ref(index).glyph_; } void Aggregate::allotment( GlyphIndex index, DimensionName res, Allotment& a ) const { a = info_->item_ref(index).allocation_.allotment(res); } void Aggregate::allot(GlyphIndex i, DimensionName res, const Allotment& al) { Allocation& a = info_->item_ref(i).allocation_; a.allot(res, al); } void Aggregate::change(GlyphIndex) { } void Aggregate::append(Glyph* glyph) { AggregateInfo info; info.glyph_ = glyph; info_->append(info); Resource::ref(glyph); } void Aggregate::prepend(Glyph* glyph) { AggregateInfo info; info.glyph_ = glyph; info_->prepend(info); Resource::ref(glyph); } void Aggregate::insert(GlyphIndex index, Glyph* glyph) { AggregateInfo info; info.glyph_ = glyph; info_->insert(index, info); Resource::ref(glyph); } void Aggregate::remove(GlyphIndex index) { AggregateInfo& info = info_->item_ref(index); Resource::unref(info.glyph_); info_->remove(index); } void Aggregate::replace(GlyphIndex index, Glyph* glyph) { AggregateInfo& info = info_->item_ref(index); Resource::ref(glyph); Resource::unref(info.glyph_); info.glyph_ = glyph; } void Aggregate::allocate(Canvas* canvas, const Allocation&, Extension& ext) { GlyphIndex count = info_->count(); for (GlyphIndex index = 0; index < count; ++index) { AggregateInfo& info = info_->item_ref(index); if (info.glyph_ != nil) { Allocation& a = info.allocation_; Extension& b = info.extension_; b.clear(); info.glyph_->allocate(canvas, a, b); ext.merge(b); } } } void Aggregate::draw(Canvas* canvas, const Allocation&) const { GlyphIndex count = info_->count(); for (GlyphIndex index = 0; index < count; ++index) { AggregateInfo& info = info_->item_ref(index); if (info.glyph_ != nil) { Allocation& a = info.allocation_; if (canvas->damaged(info.extension_)) { info.glyph_->draw(canvas, a); } } } } void Aggregate::print(Printer* p, const Allocation&) const { GlyphIndex count = info_->count(); for (GlyphIndex index = 0; index < count; ++index) { AggregateInfo& info = info_->item_ref(index); if (info.glyph_ != nil) { Allocation& a = info.allocation_; if (p->damaged(info.extension_)) { info.glyph_->print(p, a); } } } } void Aggregate::pick(Canvas* c, const Allocation&, int depth, Hit& h) { Coord x = h.left(); Coord y = h.bottom(); GlyphIndex count = info_->count(); for (GlyphIndex index = 0; index < count; ++index) { AggregateInfo& info = info_->item_ref(index); if (info.glyph_ != nil) { Extension& b = info.extension_; Allocation& a = info.allocation_; if ( x >= b.left() && x < b.right() && y >= b.bottom() && y < b.top() ) { h.begin(depth, this, index); info.glyph_->pick(c, a, depth + 1, h); h.end(); } } } } neuron-7.6.3/src/lib/InterViews/align.cpp000077500000000000000000000073711340731477100203110ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Align - aligned layout */ #include #include Align::Align(DimensionName dimension) : Layout() { dimension_ = dimension; } Align::~Align() { } void Align::request( GlyphIndex count, const Requisition* request, Requisition& result ) { Coord natural_lead = 0; Coord min_lead = -fil; Coord max_lead = fil; Coord natural_trail = 0; Coord min_trail = -fil; Coord max_trail = fil; for (int index = 0; index < count; ++index) { const Requirement& r = request[index].requirement(dimension_); if (r.defined()) { Coord r_nat = r.natural(); Coord r_max = r_nat + r.stretch(); Coord r_min = r_nat - r.shrink(); Coord r_align = r.alignment(); Coord r_inv_align = 1.0 - r_align; natural_lead = Math::max(natural_lead, Coord(r_nat * r_align)); max_lead = Math::min(max_lead, Coord(r_max * r_align)); min_lead = Math::max(min_lead, Coord(r_min * r_align)); natural_trail = Math::max( natural_trail, Coord(r_nat * r_inv_align) ); max_trail = Math::min(max_trail, Coord(r_max * r_inv_align)); min_trail = Math::max(min_trail, Coord(r_min * r_inv_align)); } } Requirement r( natural_lead, max_lead, min_lead, natural_trail, max_trail, min_trail ); result.require(dimension_, r); } void Align::allocate( const Allocation& given, GlyphIndex count, const Requisition* request, Allocation* result ) { const Allotment& g = given.allotment(dimension_); for (int index = 0; index < count; ++index) { const Requirement& r = request[index].requirement(dimension_); if (r.defined()) { Coord span = g.span(); if (r.alignment() == 0) { span = Coord(float(span) * (1 - g.alignment())); } else if (r.alignment() == 1) { span = Coord(float(span) * g.alignment()); } else { span = Coord( float(span) * Math::min( g.alignment()/r.alignment(), (1 - g.alignment())/(1 - r.alignment()) ) ); } span = Math::min(span, r.natural() + r.stretch()); span = Math::max(span, r.natural() - r.shrink()); Allotment a(g.origin(), span, r.alignment()); result[index].allot(dimension_, a); } else { result[index].allot(dimension_, g); } } } neuron-7.6.3/src/lib/InterViews/alloctbl.cpp000066400000000000000000000146321340731477100210060ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * AllocationInfo - common information stored for allocations */ #include #include #include #include /* * An allocation table is represented by a list of pointers to * allocation information objects. The list is ordered by usage * from least recently used to most recently used. Whenever a lookup * is done on the table that finds the information for a * pair, the pointer to the information is removed from its current position * in the list and put at the end. In the common case where the list * has a single element, moving the found element is unnecessary. */ declarePtrList(AllocationInfoList,AllocationInfo) implementPtrList(AllocationInfoList,AllocationInfo) class AllocationTableImpl { private: friend class AllocationTable; AllocationTableImpl(GlyphIndex, long); static bool equal(const Allocation&, const Allocation&); static bool same_size(const Allotment&, const Allotment&); GlyphIndex count_; long maximum_allocations_; AllocationInfoList allocations_; static const float epsilon_; }; const float AllocationTableImpl::epsilon_ = 1e-4; AllocationTableImpl::AllocationTableImpl( GlyphIndex count, long maximum ) : count_(count), maximum_allocations_(maximum), allocations_(maximum) { } inline bool AllocationTableImpl::equal( const Allocation& a1, const Allocation& a2 ) { return a1.equals(a2, epsilon_); } inline bool AllocationTableImpl::same_size( const Allotment& a1, const Allotment& a2 ) { return ( Math::equal(a1.span(), a2.span(), epsilon_) && Math::equal(a1.alignment(), a2.alignment(), epsilon_) ); } AllocationTable::AllocationTable(GlyphIndex count, long maximum_allocations) { impl_ = new AllocationTableImpl(count, maximum_allocations); } AllocationTable::~AllocationTable() { flush(); delete impl_; } /* * Find an element on the list that matches the given canvas and allocation. */ AllocationInfo* AllocationTable::find(Canvas* c, const Allocation& a) const { AllocationInfoList& list = impl_->allocations_; for (ListUpdater(AllocationInfoList) i(list); i.more(); i.next()) { AllocationInfo* info = i.cur(); if (info->canvas_ == c && (c == nil || *info->transformer_ == c->transformer()) && AllocationTableImpl::equal(info->allocation_, a) ) { if (list.count() > 1) { i.remove_cur(); list.append(info); } return info; } } return nil; } /* * Find an element on the list with the same canvas and same size * allocation as given. If found, set the difference in the position * of the new allocation's origin to dx and dy. */ AllocationInfo* AllocationTable::find_same_size( Canvas* c, const Allocation& a, Coord& dx, Coord& dy ) const { const Allotment& x = a.x_allotment(); const Allotment& y = a.y_allotment(); AllocationInfoList& list = impl_->allocations_; for (ListUpdater(AllocationInfoList) i(list); i.more(); i.next()) { AllocationInfo* info = i.cur(); if (info->canvas_ == c && (c == nil || *info->transformer_ == c->transformer()) ) { Allotment& oldx = info->allocation_.x_allotment(); Allotment& oldy = info->allocation_.y_allotment(); if (AllocationTableImpl::same_size(x, oldx) && AllocationTableImpl::same_size(y, oldy) ) { dx = x.origin() - oldx.origin(); dy = y.origin() - oldy.origin(); oldx.origin(x.origin()); oldy.origin(y.origin()); if (list.count() > 1) { i.remove_cur(); list.append(info); } return info; } } } return nil; } /* * Allocate a new table entry for the given canvas and allocation. * If the table is full, then use the first (least recently used) entry. */ AllocationInfo* AllocationTable::allocate(Canvas* c, const Allocation& a) { AllocationInfo* info; AllocationInfoList& list = impl_->allocations_; if (list.count() < impl_->maximum_allocations_) { info = new AllocationInfo; info->transformer_ = new Transformer; if (impl_->count_ == 0) { info->component_allocation_ = nil; } else { info->component_allocation_ = new Allocation[impl_->count_]; } } else { info = list.item(0); list.remove(0); } info->canvas_ = c; if (c == nil) { /* * This case shouldn't happen, but some old code (doc) * occasionally passes nil for the canvas during allocation. */ Transformer t; *info->transformer_ = t; } else { *info->transformer_ = c->transformer(); } info->allocation_ = a; list.append(info); return info; } /* * Return the most recently used allocation information, if any. */ AllocationInfo* AllocationTable::most_recent() const { AllocationInfo* info = nil; AllocationInfoList& list = impl_->allocations_; long n = list.count(); if (n != 0) { info = list.item(n - 1); } return info; } /* * Flush all the entries from the table. */ void AllocationTable::flush() { AllocationInfoList& list = impl_->allocations_; for (ListItr(AllocationInfoList) i(list); i.more(); i.next()) { AllocationInfo* info = i.cur(); if (info->component_allocation_ != nil) { delete [] info->component_allocation_; } delete info->transformer_; delete info; } list.remove_all(); } neuron-7.6.3/src/lib/InterViews/arrcomp.cpp000077500000000000000000000036051340731477100206560ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include ArrayCompositor::ArrayCompositor(CompositorIndex count) : Compositor() { count_ = count; } ArrayCompositor::~ArrayCompositor() { } CompositorIndex ArrayCompositor::compose( Coord*, Coord*, Coord*, int*, CompositorIndex component_count, Coord*, CompositorIndex, CompositorIndex* breaks, CompositorIndex break_count ) { CompositorIndex count = Math::min( long((component_count - 1) / count_ + 1), break_count ); for (CompositorIndex i = 0; i < count; ++i) { breaks[i] = Math::min((i+1) * count_ - 1, component_count-1); } return count; } neuron-7.6.3/src/lib/InterViews/background.cpp000077500000000000000000000041501340731477100213260ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Background - opaque glyph */ #include #include #include #include Background::Background(Glyph* body, const Color* c) : MonoGlyph(body) { color_ = c; Resource::ref(color_); } Background::~Background() { Resource::unref(color_); } void Background::allocate(Canvas* c, const Allocation& a, Extension& ext) { MonoGlyph::allocate(c, a, ext); ext.merge(c, a); } void Background::draw(Canvas* c, const Allocation& a) const { Extension ext; ext.set(c, a); if (c->damaged(ext)) { c->fill_rect(a.left(), a.bottom(), a.right(), a.top(), color_); } MonoGlyph::draw(c, a); } void Background::print(Printer* p, const Allocation& a) const { p->fill_rect(a.left(), a.bottom(), a.right(), a.top(), color_); MonoGlyph::print(p, a); } neuron-7.6.3/src/lib/InterViews/bevel.cpp000066400000000000000000000310231340731477100203000ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Bevel - 3D framing of a glyph */ #include #include #include #include #include #include BevelFrame::BevelFrame( Glyph* g, Coord t, float x, float y, bool hmargin, bool vmargin ) : MonoGlyph(g) { thickness_ = t; xalign_ = x; yalign_ = y; hmargin_ = hmargin; vmargin_ = vmargin; } BevelFrame::~BevelFrame() { } void BevelFrame::request(Requisition& req) const { Glyph* g = body(); if (g != nil) { g->request(req); if (hmargin_ || vmargin_) { Coord t = thickness_ + thickness_; Requirement& rx = req.x_requirement(); if (hmargin_ && rx.defined()) { rx.natural(rx.natural() + t); } Requirement& ry = req.y_requirement(); if (vmargin_ && ry.defined()) { ry.natural(ry.natural() + t); } } } } void BevelFrame::allocate(Canvas* c, const Allocation& a, Extension& ext) { Glyph* g = body(); if (g != nil) { if (hmargin_ || vmargin_) { Allocation interior(a); allocate_body(g, thickness(c), interior); g->allocate(c, interior, ext); } else { g->allocate(c, a, ext); } } ext.merge(c, a); } void BevelFrame::draw(Canvas* c, const Allocation& a) const { Coord t = thickness(c); draw_frame(c, a, t); Glyph* g = body(); if (g != nil) { if (hmargin_ || vmargin_) { Allocation interior(a); allocate_body(g, t, interior); g->draw(c, interior); } else { g->draw(c, a); } } } void BevelFrame::print(Printer* p, const Allocation& a) const { Coord t = thickness(p); draw_frame(p, a, t); Glyph* g = body(); if (g != nil) { if (hmargin_ || vmargin_) { Allocation interior(a); allocate_body(g, t, interior); g->print(p, interior); } else { g->print(p, a); } } } void BevelFrame::pick(Canvas* c, const Allocation& a, int depth, Hit& h) { Glyph* g = body(); if (g != nil) { if (hmargin_ || vmargin_) { Allocation interior(a); allocate_body(g, thickness(c), interior); g->pick(c, interior, depth, h); } else { g->pick(c, a, depth, h); } } } void BevelFrame::draw_frame(Canvas*, const Allocation&, Coord) const { } Coord BevelFrame::thickness(Canvas* c) const { return (c == nil) ? thickness_ : c->to_pixels_coord(thickness_); } void BevelFrame::allocate_body(Glyph* g, Coord t, Allocation& a) const { Requisition req; g->request(req); Coord h = hmargin_ ? t : 0, v = vmargin_ ? t : 0; Allotment& ax = a.x_allotment(); Coord x_span = ax.span() - h - h; Coord x_offset = h; Coord x_align = ax.alignment(); const Requirement& rx = req.x_requirement(); if (rx.defined()) { Coord x_usable = rx.natural() + rx.stretch(); if (x_span > x_usable) { x_offset += xalign_ * (x_span - x_usable); x_span = x_usable; } } ax.span(x_span); ax.offset(x_offset * (1 - x_align - x_align)); Allotment& ay = a.y_allotment(); Coord y_span = ay.span() - v - v; Coord y_offset = v; Coord y_align = ay.alignment(); const Requirement& ry = req.y_requirement(); if (ry.defined()) { Coord y_usable = ry.natural() + ry.stretch(); if (y_span > y_usable) { y_offset += yalign_ * (y_span - y_usable); y_span = y_usable; } } ay.span(y_span); ay.offset(y_offset * (1 - y_align - y_align)); } Bevel::Bevel( Glyph* g, Beveler b, const Color* light, const Color* medium, const Color* dark, Coord thickness, float x, float y, bool hmargin, bool vmargin ) : BevelFrame(g, thickness, x, y, hmargin, vmargin) { beveler_ = b; light_ = light; medium_ = medium; dark_ = dark; Resource::ref(light_); Resource::ref(medium_); Resource::ref(dark_); } Bevel::~Bevel() { Resource::unref(light_); Resource::unref(medium_); Resource::unref(dark_); } void Bevel::draw_frame(Canvas* c, const Allocation& a, Coord t) const { (*beveler_)( c, light_, medium_, dark_, t, a.left(), a.bottom(), a.right(), a.top() ); } void Bevel::rect( Canvas* c, const Color* light, const Color* medium, const Color* dark, Coord thickness, Coord left, Coord bottom, Coord right, Coord top ) { if (medium != nil) { /* background */ c->fill_rect(left, bottom, right, top, medium); } Coord left_inside = left + thickness; Coord bottom_inside = bottom + thickness; Coord right_inside = right - thickness; Coord top_inside = top - thickness; /* left edge */ c->new_path(); c->move_to(left, bottom); c->line_to(left, top); c->line_to(left_inside, top); c->line_to(left_inside, bottom); c->close_path(); c->fill(light); /* top edge */ c->new_path(); c->move_to(left_inside, top_inside); c->line_to(left_inside, top); c->line_to(right, top); c->line_to(right, top_inside); c->close_path(); c->fill(light); /* right edge */ c->new_path(); c->move_to(right_inside, bottom_inside); c->line_to(right_inside, top_inside); c->line_to(right, top); c->line_to(right, bottom); /* bottom edge (as part of same path) */ c->line_to(left, bottom); c->line_to(left_inside, bottom_inside); c->line_to(right_inside, bottom_inside); c->close_path(); c->fill(dark); } /* * A bit of a misnomer to call these arrows; they are really beveled * triangles. The only tricky part is dropping the bevel down and to the * right of the original triangle, which requires finding delta x,y for * a given thickness and matching the slope of the triangle. */ void Bevel::left_arrow( Canvas* c, const Color* light, const Color* medium, const Color* dark, Coord thickness, Coord left, Coord bottom, Coord right, Coord top ) { Coord center_y = (bottom + top) * 0.5; float slope = ((top - bottom) / (right - left)) * 0.5; float delta_x = thickness / sqrt(slope * slope + 1); float delta_y = slope * delta_x; c->new_path(); c->move_to(left, center_y); c->line_to(right, top); c->line_to(right, bottom); c->close_path(); c->fill(medium); c->new_path(); c->move_to(right - thickness, bottom + thickness); c->line_to(right - thickness, top - thickness); c->line_to(right, top); c->line_to(right, bottom); c->close_path(); c->fill(dark); c->new_path(); c->move_to(left, center_y); c->line_to(left + thickness, center_y); c->line_to(right - thickness, bottom + thickness); c->line_to(right, bottom); c->close_path(); c->fill(dark); c->new_path(); c->move_to(left + delta_x, center_y - delta_y); c->line_to(left, center_y); c->line_to(right, top); c->line_to(right, top - thickness); c->close_path(); c->fill(light); } void Bevel::right_arrow( Canvas* c, const Color* light, const Color* medium, const Color* dark, Coord thickness, Coord left, Coord bottom, Coord right, Coord top ) { Coord center_y = (bottom + top) * 0.5; float slope = ((top - bottom) / (right - left)) * 0.5; float delta_x = thickness / sqrt(slope * slope + 1); float delta_y = slope * delta_x; c->new_path(); c->move_to(left, bottom); c->line_to(left, top); c->line_to(right, center_y); c->close_path(); c->fill(medium); c->new_path(); c->move_to(left, bottom); c->line_to(left + thickness, bottom + thickness); c->line_to(right - thickness, center_y); c->line_to(right, center_y); c->close_path(); c->fill(dark); c->new_path(); c->move_to(left, bottom); c->line_to(left, top); c->line_to(left + thickness, top - thickness); c->line_to(left + delta_x, bottom + delta_y); c->close_path(); c->fill(light); c->new_path(); c->move_to(left + thickness, top - thickness); c->line_to(left, top); c->line_to(right, center_y); c->line_to(right - delta_x, center_y - delta_y); c->close_path(); c->fill(light); } void Bevel::up_arrow( Canvas* c, const Color* light, const Color* medium, const Color* dark, Coord thickness, Coord left, Coord bottom, Coord right, Coord top ) { Coord center_x = (left + right) * 0.5; float slope = 2 * ((top - bottom) / (right - left)); float delta_x = thickness / sqrt(slope * slope + 1); float delta_y = slope * delta_x; c->new_path(); c->move_to(left, bottom); c->line_to(center_x, top); c->line_to(right, bottom); c->close_path(); c->fill(medium); c->new_path(); c->move_to(left, bottom); c->line_to(right, bottom); c->line_to(right - thickness, bottom + thickness); c->line_to(left + thickness, bottom + thickness); c->close_path(); c->fill(dark); c->new_path(); c->move_to(center_x, top - thickness); c->line_to(center_x, top); c->line_to(right, bottom); c->line_to(right - thickness, bottom + thickness); c->close_path(); c->fill(dark); c->new_path(); c->move_to(left, bottom); c->line_to(left + delta_x, bottom); c->line_to(center_x + delta_x, top - delta_y); c->line_to(center_x, top); c->close_path(); c->fill(light); } void Bevel::down_arrow( Canvas* c, const Color* light, const Color* medium, const Color* dark, Coord thickness, Coord left, Coord bottom, Coord right, Coord top ) { Coord center_x = (left + right) * 0.5; float slope = 2* ((top - bottom) / (right - left)); float delta_x = thickness / sqrt(slope * slope + 1); float delta_y = slope * delta_x; c->new_path(); c->move_to(left, top); c->line_to(right, top); c->line_to(center_x, bottom); c->close_path(); c->fill(medium); c->new_path(); c->move_to(center_x, bottom); c->line_to(center_x, bottom + thickness); c->line_to(right - thickness, top - thickness); c->line_to(right, top); c->close_path(); c->fill(dark); c->new_path(); c->move_to(left, top); c->line_to(center_x, bottom); c->line_to(center_x + delta_x, bottom + delta_y); c->line_to(left + thickness, top - thickness); c->close_path(); c->fill(light); c->new_path(); c->move_to(left, top); c->line_to(right, top); c->line_to(right - delta_x, top - delta_y); c->line_to(left + thickness, top - thickness); c->close_path(); c->fill(light); } void Bevel::diamond( Canvas* c, const Color* light, const Color* medium, const Color* dark, Coord thickness, Coord left, Coord bottom, Coord right, Coord top ) { Coord x_mid = (left + right) * 0.5; Coord y_mid = (bottom + top) * 0.5; Coord left_inside = left + thickness; Coord top_inside = top - thickness; Coord right_inside = right - thickness; Coord bottom_inside = bottom + thickness; /* interior of diamond */ c->new_path(); c->move_to(left, y_mid); c->line_to(x_mid, top); c->line_to(right, y_mid); c->line_to(x_mid, bottom); c->close_path(); c->fill(medium); /* lower half */ c->new_path(); c->move_to(left, y_mid); c->line_to(x_mid, bottom); c->line_to(right, y_mid); c->line_to(right_inside, y_mid); c->line_to(x_mid, bottom_inside); c->line_to(left_inside, y_mid); c->close_path(); c->fill(dark); /* upper half */ c->new_path(); c->move_to(left, y_mid); c->line_to(x_mid, top); c->line_to(right, y_mid); c->line_to(right_inside, y_mid); c->line_to(x_mid, top_inside); c->line_to(left_inside, y_mid); c->close_path(); c->fill(light); } neuron-7.6.3/src/lib/InterViews/border.cpp000077500000000000000000000054221340731477100204670ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Border - a glyph for framing */ #include #include #include #include Border::Border(Glyph* body, const Color* c) : MonoGlyph(body) { color_ = c; Resource::ref(color_); thickness_ = 1; } Border::Border(Glyph* body, const Color* c, Coord t) : MonoGlyph(body) { color_ = c; Resource::ref(color_); thickness_ = t; } Border::~Border() { Resource::unref(color_); } void Border::allocate(Canvas* c, const Allocation& a, Extension& ext) { MonoGlyph::allocate(c, a, ext); ext.merge(c, a); } void Border::draw(Canvas* c, const Allocation& a) const { Coord left = a.left(); Coord bottom = a.bottom(); Coord right = a.right(); Coord top = a.top(); Coord t = thickness_; c->fill_rect(left, bottom + t, left + t, top, color_); c->fill_rect(left + t, top - t, right, top, color_); c->fill_rect(right - t, top - t, right, bottom, color_); c->fill_rect(right - t, bottom + t, left, bottom, color_); MonoGlyph::draw(c, a); } void Border::print(Printer* p, const Allocation& a) const { Coord left = a.left(); Coord bottom = a.bottom(); Coord right = a.right(); Coord top = a.top(); Coord t = thickness_; p->fill_rect(left, bottom + t, left + t, top, color_); p->fill_rect(left + t, top - t, right, top, color_); p->fill_rect(right - t, top - t, right, bottom, color_); p->fill_rect(right - t, bottom + t, left, bottom, color_); MonoGlyph::print(p, a); } neuron-7.6.3/src/lib/InterViews/box.cpp000066400000000000000000000172131340731477100200000ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Box - tiling glyph */ #include #include #include #include #include #include #include #include #include #include class BoxImpl { private: friend class Box; Box* box_; Layout* layout_; bool requested_; Requisition requisition_; AllocationTable* allocations_; static Extension* empty_ext_; void request(); AllocationInfo& info(Canvas*, const Allocation&, Extension&); void offset_allocate(AllocationInfo&, Coord dx, Coord dy); void full_allocate(AllocationInfo&); void invalidate(); }; bool Box::full_request_ = false; void Box::full_request(bool b) { full_request_ = b; } Extension* BoxImpl::empty_ext_; Box::Box(Layout* layout, GlyphIndex size) : PolyGlyph(size) { BoxImpl* b = new BoxImpl; impl_ = b; b->box_ = this; b->layout_ = layout; b->requested_ = false; b->allocations_ = nil; } Box::Box( Layout* layout, Glyph* g1, Glyph* g2, Glyph* g3, Glyph* g4, Glyph* g5, Glyph* g6, Glyph* g7, Glyph* g8, Glyph* g9, Glyph* g10 ) : PolyGlyph(4) { BoxImpl* b = new BoxImpl; impl_ = b; b->box_ = this; b->layout_ = layout; b->requested_ = false; b->allocations_ = nil; if (g1 != nil) { append(g1); } if (g2 != nil) { append(g2); } if (g3 != nil) { append(g3); } if (g4 != nil) { append(g4); } if (g5 != nil) { append(g5); } if (g6 != nil) { append(g6); } if (g7 != nil) { append(g7); } if (g8 != nil) { append(g8); } if (g9 != nil) { append(g9); } if (g10 != nil) { append(g10); } } Box::~Box() { BoxImpl* b = impl_; delete b->layout_; delete b->allocations_; delete b; } void Box::request(Requisition& requisition) const { BoxImpl* b = impl_; if (full_request_) { b->invalidate(); } if (!b->requested_) { b->request(); } requisition = b->requisition_; } void Box::allocate(Canvas* c, const Allocation& allocation, Extension& ext) { impl_->info(c, allocation, ext); } void Box::draw(Canvas* c, const Allocation& allocation) const { BoxImpl* b = impl_; Extension ext; ext.clear(); AllocationInfo& info = b->info(c, allocation, ext); if (c->damaged(ext)) { Allocation* a = info.component_allocations(); GlyphIndex n = count(); for (GlyphIndex i = 0; i < n; i++) { Glyph* g = component(i); if (g != nil) { g->draw(c, a[i]); } } } } void Box::print(Printer* p, const Allocation& allocation) const { BoxImpl* b = impl_; Extension ext; ext.clear(); AllocationInfo& info = b->info(p, allocation, ext); if (p->damaged(ext)) { Allocation* a = info.component_allocations(); GlyphIndex n = count(); for (GlyphIndex i = 0; i < n; i++) { Glyph* g = component(i); if (g != nil) { g->print(p, a[i]); } } } } void Box::pick(Canvas* c, const Allocation& a, int depth, Hit& h) { if (h.right() >= a.left() && h.left() < a.right() && h.top() >= a.bottom() && h.bottom() < a.top() ) { BoxImpl* b = impl_; Extension ext; ext.clear(); AllocationInfo& info = b->info(c, a, ext); Allocation* aa = info.component_allocations(); GlyphIndex n = count(); for (GlyphIndex i = 0; i < n; i++) { Glyph* g = component(i); if (g != nil) { h.begin(depth, this, i); g->pick(c, aa[i], depth + 1, h); h.end(); } } } } void Box::undraw() { AllocationTable* table = impl_->allocations_; if (table != nil) { table->flush(); } PolyGlyph::undraw(); } void Box::modified(GlyphIndex) { impl_->invalidate(); } void Box::allotment(GlyphIndex index, DimensionName d, Allotment& a) const { AllocationTable* table = impl_->allocations_; if (table != nil) { AllocationInfo* info = table->most_recent(); if (info != nil) { Allocation* allocations = info->component_allocations(); a = allocations[index].allotment(d); } } } /* class BoxImpl */ void BoxImpl::request() { GlyphIndex count = box_->count(); Requisition* r = new Requisition[count]; for (GlyphIndex i = 0; i < count; i++) { Glyph* g = box_->component(i); if (g != nil) { g->request(r[i]); } } layout_->request(count, r, requisition_); requested_ = true; delete [] r; } AllocationInfo& BoxImpl::info(Canvas* c, const Allocation& a, Extension& ext) { if (allocations_ == nil) { allocations_ = new AllocationTable(box_->count()); } AllocationInfo* info = allocations_->find(c, a); if (info == nil) { Coord dx, dy; info = allocations_->find_same_size(c, a, dx, dy); if (info != nil) { info->extension(ext); offset_allocate(*info, dx, dy); } else { info = allocations_->allocate(c, a); info->extension(ext); full_allocate(*info); } } ext = info->extension(); return *info; } void BoxImpl::offset_allocate(AllocationInfo& info, Coord dx, Coord dy) { Canvas* c = info.canvas(); Allocation* a = info.component_allocations(); Extension& box = info.extension(); Extension child; GlyphIndex n = box_->count(); for (GlyphIndex i = 0; i < n; i++) { Glyph* g = box_->component(i); if (g != nil) { Allocation& a_i = a[i]; Allotment& ax = a_i.x_allotment(); Allotment& ay = a_i.y_allotment(); ax.offset(dx); ay.offset(dy); child.clear(); g->allocate(c, a_i, child); box.merge(child); } } } void BoxImpl::full_allocate(AllocationInfo& info) { Canvas* c = info.canvas(); GlyphIndex n = box_->count(); Allocation* a = info.component_allocations(); Requisition* r = new Requisition[n]; GlyphIndex i; for (i = 0; i < n; i++) { Glyph* g = box_->component(i); if (g != nil) { g->request(r[i]); } } layout_->allocate(info.allocation(), n, r, a); delete [] r; Extension& box = info.extension(); Extension child; for (i = 0; i < n; i++) { Glyph* g = box_->component(i); if (g != nil) { child.clear(); g->allocate(c, a[i], child); box.merge(child); } } } void BoxImpl::invalidate() { requested_ = false; delete allocations_; allocations_ = nil; } neuron-7.6.3/src/lib/InterViews/browser.cpp000066400000000000000000000065661340731477100207040ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Browser -- select an item */ #include #include #include #include #include #include #include declarePtrList(BrowserList,TelltaleState) implementPtrList(BrowserList,TelltaleState) Browser::Browser( Glyph* g, Style* s, Action* accept, Action* cancel ) : InputHandler(g, s) { Resource::ref(accept); accept_ = accept; Resource::ref(cancel); cancel_ = cancel; items_ = new BrowserList; item_ = -1; } Browser::~Browser() { Resource::unref(accept_); Resource::unref(cancel_); delete items_; } void Browser::append_selectable(TelltaleState* t) { items_->append(t); } void Browser::replace_selectable(GlyphIndex i, TelltaleState* t) { items_->remove(i); items_->insert(i, t); } void Browser::remove_selectable(GlyphIndex i) { items_->remove(i); } TelltaleState* Browser::state(GlyphIndex i) const { return items_->item(i); } void Browser::select(GlyphIndex i) { if (item_ != i) { if (item_ != -1) { active(item_, false); } if (i >= -1 && i < items_->count()) { item_ = i; if (i >= 0) { active(item_, true); } } } } void Browser::active(GlyphIndex i, bool b) { TelltaleState* t = items_->item(i); t->attach(this); t->set(TelltaleState::is_active, b); t->detach(this); } GlyphIndex Browser::selected() const { return item_; } void Browser::choose(GlyphIndex i) const { if (i != -1 && accept_ != nil) { accept_->execute(); } } void Browser::cancel() { if (cancel_ != nil) { cancel_->execute(); } } void Browser::press(const Event& e) { Hit h(&e); repick(0, h); if (h.any()) { select(h.index(0)); } } void Browser::drag(const Event& e) { if (inside(e)) { Hit h(&e); repick(0, h); if (h.any()) { select(h.index(0)); return; } } select(-1); } void Browser::release(const Event&) { if (style()->value_is_on("singleClick")) { choose(item_); } } void Browser::double_click(const Event&) { choose(item_); } void Browser::update(Observable*) { redraw(); } neuron-7.6.3/src/lib/InterViews/button.cpp000066400000000000000000000067441340731477100205320ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Button - clickable Action */ #include #include #include #include Button::Button( Glyph* g, Style* s, TelltaleState* state, Action* a ) : ActiveHandler(g, s) { state_ = state; Resource::ref(state_); state_->attach(this); action_ = a; Resource::ref(action_); } Button::~Button() { state_->detach(this); Resource::unref(state_); Resource::unref(action_); } void Button::state(TelltaleState* s) { if (s != state_) { Resource::ref(s); s->attach(this); state_->detach(this); Resource::unref(state_); state_ = s; } } TelltaleState* Button::state() const { return state_; } void Button::action(Action* a) { if (a != action_) { Resource::ref(a); Resource::unref(action_); action_ = a; } } Action* Button::action() const { return action_; } #if carbon extern bool need_motion_on_deactivate_; #define NEEDMOTION(arg) need_motion_on_deactivate_ = arg; #else #define NEEDMOTION(arg) /**/ #endif void Button::enter() { TelltaleState* s = state(); if (s->test(TelltaleState::is_enabled)) { s->set(TelltaleState::is_visible, true); NEEDMOTION(true) } } void Button::leave() { TelltaleState* s = state(); if (s->test(TelltaleState::is_enabled)) { s->set(TelltaleState::is_visible, false); NEEDMOTION(false) } } void Button::press(const Event&) { TelltaleState* s = state(); if (s->test(TelltaleState::is_enabled)) { s->set(TelltaleState::is_active, true); } } void Button::release(const Event& e) { TelltaleState* s = state(); if (s->test(TelltaleState::is_enabled)) { NEEDMOTION(false) s->set(TelltaleState::is_active, false); if (inside(e)) { bool chosen = s->test(TelltaleState::is_chosen); bool act = !chosen; if (s->test(TelltaleState::is_toggle)) { s->set(TelltaleState::is_chosen, act); act = true; } else if (s->test(TelltaleState::is_choosable)) { s->set(TelltaleState::is_chosen, true); } if (act) { Action* a = action(); if (a != nil) { s->set(TelltaleState::is_running, true); a->execute(); s->set(TelltaleState::is_running, false); } } } } } void Button::update(Observable*) { redraw(); } neuron-7.6.3/src/lib/InterViews/character.cpp000077500000000000000000000060171340731477100211470ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Character - character glyph with font */ #include #include #include #include #include Character::Character(long ch, const Font* f, const Color* c) : Glyph() { c_ = ch; font_ = f; Resource::ref(font_); color_ = c; Resource::ref(color_); if (font_ != nil) { FontBoundingBox b; font_->char_bbox(c_, b); left_bearing_ = b.left_bearing(); right_bearing_ = b.right_bearing(); width_ = b.width(); ascent_ = b.font_ascent(); descent_ = b.font_descent(); height_ = ascent_ + descent_; alignment_ = (height_ == 0) ? 0 : descent_ / height_; } else { left_bearing_ = 0; right_bearing_ = 0; ascent_ = 0; descent_ = 0; width_ = 0; height_ = 0; alignment_ = 0; } } Character::~Character() { Resource::unref(font_); Resource::unref(color_); } long Character::code() const { return c_; } void Character::request(Requisition& requisition) const { Requirement rx(width_, 0, 0, 0); Requirement ry(height_, 0, 0, alignment_); requisition.require(Dimension_X, rx); requisition.require(Dimension_Y, ry); } void Character::allocate(Canvas* c, const Allocation& a, Extension& ext) { Coord x = a.x(); Coord y = a.y(); ext.set_xy( c, x - left_bearing_, y - descent_, x + right_bearing_, y + ascent_ ); } void Character::pick(Canvas*, const Allocation& a, int depth, Hit& h) { Coord x = h.left(); Coord y = h.bottom(); Coord left = a.left(); Coord right = a.right(); if (x >= left && x < right) { h.target(depth, this, (x > (left+right)/2) ? 1 : 0); } } void Character::draw(Canvas* c, const Allocation& a) const { c->character(font_, c_, a.right() - a.left(), color_, a.x(), a.y()); } neuron-7.6.3/src/lib/InterViews/compositor.cpp000077500000000000000000000030721340731477100214070ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Compositor - find breaks */ #include Compositor::Compositor() { } Compositor::~Compositor() { } CompositorIndex Compositor::compose( Coord*, Coord*, Coord*, int*, CompositorIndex, Coord*, CompositorIndex, CompositorIndex*, CompositorIndex ) { return 0; } neuron-7.6.3/src/lib/InterViews/comption.cpp000066400000000000000000000605771340731477100210530ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include class CompositionComponent { public: Glyph* glyph_; }; declareList(CompositionComponent_List,CompositionComponent) implementList(CompositionComponent_List,CompositionComponent) static const int BreakViewed = 0x01; static const int BreakValid = 0x02; class Break { public: Break(); bool viewed() const; void viewed(bool); bool valid() const; void valid(bool); Patch* patch_; int status_; Coord begin_; Coord end_; GlyphIndex first_; GlyphIndex last_; }; Break::Break() { status_ = 0; } inline bool Break::viewed() const { return (status_ & BreakViewed) != 0; } inline void Break::viewed(bool v) { if (v) { status_ |= BreakViewed; } else { status_ &= ~BreakViewed; } } inline bool Break::valid() const { return (status_ & BreakValid) != 0; } inline void Break::valid(bool v) { if (v) { status_ |= BreakValid; } else { status_ &= ~BreakValid; } } declareList(Break_List,Break) implementList(Break_List,Break) const float epsilon = 0.1; static CompositorIndex __length; static Coord* __natural; static Coord* __stretch; static Coord* __shrink; static int* __penalties; static Coord* __spans; static CompositorIndex* __breaks; static void grow_arrays (CompositorIndex length) { Coord* natural = new Coord[length]; Coord* stretch = new Coord[length]; Coord* shrink = new Coord[length]; int* penalties = new int[length]; Coord* spans = new Coord[length]; CompositorIndex* breaks = new CompositorIndex[length]; for (CompositorIndex i = 0; i < __length; ++i) { natural[i] = __natural[i]; stretch[i] = __stretch[i]; shrink[i] = __shrink[i]; penalties[i] = __penalties[i]; spans[i] = __spans[i]; breaks[i] = __breaks[i]; } delete [] __natural; __natural = natural; delete [] __stretch; __stretch = stretch; delete [] __shrink; __shrink = shrink; delete [] __penalties; __penalties = penalties; delete [] __spans; __spans = spans; delete [] __breaks; __breaks = breaks; __length = length; } static GlyphIndex prev_forced_break( GlyphIndex i, CompositionComponent_List* component ) { GlyphIndex count = component->count(); while ((i >= 0) && (i < count)) { const CompositionComponent& comp = component->item_ref(i); Glyph* g = comp.glyph_; if (g != nil) { Requisition r; g->request(r); if (r.penalty() == PenaltyGood) { break; } } --i; } return i; } static GlyphIndex next_forced_break( GlyphIndex i, CompositionComponent_List* component ) { GlyphIndex count = component->count(); while (i < count) { const CompositionComponent& comp = component->item_ref(i); Glyph* g = comp.glyph_; if (g != nil) { Requisition r; g->request(r); if (r.penalty() == PenaltyGood) { break; } } ++i; } return Math::min((long)i, long(count - 1)); } static GlyphIndex fill_arrays ( GlyphIndex first, DimensionName dimension, CompositionComponent_List* component ) { GlyphIndex count = component->count(); GlyphIndex last = first; while (last < count) { GlyphIndex index = last - first; if (index >= __length) { grow_arrays(next_forced_break(last, component) - first + 1); } __natural[index] = 0; __stretch[index] = 0; __shrink[index] = 0; __penalties[index] = PenaltyBad; const CompositionComponent& comp = component->item_ref(last); Glyph* g = comp.glyph_; if (g != nil) { Requisition r; g->request(r); Requirement& req = r.requirement(dimension); if (req.defined()) { __natural[index] = req.natural(); __stretch[index] = req.stretch(); __shrink[index] = req.shrink(); } __penalties[index] = r.penalty(); } if (__penalties[index] == PenaltyGood) { break; } else { ++last; } } return Math::min((long)last, long(count - 1)); } Composition::Composition( Glyph* context, Compositor* compositor, Glyph* separator, DimensionName dimension, Coord span, Coord stretch, Coord shrink, GlyphIndex size ) : MonoGlyph( LayoutKit::instance()->variable_span(context, stretch, shrink) ) { compositor_ = compositor; component_ = new CompositionComponent_List(size); breaks_ = new Break_List(size/50); separator_ = separator; if (separator_ != nil) { separator_->ref(); } view_all_ = true; damaged_ = true; first_damage_ = -1; last_damage_ = -1; item_ = 0; dimension_ = dimension; span_ = span; resizable_ = ( !Math::equal(stretch, Coord(0), float(1e-4)) || !Math::equal(shrink, Coord(0), float(1e-4)) ); } Composition::~Composition() { Resource::unref(separator_); compositor_ = nil; GlyphIndex count = component_->count(); for (GlyphIndex i = 0; i < count; ++i) { CompositionComponent& component = component_->item_ref(i); Resource::unref(component.glyph_); } delete component_; delete breaks_; } void Composition::allocate(Canvas* c, const Allocation& a, Extension& ext) { if (resizable_) { Coord size = a.allotment(dimension_).span(); if (!Math::equal(size, span_, float(1e-4))) { span_ = size; GlyphIndex break_count = breaks_->count(); for (GlyphIndex b = 0; b < break_count; b++) { breaks_->item_ref(b).valid(false); } damage(0, component_->count() - 1); repair(); } } MonoGlyph::allocate(c, a, ext); } void Composition::damage(GlyphIndex first, GlyphIndex last) { if (damaged_) { first_damage_ = Math::min(first_damage_, first); last_damage_ = Math::max(last_damage_, last); } else { first_damage_ = first; last_damage_ = last; damaged_ = true; } } bool Composition::repair() { if (damaged_) { GlyphIndex component_count = component_->count(); CompositorIndex break_count = breaks_->count(); CompositorIndex forced = prev_forced_break(first_damage_, component_); GlyphIndex break_index = 0; for (;;) { if (break_index < break_count) { const Break& br = breaks_->item_ref(break_index); if (br.first_ <= forced && br.last_ < forced) { ++break_index; } else { break; } } else { break; } } while ((forced < (component_count - 1)) && (forced < last_damage_)) { GlyphIndex next = fill_arrays(forced + 1, dimension_, component_); GlyphIndex count = next - forced; GlyphIndex b; for (b = 0; b < count && (b+break_index) < break_count; ++b) { const Break& br = breaks_->item_ref(b + break_index); __spans[b] = span_ - br.begin_ - br.end_; } if (b < count) { __spans[b] = span_; } CompositorIndex compose_count = compositor_->compose( __natural, __stretch, __shrink, __penalties, count, __spans, break_count - break_index + 1, __breaks, count ); do_repair(forced + 1, break_index, __breaks, compose_count); forced = next; break_index += compose_count; break_count = breaks_->count(); } damaged_ = false; return false; } else { return true; } } void Composition::do_repair( GlyphIndex first_component, GlyphIndex first_break, CompositorIndex* breaks, CompositorIndex count ) { GlyphIndex break_index = first_break; Glyph* contents = body(); for (GlyphIndex i = 0; i < count; ++i) { Break b; if (break_index < breaks_->count()) { const Break& br = breaks_->item_ref(break_index); b.begin_ = br.begin_; b.end_ = br.end_; } else { b.begin_ = 0; b.end_ = 0; } b.first_ = first_component + ((i == 0) ? 0 : breaks[i-1] + 1); b.last_ = first_component + (breaks[i] - 1); bool re_break = (break_index == breaks_->count()); if (!re_break) { const Break& br = breaks_->item_ref(break_index); re_break = ( !br.valid() || br.first_ != b.first_ || br.last_ != b.last_ ); } if (re_break) { while ( break_index < breaks_->count() - 1 && breaks_->item_ref(break_index + 1).last_ <= b.last_ ) { contents->remove(break_index * 2 + 1); contents->remove(break_index * 2); breaks_->remove(break_index); } re_break = (break_index == breaks_->count()); if (!re_break) { const Break& br = breaks_->item_ref(break_index); re_break = ( (i < count-1 && br.last_ >= first_component + breaks[i+1] - 1) || (i == count-1 && br.first_ > b.last_ + 1) ); } if (re_break) { contents->insert(break_index * 2, make_item(b, view_all_)); contents->insert(break_index * 2 + 1, separator(b)); breaks_->insert(break_index, b); } else { Break& br = breaks_->item_ref(break_index); if (br.patch_ != nil) { br.patch_->redraw(); } contents->replace(break_index * 2, make_item(b, view_all_)); contents->replace(break_index * 2 + 1, separator(b)); br = b; } } ++break_index; } } void Composition::view(GlyphIndex first, GlyphIndex last) { GlyphIndex bc = breaks_->count(); Glyph* contents = body(); for (GlyphIndex b = 0; b < bc; ++b) { Break& br = breaks_->item_ref(b); if (br.last_ >= first && br.first_ <= last) { if (!br.viewed()) { contents->replace(b * 2, make_item(br, true)); } } else { if (br.viewed()) { contents->replace(b * 2, make_item(br, false)); } } } view_all_ = false; } Glyph* Composition::separator(Break& b) { if (b.last_ >= component_->count()-1) { return separator_; } else { Glyph* inbreak = component_->item_ref(b.last_ + 1).glyph_; if (inbreak != nil) { Glyph* g = inbreak->compose(in_break); if (g != nil) { return g; } else { return separator_; } } else { return separator_; } } } void Composition::margin(CompositorIndex item, Coord begin, Coord end) { CompositorIndex b = item/2; if (b < breaks_->count() && item%2 == 0) { Break& br = breaks_->item_ref(b); if (br.begin_ != begin || br.end_ != end) { br.begin_ = begin; br.end_ = end; br.valid(false); damage(br.first_ - 1, br.last_ + 1); } } } GlyphIndex Composition::beginning_of(CompositorIndex item) const { CompositorIndex i = Math::max(0L, Math::min(long(item/2), long(breaks_->count()-1))); return breaks_->item_ref(i).first_; } GlyphIndex Composition::end_of(CompositorIndex item) const { CompositorIndex i = Math::max(0L, Math::min(long(item/2), long(breaks_->count()-1))); return breaks_->item_ref(i).last_; } GlyphIndex Composition::count() const { return component_->count(); } Glyph* Composition::component(GlyphIndex index) const { return component_->item_ref(index).glyph_; } void Composition::change(GlyphIndex index) { CompositionComponent& component = component_->item_ref(index); Glyph* contents = body(); for (CompositorIndex b = item(index)/2; b < breaks_->count(); ++b) { Break& br = breaks_->item_ref(b); if (br.viewed() && index >= br.first_ && index <= br.last_+1) { contents->component(2 * b)->change(index - br.first_ + 2); contents->change(2 * b); } if (br.first_ > index) { break; } } } void Composition::append(Glyph* glyph) { insert(component_->count(), glyph); } void Composition::prepend(Glyph* glyph) { insert(0, glyph); } void Composition::insert(GlyphIndex index, Glyph* glyph) { if (glyph != nil) { glyph->ref(); } CompositionComponent component; component.glyph_ = glyph; component_->insert(index, component); Glyph* contents = body(); for (CompositorIndex b = item(index)/2; b < breaks_->count(); ++b) { Break& br = breaks_->item_ref(b); if (br.viewed() && index >= br.first_ && index <= br.last_+1) { br.valid(false); contents->component(2 * b)->insert(index - br.first_ + 2, nil); contents->change(2 * b); } if (index < br.first_) { ++br.first_; } if (index <= br.last_ + 1) { ++br.last_; } } damage(index - 1, index + 1); } void Composition::remove(GlyphIndex index) { CompositionComponent& component = component_->item_ref(index); if (component.glyph_ != nil) { component.glyph_->unref(); } component_->remove(index); Glyph* contents = body(); for (CompositorIndex b = item(index)/2; b < breaks_->count(); ++b) { Break& br = breaks_->item_ref(b); if (br.viewed() && index >= br.first_ && index <= br.last_+1) { br.valid(false); contents->component(2 * b)->remove(index - br.first_ + 2); contents->change(2 * b); } if (index < br.first_) { --br.first_; } if (index <= br.last_ + 1) { --br.last_; } } damage(index - 1, index); } void Composition::replace(GlyphIndex index, Glyph* glyph) { Requisition oldr, newr; if (glyph != nil) { glyph->request(newr); glyph->ref(); } CompositionComponent& component = component_->item_ref(index); if (component.glyph_ != nil) { component.glyph_->request(oldr); component.glyph_->unref(); } component.glyph_ = glyph; Glyph* contents = body(); for (CompositorIndex b = item(index)/2; b < breaks_->count(); ++b) { Break& br = breaks_->item_ref(b); if (br.viewed() && index >= br.first_-1 && index <= br.last_+1) { if (newr.equals(oldr, epsilon)) { Glyph* g = ( glyph == nil ? nil : index == br.first_-1 ? glyph->compose(post_break) : index == br.last_+1 ? glyph->compose(pre_break) : glyph->compose(no_break) ); contents->component(2 * b)->replace(index-br.first_+2, g); } else { br.valid(false); damage(index - 1, index + 1); } contents->change(2 * b); } if (br.first_ > index) { break; } } } CompositorIndex Composition::item(GlyphIndex index) const { CompositorIndex count = breaks_->count(); Composition* c = (Composition*)this; c->item_ = Math::min(Math::max(0L, item_), long(count-1)); while (c->item_ < count-1 && c->breaks_->item_ref(item_).last_ < index) { c->item_ += 1; } while (c->item_ > 0 && c->breaks_->item_ref(item_).first_ > index) { c->item_ -= 1; } return Math::max(0L, c->item_) * 2; } void Composition::allotment( GlyphIndex i, DimensionName res, Allotment& a ) const { for (GlyphIndex b = item(i)/2; b < breaks_->count(); ++b) { Break& br = breaks_->item_ref(b); if (i >= br.first_ && i <= br.last_+1) { if (br.viewed()) { body()->component(2*b)->allotment(i - br.first_ + 2, res, a); } else { body()->allotment(2*b, res, a); } } } } /* * Translate a pick on the composition contents into what looks * like a pick on the elements. That is, if the composition * is a list of characters, it will be arranged into lines. * The pick on the lines will return , which needs * to be compressed into a single index for the composition. */ void Composition::pick( Canvas* c, const Allocation& allocation, int depth, Hit& h ) { long n = h.count(); MonoGlyph::pick(c, allocation, depth, h); if (h.count() > n) { /* * Retrieve the index of the line that was hit into "item". * Compositions create two glyphs per formatted line: * even-numbered elements refer to the lines and odd-numbered ones * refer to the separators between lines. We will compute * the element "index" from "item" and the break information. */ GlyphIndex item = h.index(depth); GlyphIndex b_count = breaks_->count(); GlyphIndex index; if (item % 2 == 0) { GlyphIndex b_index = item / 2; if (b_index < b_count) { /* * Hit on a line: calculate the character index by adding * the line's start to the offset into the line. */ const Break& br = breaks_->item_ref(b_index); index = br.first_ + h.index(depth+1) - 2; index = Math::max(br.first_, Math::min(long(br.last_ + 1), index)); } else { /* * This case only seems to happen when there is * a float at the end of the composition. */ index = breaks_->item_ref(b_count - 1).last_ + 1; } } else { GlyphIndex b_index = item / 2 + 1; if (b_index < b_count) { /* * Hit on the separator between lines: assume that * the hit refers to the beginning of the following line. */ index = breaks_->item_ref(b_index).first_; } else { /* * Hit on separator at the end of the composition: * return the end of the last line. */ index = breaks_->item_ref(b_index - 1).last_ + 1; } } /* * Remove the hit target for depth + 1, effectively * shifting information below it up one level. */ h.remove(depth + 1); /* * Finally, add the information for this level. */ h.retarget(depth, this, index); } } Glyph* Composition::make_item(Break& nb, bool created) { LayoutKit* layout = LayoutKit::instance(); nb.valid(true); nb.viewed(created); if (created) { Glyph* g = make(nb); if (span_ > 0 && span_ < fil) { g = layout->fixed_span_dimension(g, dimension_, span_); } nb.patch_ = new Patch(g); return nb.patch_; } else { static GlyphIndex __req_count; static Requisition* __req; GlyphIndex count = nb.last_ - nb.first_ + 3; if (count >= __req_count) { delete [] __req; __req = new Requisition[count]; __req_count = count; } GlyphIndex index = 0; if (nb.first_ > 0) { Glyph* g = component_->item_ref(nb.first_ - 1).glyph_; if (g != nil) { g = g->compose(post_break); } if (g != nil) { g->request(__req[index]); ++index; } } for (GlyphIndex k = nb.first_; k <= nb.last_; ++k) { Glyph* g = component_->item_ref(k).glyph_; if (g != nil) { g = g->compose(no_break); } if (g != nil) { g->request(__req[index]); ++index; } } if (nb.last_ < component_->count()-1) { Glyph* g = component_->item_ref(nb.last_ + 1).glyph_; if (g != nil) { g = g->compose(pre_break); } if (g != nil) { g->request(__req[index]); ++index; } } Requisition r; DimensionName cross; if (dimension_ == Dimension_X) { if (span_ > 0 && span_ < fil) { Requirement require(span_); r.require(dimension_, require); } else { Tile tile(dimension_); tile.request(index, __req, r); } cross = Dimension_Y; } else { if (span_ > 0 && span_ < fil) { Requirement require(span_, 0, 0, 1.0); r.require(dimension_, require); } else { TileReversed tile(dimension_); tile.request(index, __req, r); } cross = Dimension_X; } Align align(cross); align.request(index, __req, r); nb.patch_ = nil; return layout->glue(r); } } Glyph* Composition::make(Break&) { return nil; } LRComposition::LRComposition( Glyph* context, Compositor* compositor, Glyph* separator, Coord width, Coord stretch, Coord shrink, GlyphIndex size ) : Composition( context, compositor, separator, Dimension_X, width, stretch, shrink, size ) { } LRComposition::~LRComposition() { } Glyph* LRComposition::make(Break& nb) { LayoutKit* layout = LayoutKit::instance(); Glyph* glyph = layout->hbox(nb.last_ - nb.first_ + 5); glyph->append(layout->hglue(nb.begin_, 0, 0, 0.0)); if (nb.first_ > 0) { Glyph* g = component(nb.first_ - 1); if (g != nil) { glyph->append(g->compose(post_break)); } else { glyph->append(nil); } } else { glyph->append(nil); } for (GlyphIndex k = nb.first_; k <= nb.last_; ++k) { Glyph* g = component(k); if (g != nil) { glyph->append(g->compose(no_break)); } else { glyph->append(nil); } } if (nb.last_ < count()-1) { Glyph* g = component(nb.last_ + 1); if (g != nil) { glyph->append(g->compose(pre_break)); } else { glyph->append(nil); } } else { glyph->append(nil); } glyph->append(layout->hglue(nb.end_, 0, 0, 1.0)); return glyph; } TBComposition::TBComposition( Glyph* context, Compositor* compositor, Glyph* separator, Coord height, Coord stretch, Coord shrink, GlyphIndex size ) : Composition( context, compositor, separator, Dimension_Y, height, stretch, shrink, size ) { } TBComposition::~TBComposition() { } Glyph* TBComposition::make(Break& nb) { LayoutKit* layout = LayoutKit::instance(); Glyph* glyph = layout->vbox(nb.last_ - nb.first_ + 5); glyph->append(layout->vglue(nb.begin_, 0, 0, 1.0)); if (nb.first_ > 0) { Glyph* g = component(nb.first_ - 1); if (g != nil) { glyph->append(g->compose(post_break)); } else { glyph->append(nil); } } else { glyph->append(nil); } for (GlyphIndex k = nb.first_; k <= nb.last_; ++k) { Glyph* g = component(k); if (g != nil) { glyph->append(g->compose(no_break)); } else { glyph->append(nil); } } if (nb.last_ < count()-1) { Glyph* g = component(nb.last_ + 1); if (g != nil) { glyph->append(g->compose(pre_break)); } else { glyph->append(nil); } } else { glyph->append(nil); } glyph->append(layout->vglue(nb.end_, 0, 0, 0.0)); return glyph; } neuron-7.6.3/src/lib/InterViews/debug.cpp000077500000000000000000000072571340731477100203100ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * DebugGlyph -- trace glyph calls */ #include #include #include #include DebugGlyph::DebugGlyph( Glyph* g, const char* msg, unsigned int flags ) : MonoGlyph(g) { msg_ = msg; flags_ = flags; } DebugGlyph::~DebugGlyph() { } void DebugGlyph::request(Requisition& r) const { MonoGlyph::request(r); if ((flags_ & trace_request) != 0) { heading("request "); print_requirement(r.requirement(Dimension_X)); printf(", "); print_requirement(r.requirement(Dimension_Y)); printf("\n"); } } void DebugGlyph::allocate(Canvas* c, const Allocation& a, Extension& ext) { if ((flags_ & trace_allocate) != 0) { heading("allocate "); print_allotment(a.allotment(Dimension_X)); printf(", "); print_allotment(a.allotment(Dimension_Y)); printf("\n"); } MonoGlyph::allocate(c, a, ext); } void DebugGlyph::draw(Canvas* c, const Allocation& a) const { if ((flags_ & trace_draw) != 0) { heading("draw "); print_allotment(a.allotment(Dimension_X)); printf(", "); print_allotment(a.allotment(Dimension_Y)); if (c != nil) { Extension e; c->damage_area(e); printf( " [%.2f,%.2f %.2f,%.2f]", e.left(), e.bottom(), e.right(), e.top() ); } printf("\n"); } MonoGlyph::draw(c, a); } void DebugGlyph::print(Printer* p, const Allocation& a) const { if ((flags_ & trace_print) != 0) { heading("print "); print_allotment(a.allotment(Dimension_X)); printf(", "); print_allotment(a.allotment(Dimension_Y)); printf("\n"); } MonoGlyph::print(p, a); } void DebugGlyph::pick(Canvas* c, const Allocation& a, int depth, Hit& h) { if ((flags_ & trace_pick) != 0) { heading("pick "); printf( "at (%.2f,%.2f,%.2f,%.2f) ", h.left(), h.bottom(), h.right(), h.top() ); print_allotment(a.allotment(Dimension_X)); printf(", "); print_allotment(a.allotment(Dimension_Y)); printf("\n"); } MonoGlyph::pick(c, a, depth, h); } void DebugGlyph::undraw() { if ((flags_ & trace_undraw) != 0) { heading("undraw\n"); } MonoGlyph::undraw(); } void DebugGlyph::print_requirement(const Requirement& r) { printf( "%.2f(+%.2f,-%.2f) @ %.2f", r.natural(), r.stretch(), r.shrink(), r.alignment() ); } void DebugGlyph::print_allotment(const Allotment& a) { printf( "%.2f,%.2f @ %.2f", a.begin(), a.end(), a.alignment() ); } void DebugGlyph::heading(const char* s) const { printf("%s(0x%p) %s", msg_, body(), s); } neuron-7.6.3/src/lib/InterViews/deck.cpp000077500000000000000000000065771340731477100201340ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include Deck::Deck(GlyphIndex size) : PolyGlyph(size) { card_ = -1; changed_ = true; } Deck::~Deck() { } GlyphIndex Deck::card() const { return card_; } void Deck::flip_to(GlyphIndex index) { undraw(); card_ = index; } void Deck::request(Requisition& req) const { if (changed_) { GlyphIndex n = count(); Requisition* r = new Requisition[n]; for (GlyphIndex i = 0; i < n; i++) { Glyph* g = component(i); if (g != nil) { g->request(r[i]); } } Deck* d = (Deck*)this; Align x(Dimension_X); x.request(n, r, d->requisition_); Align y(Dimension_Y); y.request(n, r, d->requisition_); delete [] r; d->changed_ = false; } req = requisition_; } /* * When allocating a deck, we allocate the card (top component). * We also make the extension cover the entire allocation; * otherwise updating gets complicated in the presence of a flip_to. * Usually, this won't hurt. */ void Deck::allocate(Canvas* c, const Allocation& a, Extension& ext) { allocation_ = a; if (card_ >= 0 && card_ < count()) { Glyph* g = component(card_); if (g != nil) { g->allocate(c, a, ext); } ext.merge(c, a); } } void Deck::draw(Canvas* c, const Allocation& a) const { if (card_ >= 0 && card_ < count()) { Glyph* g = component(card_); if (g != nil) { g->draw(c, a); } } } void Deck::print(Printer* p, const Allocation& a) const { if (card_ >= 0 && card_ < count()) { Glyph* g = component(card_); if (g != nil) { g->print(p, a); } } } void Deck::pick(Canvas* c, const Allocation& a, int depth, Hit& h) { if (card_ >= 0 && card_ < count()) { Glyph* g = component(card_); if (g != nil) { h.begin(depth, this, card_); g->pick(c, a, depth + 1, h); h.end(); } } } void Deck::undraw() { if (card_ >= 0 && card_ < count()) { Glyph* g = component(card_); if (g != nil) { g->undraw(); } } } void Deck::modified(GlyphIndex) { changed_ = true; } void Deck::allotment(GlyphIndex, DimensionName d, Allotment& a) const { a = allocation_.allotment(d); } neuron-7.6.3/src/lib/InterViews/dialogs.cpp000066400000000000000000000163211340731477100206310ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * DialogKit -- object for creating common dialog boxes */ #include #include #ifdef motif_kit #include #endif #ifdef openlook_kit #include #endif #include #include #include #include #include #include #include class DialogKitImpl { private: friend class DialogKit; static DialogKit* instance_; static DialogKit* make_kit(); WidgetKit* kit_; }; DialogKit* DialogKitImpl::instance_; /* * We need to create a widget kit to make sure it is built * before trying to build any dialog objects, and thus avoiding * any circularities regarding style dependencies and the creation * of the initial style settings by the widget kit. */ DialogKit::DialogKit() { impl_ = new DialogKitImpl; impl_->kit_ = WidgetKit::instance(); } DialogKit::~DialogKit() { delete impl_; } DialogKit* DialogKit::instance() { if (DialogKitImpl::instance_ == nil) { DialogKitImpl::instance_ = DialogKitImpl::make_kit(); } return DialogKitImpl::instance_; } DialogKit* DialogKitImpl::make_kit() { #ifdef openlook_kit String gui; if (Session::instance()->style()->find_attribute("gui", gui)) { if (gui == "OpenLook" || gui == "openlook") { return new OLDialogKit; } } #endif return new MFDialogKit; } WidgetKit* DialogKit::widget_kit() const { return impl_->kit_; } FieldEditor* DialogKit::field_editor( const char* sample, Style* style, FieldEditorAction* a ) const { return make_field_editor(String(sample), widget_kit(), style, a); } FieldEditor* DialogKit::field_editor( const String& sample, Style* style, FieldEditorAction* a ) const { return make_field_editor(sample, widget_kit(), style, a); } FieldEditor* DialogKit::make_field_editor( const String&, WidgetKit*, Style*, FieldEditorAction* ) const { /* DialogKit subclasses should define this */ return nil; } FileChooser* DialogKit::file_chooser( const char* dir, Style* style, FileChooserAction* a ) const { return make_file_chooser(String(dir), widget_kit(), style, a); } FileChooser* DialogKit::file_chooser( const String& dir, Style* style, FileChooserAction* a ) const { return make_file_chooser(dir, widget_kit(), style, a); } FileChooser* DialogKit::make_file_chooser( const String&, WidgetKit*, Style*, FileChooserAction* ) const { /* DialogKit subclasses should define this */ return nil; } /* class DialogHandler -- helper for class Dialog */ class DialogHandler : public Handler { public: DialogHandler(Dialog*); virtual ~DialogHandler(); virtual bool event(Event&); private: Dialog* dialog_; }; DialogHandler::DialogHandler(Dialog* d) { dialog_ = d; } DialogHandler::~DialogHandler() { } bool DialogHandler::event(Event&) { dialog_->dismiss(false); return true; } /* class Dialog */ Dialog::Dialog(Glyph* g, Style* s) : InputHandler(g, s) { } Dialog::~Dialog() { } #if defined(MINGW) extern "C" { extern int (*iv_bind_enqueue_)(void(*)(void*), void*); static bool rval_; static void run_in_gui_thread(void* v) { Dialog* d = (Dialog*)v; rval_ = d->run(); } static bool run_mingw(Dialog* d) { if (iv_bind_enqueue_ && (*iv_bind_enqueue_)(run_in_gui_thread, (void*)d)) { return rval_; } return d->run(); } } // extern "C" #endif // MINGW bool Dialog::post_for_aligned(Window* w, float x_align, float y_align) { TransientWindow* t = new TransientWindow(this); t->style(new Style(style())); t->transient_for(w); t->wm_delete(new DialogHandler(this)); t->place(w->left() + 0.5 * w->width(), w->bottom() + 0.5 * w->height()); t->align(x_align, y_align); t->map(); #if defined(MINGW) bool b = run_mingw(this); #else bool b = run(); #endif t->unmap(); t->display()->sync(); delete t; return b; } bool Dialog::post_at_aligned( Coord x, Coord y, float x_align, float y_align ) { TransientWindow* t = new TransientWindow(this); t->style(new Style(style())); t->wm_delete(new DialogHandler(this)); t->place(x, y); t->align(x_align, y_align); t->map(); #if defined(MINGW) bool b = run_mingw(this); #else bool b = run(); #endif t->unmap(); t->display()->sync(); delete t; return b; } #if MAC #include #endif //NEURON used to have its own slightly hacked version of dialogs.cpp // but as of gcc 3.3 under powerpc-apple-darwin7.0.0 // that caused multiply defined symbol errors. For this reason we // abbandoned the NEURON dialogs.cpp in favor of an extern C callback. // i.e. it is used if the pointer is non-nil #define OC_UNQUIT 1 #if OC_UNQUIT extern "C" { bool (*IVDialog_setAcceptInput)(bool) = nil; } #endif bool Dialog::run() { Session* s = Session::instance(); Event e; done_ = false; #if carbon extern int dialog_running_; extern int iv_carbon_in_menu_; extern void iv_carbon_dialog_handle(WindowRef); WindowRef thiswin = canvas()->window()->rep()->macWindow(); int drsav = dialog_running_; dialog_running_ = 1; iv_carbon_in_menu_ = 0; #endif #if OC_UNQUIT bool old; if (IVDialog_setAcceptInput) { old = (*IVDialog_setAcceptInput)(false); s->unquit(); } #endif for (;;) { #if carbon s->screen_update(); iv_carbon_dialog_handle(thiswin); #else #if defined(WIN32) s->read(e); e.handle(); #else s->read(e); // added by ro2m: don't respond to events that don't have display (it happens..) if (e.display() == nil) continue; if (e.grabber() != nil || inside(e)) { e.handle(); } else if (e.type() == Event::key) { keystroke(e); } #endif #endif if (done_) { break; } if (s->done()) { accepted_ = false; break; } } #if OC_UNQUIT if (IVDialog_setAcceptInput) { (*IVDialog_setAcceptInput)(old); } #endif #if carbon dialog_running_ = drsav; #endif return accepted_; } void Dialog::dismiss(bool accept) { accepted_ = accept; done_ = true; } neuron-7.6.3/src/lib/InterViews/fbrowser.cpp000077500000000000000000000246421340731477100210500ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * FileBrowser -- browse a directory */ #if MAC #define WIN32 #endif #ifndef WIN32 #include #include #endif #include #include #include #include #include #include #include #include class FileBrowserImpl; typedef void (FileBrowserImpl::*FileBrowserKeyFunc)(); struct FileBrowserKeyInfo { char key; const char* name; FileBrowserKeyFunc func; }; static const int keymap_size = 256; class FileBrowserImpl { public: FileBrowser* browser_; WidgetKit* kit_; GlyphIndex selected_; TBScrollBox* box_; enum { selecting, grab_scrolling, rate_scrolling } mode_; Coord scale_; Cursor* save_cursor_; Coord start_scroll_pointer_; Coord cur_scroll_pointer_; Coord start_scroll_pos_; #ifndef WIN32 IOHandler* rate_handler_; long usec_rate_; #endif FileBrowserKeyFunc key_[keymap_size]; void rate_scroll_timer(long, long); void open(); void cancel(); void scroll_to_first(); void scroll_to_last(); void select_all(); void unselect_all(); void next_focus(); void select_previous(); void select_next(); void select_top(); void select_bottom(); void scroll_down(); void scroll_up(); void page_down(); void page_up(); void half_page_down(); void half_page_up(); }; #ifndef WIN32 declareIOCallback(FileBrowserImpl) implementIOCallback(FileBrowserImpl) #endif static FileBrowserKeyInfo default_key_map[] = { { '\r', "open", &FileBrowserImpl::open }, { '\007', "cancel", &FileBrowserImpl::cancel }, { '\033', "cancel", &FileBrowserImpl::cancel }, { 'g', "scroll-to-first", &FileBrowserImpl::scroll_to_first }, { 'G', "scroll-to-last", &FileBrowserImpl::scroll_to_last }, { 'a', "select-all", &FileBrowserImpl::select_all }, { '\177', "unselect-all", &FileBrowserImpl::unselect_all }, { '\010', "unselect-all", &FileBrowserImpl::unselect_all }, { '\t', "next-focus", &FileBrowserImpl::next_focus }, { 'p', "select-previous", &FileBrowserImpl::select_previous }, { 'n', "select-next", &FileBrowserImpl::select_next }, { '<', "select-top", &FileBrowserImpl::select_top }, { '>', "select-bottom", &FileBrowserImpl::select_bottom }, { 'j', "scroll-down", &FileBrowserImpl::scroll_down }, { 'k', "scroll-up", &FileBrowserImpl::scroll_up }, { ' ', "page-down", &FileBrowserImpl::page_down }, { 'b', "page-up", &FileBrowserImpl::page_up }, { 'd', "half-page-down", &FileBrowserImpl::half_page_down }, { 'u', "half-page-up", &FileBrowserImpl::half_page_up }, { 0, nil } }; FileBrowser::FileBrowser( WidgetKit* kit, Action* accept, Action* cancel ) : Browser(nil, kit->style(), accept, cancel) { impl_ = new FileBrowserImpl; FileBrowserImpl& fb = *impl_; fb.browser_ = this; fb.kit_ = kit; fb.selected_ = -1; fb.box_ = new TBScrollBox; const Font* f = kit->font(); FontBoundingBox bbox; f->font_bbox(bbox); fb.scale_ = 1.0 / (bbox.ascent() + bbox.descent()); fb.save_cursor_ = nil; for (int i = 0; i < keymap_size; i++) { fb.key_[i] = nil; } for (FileBrowserKeyInfo* k = &default_key_map[0]; k->key != 0; k++) { fb.key_[k->key] = k->func; } #ifndef WIN32 fb.rate_handler_ = new IOCallback(FileBrowserImpl)( impl_, &FileBrowserImpl::rate_scroll_timer ); Style* s = kit->style(); long milliseconds = 75; s->find_attribute("scrollRate", milliseconds); fb.usec_rate_ = 1000 * milliseconds; #endif body(fb.box_); } FileBrowser::~FileBrowser() { #ifndef WIN32 delete impl_->rate_handler_; #endif delete impl_; } void FileBrowser::press(const Event& e) { FileBrowserImpl& fb = *impl_; EventButton b = e.pointer_button(); Window* w = canvas()->window(); switch (b) { case Event::left: fb.mode_ = FileBrowserImpl::selecting; Browser::press(e); break; case Event::middle: #if defined(WIN32) case Event::right: #endif fb.mode_ = FileBrowserImpl::grab_scrolling; fb.save_cursor_ = w->cursor(); fb.start_scroll_pointer_ = e.pointer_y(); fb.start_scroll_pos_ = fb.box_->cur_lower(Dimension_Y); w->cursor(fb.kit_->hand_cursor()); break; #if !defined(WIN32) case Event::right: fb.mode_ = FileBrowserImpl::rate_scrolling; fb.start_scroll_pointer_ = e.pointer_y(); fb.start_scroll_pos_ = fb.box_->cur_lower(Dimension_Y); fb.save_cursor_ = w->cursor(); break; #endif default: break; } } void FileBrowser::drag(const Event& e) { FileBrowserImpl& fb = *impl_; WidgetKit& kit = *fb.kit_; Coord delta; Window* w = canvas()->window(); switch (fb.mode_) { case FileBrowserImpl::selecting: Browser::drag(e); break; case FileBrowserImpl::grab_scrolling: delta = e.pointer_y() - fb.start_scroll_pointer_; fb.box_->scroll_to( Dimension_Y, fb.start_scroll_pos_ - delta * fb.scale_ ); break; case FileBrowserImpl::rate_scrolling: #ifndef WIN32 fb.cur_scroll_pointer_ = e.pointer_y(); if (fb.cur_scroll_pointer_ > fb.start_scroll_pointer_) { w->cursor(kit.ufast_cursor()); } else { w->cursor(kit.dfast_cursor()); } Dispatcher::instance().stopTimer(fb.rate_handler_); fb.rate_scroll_timer(0, 0); #endif break; } } void FileBrowser::release(const Event& e) { FileBrowserImpl& fb = *impl_; Window* w = canvas()->window(); Coord delta; switch (fb.mode_) { case FileBrowserImpl::selecting: Browser::release(e); break; case FileBrowserImpl::grab_scrolling: delta = e.pointer_y() - fb.start_scroll_pointer_; fb.box_->scroll_to( Dimension_Y, fb.start_scroll_pos_ - delta * fb.scale_ ); w->cursor(fb.save_cursor_); break; case FileBrowserImpl::rate_scrolling: #ifndef WIN32 Dispatcher::instance().stopTimer(fb.rate_handler_); w->cursor(fb.save_cursor_); #endif break; } } void FileBrowser::keystroke(const Event& e) { char c; if (e.mapkey(&c, 1) != 0) { FileBrowserImpl& fb = *impl_; FileBrowserKeyFunc f = fb.key_[c]; if (f != nil) { (fb.*f)(); } } } InputHandler* FileBrowser::focus_in() { FileBrowserImpl& fb = *impl_; if (fb.selected_ == -1) { fb.select_top(); } else { Browser::select(fb.selected_); } return Browser::focus_in(); } void FileBrowser::focus_out() { FileBrowserImpl& fb = *impl_; fb.selected_ = selected(); Browser::select(-1); } void FileBrowser::select(GlyphIndex i) { FileBrowserImpl& fb = *impl_; fb.selected_ = i; Browser::select(i); } Adjustable* FileBrowser::adjustable() const { return impl_->box_; } void FileBrowser::refresh() { FileBrowserImpl& fb = *impl_; fb.box_->scroll_to(Dimension_Y, Coord(fb.box_->count())); } /* class FileBrowserImpl */ void FileBrowserImpl::rate_scroll_timer(long, long) { Coord delta = cur_scroll_pointer_ - start_scroll_pointer_; box_->scroll_to( Dimension_Y, box_->cur_lower(Dimension_Y) + delta * scale_ ); #ifndef WIN32 Dispatcher::instance().startTimer(0, usec_rate_, rate_handler_); #endif } void FileBrowserImpl::open() { FileBrowser& b = *browser_; GlyphIndex i = b.selected(); if (i >= 0 && i < b.count()) { b.choose(i); } } void FileBrowserImpl::cancel() { browser_->cancel(); } void FileBrowserImpl::scroll_to_first() { box_->scroll_to(Dimension_Y, Coord(box_->count())); } void FileBrowserImpl::scroll_to_last() { box_->scroll_to(Dimension_Y, Coord(0)); } void FileBrowserImpl::select_all() { } void FileBrowserImpl::unselect_all() { browser_->select(-1); } void FileBrowserImpl::next_focus() { browser_->next_focus(); } void FileBrowserImpl::select_previous() { FileBrowser& b = *browser_; GlyphIndex i = b.selected(); if (!box_->shown(i)) { box_->scroll_to(Dimension_Y, Coord(box_->count() - i - 1)); } if (i > 0) { --i; if (!box_->shown(i)) { box_->scroll_forward(Dimension_Y); } b.select(i); } } void FileBrowserImpl::select_next() { FileBrowser& b = *browser_; GlyphIndex i = b.selected(); if (!box_->shown(i)) { box_->scroll_to( Dimension_Y, Coord( box_->count() - 1 - i + box_->first_shown() - box_->last_shown() ) ); } if (i < b.count() - 1) { ++i; if (!box_->shown(i)) { box_->scroll_backward(Dimension_Y); } b.select(i); } } void FileBrowserImpl::select_top() { browser_->select(box_->first_shown()); } void FileBrowserImpl::select_bottom() { browser_->select(box_->last_shown()); } void FileBrowserImpl::scroll_down() { box_->scroll_forward(Dimension_Y); } void FileBrowserImpl::scroll_up() { box_->scroll_backward(Dimension_Y); } void FileBrowserImpl::page_down() { box_->page_backward(Dimension_Y); } void FileBrowserImpl::page_up() { box_->page_forward(Dimension_Y); } void FileBrowserImpl::half_page_down() { GlyphIndex n = box_->last_shown() - box_->first_shown() + 1; GlyphIndex half = n >> 1; for (GlyphIndex i = 0; i < half; i++) { box_->scroll_backward(Dimension_Y); } } void FileBrowserImpl::half_page_up() { GlyphIndex n = box_->last_shown() - box_->first_shown() + 1; GlyphIndex half = n >> 1; for (GlyphIndex i = 0; i < half; i++) { box_->scroll_forward(Dimension_Y); } } neuron-7.6.3/src/lib/InterViews/fchooser.cpp000066400000000000000000000326131340731477100210210ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * FileChooser -- select a file */ #ifdef WIN32 #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include class FileChooserImpl { private: friend class FileChooser; String* name_; WidgetKit* kit_; FileChooser* fchooser_; FileBrowser* fbrowser_; FieldEditor* editor_; FieldEditor* filter_; FieldEditor* directory_filter_; int* filter_map_; Directory* dir_; FileChooserAction* action_; const String* selected_; Style* style_; Action* update_; void init(FileChooser*, Style*, FileChooserAction*); void fcfree(); void build(); void clear(); void load(); FieldEditor* add_filter( Style*, const char* pattern_attribute, const char* default_pattern, const char* caption_attribute, const char* default_caption, Glyph*, FieldEditorAction* ); bool filtered(const String&, FieldEditor*); void accept_dir(); void accept_browser(); void cancel_browser(); void accept_editor(FieldEditor*); void cancel_editor(FieldEditor*); void accept_filter(FieldEditor*); bool chdir(const String&); static const Color* disable_color(); bool choose_dir_; }; declareActionCallback(FileChooserImpl) implementActionCallback(FileChooserImpl) declareFieldEditorCallback(FileChooserImpl) implementFieldEditorCallback(FileChooserImpl) FileChooser::FileChooser( const String& dir, WidgetKit* kit, Style* s, FileChooserAction* a ) : Dialog(nil, s) { impl_ = new FileChooserImpl; FileChooserImpl& fc = *impl_; fc.name_ = new CopyString(dir); fc.kit_ = kit; fc.init(this, s, a); fc.editor_->select(fc.editor_->text()->length()); } FileChooser::~FileChooser() { impl_->fcfree(); delete impl_; } const String* FileChooser::selected() const { return impl_->selected_; } const String* FileChooser::dir() const { return impl_->dir_->path(); } void FileChooser::reread() { FileChooserImpl& fc = *impl_; if (!fc.chdir(*fc.dir_->path())) { /* should generate an error message */ } } void FileChooser::dismiss(bool accept) { Dialog::dismiss(accept); FileChooserImpl& fc = *impl_; if (fc.action_ != nil) { fc.action_->execute(this, accept); } } /** class FileChooserImpl **/ void FileChooserImpl::init( FileChooser* chooser, Style* s, FileChooserAction* a ) { fchooser_ = chooser; fbrowser_ = nil; editor_ = nil; filter_ = nil; directory_filter_ = nil; filter_map_ = nil; dir_ = Directory::open(*name_); if (dir_ == nil) { dir_ = Directory::current(); /* and what if we can't read the current directory? */ } #ifdef WIN32 if (dir_ == nil) { MessageBox(NULL, "FileChooserImpl::init dir is nil", "Internal error", MB_OK); } #endif Resource::ref(a); action_ = a; style_ = new Style(s); Resource::ref(style_); style_->alias("FileChooser"); style_->alias("Dialog"); update_ = new ActionCallback(FileChooserImpl)( this, &FileChooserImpl::build ); style_->add_trigger_any(update_); choose_dir_ = style_->value_is_on("choose_directory"); build(); } void FileChooserImpl::fcfree() { delete name_; delete dir_; delete [] filter_map_; Resource::unref(action_); style_->remove_trigger_any(update_); Resource::unref(style_); } void FileChooserImpl::build() { WidgetKit& kit = *kit_; const LayoutKit& layout = *LayoutKit::instance(); Style* s = style_; kit.push_style(); kit.style(s); String caption(""); s->find_attribute("caption", caption); String subcaption("Enter filename:"); if (choose_dir_) { subcaption = "Enter directory name:"; } s->find_attribute("subcaption", subcaption); String open("Open"); s->find_attribute("open", open); String close("Cancel"); s->find_attribute("cancel", close); long rows = 10; s->find_attribute("rows", rows); const Font* f = kit.font(); FontBoundingBox bbox; f->font_bbox(bbox); Coord height = rows * (bbox.ascent() + bbox.descent()) + 1.0; Coord width; if (!s->find_attribute("width", width)) { width = 16 * f->width('m') + 3.0; } Action* accept = new ActionCallback(FileChooserImpl)( this, &FileChooserImpl::accept_browser ); Action* cancel = new ActionCallback(FileChooserImpl)( this, &FileChooserImpl::cancel_browser ); if (editor_ == nil) { editor_ = DialogKit::instance()->field_editor( *dir_->path(), s, new FieldEditorCallback(FileChooserImpl)( this, &FileChooserImpl::accept_editor, &FileChooserImpl::cancel_editor ) ); } // added by ro2m: check for style for default selection String defsel(""); if(s->find_attribute("defaultSelection", defsel)) { editor_->field(defsel); } fbrowser_ = new FileBrowser(kit_, accept, cancel); fchooser_->remove_all_input_handlers(); fchooser_->append_input_handler(editor_); fchooser_->append_input_handler(fbrowser_); Glyph* g = layout.vbox(); if (caption.length() > 0) { g->append(layout.rmargin(kit.fancy_label(caption), 5.0, fil, 0.0)); } if (subcaption.length() > 0) { g->append(layout.rmargin(kit.fancy_label(subcaption), 5.0, fil, 0.0)); } g->append(layout.vglue(5.0, 0.0, 2.0)); g->append(editor_); g->append(layout.vglue(15.0, 0.0, 12.0)); g->append( layout.hbox( layout.vcenter( kit.inset_frame( layout.margin( layout.natural_span(fbrowser_, width, height), 1.0 ) ), 1.0 ), layout.hspace(4.0), kit.vscroll_bar(fbrowser_->adjustable()) ) ); g->append(layout.vspace(15.0)); if (s->value_is_on("filter")) { FieldEditorAction* action = new FieldEditorCallback(FileChooserImpl)( this, &FileChooserImpl::accept_filter, nil ); filter_ = add_filter( s, "filterPattern", "", "filterCaption", "Filter:", g, action ); if (s->value_is_on("directoryFilter")) { directory_filter_ = add_filter( s, "directoryFilterPattern", "", "directoryFilterCaption", "Directory Filter:", g, action ); } else { directory_filter_ = nil; } } else { filter_ = nil; directory_filter_ = nil; } g->append( layout.hbox( layout.hglue(10.0), choose_dir_ ? layout.vcenter(kit.default_button("List Dir", accept)) : layout.vcenter(kit.default_button(open, accept)), layout.hglue(10.0, 0.0, 5.0), layout.vcenter(kit.push_button(close, cancel)), layout.hglue(10.0) ) ); if (choose_dir_) { Action* accept_d = new ActionCallback(FileChooserImpl)( this, &FileChooserImpl::accept_dir ); g->append(layout.vglue(5.0, 0.0, 2.0)); g->append(layout.hbox(layout.hglue(10.0),layout.vcenter(kit.push_button(open, accept_d)), layout.hglue(10.0))); } fchooser_->body( layout.back( layout.vcenter(kit.outset_frame(layout.margin(g, 5.0)), 1.0), new Target(nil, TargetPrimitiveHit) ) ); fchooser_->focus(editor_); kit.pop_style(); load(); } void FileChooserImpl::clear() { Browser& b = *fbrowser_; b.select(-1); GlyphIndex n = b.count(); for (GlyphIndex i = 0; i < n; i++) { b.remove_selectable(0); b.remove(0); } } static const Color* disable_color_; const Color* FileChooserImpl::disable_color() { if (!disable_color_) { Style* s = WidgetKit::instance()->style(); String dc; if (s->find_attribute("disable_color", dc)) { disable_color_ = Color::lookup(Session::instance()->default_display(), dc); } if (!disable_color_) { disable_color_ = new Color(.5,.5,.5,1.); } Resource::ref(disable_color_); } return disable_color_; } void FileChooserImpl::load() { Directory& d = *dir_; FileBrowser& b = *fbrowser_; WidgetKit& kit = *kit_; kit.push_style(); kit.style(style_); const LayoutKit& layout = *LayoutKit::instance(); int dircount = d.count(); delete [] filter_map_; int* index = new int[dircount]; filter_map_ = index; for (int i = 0; i < dircount; i++) { const String& f = *d.name(i); bool is_dir = d.is_directory(i); if ((is_dir && filtered(f, directory_filter_)) || (!is_dir && filtered(f, filter_)) ) { Glyph* name; if (!is_dir && choose_dir_) { name = new Label(f, kit.font(), disable_color()); }else{ name = kit.label(f); } if (is_dir) { name = layout.hbox(name, kit.label("/")); } Glyph* label = new Target( layout.h_margin(name, 3.0, 0.0, 0.0, 15.0, fil, 0.0), TargetPrimitiveHit ); TelltaleState* t = new TelltaleState(TelltaleState::is_enabled); b.append_selectable(t); b.append(new ChoiceItem(t, label, kit.bright_inset_frame(label))); if (!is_dir && choose_dir_) { t->set(TelltaleState::is_enabled, false); } *index++ = i; } } b.refresh(); kit.pop_style(); } FieldEditor* FileChooserImpl::add_filter( Style* s, const char* pattern_attribute, const char* default_pattern, const char* caption_attribute, const char* default_caption, Glyph* body, FieldEditorAction* action ) { String pattern(default_pattern); s->find_attribute(pattern_attribute, pattern); String caption(default_caption); s->find_attribute(caption_attribute, caption); FieldEditor* e = DialogKit::instance()->field_editor(pattern, s, action); fchooser_->append_input_handler(e); WidgetKit& kit = *kit_; LayoutKit& layout = *LayoutKit::instance(); body->append( layout.hbox( layout.vcenter(kit.fancy_label(caption), 0.5), layout.hspace(2.0), layout.vcenter(e, 0.5) ) ); body->append(layout.vspace(10.0)); return e; } bool FileChooserImpl::filtered(const String& name, FieldEditor* e) { if (e == nil) { return true; } const String* s = e->text(); if (s == nil || s->length() == 0) { return true; } return s == nil || s->length() == 0 || Directory::match(name, *s); } void FileChooserImpl::accept_dir() { accept_browser(); if (choose_dir_) { selected_ = dir_->path(); fchooser_->dismiss(true); } } void FileChooserImpl::accept_browser() { int i = int(fbrowser_->selected()); if (i == -1) { accept_editor(editor_); return; } i = filter_map_[i]; const String& path = *dir_->path(); const String& name = *dir_->name(i); int length = path.length() + name.length(); char* tmp = new char[length + 1]; sprintf( tmp, "%.*s%.*s", path.length(), path.string(), name.length(), name.string() ); editor_->field(tmp); selected_ = editor_->text(); if (dir_->is_directory(i)) { if (chdir(String(tmp, length))) { editor_->field(*dir_->path()); fchooser_->focus(editor_); } else { /* should generate an error message */ } } else if (!choose_dir_){ fchooser_->dismiss(true); } else { // get rid of file and move back to directory accept_editor(editor_); } delete [] tmp; } void FileChooserImpl::cancel_browser() { selected_ = nil; fchooser_->dismiss(false); } void FileChooserImpl::accept_editor(FieldEditor* e) { String* path = Directory::canonical(*e->text()); e->field(*path); if (chdir(*path)) { /* chdir has copied the string */ delete path; }else if (choose_dir_) { e->field(e->text()->left(e->text()->rindex('/'))); accept_editor(e); } else { selected_ = path; fchooser_->dismiss(true); e->select(path->rindex('/') + 1, path->length()); } } void FileChooserImpl::cancel_editor(FieldEditor*) { fchooser_->dismiss(false); } void FileChooserImpl::accept_filter(FieldEditor*) { clear(); load(); } bool FileChooserImpl::chdir(const String& name) { Directory* d = Directory::open(name); if (d != nil) { dir_->close(); delete dir_; dir_ = d; clear(); load(); return true; } return false; } /** class FileChooserAction **/ FileChooserAction::FileChooserAction() { } FileChooserAction::~FileChooserAction() { } void FileChooserAction::execute(FileChooser*, bool) { } neuron-7.6.3/src/lib/InterViews/field.cpp000066400000000000000000000432231340731477100202730ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #if !defined(WIN32) && !MAC // the unix version -- see #if defined(WIN32) || MAC below /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * FieldEditor -- simple editor for text fields */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include class FieldStringEditor : public StringEditor { public: FieldStringEditor( ButtonState* bs, const char* sample, WidgetKit*, Style* ); virtual ~FieldStringEditor(); virtual void print(Printer*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); void press(const Event&); bool keystroke(const Event&); void cursor_on(); void cursor_off(); void focus_in(); void focus_out(); void cut(SelectionManager*); void paste(SelectionManager*); protected: virtual void Reconfig(); private: WidgetKit* kit_; Style* style_; int start_; int index_; void do_select(Event&); void do_grab_scroll(Event&); void do_rate_scroll(Event&); }; declareSelectionCallback(FieldStringEditor) implementSelectionCallback(FieldStringEditor) FieldStringEditor::FieldStringEditor( ButtonState* bs, const char* sample1, WidgetKit* kit, Style* style1 ) : StringEditor(bs, sample1) { kit_ = kit; style_ = style1; Resource::ref(style1); delete input; input = nil; } FieldStringEditor::~FieldStringEditor() { Resource::unref(style_); } void FieldStringEditor::print(Printer* p, const Allocation& a) const { const Font* f = output->GetFont(); const Color* fg = output->GetFgColor(); FontBoundingBox b; f->font_bbox(b); Coord x = a.left(), y = a.bottom() + b.font_descent(); FieldStringEditor* e = (FieldStringEditor*)this; for (const char* s = e->Text(); *s != '\0'; s++) { Coord w = f->width(*s); p->character(f, *s, w, fg, x, y); x += w; } } void FieldStringEditor::pick( Canvas*, const Allocation& a, int depth, Hit& h ) { const Event* ep = h.event(); if (ep != nil && h.left() < a.right() && h.right() >= a.left() && h.bottom() < a.top() && h.top() >= a.bottom() ) { h.target(depth, this, 0); } } void FieldStringEditor::press(const Event& event) { Event e; display->Draw(output, canvas); switch (event.pointer_button()) { case Event::left: do_select(e); break; case Event::middle: do_grab_scroll(e); break; case Event::right: do_rate_scroll(e); break; } } void FieldStringEditor::do_select(Event& e) { int origin = display->Left(0, 0); int width = display->Width(); Poll(e); start_ = display->LineIndex(0, e.x); do { if (e.x < 0) { origin = Math::min(0, origin - e.x); } else if (e.x > xmax) { origin = Math::max( xmax - width, origin - (e.x - xmax) ); } display->Scroll(0, origin, ymax); index_ = display->LineIndex(0, e.x); DoSelect(start_, index_); Poll(e); } while (e.leftmouse); SelectionManager* s = e.display()->primary_selection(); s->own( new SelectionCallback(FieldStringEditor)(this, &FieldStringEditor::cut) ); } void FieldStringEditor::do_grab_scroll(Event& e) { Window* w = canvas->window(); Cursor* c = w->cursor(); w->cursor(kit_->hand_cursor()); int origin = display->Left(0, 0); int width = display->Width(); Poll(e); int x = e.x; do { origin += e.x - x; origin = Math::min( 0, Math::max(Math::min(0, xmax - width), origin) ); display->Scroll(0, origin, ymax); x = e.x; Poll(e); } while (e.middlemouse); w->cursor(c); } void FieldStringEditor::do_rate_scroll(Event& e) { Window* w = canvas->window(); Cursor* c = w->cursor(); WidgetKit& kit = *kit_; Cursor* left1 = kit.lfast_cursor(); Cursor* right1 = kit.rfast_cursor(); int origin = display->Left(0, 0); int width = display->Width(); Poll(e); int x = e.x; do { origin += x - e.x; origin = Math::min( 0, Math::max(Math::min(0, xmax - width), origin) ); display->Scroll(0, origin, ymax); if (e.x - x < 0) { w->cursor(left1); } else { w->cursor(right1); } Poll(e); } while (e.rightmouse); w->cursor(c); } #define XK_MISCELLANY #include #include bool FieldStringEditor::keystroke(const Event& e) { unsigned long keysym = e.keysym(); switch(keysym) { case XK_Right: Select(text->NextCharacter(right)); break; case XK_Left: Select(text->PreviousCharacter(left)); break; case XK_Home: Select(text->BeginningOfLine(left)); break; case XK_End: Select(text->EndOfLine(right)); break; } char c; return e.mapkey(&c, 1) != 0 && HandleChar(c) && c == '\t'; } void FieldStringEditor::cursor_on() { if (canvas != nil) { display->CaretStyle(BarCaret); } } void FieldStringEditor::cursor_off() { if (canvas != nil) { display->CaretStyle(NoCaret); } } void FieldStringEditor::focus_in() { } void FieldStringEditor::focus_out() { } void FieldStringEditor::cut(SelectionManager* s) { if (start_ > index_) { int tmp = start_; start_ = index_; index_ = tmp; } s->put_value(Text() + start_, index_ - start_); } void FieldStringEditor::paste(SelectionManager*) { /* unimplemented */ } void FieldStringEditor::Reconfig() { kit_->push_style(); kit_->style(style_); Painter* p = new Painter(output); p->SetColors(kit_->foreground(), kit_->background()); p->SetFont(kit_->font()); Resource::unref(output); output = p; StringEditor::Reconfig(); kit_->pop_style(); } class FieldButton : public ButtonState { public: FieldButton(FieldEditor*, FieldEditorAction*); virtual ~FieldButton(); virtual void Notify(); private: FieldEditor* editor_; FieldEditorAction* action_; }; class FieldEditorImpl { private: friend class FieldEditor; WidgetKit* kit_; FieldStringEditor* editor_; FieldButton* bs_; String text_; bool cursor_is_on_; IOHandler* blink_handler_; long flash_rate_; void build(FieldEditor*, const char*, FieldEditorAction*); void blink_cursor(long, long); void stop_blinking(); }; declareIOCallback(FieldEditorImpl) implementIOCallback(FieldEditorImpl) FieldEditor::FieldEditor( const String& sample, WidgetKit* kit, Style* s, FieldEditorAction* action ) : InputHandler(nil, s) { impl_ = new FieldEditorImpl; impl_->kit_ = kit; NullTerminatedString ns(sample); impl_->build(this, ns.string(), action); } FieldEditor::~FieldEditor() { FieldEditorImpl* i = impl_; i->stop_blinking(); Resource::unref(i->editor_); Resource::unref(i->bs_); delete i->blink_handler_; delete i; } void FieldEditor::undraw() { FieldEditorImpl& f = *impl_; f.stop_blinking(); InputHandler::undraw(); } void FieldEditor::press(const Event& e) { impl_->editor_->press(e); } void FieldEditor::drag(const Event&) { } void FieldEditor::release(const Event&) { } void FieldEditor::keystroke(const Event& e) { FieldEditorImpl& f = *impl_; if (f.editor_->keystroke(e)) { select(text()->length()); next_focus(); } } InputHandler* FieldEditor::focus_in() { FieldEditorImpl& f = *impl_; f.blink_cursor(0, 0); f.editor_->focus_in(); return InputHandler::focus_in(); } void FieldEditor::focus_out() { FieldEditorImpl& f = *impl_; f.stop_blinking(); f.editor_->cursor_off(); f.editor_->focus_out(); InputHandler::focus_out(); } void FieldEditor::field(const char* str) { impl_->editor_->Message(str); } void FieldEditor::field(const String& s) { NullTerminatedString ns(s); impl_->editor_->Message(ns.string()); } void FieldEditor::select(int pos) { impl_->editor_->Select(pos); } void FieldEditor::select(int l, int r) { impl_->editor_->Select(l, r); } void FieldEditor::edit() { impl_->editor_->Edit(); } void FieldEditor::edit(const char* str, int left, int right) { impl_->editor_->Edit(str, left, right); } void FieldEditor::edit(const String& str, int left, int right) { NullTerminatedString ns(str); impl_->editor_->Edit(ns.string(), left, right); } const String* FieldEditor::text() const { impl_->text_ = String(impl_->editor_->Text()); return &impl_->text_; } /** class FieldEditorImpl **/ void FieldEditorImpl::build( FieldEditor* e, const char* str, FieldEditorAction* a ) { WidgetKit& kit = *kit_; kit.begin_style("FieldEditor"); Style* s = kit.style(); bs_ = new FieldButton(e, a); editor_ = new FieldStringEditor(bs_, str, kit_, s); Glyph* g = editor_; if (s->value_is_on("beveled")) { g = kit.inset_frame( new Background( LayoutKit::instance()->h_margin(editor_, 2.0), kit.background() ) ); } e->body(g); cursor_is_on_ = false; blink_handler_ = new IOCallback(FieldEditorImpl)( this, &FieldEditorImpl::blink_cursor ); float sec = 0.5; s->find_attribute("cursorFlashRate", sec); flash_rate_ = long(sec * 1000000); kit.end_style(); } void FieldEditorImpl::blink_cursor(long, long) { if (cursor_is_on_) { editor_->cursor_off(); cursor_is_on_ = false; } else { editor_->cursor_on(); cursor_is_on_ = true; } if (flash_rate_ > 10) { Dispatcher::instance().startTimer(0, flash_rate_, blink_handler_); } } void FieldEditorImpl::stop_blinking() { Dispatcher::instance().stopTimer(blink_handler_); editor_->cursor_off(); cursor_is_on_ = false; } /** class FieldButton **/ FieldButton::FieldButton(FieldEditor* editor, FieldEditorAction* action) { editor_ = editor; action_ = action; Resource::ref(action_); } FieldButton::~FieldButton() { Resource::unref(action_); } /* * We need to reset the button state's value so that we'll get * notified again. If we call SetValue, then it will call * Notify again! Alas, we must access the protected value member (sigh). */ void FieldButton::Notify() { int v; GetValue(v); value = 0; if (action_ != nil) { switch (v) { case '\r': action_->accept(editor_); break; case /* ^G */ '\007': case /* Esc */ '\033': action_->cancel(editor_); break; default: break; } } } /** class FieldEditorAction **/ FieldEditorAction::FieldEditorAction() { } FieldEditorAction::~FieldEditorAction() { } void FieldEditorAction::accept(FieldEditor*) { } void FieldEditorAction::cancel(FieldEditor*) { } #endif #if defined(WIN32) || MAC /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * FieldEditor -- simple editor for text fields */ // ======================================================================= // // Reworked the field editor to be a glyph-based text editor, and removed // all usage of Interacters (ie the StringEditor). // // Windows 3.1/NT InterViews Port // Copyright (c) 1993 Tim Prinzing // // Permission to use, copy, modify, distribute, and sell this software and // its documentation for any purpose is hereby granted without fee, provided // that (i) the above copyright notice and this permission notice appear in // all copies of the software and related documentation, and (ii) the name of // Tim Prinzing may not be used in any advertising or publicity relating to // the software without the specific, prior written permission of Tim Prinzing. // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL Tim Prinzing BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // // ======================================================================= #include #include #include #include #include #include #include #include class FieldEditorImpl { private: friend class FieldEditor; TextLine* editor_; String text_; FieldEditorAction* action_; }; FieldEditor::FieldEditor( const String& sample, WidgetKit* kit, Style* s, FieldEditorAction* action) : InputHandler(nil, s) { impl_ = new FieldEditorImpl; impl_->action_ = action; Resource::ref(impl_->action_); kit->begin_style("FieldEditor"); Style* sty = kit->style(); impl_->editor_ = new TextLine(sample, sample.length()); Glyph* g = impl_->editor_; if (sty->value_is_on("beveled")) { g = kit->inset_frame( new Background( LayoutKit::instance()->h_margin(impl_->editor_, 2.0), kit->background() ) ); } body(g); kit->end_style(); } FieldEditor::~FieldEditor() { Resource::unref(impl_->action_); delete impl_; } void FieldEditor::undraw() { InputHandler::undraw(); } void FieldEditor::press(const Event& e) { impl_->editor_->press(e); } void FieldEditor::drag(const Event& e) { impl_->editor_->drag(e); } void FieldEditor::release(const Event&) { } void FieldEditor::keystroke(const Event& e) { FieldEditorImpl& f = *impl_; char buffer[2]; int count = e.mapkey(buffer, 2); if (count) { switch (buffer[0]) { case '\r': f.action_->accept(this); return; case /* ^G */ '\007': case /* Esc */ '\033': f.action_->cancel(this); return; default: ; } } f.editor_->keystroke(e); } InputHandler* FieldEditor::focus_in() { FieldEditorImpl& f = *impl_; f.editor_->readOnly(false); return InputHandler::focus_in(); } void FieldEditor::focus_out() { FieldEditorImpl& f = *impl_; f.editor_->readOnly(true); InputHandler::focus_out(); } void FieldEditor::field(const char* str) { String s(str); field(s); } void FieldEditor::field(const String& s) { String old(impl_->editor_->value()); impl_->editor_->region(0, 0, 0, old.length()); impl_->editor_->cut(); impl_->editor_->paste(s.string(), s.length()); } void FieldEditor::select(int pos) { select(pos, pos); } void FieldEditor::select(int l, int r) { impl_->editor_->region(0, l, 0, r); // impl_->editor_->location(0, r); impl_->editor_->location(0, l); } void FieldEditor::edit() { impl_->editor_->reset(); } void FieldEditor::edit(const char* str, int left, int right) { field(str); select(left, right); } void FieldEditor::edit(const String& str, int left, int right) { field(str); select(left, right); } const String* FieldEditor::text() const { impl_->text_ = impl_->editor_->value(); return &impl_->text_; } /** class FieldEditorAction **/ FieldEditorAction::FieldEditorAction() { } FieldEditorAction::~FieldEditorAction() { } void FieldEditorAction::accept(FieldEditor*) { } void FieldEditorAction::cancel(FieldEditor*) { } #endif neuron-7.6.3/src/lib/InterViews/geometry.cpp000066400000000000000000000176451340731477100210540ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include #include #include #include Requirement::Requirement( Coord natural_lead, Coord max_lead, Coord min_lead, Coord natural_trail, Coord max_trail, Coord min_trail ) { natural_lead = Math::max(min_lead, Math::min(max_lead, natural_lead)); max_lead = Math::max(max_lead, natural_lead); min_lead = Math::min(min_lead, natural_lead); natural_trail = Math::max(min_trail, Math::min(max_trail, natural_trail)); max_trail = Math::max(max_trail, natural_trail); min_trail = Math::min(min_trail, natural_trail); natural_ = natural_lead + natural_trail; if (natural_lead == 0) { shrink_ = natural_trail - min_trail; stretch_ = max_trail - natural_trail; alignment_ = 0; } else if (natural_trail == 0) { shrink_ = natural_lead - min_lead; stretch_ = max_lead - natural_lead; alignment_ = 1; } else { float fshrink = Math::max( float(min_lead)/float(natural_lead), float(min_trail)/float(natural_trail) ); shrink_ = Coord(natural_ * (1 - fshrink)); float fstretch = Math::min( float(max_lead)/float(natural_lead), float(max_trail)/float(natural_trail) ); stretch_ = Coord(natural_ * (fstretch - 1)); if (natural_ == 0) { alignment_ = 0; } else { alignment_ = float(natural_lead) / float(natural_); } } } bool Requirement::equals(const Requirement& r, float epsilon) const { if (!Math::equal(natural_, r.natural_, epsilon)) { return false; } else if (!Math::equal(stretch_, r.stretch_, epsilon)) { return false; } else if (!Math::equal(shrink_, r.shrink_, epsilon)) { return false; } else if (!Math::equal(alignment_, r.alignment_, epsilon)) { return false; } else { return true; } } /* hack to persuade cfront to inline both subobject constructors */ Requisition::Requisition() : x_(), y_(-fil) { penalty_ = PenaltyBad; } Requisition::Requisition(const Requisition& r) : x_(r.x_), y_(r.y_) { penalty_ = r.penalty_; } bool Requisition::equals(const Requisition& r, float epsilon) const { return x_.equals(r.x_, epsilon) && y_.equals(r.y_, epsilon); } void Requisition::require(DimensionName n, const Requirement& r) { switch (n) { case Dimension_X: x_ = r; break; case Dimension_Y: y_ = r; break; } } static Requirement* empty_requirement; Requirement& Requisition::requirement(DimensionName n) { switch (n) { case Dimension_X: return x_; case Dimension_Y: return y_; } if (empty_requirement == nil) { empty_requirement = new Requirement; } return *empty_requirement; } const Requirement& Requisition::requirement(DimensionName n) const { switch (n) { case Dimension_X: return x_; case Dimension_Y: return y_; } if (empty_requirement == nil) { empty_requirement = new Requirement; } return *empty_requirement; } bool Allotment::equals(const Allotment& a, float epsilon) const { if (!Math::equal(origin_, a.origin_, epsilon)) { return false; } else if (!Math::equal(span_, a.span_, epsilon)) { return false; } else if (!Math::equal(alignment_, a.alignment_, epsilon)) { return false; } return true; } /* hack to persuade cfront to inline both subobject constructors */ Allocation::Allocation() : x_(), y_(0, 0, 0) { } Allocation::Allocation(const Allocation& a) : x_(a.x_), y_(a.y_) { } void Allocation::allot(DimensionName n, const Allotment& a) { if (n == Dimension_X) { x_ = a; } else if (n == Dimension_Y) { y_ = a; } } static Allotment* empty_allotment; Allotment& Allocation::allotment(DimensionName n) { if (n == Dimension_X) { return x_; } else if (n == Dimension_Y) { return y_; } if (empty_allotment == nil) { empty_allotment = new Allotment; } return *empty_allotment; } const Allotment& Allocation::allotment(DimensionName n) const { if (n == Dimension_X) { return x_; } else if (n == Dimension_Y) { return y_; } if (empty_allotment == nil) { empty_allotment = new Allotment; } return *empty_allotment; } bool Allocation::equals(const Allocation& a, float epsilon) const { return x_.equals(a.x_, epsilon) && y_.equals(a.y_, epsilon); } Extension::Extension() { const Coord zero = 0; x_begin_ = zero; x_end_ = zero; y_begin_ = zero; y_end_ = zero; } Extension::Extension(const Extension& ext) { x_begin_ = ext.x_begin_; x_end_ = ext.x_end_; y_begin_ = ext.y_begin_; y_end_ = ext.y_end_; } void Extension::operator =(const Extension& ext) { x_begin_ = ext.x_begin_; x_end_ = ext.x_end_; y_begin_ = ext.y_begin_; y_end_ = ext.y_end_; } void Extension::transform_xy( Canvas* c, Coord& left, Coord& bottom, Coord& right, Coord& top ) { if (c != nil) { const Transformer& t = c->transformer(); if (!t.identity()) { Coord x1, y1, x2, y2, x3, y3, x4, y4; t.transform(left, bottom, x1, y1); t.transform(left, top, x2, y2); t.transform(right, top, x3, y3); t.transform(right, bottom, x4, y4); left = Math::min(x1, x2, x3, x4); bottom = Math::min(y1, y2, y3, y4); right = Math::max(x1, x2, x3, x4); top = Math::max(y1, y2, y3, y4); } } } void Extension::set(Canvas* c, const Allocation& a) { set_xy(c, a.left(), a.bottom(), a.right(), a.top()); } void Extension::set_xy(Canvas* c, Coord l, Coord b, Coord r, Coord t) { Coord left = l; Coord bottom = b; Coord right = r; Coord top = t; transform_xy(c, left, bottom, right, top); x_begin_ = left; x_end_ = right; y_begin_ = bottom; y_end_ = top; } void Extension::clear() { x_begin_ = fil; x_end_ = -fil; y_begin_ = fil; y_end_ = -fil; } void Extension::merge(const Extension& ext) { x_begin_ = Math::min(x_begin_, ext.x_begin_); x_end_ = Math::max(x_end_, ext.x_end_); y_begin_ = Math::min(y_begin_, ext.y_begin_); y_end_ = Math::max(y_end_, ext.y_end_); } void Extension::merge(Canvas* c, const Allocation& a) { merge_xy(c, a.left(), a.bottom(), a.right(), a.top()); } void Extension::merge_xy(Canvas* c, Coord l, Coord b, Coord r, Coord t) { Coord left = l; Coord bottom = b; Coord right = r; Coord top = t; transform_xy(c, left, bottom, right, top); x_begin_ = Math::min(x_begin_, left); x_end_ = Math::max(x_end_, right); y_begin_ = Math::min(y_begin_, bottom); y_end_ = Math::max(y_end_, top); } neuron-7.6.3/src/lib/InterViews/glyph.cpp000077500000000000000000000051551340731477100203400ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Glyph - visible data */ #include #include #include Glyph::Glyph() { } Glyph::~Glyph() { } void Glyph::request(Requisition&) const { } void Glyph::allocate(Canvas*, const Allocation&, Extension&) { } void Glyph::draw(Canvas*, const Allocation&) const { } void Glyph::print(Printer* p, const Allocation& a) const { draw(p, a); } void Glyph::pick(Canvas*, const Allocation& a, int depth, Hit& h) { Coord x = h.left(); Coord y = h.bottom(); if (x >= a.left() && x < a.right() && y >= a.bottom() && y < a.top()) { h.target(depth, this, 0); } } void Glyph::undraw() { GlyphIndex n = count(); for (GlyphIndex i = 0; i < n; i++) { Glyph* g = component(i); if (g != nil) { g->undraw(); } } } Glyph* Glyph::clone() const { return nil; } Glyph* Glyph::compose(GlyphBreakType b) { return (b == no_break || b == pre_break) ? this : nil; } void Glyph::append(Glyph*) { } void Glyph::prepend(Glyph*) { } void Glyph::insert(GlyphIndex, Glyph*) { } void Glyph::remove(GlyphIndex) { } void Glyph::replace(GlyphIndex, Glyph*) { } void Glyph::change(GlyphIndex) { } GlyphIndex Glyph::count() const { return 0; } Glyph* Glyph::component(GlyphIndex) const { return nil; } void Glyph::allotment(GlyphIndex, DimensionName, Allotment& a) const { Allotment def; a = def; } neuron-7.6.3/src/lib/InterViews/group.cpp000077500000000000000000000056461340731477100203560ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include implementList(GlyphIndexList,GlyphIndex); Group::Group(Aggregate* aggregate, DimensionName dimension) { aggregate_ = aggregate; if (aggregate_ != nil) { aggregate_->ref(); } dimension_ = dimension; layout_ = new Align(dimension); count_ = 0; } Group::~Group() { if (aggregate_ != nil) { aggregate_->unref(); } delete layout_; } void Group::map(GlyphIndex index) { map_.append(index); ++count_; } void Group::request(Requisition& requisition) const { if (aggregate_ != nil) { Requisition* r = new Requisition[count_]; for (int i = 0; i < count_; ++i) { Glyph* g = aggregate_->component(map_.item(i)); if (g != nil) { g->request(r[i]); } } layout_->request(count_, r, requisition); delete [] r; } } void Group::allocate(Canvas*, const Allocation& allocation, Extension&) { if (aggregate_ != nil) { Requisition* requisitions = new Requisition[count_]; int i; for (i = 0; i < count_; ++i) { Glyph* g = aggregate_->component(map_.item(i)); if (g != nil) { g->request(requisitions[i]); } } Allocation* allocations = new Allocation[count_]; layout_->allocate(allocation, count_, requisitions, allocations); for (i = 0; i < count_; ++i) { aggregate_->allot( map_.item(i), dimension_, allocations[i].allotment(dimension_) ); } delete [] allocations; delete [] requisitions; } } neuron-7.6.3/src/lib/InterViews/handler.cpp000077500000000000000000000025351340731477100206310ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Handler - event handler */ #include Handler::Handler() { } Handler::~Handler() { } neuron-7.6.3/src/lib/InterViews/hit.cpp000066400000000000000000000256271340731477100200040ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Hit detection */ #include #include #include #include #include #include struct HitTarget { Glyph* glyph_; GlyphIndex index_; Handler* handler_; }; static const int HitTargetList_fixed = 20; struct HitTargetList { int avail_; int used_; HitTarget* targets_; HitTarget fixed_targets_[HitTargetList_fixed]; }; static const int HitList_fixed = 5; struct HitList { int avail_; int used_; HitTargetList* lists_; HitTargetList fixed_lists_[HitList_fixed]; }; struct PossibleHitTarget { bool picked_; GlyphIndex count_; int depth_; HitTarget item_; }; static const int HitStack_fixed = 25; struct HitStack { int avail_; int used_; PossibleHitTarget* possible_targets_; PossibleHitTarget fixed_possible_targets_[HitStack_fixed]; }; struct HitTargetArea { Coord left; Coord bottom; Coord right; Coord top; }; static const int HitTargetAreaList_fixed = 25; struct HitTargetAreaList { int avail_; int used_; HitTargetArea* areas_; HitTargetArea fixed_areas_[HitTargetAreaList_fixed]; }; class HitImpl { private: friend class Hit; void init(Coord x1, Coord y1, Coord x2, Coord y2); void hfree(); void add_item( bool override, int depth, Glyph*, GlyphIndex, Handler*, GlyphIndex target ); HitTarget& item(int depth, GlyphIndex); HitTargetArea& area(); const Event* event_; Handler* default_handler_; int default_handler_depth_; HitList items_; HitStack picks_; HitTargetAreaList areas_; }; void HitImpl::init(Coord x1, Coord y1, Coord x2, Coord y2) { event_ = nil; default_handler_ = nil; items_.avail_ = HitList_fixed; items_.used_ = 0; items_.lists_ = items_.fixed_lists_; picks_.avail_ = HitStack_fixed; picks_.used_ = 0; picks_.possible_targets_ = picks_.fixed_possible_targets_; areas_.avail_ = HitTargetAreaList_fixed; areas_.used_ = 1; areas_.areas_ = areas_.fixed_areas_; HitTargetArea& a = areas_.areas_[0]; a.left = x1; a.bottom = y1; a.right = x2; a.top = y2; } void HitImpl::hfree() { for (int i = 0; i < items_.used_; i++) { HitTargetList& list = items_.lists_[i]; if (list.targets_ != list.fixed_targets_) { delete [] list.targets_; } } if (items_.lists_ != items_.fixed_lists_) { delete [] items_.lists_; } if (picks_.possible_targets_ != picks_.fixed_possible_targets_) { delete [] picks_.possible_targets_; } if (areas_.areas_ != areas_.fixed_areas_) { delete [] areas_.areas_; } } Hit::Hit(const Event* e) { init(); Coord x = e->pointer_x(); Coord y = e->pointer_y(); impl_->init(x, y, x, y); impl_->event_ = e; } Hit::Hit(Coord x, Coord y) { init(); impl_->init(x, y, x, y); } Hit::Hit(Coord left, Coord bottom, Coord right, Coord top) { init(); impl_->init(left, bottom, right, top); } Hit::Hit(HitImpl* h) { impl_ = h; } Hit::~Hit() { impl_->hfree(); if (impl_ != (HitImpl*)free_store_) { delete impl_; } } void Hit::init() { if (sizeof(HitImpl) <= sizeof(free_store_)) { impl_ = (HitImpl*)free_store_; } else { impl_ = new HitImpl; } } const Event* Hit::event() const { return impl_->event_; } Coord Hit::left() const { return impl_->area().left; } Coord Hit::bottom() const { return impl_->area().bottom; } Coord Hit::right() const { return impl_->area().right; } Coord Hit::top() const { return impl_->area().top; } void Hit::push_transform() { HitTargetAreaList& s = impl_->areas_; if (s.used_ >= s.avail_) { int new_avail = s.avail_ << 1; HitTargetArea* new_areas = new HitTargetArea[new_avail]; Memory::copy(s.areas_, new_areas, s.used_ * sizeof(HitTargetArea)); if (s.areas_ != s.fixed_areas_) { delete [] s.areas_; } s.areas_ = new_areas; s.avail_ = new_avail; } s.areas_[s.used_] = s.areas_[s.used_ - 1]; s.used_ += 1; } void Hit::transform(const Transformer& t) { HitTargetArea& a = impl_->area(); Coord x1, y1, x2, y2, x3, y3, x4, y4; t.inverse_transform(a.left, a.bottom, x1, y1); t.inverse_transform(a.left, a.top, x2, y2); t.inverse_transform(a.right, a.top, x3, y3); t.inverse_transform(a.right, a.bottom, x4, y4); a.left = Math::min(x1, x2, x3, x4); a.bottom = Math::min(y1, y2, y3, y4); a.right = Math::max(x1, x2, x3, x4); a.top = Math::max(y1, y2, y3, y4); } void Hit::pop_transform() { HitTargetAreaList& s = impl_->areas_; if (s.used_ != 0) { s.used_ -= 1; } } void Hit::begin(int depth, Glyph* target, GlyphIndex index, Handler* h) { HitStack& s = impl_->picks_; if (s.used_ >= s.avail_) { int new_avail = s.avail_ << 1; PossibleHitTarget* new_possible = new PossibleHitTarget[new_avail]; Memory::copy( s.possible_targets_, new_possible, s.used_ * sizeof(PossibleHitTarget) ); if (s.possible_targets_ != s.fixed_possible_targets_) { delete [] s.possible_targets_; } s.possible_targets_ = new_possible; s.avail_ = new_avail; } PossibleHitTarget& p = s.possible_targets_[s.used_]; p.picked_ = false; p.count_ = impl_->items_.used_; p.depth_ = depth; p.item_.glyph_ = target; p.item_.index_ = index; p.item_.handler_ = h; s.used_ += 1; } void Hit::target(int depth, Glyph* target, GlyphIndex index, Handler* h) { HitStack& stk = impl_->picks_; long top = stk.used_ - 1; if (top >= 0) { stk.possible_targets_[top].picked_ = true; } HitList& i = impl_->items_; if (i.used_ >= i.avail_) { int new_avail = i.avail_ << 1; HitTargetList* new_lists = new HitTargetList[new_avail]; for (int e = 0; e < i.used_; e++) { HitTargetList& t_old = i.lists_[e]; HitTargetList& t_new = new_lists[e]; t_new.avail_ = t_old.avail_; t_new.used_ = t_old.used_; if (t_old.targets_ == t_old.fixed_targets_) { t_new.targets_ = t_new.fixed_targets_; Memory::copy( t_old.fixed_targets_, t_new.fixed_targets_, sizeof(t_new.fixed_targets_) ); } else { t_new.targets_ = t_old.targets_; } } if (i.lists_ != i.fixed_lists_) { delete [] i.lists_; } i.lists_ = new_lists; i.avail_ = new_avail; } HitTargetList& t = i.lists_[i.used_]; t.avail_ = HitTargetList_fixed; t.used_ = -1; t.targets_ = t.fixed_targets_; for (HitTarget* ht = t.targets_; ht < &t.targets_[t.avail_]; ht++) { ht->glyph_ = nil; } i.used_ += 1; impl_->add_item(false, depth, target, index, h, 0); } void Hit::end() { HitStack& stk = impl_->picks_; int top = stk.used_ - 1; if (top >= 0) { const PossibleHitTarget& p = stk.possible_targets_[top]; if (p.picked_) { GlyphIndex new_targets = impl_->items_.used_ - p.count_; for (int i = 0; i < new_targets; i++) { impl_->add_item( false, p.depth_, p.item_.glyph_, p.item_.index_, p.item_.handler_, i ); } if (top > 0) { stk.possible_targets_[top - 1].picked_ = true; } } stk.used_ = top; } } void Hit::remove(int depth, GlyphIndex target) { if (target < 0 || target >= impl_->items_.used_) { ListImpl_range_error(target); } HitTargetList& list = impl_->items_.lists_[target]; for (int i = depth + 1; i <= list.used_; i++) { list.targets_[i - 1] = list.targets_[i]; } list.used_ -= 1; if (list.targets_[depth].handler_ == impl_->default_handler_) { impl_->default_handler_depth_ = depth; } } void Hit::retarget( int depth, Glyph* g, GlyphIndex i, Handler* h, GlyphIndex target ) { impl_->add_item(true, depth, g, i, h, target); } bool Hit::any() const { return impl_->items_.used_ != 0; } int Hit::count() const { return impl_->items_.used_; } int Hit::depth(GlyphIndex target) const { if (target < 0 || target >= impl_->items_.used_) { ListImpl_range_error(target); } return impl_->items_.lists_[target].used_; } Glyph* Hit::target(int depth, GlyphIndex target) const { return impl_->item(depth, target).glyph_; } GlyphIndex Hit::index(int depth, GlyphIndex target) const { return impl_->item(depth, target).index_; } Handler* Hit::handler() const { return impl_->default_handler_; } /* * Add an item to the current hit list. Use the depth * to place it appropriately. */ void HitImpl::add_item( bool override, int depth, Glyph* g, GlyphIndex i, Handler* h, GlyphIndex target ) { HitTarget& t = item(depth, target); if (override || t.glyph_ == nil) { t.glyph_ = g; t.index_ = i; t.handler_ = h; } if (h != nil && (default_handler_ == nil || depth >= default_handler_depth_) ) { default_handler_ = h; default_handler_depth_ = depth; } } /* * The way we specify targets is the opposite of how we store them: * "item(depth, 0)" is the most recently targetted item at that depth. * So, we use "used_ - 1 - t" as the appropriate target index. */ HitTarget& HitImpl::item(int depth, GlyphIndex t) { if (t < 0 || t >= items_.used_) { ListImpl_range_error(t); } GlyphIndex target = items_.used_ - 1 - t; HitTargetList& list = items_.lists_[target]; if (depth >= list.avail_) { int new_avail = depth + HitTargetList_fixed; HitTarget* new_targets = new HitTarget[new_avail]; Memory::copy( list.targets_, new_targets, (list.used_ + 1) * sizeof(HitTarget) ); if (list.targets_ != list.fixed_targets_) { delete [] list.targets_; } HitTarget* i; for (i = &new_targets[list.avail_]; i < &new_targets[new_avail]; i++) { i->glyph_ = nil; } list.avail_ = new_avail; list.targets_ = new_targets; } if (depth > list.used_) { list.used_ = depth; } return list.targets_[depth]; } HitTargetArea& HitImpl::area() { HitTargetAreaList& s = areas_; return s.areas_[s.used_ - 1]; } neuron-7.6.3/src/lib/InterViews/image.cpp000077500000000000000000000051111340731477100202670ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Image - displays a Raster */ #include #include #include Image::Image(const Raster* raster) : Glyph() { raster_ = raster; if (raster_ != nil) { raster_->ref(); } } Image::~Image() { if (raster_ != nil) { raster_->unref(); raster_ = nil; } } void Image::request(Requisition& requisition) const { if (raster_ != nil) { Coord left_bearing = raster_->left_bearing(); Coord right_bearing = raster_->right_bearing(); Coord ascent = raster_->ascent(); Coord descent = raster_->descent(); Requirement rx( left_bearing, left_bearing, left_bearing, right_bearing, right_bearing, right_bearing ); Requirement ry( descent, descent, descent, ascent, ascent, ascent ); requisition.require(Dimension_X, rx); requisition.require(Dimension_Y, ry); } } void Image::allocate(Canvas* c, const Allocation& a, Extension& ext) { if (raster_ != nil) { Coord x = a.x(); Coord y = a.y(); ext.set_xy( c, x - raster_->left_bearing(), y - raster_->descent(), x + raster_->right_bearing(), y + raster_->ascent() ); } } void Image::draw(Canvas* c, const Allocation& a) const { if (raster_ != nil) { c->image(raster_, a.x(), a.y()); } } neuron-7.6.3/src/lib/InterViews/input.cpp000066400000000000000000000327171340731477100203550ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * InputHandler - glyph that handles input */ #include #include #include #include #include #include #include #include #include #include #include declarePtrList(InputHandlerList,InputHandler) implementPtrList(InputHandlerList,InputHandler) class InputHandlerImpl : public Handler { private: friend class InputHandler; InputHandlerImpl(InputHandler*, Style*); virtual ~InputHandlerImpl(); InputHandler* input_; Style* style_; InputHandlerList children_; GlyphIndex focus_item_; InputHandler* focus_handler_; InputHandler* parent_; AllocationTable* allocations_; bool pressed_ : 1; bool recorded_time_ : 1; EventButton button_; unsigned long click_time_; virtual bool event(Event&); AllocationInfo& info(Canvas*, const Allocation&); AllocationInfo* most_recent_info(); void reset(); void down(Event&); void motion(Event&); void up(Event&); bool inside(const Event&, const AllocationInfo&, bool hit_check = true); static unsigned long threshold_; }; unsigned long InputHandlerImpl::threshold_ = 0; InputHandler::InputHandler(Glyph* g, Style* s) : MonoGlyph(g) { impl_ = new InputHandlerImpl(this, s); Resource::ref(impl_); } InputHandler::~InputHandler() { #if defined(WIN32) || MAC // // The 3.1 distribution tried to ensure that the handler was removed fr$ // the handler list before destruction... but it was dereferencing a // canvas that had already been free'd which occasionally resulted in an // access violation. The undraw() function should take care of this... // so the ungrab code has been removed. // #else AllocationInfo* info = impl_->most_recent_info(); if (info != nil) { info->canvas()->window()->display()->ungrab(impl_, true); } #endif Resource::unref(impl_); } Handler* InputHandler::handler() const { return impl_; } InputHandler* InputHandler::parent() const { return impl_->parent_; } Style* InputHandler::style() const { return impl_->style_; } void InputHandler::append_input_handler(InputHandler* h) { if (h != nil) { impl_->children_.append(h); h->impl_->parent_ = this; } } void InputHandler::remove_input_handler(GlyphIndex index) { InputHandlerImpl& i = *impl_; InputHandlerList& list = i.children_; if (list.item(index) == i.focus_handler_) { next_focus(); if (list.item(index) == i.focus_handler_) { i.focus_handler_ = nil; } } list.remove(index); } void InputHandler::remove_all_input_handlers() { InputHandlerImpl& i = *impl_; i.children_.remove_all(); i.focus_handler_ = nil; } GlyphIndex InputHandler::input_handler_count() const { return impl_->children_.count(); } InputHandler* InputHandler::input_handler(GlyphIndex index) const { return impl_->children_.item(index); } void InputHandler::focus(InputHandler* h) { InputHandlerImpl& i = *impl_; GlyphIndex n = i.children_.count(); for (GlyphIndex g = 0; g < n; g++) { if (i.children_.item(g) == h) { if (i.focus_handler_ != nil) { i.focus_handler_->focus_out(); } i.focus_item_ = g; i.focus_handler_ = h->focus_in(); break; } } } void InputHandler::next_focus() { InputHandlerImpl& i = *impl_; if (i.focus_handler_ != nil) { i.focus_handler_->focus_out(); } GlyphIndex n = i.children_.count(); GlyphIndex f = i.focus_item_ + 1; if (f >= n) { if (i.parent_ != nil) { i.parent_->next_focus(); return; } else if (n == 0) { return; } else { f = 0; } } i.focus_item_ = f; i.focus_handler_ = i.children_.item(f)->focus_in(); } void InputHandler::prev_focus() { InputHandlerImpl& i = *impl_; if (i.focus_handler_ != nil) { i.focus_handler_->focus_out(); } GlyphIndex n = i.children_.count(); GlyphIndex f = i.focus_item_ - 1; if (f < 0) { if (i.parent_ != nil) { i.parent_->prev_focus(); return; } else if (n == 0) { return; } else { f = n - 1; } } i.focus_item_ = f; i.focus_handler_ = i.children_.item(f)->focus_in(); } void InputHandler::allocate(Canvas* c, const Allocation& a, Extension& ext) { AllocationInfo& info = impl_->info(c, a); ext.merge(info.extension()); allocation_changed(c, a); } void InputHandler::draw(Canvas* c, const Allocation& a) const { AllocationInfo& info = impl_->info(c, a); Glyph* g = body(); if (g != nil && c->damaged(info.extension())) { g->draw(c, a); } } void InputHandler::pick(Canvas* c, const Allocation& a, int depth, Hit& h) { AllocationInfo& info = impl_->info(c, a); const Event* e = h.event(); EventType t = (e == nil) ? Event::undefined : e->type(); switch (t) { case Event::key: #if defined(WIN32) || MAC if (e && impl_->inside(*e, info, false)) { #else if (e && impl_->inside(*e, info)) { #endif InputHandler* ih = impl_->focus_handler_; InputHandlerImpl* handler = (ih == nil) ? impl_ : ih->impl_; h.target(depth, this, 0, handler); } break; case Event::undefined: case Event::other_event: MonoGlyph::pick(c, a, depth, h); break; default: h.begin(depth, this, 0, impl_); MonoGlyph::pick(c, a, depth, h); h.end(); break; } } void InputHandler::undraw() { MonoGlyph::undraw(); AllocationTable* table = impl_->allocations_; if (table != nil) { AllocationInfo* info = impl_->most_recent_info(); if (info != nil) { Window* w = info->canvas()->window(); if (w != nil) { w->display()->ungrab(impl_, true); } } table->flush(); } } Canvas* InputHandler::canvas() const { AllocationInfo* info = impl_->most_recent_info(); return info == nil ? nil : info->canvas(); } const Transformer& InputHandler::transformer() const { return impl_->most_recent_info()->transformer(); } const Allocation& InputHandler::allocation() const { return impl_->most_recent_info()->allocation(); } void InputHandler::redraw() const { InputHandlerImpl& i = *impl_; AllocationInfo* info = i.most_recent_info(); if (info != nil) { info->canvas()->damage(info->extension()); } } void InputHandler::repick(int depth, Hit& h) { Canvas* c = canvas(); if (c != nil) { const Transformer& t = transformer(); c->push_transform(); c->transformer(t); h.push_transform(); h.transform(t); pick(c, allocation(), depth, h); h.pop_transform(); c->pop_transform(); } } void InputHandler::move(const Event&) { } void InputHandler::press(const Event&) { } void InputHandler::drag(const Event&) { } void InputHandler::release(const Event&) { } void InputHandler::keystroke(const Event& e) { InputHandlerImpl& i = *impl_; if (i.focus_item_ != -1) { i.focus_handler_->keystroke(e); } } void InputHandler::double_click(const Event&) { } InputHandler* InputHandler::focus_in() { return this; } void InputHandler::focus_out() { } void InputHandler::allocation_changed(Canvas*, const Allocation&) { } bool InputHandler::inside(const Event& e) { InputHandlerImpl& i = *impl_; AllocationInfo* info = i.most_recent_info(); return info != nil && i.inside(e, *info); } /* class InputHandlerImpl */ InputHandlerImpl::InputHandlerImpl(InputHandler* h, Style* s) { input_ = h; Resource::ref(s); style_ = s; parent_ = nil; allocations_ = nil; focus_item_ = -1; focus_handler_ = nil; reset(); if (threshold_ == 0) { #if MAC && !carbon long t = 25; #else long t = 250; #endif // Note: for Carbon should use GetDblTime to define the double click interval #if carbon if (!s->find_attribute("clickDelay", t)) { t = GetDblTime()*10; } //printf("double click delay (ms) %d\n", t); #else s->find_attribute("clickDelay", t); #endif threshold_ = t; } } InputHandlerImpl::~InputHandlerImpl() { Resource::unref(style_); delete allocations_; } AllocationInfo& InputHandlerImpl::info(Canvas* c, const Allocation& a) { if (allocations_ == nil) { allocations_ = new AllocationTable(0, 1); } AllocationInfo* info = allocations_->find(c, a); if (info == nil) { /* * The need for this code is unfortunate. * The problem is that an input handler needs to ensure * that it ungrabs if a canvas/window is replaced * from the allocation table. Perhaps there should be * a general-purpose interface for this from allocation table, * but for now we know InputHandler only keeps a single allocation. * So, before allocating a new one we check to see if there is * an old one that has a valid window. Then we do the ungrab. * If we didn't do anything about the ungrab, then handler * might stay grabbed even when we forgot about the window. */ AllocationInfo* old_info = allocations_->most_recent(); if (old_info != nil) { Canvas* old_c = old_info->canvas(); if (old_c != nil) { Window* old_w = old_c->window(); if (old_w != nil && old_w != c->window()) { old_w->display()->ungrab(this, true); } } } info = allocations_->allocate(c, a); Extension ext; ext.clear(); input_->MonoGlyph::allocate(c, a, ext); info->extension(ext); } return *info; } AllocationInfo* InputHandlerImpl::most_recent_info() { AllocationTable* a = allocations_; if (a != nil) { AllocationInfo* info = a->most_recent(); if (info != nil && info->canvas() != nil) { return info; } } return nil; } void InputHandlerImpl::reset() { pressed_ = false; recorded_time_ = false; } bool InputHandlerImpl::event(Event& e) { bool handled = true; switch (e.type()) { case Event::down: down(e); break; case Event::motion: motion(e); break; case Event::up: up(e); break; case Event::key: input_->keystroke(e); break; default: /* ignore */ break; } return handled; } void InputHandlerImpl::down(Event& e) { if (!pressed_) { pressed_ = true; button_ = e.pointer_button(); e.grab(this); #if defined(WIN32) || MAC e.window()->grab_pointer(); #endif if (parent_ != nil) { parent_->focus(input_); } else { if (focus_handler_ != input_) { if (focus_handler_ != nil) { focus_handler_->focus_out(); focus_item_ = -1; } focus_handler_ = input_->focus_in(); } } input_->press(e); } } void InputHandlerImpl::motion(Event& e) { if (pressed_) { input_->drag(e); } else { input_->move(e); } } void InputHandlerImpl::up(Event& e) { #if carbon extern bool session_deactivating_; if (session_deactivating_) { input_->release(e); return; } #endif if (pressed_ && e.pointer_button() == button_) { pressed_ = false; e.ungrab(this); #if defined(WIN32) || (MAC && !carbon) e.window()->ungrab_pointer(); #endif input_->release(e); unsigned long t = e.time(); if (recorded_time_ && t - click_time_ < threshold_) { input_->double_click(e); } click_time_ = t; recorded_time_ = true; } } bool InputHandlerImpl::inside( const Event& event, const AllocationInfo& info, bool hit_check ) { Coord x = event.pointer_x(); Coord y = event.pointer_y(); Canvas* c = info.canvas(); Window* w = c->window(); if (w == nil || w != event.window()) { return false; } const Extension& e = info.extension(); if (x < e.right() && x >= e.left() && y < e.top() && y >= e.bottom()) { if (! hit_check) { return true; } const Transformer& t = info.transformer(); Hit hit(&event); hit.transform(t); c->push_transform(); c->transformer(t); input_->MonoGlyph::pick(c, info.allocation(), 0, hit); c->pop_transform(); if (hit.any()) { return true; } } return false; } /* class ActiveHandler */ ActiveHandler::ActiveHandler(Glyph* g, Style* s) : InputHandler(g, s) { inside_ = false; } ActiveHandler::~ActiveHandler() { } void ActiveHandler::undraw() { if (inside_) { inside_ = false; leave(); } InputHandler::undraw(); } void ActiveHandler::move(const Event& e) { Handler* h = handler(); if (e.handler() == h) { if (!inside_) { inside_ = true; e.grab(h); enter(); } } else if (inside_) { inside_ = false; leave(); e.ungrab(h); } } void ActiveHandler::drag(const Event& e) { move(e); } void ActiveHandler::enter() { } void ActiveHandler::leave() { } neuron-7.6.3/src/lib/InterViews/iv3text.cpp000066400000000000000000001070551340731477100206220ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Redwood Design Automation * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the name of * Redwood Design Automation may not be used in any advertising or publicity * relating to the software without the specific, prior written permission of * Redwood Design Automation. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL REDWOOD DESIGN AUTOMATION BE LIABLE FOR ANY SPECIAL, * INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT * ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ // ======================================================================= // // Reworked to use InterViews classes instead of the Redwood utility // classes. // // 1.3 // 1998/08/16 19:33:28 // // InterViews Port to the Windows 3.1/NT operating systems // Copyright (c) 1993 Tim Prinzing // // Permission to use, copy, modify, distribute, and sell this software and // its documentation for any purpose is hereby granted without fee, provided // that (i) the above copyright notice and this permission notice appear in // all copies of the software and related documentation, and (ii) the name of // Tim Prinzing may not be used in any advertising or publicity relating to // the software without the specific, prior written permission of Tim Prinzing. // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL Tim Prinzing BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // // ======================================================================= #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include implementActionCallback(Text); implementPtrList(TextAnnotationArray,TextAnnotation) implementPtrList(TextActionArray,Action) ///////////////////// // Text Annotation // ///////////////////// TextAnnotation::TextAnnotation() { } TextAnnotation::~TextAnnotation() { } void TextAnnotation::execute() { } ///////////////// // Text Region // ///////////////// TextRegion::TextRegion() { line1_ = 0; column1_ = 0; line2_ = 0; column2_ = 0; WidgetKit* kit = WidgetKit::instance(); Style* style = kit->style(); String gui("monochrome"); if (gui == kit->gui()) { color_ = new Color(*kit->foreground(), 0.25); } else { color_ = new Color(.7, .8, 1, 1); } Resource::ref(color_); } TextRegion::~TextRegion() { Resource::unref(color_); color_ = 0; } void TextRegion::line1(unsigned line1) { line1_ = line1; } unsigned TextRegion::line1() const { return line1_; } void TextRegion::column1(unsigned column1) { column1_ = column1; } unsigned TextRegion::column1() const { return column1_; } void TextRegion::line2(unsigned line2) { line2_ = line2; } unsigned TextRegion::line2() const { return line2_; } void TextRegion::column2(unsigned column2) { column2_ = column2; } unsigned TextRegion::column2() const { return column2_; } void TextRegion::color(const Color* color) { Resource::unref(color_); color_ = (Color*)color; Resource::ref(color_); } const Color* TextRegion::color() const { return color_; } TextRegion::TextRegion(const TextRegion& region) { line1_ = region.line1_; column1_ = region.column1_; line2_ = region.line2_; column2_ = region.column2_; Resource::ref(region.color_); color_ = region.color_; } TextRegion& TextRegion::operator=(const TextRegion& region) { line1_ = region.line1_; column1_ = region.column1_; line2_ = region.line2_; column2_ = region.column2_; Resource::ref(region.color_); Resource::unref(color_); color_ = region.color_; return *this; } ////////////////// // Text Handler // ////////////////// class TextHandler : public Handler { public: TextHandler(Text* target); virtual bool event(Event& event); protected: Text* target_; bool pressed_; }; TextHandler::TextHandler(Text* target) { target_ = target; pressed_ = false; } bool TextHandler::event(Event& e) { bool handled = true; switch (e.type()) { case Event::down: if (!pressed_) { pressed_ = true; target_->press(e); e.grab(this); } break; case Event::motion: if (pressed_) { target_->drag(e); } break; case Event::up: if (pressed_) { pressed_ = false; e.ungrab(this); } break; case Event::key: target_->keystroke(e); break; default: /* ignore */ break; } return handled; } ////////// // Text // ////////// Text::Text(unsigned initialLines, unsigned initialColumns, TextBuffer* t) { handler_ = new TextHandler(this); Resource::ref(handler_); dirty_ = false; text_ = t; insertion_.line_ = 0; insertion_.column_ = 0; WidgetKit* kit = WidgetKit::instance(); Style* s = kit->style(); String gui("monochrome"); if (gui == kit->gui()) insertion_.color_ = new Color(*kit->foreground()); else insertion_.color_ = new Color(1, .5, .5, 1); Resource::ref(insertion_.color_); insertion_.width_ = 2; initialLines_ = Math::max(initialLines, 1u); initialColumns_ = Math::max(initialColumns, 1u); font_ = kit->font(); Resource::ref(font_); textColor_ = new Color(*kit->foreground()); Resource::ref(textColor_); readOnly_ = false; canvas_ = 0; allocation_ = 0; curLowerX_ = 0; curUpperX_ = 0; curLowerY_ = 0; curUpperY_ = 0; textBuffer_ = 0; needWidth_ = false; width_ = 0; ctl_pn_col_ = -1; escape_ = 10; } Text::~Text() { Resource::unref(handler_); Resource::unref(insertion_.color_); Resource::unref(font_); Resource::unref(textColor_); delete text_; } Handler* Text::handler() { return handler_; } void Text::pick(Canvas*, const Allocation&, int depth, Hit& h) { const Event* e = h.event(); EventButton t = (e == nil) ? Event::none : e->pointer_button(); EventType t1 = (e == nil) ? Event::undefined : e->type(); if (t == Event::left || t == Event::right || t == Event::middle || t1 == Event::key) { Coord x = e->pointer_x(); Coord y = e->pointer_y(); Allocation* a = allocation_; if (x >= a->left() && x <= a->right() && y >= a->bottom() && y <= a->top()) { h.target(depth, this, 0, handler()); } } } inline Coord Text::width(char ch) const { return ch == '\t' ? font_->width(' ') * 8 : font_->width(ch); } Coord Text::width(const String& line) const { Coord lineTotal = 0; for (unsigned j = 0; j < line.length(); ++j) { lineTotal += width(line[j]); } return lineTotal; } Coord Text::width() const { if (needWidth_) { Coord total = 0; for (unsigned i = 0; i < text_->Height(); ++i) { int index0 = text_->LineIndex(i); int index1 = text_->BeginningOfNextLine(index0); const String line(text_->Text(index0), index1 - index0); total = Math::max(total, width(line)); } ((Text*) this)->width_ = total; ((Text*) this)->needWidth_ = false; } return width_; } void Text::readOnly(bool readOnly) { if (readOnly_ != readOnly) { readOnly_ = readOnly; damage(insertion_); } } bool Text::readOnly() const { return readOnly_; } void Text::font(const Font* f) { Resource::ref(f); Resource::unref(font_); font_ = f; needWidth_ = true; notify_all(); damage(); } const Font* Text::font() const { return font_; } void Text::request(Requisition& requisition) const { FontBoundingBox fbb; font_->font_bbox(fbb); Requirement rx(width(' ') * initialColumns_, fil, width(' ') * (initialColumns_ - 1), 0); Requirement ry((fbb.ascent() + fbb.descent()) * initialLines_, fil, (fbb.ascent() + fbb.descent()) * (initialLines_ - 1), 0); requisition.require(Dimension_X, rx); requisition.require(Dimension_Y, ry); } void Text::allocate(Canvas* c, const Allocation& a, Extension& extension) { canvas_ = c; if (! allocation_) { allocation_ = new Allocation(a); curLowerX_ = 0; curLowerY_ = 0; } else { *allocation_ = a; } curUpperX_ = curLowerX_ + allocation_->allotment(Dimension_X).span(); curUpperY_ = curLowerY_ + allocation_->allotment(Dimension_Y).span(); extension.merge(c, a); notify_all(); } void Text::undraw() { canvas_ = nil; } Coord Text::columnCoord(const String& line, unsigned column) const { Coord x; x = allocation_->left() - curLowerX_; if (line.length()) { unsigned to = Math::min(column, unsigned(line.length())); String part = line.substr(0, to); for (unsigned i = 0; i < to; ++i) { x += width(line[i]); } if (column > line.length()) { x += font_->width(' ') * (column - line.length()); } } else { x += font_->width(' ') * column; } return x; } void Text::drawRegion(const TextRegion& region, unsigned i, Coord x, Coord y, const String& line) const { unsigned line1 = region.line1(); unsigned line2 = region.line2(); unsigned column1 = region.column1(); unsigned column2 = region.column2(); FontBoundingBox fbb; font_->font_bbox(fbb); if ((line1 == i) && (line1 == line2) && (column1 < column2)) { canvas_->fill_rect(columnCoord(line, column1), y - fbb.descent(), columnCoord(line, column2), y + fbb.ascent(), region.color()); } if ((line1 == i) && (line1 < line2)) { canvas_->fill_rect(columnCoord(line, column1), y - fbb.descent(), allocation_->right(), y + fbb.ascent(), region.color()); } if ((line1 < i) && (i < line2)) { canvas_->fill_rect(x, y - fbb.descent(), allocation_->right(), y + fbb.ascent(), region.color()); } if ((line2 == i) && (line1 < line2)) { canvas_->fill_rect(0, y - fbb.descent(), columnCoord(line, column2), y + fbb.ascent(), region.color()); } } void Text::drawLocation(const TextLocation& location, unsigned i, Coord /* x */, Coord y, const String& line) const { FontBoundingBox fbb; font_->font_bbox(fbb); if (location.line_ == i) { Coord lb = columnCoord(line, location.column_); canvas_->fill_rect(lb, y - fbb.descent(), lb + location.width_, y + fbb.ascent(), location.color_); } } void Text::drawLine(unsigned /* i */, Coord x, Coord y, const String& line) const { for (unsigned j = 0; j < line.length(); ++j) { char ch = line[j]; Coord w = width(ch); if (ch != '\t') { canvas_->character(font_, ch, w, textColor_, x, y); } x += w; } } bool Text::damaged(unsigned line) const { FontBoundingBox fbb; font_->font_bbox(fbb); Coord base = allocation_->top() + curLowerY_; Coord lineHeight = fbb.ascent() + fbb.descent(); Coord top = base - lineHeight * line; Coord bottom = base - lineHeight * (line + 1); return canvas_->damaged(allocation_->left(), Math::max(bottom, allocation_->bottom()), allocation_->right(), Math::min(top, allocation_->top())); } void Text::draw(Canvas*, const Allocation&) const { canvas_->push_clipping(); canvas_->clip_rect(allocation_->left(), allocation_->bottom(), allocation_->right(), allocation_->top()); FontBoundingBox fbb; font_->font_bbox(fbb); Coord r = curLowerY_ / (fbb.ascent() + fbb.descent()); unsigned i = unsigned(r); Coord y = allocation_->top() + (r - i) * (fbb.ascent() + fbb.descent()); unsigned max = Math::max(Math::max(selection_.line2(), insertion_.line_), (unsigned) text_->Height() ? (unsigned) text_->Height() - 1 : 0); for (; i <= max; ++i) { y -= fbb.ascent(); if (damaged(i)) { Coord x = allocation_->left() - curLowerX_; if (i < text_->Height()) { const String line = text_->getNth(i); drawRegion(selection_, i, x, y, line); if (! readOnly_) { drawLocation(insertion_, i, x, y, line); } for (GlyphIndex j = 0; j < annotation_.count(); ++j) { drawRegion(*annotation_.item(j), i, x, y, line); } drawLine(i, x, y, line); } else { String line; drawRegion(selection_, i, x, y, line); if (! readOnly_) { drawLocation(insertion_, i, x, y, line); } for (GlyphIndex j = 0; j < annotation_.count(); ++j) { drawRegion(*annotation_.item(j), i, x, y, line); } drawLine(i, x, y, line); } } y -= fbb.descent(); if (y < (allocation_->bottom() - fbb.ascent())) break; } canvas_->pop_clipping(); } bool Text::snap( const Event& event, unsigned& line, unsigned& column) const { unsigned originalLine = line; unsigned originalColumn = column; Coord x = event.pointer_x() - allocation_->left() + curLowerX_; Coord y = allocation_->top() + curLowerY_ - event.pointer_y(); FontBoundingBox fbb; font_->font_bbox(fbb); line = Math::max(int(y / (fbb.ascent() + fbb.descent())), 0); if (line < text_->Height()) { const String& string = text_->getNth(line); unsigned i; for (i = 0; i < string.length(); ++i) { x -= width(string[i]) / 2.0; if (x < 0) break; x -= width(string[i]) / 2.0; } column = i; if (i > 0 && string[i-1] == '\n') { --column; } // if (i >= string.length()) // column += (unsigned) ((x + width(' ') / 2) / width(' ')); } else if (text_->Height() > 0) { line = text_->Height()-1; column = text_->getNth(line).length(); //column = (unsigned) ((x + width(' ') / 2) / width(' ')); }else{ line = 0; column = 0; } column = Math::max(column, unsigned(0)); return (line != originalLine) || (column != originalColumn); } void Text::eraseLine() { if (insertion_.line_ < text_->Height()) { int oldWidth = text_->Width(); int index0 = text_->LineIndex(insertion_.line_); int index1 = text_->BeginningOfNextLine(index0); // ---- delete the text ---- text_->Delete(index0, index1 - index0); // --- check for width change ---- if (text_->Width() != oldWidth) { needWidth_ = true; notify_all(); } } insertion_.column_ = 0; repair(); damage(insertion_); repair(); } void Text::backspace() { if ((insertion_.column_ <= 0) && (insertion_.line_ > 0)) { --insertion_.line_; if (insertion_.line_ >= text_->Height()) { insertion_.column_ = 0; } else { // --- update insertion point --- int index = text_->LineIndex(insertion_.line_); //insertion_.column_ = text_->LineOffset(index); // ---- delete the character ---- int delIndex = text_->EndOfLine(index); insertion_.column_ = delIndex - index; text_->Delete(delIndex, 1); } needWidth_ = true; notify_all(); damage(); // !!! could only damage from insertion to end of window } else if (insertion_.column_ > 0) { int oldWidth = text_->Width(); int index = text_->LineIndex(insertion_.line_); // ---- delete the text --- text_->Delete(index + insertion_.column_ - 1, 1); --insertion_.column_; if (text_->Width() != oldWidth) { needWidth_ = true; notify_all(); } repair(); damage(insertion_); repair(); } } void Text::insertChars(const char* txt, unsigned count) { TextBuffer text(txt, count, count); // ---- insert the text info the buffer ---- text_->Insert(text_->LineIndex(insertion_.line_) + insertion_.column_, txt, count); dirty(true); if (text.Height() > 1) { TextRegion area; area.line1(insertion_.line_); area.column1(0); area.line2(insertion_.line_ + text.Height() - 1); area.column2(0); insertion_.line_ += text.Height() - 1; insertion_.column_ = 0; damage(); // !!! could only damage from insertion to end of window for (unsigned i = 0; i < text.Height(); ++i) { width_ = Math::max(width_, width(text.getNth(i))); } notify_all(); } else { TextLocation old = insertion_; insertion_.column_ += count; Coord newWidth = width(text_->getNth(insertion_.line_)); if (newWidth >= width_) { width_ = Math::max(width_, newWidth); notify_all(); } repair(); damage(old); repair(); } } void Text::context_key(char key) { // attempt to preserve column as much as possible for // a ctrl-p ctrl-n sequence if (key == 14 || key == 16) { if (ctl_pn_col_ == -1) { ctl_pn_col_ = insertion_.column_; } }else{ ctl_pn_col_ = -1; } // how many chars since last escape if (key == 033) { escape_ = 0; }else{ ++escape_; } } void Text::keystroke(const Event& event) { if (readOnly_) { return; } char buffer[8]; // needs to be dynamically adjusted int count = event.mapkey(buffer, 8); if (count <= 0) { return; } // return causes a newline if (buffer[0] == '\r') { buffer[0] = '\n'; } context_key(buffer[0]); if (buffer[0] == 2) // control-b { if (insertion_.column_ > 0) { --insertion_.column_; damage(insertion_); repair(); }else if (insertion_.line_ > 0) { damage(insertion_); --insertion_.line_; // now just like a control-e int index = text_->LineIndex(insertion_.line_); int end = text_->EndOfLine(index); insertion_.column_ = end - index; damage(insertion_); repair(); } return; } else if (buffer[0] == 1) // control-a { insertion_.column_ = 0; damage(insertion_); repair(); return; } else if (buffer[0] == 6) // control-f { int index = text_->LineIndex(insertion_.line_); int end = text_->EndOfLine(index); if (insertion_.column_ < end - index) { ++insertion_.column_; damage(insertion_); repair(); }else if (insertion_.line_ < text_->Height()-1) { damage(insertion_); ++insertion_.line_; // now just like control-a insertion_.column_ = 0; damage(insertion_); repair(); } return; } else if (buffer[0] == 5) // control-e { int index = text_->LineIndex(insertion_.line_); int end = text_->EndOfLine(index); insertion_.column_ = end - index; damage(insertion_); repair(); return; } else if (buffer[0] == 16) { // control-p if (insertion_.line_ > 0) { damage(insertion_); --insertion_.line_; insertion_.column_ = ctl_pn_col_; int index = text_->LineIndex(insertion_.line_); int col = text_->EndOfLine(index) - index; if (col < insertion_.column_){ insertion_.column_ = col; } damage(insertion_); repair(); } return; }else if (buffer[0] == 14) { // control-n if (insertion_.line_ < text_->Height()-1) { damage(insertion_); ++insertion_.line_; insertion_.column_ = ctl_pn_col_; int index = text_->LineIndex(insertion_.line_); int col = text_->EndOfLine(index) - index; if (col < insertion_.column_){ insertion_.column_ = col; } damage(insertion_); repair(); } return; }else if (escape_ == 1) { // escaped chars if (buffer[0] == '>') { // to end of buffer damage(insertion_); if (text_->Height() >0) { insertion_.line_ = text_->Height()-1; } else { insertion_.line_ = 0; } int index = text_->LineIndex(text_->EndOfText()); insertion_.column_ = text_->EndOfText()-index; damage(insertion_); repair(); }else if (buffer[0] == '<') {// to beginning of buffer damage(insertion_); insertion_.line_ = 0; insertion_.column_ = 0; damage(insertion_); repair(); } return; }else if (buffer[0] == 033) { // ignore the escape itself return; } else if (buffer[0] == 4) // ctrl-d { if (!delete_selection()) { // like a ctrl-f then backspace int index = text_->LineIndex(insertion_.line_); int end = text_->EndOfLine(index); if (insertion_.column_ < end - index) { ++insertion_.column_; backspace(); }else if (insertion_.line_ < text_->Height()-1) { ++insertion_.line_; // now just like control-a insertion_.column_ = 0; backspace(); } } } else if (buffer[0] == 21) { // control u eraseLine(); } else if ((buffer[0] == '\b') || (buffer[0] == 127)) { // backspace and delete if (!delete_selection()) { backspace(); } } else { delete_selection(); insertChars(buffer, count); } dirty(true); } bool Text::delete_selection() { int i1 = text_->LineIndex(selection_.line1()) + selection_.column1(); int i2 = text_->LineIndex(selection_.line2()) + selection_.column2(); if (i2 > i1) { selection_.column2(selection_.column1()); selection_.line2(selection_.line1()); text_->Delete(i1, i2 - i1); damage(); }else if (i1 > i2) { selection_.column1(selection_.column2()); selection_.line1(selection_.line2()); text_->Delete(i2, i1 - i2); damage(); }else{ return false; } return true; } void Text::repair() { if (canvas_ && canvas_->window()) { canvas_->window()->repair(); } } void Text::damage(const TextLocation& location) { if (! canvas_) { return; } //mlh to get horizontal scrolling. Not well understood yet. expose(0, location.column_); FontBoundingBox fbb; font_->font_bbox(fbb); Coord base = allocation_->top() + curLowerY_; Coord lineHeight = fbb.ascent() + fbb.descent(); Coord top = Math::min(base - lineHeight * location.line_, allocation_->top()); Coord bottom = Math::max(base - lineHeight * (location.line_ + 1), allocation_->bottom()); if ((allocation_->left() <= allocation_->right()) && (bottom <= top)) { canvas_->damage(allocation_->left(), bottom, allocation_->right(), top); } } void Text::damage(const TextRegion& region) { if (! canvas_) { return; } FontBoundingBox fbb; font_->font_bbox(fbb); Coord base = allocation_->top() + curLowerY_; Coord lineHeight = fbb.ascent() + fbb.descent(); Coord top = Math::min(base - lineHeight * region.line1(), allocation_->top()); Coord bottom = Math::max(base - lineHeight * (region.line2() + 1), allocation_->bottom()); if ((allocation_->left() <= allocation_->right()) && (bottom <= top)) { canvas_->damage(allocation_->left(), bottom, allocation_->right(), top); } } void Text::damage() { if (! canvas_) { return; } canvas_->damage(allocation_->left(), allocation_->bottom(), allocation_->right(), allocation_->top()); } void Text::press(const Event& event) { // if (event.pointer_button() == Event::left) { context_key(0); if (event.pointer_button() != Event::middle) { TextRegion old = selection_; unsigned line1 = selection_.line1(); unsigned column1 = selection_.column1(); snap(event, line1, column1); selection_.line1(line1); selection_.column1(column1); selection_.line2(line1); selection_.column2(column1); repair(); damage(old); repair(); // } else if (event.pointer_button() == Event::right) { TextLocation oldi = insertion_; snap(event, insertion_.line_, insertion_.column_); repair(); damage(oldi); repair(); damage(insertion_); repair(); } else if (event.pointer_button() == Event::middle) { unsigned line = 0; unsigned column = 0; snap(event, line, column); for (int i = 0; i < annotation_.count(); ++i) { TextAnnotation& a = *annotation_.item(i); if (a.line1() <= line && line <= a.line2()) { if (!((a.line1() == line && a.column1() > column) || (a.line2() == line && a.column2() < column))) { a.execute(); break; } } } } } void Text::drag(const Event& event) { if (event.left_is_down()) { unsigned line = selection_.line2(); unsigned column = selection_.column2(); if (snap(event, line, column) && ((line > selection_.line1()) || ((line == selection_.line1()) && (column >= selection_.column1())))) { TextRegion area; if (selection_.line2() < line) { area.line1(selection_.line2()); area.column1(selection_.column2()); area.line2(line); area.column2(column); } else { area.line1(line); area.column1(column); area.line2(selection_.line2()); area.column2(selection_.column2()); } selection_.line2(line); selection_.column2(column); repair(); damage(area); repair(); } } else if (event.right_is_down()) { TextLocation old = insertion_; if (snap(event, insertion_.line_, insertion_.column_)) { repair(); damage(old); repair(); damage(insertion_); repair(); } } } Coord Text::height() const { FontBoundingBox fbb; font_->font_bbox(fbb); return text_->Height() * (fbb.ascent() + fbb.descent()); } Coord Text::lower(DimensionName) const { return 0; } Coord Text::upper(DimensionName dimension) const { return (dimension == Dimension_X ? width() : height()); } Coord Text::length(DimensionName dimension) const { return upper(dimension) - lower(dimension); } Coord Text::cur_lower(DimensionName dimension) const { // return (dimension == Dimension_X ? curLowerX_ : curLowerY_); return (dimension == Dimension_X ? curLowerX_ : height() - curUpperY_); } Coord Text::cur_upper(DimensionName dimension) const { // return (dimension == Dimension_X ? curUpperX_ : curUpperY_); return (dimension == Dimension_X ? curUpperX_ : height() - curLowerY_); } Coord Text::cur_length(DimensionName dimension) const { return cur_upper(dimension) - cur_lower(dimension); } void Text::scroll_forward(DimensionName dimension) { FontBoundingBox fbb; font_->font_bbox(fbb); if (dimension == Dimension_X) { scroll_to(dimension, cur_lower(Dimension_X) + width(' ')); } else { scroll_to(dimension, cur_lower(Dimension_Y) + (fbb.ascent() + fbb.descent())); } } void Text::scroll_backward(DimensionName dimension) { FontBoundingBox fbb; font_->font_bbox(fbb); if (dimension == Dimension_X) { scroll_to(dimension, cur_lower(Dimension_X) - width(' ')); } else { scroll_to(dimension, cur_lower(Dimension_Y) - (fbb.ascent() + fbb.descent())); } } void Text::page_forward(DimensionName dimension) { scroll_to(dimension, cur_lower(dimension) + cur_length(dimension)); } void Text::page_backward(DimensionName dimension) { scroll_to(dimension, cur_lower(dimension) - cur_length(dimension)); } void Text::cur_lower(DimensionName dimension, Coord position) { if (dimension == Dimension_X) { curLowerX_ = position; curUpperX_ = position + allocation_->allotment(Dimension_X).span(); } else { // curLowerY_ = position; // curUpperY_ = position + allocation_->allotment(Dimension_Y).span(); curLowerY_ = height() - position - allocation_->allotment(Dimension_Y).span(); curUpperY_ = height() - position; } } void Text::scroll_to(DimensionName dimension, Coord position) { // let the user scroll to the right (or down) past the current size. /* if (position > (upper(dimension) - cur_length(dimension))) { position = upper(dimension) - cur_length(dimension); } */ // if (position < lower(dimension)) { // position = lower(dimension); // } if (dimension == Dimension_X) { if (position < lower(dimension)) { position = lower(dimension); } } else { if (position > (upper(dimension) - cur_length(dimension))) { position = upper(dimension) - cur_length(dimension); } } if (position == cur_lower(dimension)) { return; } cur_lower(dimension, position); notify(dimension); damage(); } void Text::reset() { text_->Delete(0, text_->Length()); insertion_.line_ = 0; insertion_.column_ = 0; selection_.line1(0); selection_.column1(0); selection_.line2(0); selection_.column2(0); if (textBuffer_) delete textBuffer_; textBuffer_ = 0; deannotate(); needWidth_ = false; width_ = 0; dirty(false); notify_all(); } void Text::modified() { } bool Text::dirty() { return dirty_; } void Text::dirty(bool dirty) { if (dirty_ != dirty) { dirty_ = dirty; modified(); for (int i = 0; i < dirtyActions_.count(); ++i) { dirtyActions_.item(i)->execute(); } } } void Text::copy() { // ---- check for reasonable selection ---- unsigned line1 = selection_.line1(); unsigned line2 = selection_.line2(); unsigned column1 = selection_.column1(); unsigned column2 = selection_.column2(); if ((line1 > line2) || ((line1 == line2) && (column1 >= column2))) { return; } // --- create a text buffer that copies the selection region --- if (textBuffer_) { char* buff = (char*) textBuffer_->Text(); delete textBuffer_; // delete buff; // hines: why delete twice } int index0 = text_->LineIndex(line1) + column1; int index1 = text_->LineIndex(line2) + column2; int len = index1 - index0 + 1; char* txt = new char[len + 1]; Memory::copy(text_->Text(index0, index1), txt, len); textBuffer_ = new TextBuffer(txt, len, len); } void Text::cut() { // ---- check for reasonable selection ---- unsigned line1 = selection_.line1(); unsigned line2 = selection_.line2(); unsigned column1 = selection_.column1(); unsigned column2 = selection_.column2(); if ((line1 > line2) || ((line1 == line2) && (column1 >= column2))) { return; } // ---- copy to cut/copy/paste buffer ---- copy(); // ---- remove from text buffer --- int index0 = text_->LineIndex(line1) + column1; int index1 = text_->LineIndex(line2) + column2; int len = index1 - index0 + 1; text_->Delete(index0, len); // ---- update view ---- insertion_.line_ = selection_.line1(); insertion_.column_ = selection_.column1(); selection_.line2(selection_.line1()); selection_.column2(selection_.column1()); needWidth_ = true; dirty(true); notify_all(); damage(); } void Text::paste() { // --- see if there is anything to do ---- if (! textBuffer_) return; insertChars(textBuffer_->Text(), textBuffer_->Length()); } void Text::paste(const char* buffer, unsigned count) { insertChars(buffer, count); } TextBuffer* Text::buffer() const { return textBuffer_; } void Text::expose(unsigned line1, unsigned column1, unsigned /*line2*/, unsigned /*column2*/) { expose(line1, column1); } void Text::region(unsigned line1, unsigned column1, unsigned line2, unsigned column2) { TextRegion old = selection_; selection_.line1(line1); selection_.column1(column1); selection_.line2(line2); selection_.column2(column2); damage(old); damage(selection_); expose(line1, column1, line2, column2); } void Text::getRegion(unsigned& line1, unsigned& column1, unsigned& line2, unsigned& column2) { line1 = selection_.line1(); column1 = selection_.column1(); line2 = selection_.line2(); column2 = selection_.column2(); } void Text::expose(unsigned line, unsigned column) { if (! canvas_) return; String string; if (line < text_->Height()) { string = text_->getNth(line); } FontBoundingBox fbb; font_->font_bbox(fbb); Coord x = columnCoord(string, column) - allocation_->left() + curLowerX_; bool invisibleX = (x < curLowerX_) || ((x + width(' ')) > curUpperX_); Coord y = line * (fbb.ascent() + fbb.descent()); bool invisibleY = (y < curLowerY_) || ((y + fbb.ascent() + fbb.descent()) > curUpperY_); if (invisibleX) { scroll_to(Dimension_X, x - (curUpperX_ - curLowerX_) / 2); } if (invisibleY) { scroll_to(Dimension_Y, height() - y - (curUpperY_ - curLowerY_) / 2); } } void Text::location(unsigned line, unsigned column) { TextLocation old = insertion_; insertion_.line_ = line; insertion_.column_ = column; damage(old); damage(insertion_); expose(line, column); } void Text::getLocation(unsigned& line, unsigned& column) { line = insertion_.line_; column = insertion_.column_; } void Text::annotate(TextAnnotation* annotation) { annotation_.append(annotation); damage(*annotation); } void Text::deannotate(TextAnnotation* annotation) { GlyphIndex len = annotation_.count(); for (GlyphIndex i = 0; i < len; i++) { if (annotation_.item(i) == annotation) { annotation_.remove(i); break; } } damage(*annotation); } void Text::deannotate() { while (annotation_.count()) { annotation_.remove(0); } damage(); } void Text::insertDirtyAction(Action* action) { dirtyActions_.append(action); } void Text::removeDirtyAction(Action* action) { GlyphIndex len = dirtyActions_.count(); for (GlyphIndex i = 0; i < len; i++) { if (dirtyActions_.item(i) == action) { dirtyActions_.remove(i); break; } } } /////////////// // Text Line // /////////////// TextLine::TextLine(unsigned initialColumns) : Text(1u, initialColumns) { int len = 2 * initialColumns; char* buff = new char[len + 1]; TextBuffer* b = new TextBuffer(buff, 0, len); editBuffer(b); } TextLine::TextLine(const String& line, unsigned initialColumns) : Text(1u, initialColumns) { int buflen = 2 * initialColumns; char* buff = new char[buflen + 1]; int len = Math::min(line.length(), buflen); Memory::copy(line.string(), buff, len); TextBuffer* b = new TextBuffer(buff, len, buflen); editBuffer(b); delete [] buff; } TextLine::~TextLine() { #if 0 // seems to me (hines) that buff is deleted when base class // Text is deleted char* buff = (char*) editBuffer()->Text(); delete buff; #endif } void TextLine::request(Requisition& requisition) const { FontBoundingBox fbb; font_->font_bbox(fbb); Text::request(requisition); Requirement ry(fbb.ascent() + fbb.descent(), 0, 0, 0); requisition.require(Dimension_Y, ry); } void TextLine::keystroke(const Event& event) { // ignore carrage returns char buffer[2]; int count = event.mapkey(buffer, 2); if (buffer[0] == '\r') { return; } Text::keystroke(event); } String TextLine::value() { if (! text_->Height()) return ""; return text_->getNth(0); } //////////////////////// // Text Line Adjuster // //////////////////////// TextLineAdjuster::TextLineAdjuster(TextLine* textLine) : Patch(0), Observer() { LayoutKit* lkit = LayoutKit::instance(); adjustable_ = textLine; adjustable_->attach(Dimension_X, this); adjustable_->attach(Dimension_Y, this); updating_ = false; have_ = false; box_ = lkit->hbox(textLine); body(box_); } TextLineAdjuster::~TextLineAdjuster() { } void TextLineAdjuster::update(Observable*) { if (updating_) return; updating_ = true; bool need = needButtons(); if (need != have_) { if (need) addButtons(); else removeButtons(); reallocate(); redraw(); have_ = ! have_; } updating_ = false; } bool TextLineAdjuster::needButtons() { return allocation().allotment(Dimension_X).span() < adjustable_->length(Dimension_X); } void TextLineAdjuster::addButtons() { WidgetKit* kit = WidgetKit::instance(); LayoutKit* lkit = LayoutKit::instance(); Style* style = kit->style(); Stepper* left = kit->left_mover(adjustable_); Stepper* right = kit->right_mover(adjustable_); Coord mover_size = 15.0; style->find_attribute("mover_size", mover_size); box_->prepend(lkit->h_fixed_span(left, mover_size)); box_->append(lkit->h_fixed_span(right, mover_size)); } void TextLineAdjuster::removeButtons() { box_->remove(2); box_->remove(0); } neuron-7.6.3/src/lib/InterViews/iv3textbuffer.cpp000066400000000000000000000271301340731477100220070ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TextBuffer - editable text buffer */ // ======================================================================= // // Moved out of the 2.6 compatibility area and made a bunch of functions // const. // // 1.1 // 1997/03/28 17:36:37 // // Windows 3.1/NT InterViews Port // Copyright (c) 1993 Tim Prinzing // // Permission to use, copy, modify, distribute, and sell this software and // its documentation for any purpose is hereby granted without fee, provided // that (i) the above copyright notice and this permission notice appear in // all copies of the software and related documentation, and (ii) the name of // Tim Prinzing may not be used in any advertising or publicity relating to // the software without the specific, prior written permission of Tim Prinzing. // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL Tim Prinzing BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // // ======================================================================= //#include "c:/nrn/src/mswin/winio/debug.h" #include #include #include #include #if !defined(WIN32) && !defined(__MWERKS__) #include #endif #include #include #include static const char NEWLINE = '\012'; TextBuffer::TextBuffer (const char* t, int l, int s) { text = new char[s+1]; Memory::zero(text,s+1); if (t && l > 0) { Memory::copy(t,text,l); } length = l; size = s; Memory::zero(text + length, size - length); linecount = 1 + LinesBetween(0, length); lastline = 0; lastindex = 0; } TextBuffer::~TextBuffer() { delete [] text; } // --------------------------------------------------------------------- // Returns a string containing the text of the given line index. // This is primarily a convenience function. The returned string // should be considered temporary... the contents of which will // become invalid with the next edit operation. // --------------------------------------------------------------------- #if 1 //I (hines) am working around two apparent problems here. First, the string // did not seem to be terminated. Second, it seemed to be deleted before // it was returned. static CopyString* tb_[20]; static int tbi_; String TextBuffer::getNth(int i) const { int index0 = LineIndex(i); int index1 = BeginningOfNextLine(index0); tbi_ = (tbi_ + 1)%20; if (tb_[tbi_]) { delete tb_[tbi_]; } tb_[tbi_] = new CopyString(Text(index0), index1 - index0); //DebugMessage("%d %d %d %d |%s|\n", i, index0, index1, //tb_[tbi_]->length(), tb_[tbi_]->string()); return *tb_[tbi_]; } #else String TextBuffer::getNth(int i) const { int index0 = LineIndex(i); int index1 = BeginningOfNextLine(index0); const String line(Text(index0), index1 - index0); return line; } #endif inline int limit (int l, int x, int h) { return (xh) ? h : x; } int TextBuffer::Search (Regexp* regexp, int index, int range, int stop) { int s = limit(0, stop, length); int i = limit(0, index, s); return regexp->Search(text, s, i, range); } int TextBuffer::BackwardSearch (Regexp* regexp, int index) { int i = limit(0, index, length); int r = regexp->Search(text, length, i, -i); if (r >= 0) { return regexp->BeginningOfMatch(); } else { return r; } } int TextBuffer::ForwardSearch (Regexp* regexp, int index) { int i = limit(0, index, length); int r = regexp->Search(text, length, i, length - i); if (r >= 0) { return regexp->EndOfMatch(); } else { return r; } } int TextBuffer::Match (Regexp* regexp, int index, int stop) { int s = limit(0, stop, length); int i = limit(0, index, s); return regexp->Match(text, length, i); } bool TextBuffer::BackwardMatch (Regexp* regexp, int index) { int i = limit(0, index, length); for (int j = i; j >= 0; --j) { if (regexp->Match(text, length, j) == i - j) { return true; } } return false; } bool TextBuffer::ForwardMatch (Regexp* regexp, int index) { int i = limit(0, index, length); return regexp->Match(text, length, i) >= 0; } int TextBuffer::Insert (int index, const char* string, int count) { if (index < 0 || index > length) { return 0; } else if (count < 0) { return Insert(index + count, string, -count); } else { if (count > size - length) { int newSize = 2 * size + 1; if (count > newSize - length) newSize += count; char *newText = new char[newSize+1]; Memory::zero(newText,newSize); Memory::copy(text,newText,size+1); delete [] text; text = newText; size = newSize; } Memory::copy(text + index, text + index + count, length - index); Memory::copy(string, text + index, count); length += count; int newlines = (count == 1) ? (*string == NEWLINE) : LinesBetween(index, index + count); linecount += newlines; if (lastindex > index) { lastindex += count; lastline += newlines; } return count; } } int TextBuffer::Delete (int index, int count) { if (index < 0 || index > length) { return 0; } else if (count < 0) { return -Delete(index + count, -count); } else { count = Math::min(count, length - index); int oldlines = (count == 1) ? (text[index] == NEWLINE) : LinesBetween(index, index + count); if (lastindex > index + count) { lastindex -= count; lastline -= oldlines; } else if (lastindex >= index) { (void)LineNumber(index); } Memory::copy( text + index + count, text + index, length - (index+count) ); length -= count; Memory::zero(text + length, count); linecount -= oldlines; return count; } } int TextBuffer::Copy (int index, char* buffer, int count) { if (index < 0 || index > length) { return 0; } else if (count < 0) { return Copy(index + count, buffer, -count); } else { count = Math::min(count, length - index); Memory::copy(text + index, buffer, count); return count; } } int TextBuffer::Width () const { int width = 0; int i = 0; while (i != length) { width = Math::max(width, EndOfLine(i) - i); i = BeginningOfNextLine(i); } return width; } int TextBuffer::LineIndex(int line) const { int l = (line<0) ? 0 : (line>=linecount) ? linecount-1 : line; while (lastline > l) { ((TextBuffer*) this)->lastline --; ((TextBuffer*) this)->lastindex = BeginningOfLine(EndOfPreviousLine(lastindex)); } while (lastline < l) { ((TextBuffer*) this)->lastline ++; ((TextBuffer*) this)->lastindex = BeginningOfNextLine(lastindex); } if (line >= linecount) { return EndOfText(); } else { return lastindex; } } int TextBuffer::LinesBetween (int index1, int index2) const { if (index1 == index2) { return 0; } else if (index1 > index2) { return -LinesBetween(index2, index1); } else { const char* start = Text(index1); const char* finish = Text(index2); const char* tt; int l = 0; while (start < finish) { tt = (char*)memchr(start, NEWLINE, finish - start); if (tt == nil) { break; } start = tt + 1; ++l; } return l; } } int TextBuffer::LineNumber (int index) const { int l = LinesBetween(lastindex, index); ((TextBuffer*) this)->lastline += l; ((TextBuffer*) this)->lastindex = BeginningOfLine(index); return lastline; } int TextBuffer::LineOffset (int index) const { return (index<0) ? 0 : (index>length) ? 0 : index-BeginningOfLine(index); } bool TextBuffer::IsBeginningOfLine (int index) const { const char* t = Text(index); return t <= text || *(t-1) == NEWLINE; } int TextBuffer::BeginningOfLine (int index) const { const char* t = Text(index); while (t > text && *(t-1) != NEWLINE) { --t; } return t - text; } int TextBuffer::BeginningOfNextLine (int index) const { const char* t = Text(index); const char* e = text + length; t = (char*)memchr(t, NEWLINE, e - t); if (t == nil) { return length; } else { return t - text + 1; } } bool TextBuffer::IsEndOfLine (int index) const { const char* t = Text(index); return t >= text + length || *t == NEWLINE; } int TextBuffer::EndOfLine (int index) const { const char* t = Text(index); const char* e = text + length; if (t == e) { return length; } t = (char*)memchr(t, NEWLINE, e - t); if (t == nil) { return length; } else { return t - text; } } int TextBuffer::EndOfPreviousLine (int index) const { const char* t = Text(index-1); while (t > text && *t != NEWLINE) { --t; } return t - text; } bool TextBuffer::IsBeginningOfWord (int index) const { const char* t = Text(index); return t <= text || (!isalnum(*(t-1)) && isalnum(*t)); } int TextBuffer::BeginningOfWord (int index) const { const char* t = Text(index); while (t > text && !(!isalnum(*(t-1)) && isalnum(*t))) { --t; } return t - text; } int TextBuffer::BeginningOfNextWord (int index) const { const char* t = Text(index+1); while (t < text+length && !(!isalnum(*(t-1)) && isalnum(*t))) { ++t; } return t - text; } bool TextBuffer::IsEndOfWord (int index) const { const char* t = Text(index); return t >= text+length || (isalnum(*(t-1)) && !isalnum(*t)); } int TextBuffer::EndOfWord (int index) const { const char* t = Text(index); while (t < text+length && !(isalnum(*(t-1)) && !isalnum(*t))) { ++t; } return t - text; } int TextBuffer::EndOfPreviousWord (int index) const { const char* t = Text(index-1); while (t > text && !(isalnum(*(t-1)) && !isalnum(*t))) { --t; } return t - text; } neuron-7.6.3/src/lib/InterViews/kit.cpp000066400000000000000000000712161340731477100200020ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * WidgetKit -- object for creating common UI objects */ // ======================================================================= // // 1.4 // 1997/07/22 15:26:25 // // Windows 3.1/NT InterViews Port // Copyright (c) 1993 Tim Prinzing // // Permission to use, copy, modify, distribute, and sell this software and // its documentation for any purpose is hereby granted without fee, provided // that (i) the above copyright notice and this permission notice appear in // all copies of the software and related documentation, and (ii) the name of // Tim Prinzing may not be used in any advertising or publicity relating to // the software without the specific, prior written permission of Tim Prinzing. // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL Tim Prinzing BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // // ======================================================================= #ifdef WIN32 #include #endif #ifdef mswin_kit #include #endif #ifdef motif_kit #include #endif #ifdef bw_kit #include #endif #ifdef openlook_kit #include #endif #ifdef sgi_motif_kit #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include # if 1 //#ifndef MAC #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #else #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #endif #include #include #include #include declareActionCallback(Session) implementActionCallback(Session) declarePtrList(WidgetKitStyleList,Style) implementPtrList(WidgetKitStyleList,Style) class WidgetKitImpl { private: friend class WidgetKit; static WidgetKit* kit_; static WidgetKit* make_kit(); Style* style_; bool style_changed_; const Font* font_; const Color* foreground_; const Color* background_; WidgetKitStyleList styles_; Cursor* hand_cursor_; Cursor* lfast_cursor_; Cursor* lufast_cursor_; Cursor* ufast_cursor_; Cursor* rufast_cursor_; Cursor* rfast_cursor_; Cursor* rdfast_cursor_; Cursor* dfast_cursor_; Cursor* ldfast_cursor_; bool initialized_label_styles_; UniqueString* chiseled_label_style_; UniqueString* raised_label_style_; WidgetKitImpl(); ~WidgetKitImpl(); void style(Style*); Style* style(); void update_style_info(); void report_error( Session*, const char* op, const String& name, const char* value ); WidgetKitImpl* updated(); TelltaleState* begin_style(const char*, const char*, TelltaleFlags); TelltaleState* begin_menubar_item_style(); TelltaleState* begin_menu_item_style(); TelltaleState* begin_check_menu_item_style(); TelltaleState* begin_radio_menu_item_style(TelltaleGroup*); TelltaleState* begin_menu_item_separator_style(); MenuItem* end_menu_item_style(Glyph*, TelltaleState*); TelltaleState* begin_push_button_style(); TelltaleState* begin_default_button_style(); TelltaleState* begin_check_box_style(); TelltaleState* begin_palette_button_style(); TelltaleState* begin_radio_button_style(TelltaleGroup*); Button* end_button_style(Glyph*, TelltaleState*, Action*); Glyph* build_fancy_label(Glyph* above, Glyph* below, Glyph* g); ColorIntensity label_shading(); }; WidgetKit* WidgetKitImpl::kit_; WidgetKit::WidgetKit() { impl_ = new WidgetKitImpl; WidgetKitImpl::kit_ = this; } WidgetKit::~WidgetKit() { delete impl_; } WidgetKit* WidgetKit::instance() { WidgetKit* k = WidgetKitImpl::kit_; if (k == nil) { k = WidgetKitImpl::make_kit(); k->style_changed(k->impl_->style_); } return k; } const char* WidgetKit::gui() const { return "unknown"; } void WidgetKit::style(Style* s) { impl_->style(s); style_changed(s); } Style* WidgetKit::style() const { return impl_->style_; } const Font* WidgetKit::font() const { return impl_->updated()->font_; } const Color* WidgetKit::foreground() const { return impl_->updated()->foreground_; } const Color* WidgetKit::background() const { return impl_->updated()->background_; } void WidgetKit::begin_style(const String& str) { push_style(new Style(str, style())); } void WidgetKit::begin_style(const char* str) { begin_style(String(str)); } void WidgetKit::begin_style(const String& str_name, const String& str_alias) { Style* s = new Style(str_name, style()); s->alias(str_alias); push_style(s); } void WidgetKit::begin_style(const char* s, const char* a) { begin_style(String(s), String(a)); } void WidgetKit::alias(const String& str) { style()->alias(str); } void WidgetKit::alias(const char* str) { style()->alias(str); } void WidgetKit::end_style() { pop_style(); } void WidgetKit::push_style() { WidgetKitImpl& k = *impl_; k.styles_.prepend(k.style_); Resource::ref(k.style_); } void WidgetKit::push_style(Style* s) { push_style(); style(s); } void WidgetKit::pop_style() { WidgetKitImpl& k = *impl_; long n = k.styles_.count(); if (n != 0) { Style* s = k.styles_.item(0); k.styles_.remove(0); k.style(s); Resource::unref(s); style_changed(s); } } void WidgetKit::style_changed(Style*) { } #if 1 || defined(__STDC__) || defined(__ANSI_CPP__) #define __concat(first,second) first##second #else #define __concat(first,second) first/**/second #endif #define concat(first,second) __concat(first,second) #define WidgetKit_cursor_function(c) \ Cursor* WidgetKit::concat(c,_cursor)() const { \ WidgetKitImpl& k = *impl_; \ if (k.concat(c,_cursor_) == nil) { \ k.concat(c,_cursor_) = new Cursor( \ new Bitmap( \ concat(c,_bits), concat(c,_width), concat(c,_height), \ concat(c,_x_hot), concat(c,_y_hot) \ ), \ new Bitmap( \ concat(c,_mask_bits), \ concat(c,_mask_width), concat(c,_mask_height) \ ) \ ); \ } \ return k.concat(c,_cursor_); \ } WidgetKit_cursor_function(hand) WidgetKit_cursor_function(lfast) WidgetKit_cursor_function(lufast) WidgetKit_cursor_function(ufast) WidgetKit_cursor_function(rufast) WidgetKit_cursor_function(rfast) WidgetKit_cursor_function(rdfast) WidgetKit_cursor_function(dfast) WidgetKit_cursor_function(ldfast) Glyph* WidgetKit::label(const char* str) const { return new Label(str, font(), foreground()); } Glyph* WidgetKit::label(const String& str) const { return new Label(str, font(), foreground()); } Glyph* WidgetKit::chiseled_label(const char* str) const { return chiseled_label(String(str)); } Glyph* WidgetKit::chiseled_label(const String& str) const { WidgetKitImpl& k = *impl_; const Font* f = font(); ColorIntensity shading = k.label_shading(); return k.build_fancy_label( nil, new Label(str, f, new Color(shading, shading, shading, 1.0)), new Label(str, f, foreground()) ); } Glyph* WidgetKit::raised_label(const char* str) const { return raised_label(String(str)); } Glyph* WidgetKit::raised_label(const String& str) const { WidgetKitImpl& k = *impl_; const Font* f = font(); ColorIntensity shading = k.label_shading(); return k.build_fancy_label( new Label(str, f, new Color(shading, shading, shading, 1.0)), nil, new Label(str, f, foreground()) ); } Glyph* WidgetKit::fancy_label(const char* str) const { return fancy_label(String(str)); } Glyph* WidgetKit::fancy_label(const String& str) const { WidgetKitImpl& k = *impl_; String v; if (k.style()->find_attribute("labelStyle", v)) { UniqueString u(v); if (!k.initialized_label_styles_) { k.chiseled_label_style_ = new UniqueString("chiseled"); k.raised_label_style_ = new UniqueString("raised"); k.initialized_label_styles_ = true; } if (u == *k.chiseled_label_style_) { return chiseled_label(str); } if (u == *k.raised_label_style_) { return raised_label(str); } } return label(str); } Menu* WidgetKit::menubar() const { WidgetKit* k = (WidgetKit*)this; k->begin_style("MenuBar", "Menu"); Menu* m = new Menu(menubar_look(), style(), 0.0, 0.0, 0.0, 1.0); k->end_style(); return m; } Menu* WidgetKit::pulldown() const { WidgetKit* k = (WidgetKit*)this; k->begin_style("Pulldown", "Menu"); Menu* m = new Menu(pulldown_look(), style(), 1.0, 1.0, 0.0, 1.0); k->end_style(); return m; } Menu* WidgetKit::pullright() const { WidgetKit* k = (WidgetKit*)this; k->begin_style("Pullright", "Menu"); Menu* m = new Menu(pullright_look(), style(), 1.0, 1.0, 0.0, 1.0); k->end_style(); return m; } Glyph* WidgetKit::pullright_look() const { return pulldown_look(); } MenuItem* WidgetKit::menubar_item(const char* s) const { TelltaleState* t = impl_->begin_menubar_item_style(); return impl_->end_menu_item_style(menubar_item_look(label(s), t), t); } MenuItem* WidgetKit::menubar_item(const String& s) const { TelltaleState* t = impl_->begin_menubar_item_style(); return impl_->end_menu_item_style(menubar_item_look(label(s), t), t); } MenuItem* WidgetKit::menubar_item(Glyph* g) const { TelltaleState* t = impl_->begin_menubar_item_style(); return impl_->end_menu_item_style(menubar_item_look(g, t), t); } MenuItem* WidgetKit::menu_item(const char* s) const { TelltaleState* t = impl_->begin_menu_item_style(); return impl_->end_menu_item_style(menu_item_look(label(s), t), t); } MenuItem* WidgetKit::menu_item(const String& s) const { TelltaleState* t = impl_->begin_menu_item_style(); return impl_->end_menu_item_style(menu_item_look(label(s), t), t); } MenuItem* WidgetKit::menu_item(Glyph* g) const { TelltaleState* t = impl_->begin_menu_item_style(); return impl_->end_menu_item_style(menu_item_look(g, t), t); } MenuItem* WidgetKit::check_menu_item(const char* s) const { TelltaleState* t = impl_->begin_check_menu_item_style(); return impl_->end_menu_item_style(check_menu_item_look(label(s), t), t); } MenuItem* WidgetKit::check_menu_item(const String& s) const { TelltaleState* t = impl_->begin_check_menu_item_style(); return impl_->end_menu_item_style(check_menu_item_look(label(s), t), t); } MenuItem* WidgetKit::check_menu_item(Glyph* g) const { TelltaleState* t = impl_->begin_check_menu_item_style(); return impl_->end_menu_item_style(check_menu_item_look(g, t), t); } MenuItem* WidgetKit::radio_menu_item(TelltaleGroup* g, const char* s) const { TelltaleState* t = impl_->begin_radio_menu_item_style(g); return impl_->end_menu_item_style(radio_menu_item_look(label(s), t), t); } MenuItem* WidgetKit::radio_menu_item(TelltaleGroup* g, const String& s) const { TelltaleState* t = impl_->begin_radio_menu_item_style(g); return impl_->end_menu_item_style(radio_menu_item_look(label(s), t), t); } MenuItem* WidgetKit::radio_menu_item(TelltaleGroup* group, Glyph* g) const { TelltaleState* t = impl_->begin_radio_menu_item_style(group); return impl_->end_menu_item_style(radio_menu_item_look(g, t), t); } MenuItem* WidgetKit::menu_item_separator() const { TelltaleState* t = impl_->begin_menu_item_separator_style(); return impl_->end_menu_item_style(menu_item_separator_look(), t); } Button* WidgetKit::push_button(const char* s, Action* a) const { TelltaleState* t = impl_->begin_push_button_style(); return impl_->end_button_style(push_button_look(label(s), t), t, a); } Button* WidgetKit::push_button(const String& s, Action* a) const { TelltaleState* t = impl_->begin_push_button_style(); return impl_->end_button_style(push_button_look(label(s), t), t, a); } Button* WidgetKit::push_button(Glyph* g, Action* a) const { TelltaleState* t = impl_->begin_push_button_style(); return impl_->end_button_style(push_button_look(g, t), t, a); } Button* WidgetKit::default_button(const char* s, Action* a) const { TelltaleState* t = impl_->begin_default_button_style(); return impl_->end_button_style(default_button_look(label(s), t), t, a); } Button* WidgetKit::default_button(const String& s, Action* a) const { TelltaleState* t = impl_->begin_default_button_style(); return impl_->end_button_style(default_button_look(label(s), t), t, a); } Button* WidgetKit::default_button(Glyph* g, Action* a) const { TelltaleState* t = impl_->begin_default_button_style(); return impl_->end_button_style(default_button_look(g, t), t, a); } Button* WidgetKit::check_box(const char* s, Action* a) const { TelltaleState* t = impl_->begin_check_box_style(); return impl_->end_button_style(check_box_look(label(s), t), t, a); } Button* WidgetKit::check_box(const String& s, Action* a) const { TelltaleState* t = impl_->begin_check_box_style(); return impl_->end_button_style(check_box_look(label(s), t), t, a); } Button* WidgetKit::check_box(Glyph* g, Action* a) const { TelltaleState* t = impl_->begin_check_box_style(); return impl_->end_button_style(check_box_look(g, t), t, a); } Button* WidgetKit::palette_button(const char* s, Action* a) const { TelltaleState* t = impl_->begin_palette_button_style(); return impl_->end_button_style(palette_button_look(label(s), t), t, a); } Button* WidgetKit::palette_button(const String& s, Action* a) const { TelltaleState* t = impl_->begin_palette_button_style(); return impl_->end_button_style(palette_button_look(label(s), t), t, a); } Button* WidgetKit::palette_button(Glyph* g, Action* a) const { TelltaleState* t = impl_->begin_palette_button_style(); return impl_->end_button_style(palette_button_look(g, t), t, a); } Button* WidgetKit::radio_button( TelltaleGroup* g, const char* s, Action* a ) const { TelltaleState* t = impl_->begin_radio_button_style(g); return impl_->end_button_style(radio_button_look(label(s), t), t, a); } Button* WidgetKit::radio_button( TelltaleGroup* g, const String& s, Action* a ) const { TelltaleState* t = impl_->begin_radio_button_style(g); return impl_->end_button_style(radio_button_look(label(s), t), t, a); } Button* WidgetKit::radio_button( TelltaleGroup* group, Glyph* g, Action* a ) const { TelltaleState* t = impl_->begin_radio_button_style(group); return impl_->end_button_style(radio_button_look(g, t), t, a); } Action* WidgetKit::quit() const { return new ActionCallback(Session)(Session::instance(), &Session::quit); } Glyph* WidgetKit::hslider(Adjustable* a) const { WidgetKit* k = (WidgetKit*)this; k->begin_style("HSlider", "Slider"); Glyph* g = slider_look(Dimension_X, a); k->end_style(); return g; } Glyph* WidgetKit::hscroll_bar(Adjustable* a) const { WidgetKit* k = (WidgetKit*)this; k->begin_style("HScrollBar", "ScrollBar"); Glyph* g = scroll_bar_look(Dimension_X, a); k->end_style(); return g; } Glyph* WidgetKit::vslider(Adjustable* a) const { WidgetKit* k = (WidgetKit*)this; k->begin_style("VSlider", "Slider"); Glyph* g = slider_look(Dimension_Y, a); k->end_style(); return g; } Glyph* WidgetKit::vscroll_bar(Adjustable* a) const { WidgetKit* k = (WidgetKit*)this; k->begin_style("VScrollBar", "ScrollBar"); Glyph* g = scroll_bar_look(Dimension_Y, a); k->end_style(); return g; } Glyph* WidgetKit::panner(Adjustable* x, Adjustable* y) const { WidgetKit* k = (WidgetKit*)this; k->begin_style("Panner"); Glyph* g = panner_look(x, y); k->end_style(); return g; } Stepper* WidgetKit::enlarger(Adjustable*) const { /* unimplemented */ return nil; } Stepper* WidgetKit::reducer(Adjustable*) const { /* unimplemented */ return nil; } Stepper* WidgetKit::up_mover(Adjustable* a) const { TelltaleState* t = impl_->begin_style( "UpMover", "Button", TelltaleState::is_enabled ); Stepper* s = new ForwardScroller( up_mover_look(t), style(), t, a, Dimension_Y ); ((WidgetKit*)this)->end_style(); return s; } Stepper* WidgetKit::down_mover(Adjustable* a) const { TelltaleState* t = impl_->begin_style( "DownMover", "Button", TelltaleState::is_enabled ); Stepper* s = new BackwardScroller( down_mover_look(t), style(), t, a, Dimension_Y ); ((WidgetKit*)this)->end_style(); return s; } Stepper* WidgetKit::left_mover(Adjustable* a) const { TelltaleState* t = impl_->begin_style( "LeftMover", "Button", TelltaleState::is_enabled ); Stepper* s = new BackwardScroller( left_mover_look(t), style(), t, a, Dimension_X ); ((WidgetKit*)this)->end_style(); return s; } Stepper* WidgetKit::right_mover(Adjustable* a) const { TelltaleState* t = impl_->begin_style( "RightMover", "Button", TelltaleState::is_enabled ); Stepper* s = new ForwardScroller( right_mover_look(t), style(), t, a, Dimension_X ); ((WidgetKit*)this)->end_style(); return s; } WidgetKitImpl::WidgetKitImpl() { style_ = nil; style_changed_ = false; font_ = nil; foreground_ = nil; background_ = nil; style(Session::instance()->style()); hand_cursor_ = nil; lfast_cursor_ = nil; lufast_cursor_ = nil; ufast_cursor_ = nil; rufast_cursor_ = nil; rfast_cursor_ = nil; rdfast_cursor_ = nil; dfast_cursor_ = nil; ldfast_cursor_ = nil; initialized_label_styles_ = false; chiseled_label_style_ = nil; raised_label_style_ = nil; } WidgetKitImpl::~WidgetKitImpl() { Resource::unref(style_); Resource::unref(font_); Resource::unref(foreground_); Resource::unref(background_); delete hand_cursor_; delete lfast_cursor_; delete lufast_cursor_; delete ufast_cursor_; delete rufast_cursor_; delete rfast_cursor_; delete rdfast_cursor_; delete dfast_cursor_; } void WidgetKitImpl::style(Style* s) { Resource::ref(s); Resource::unref(style_); style_ = s; style_changed_ = true; } Style* WidgetKitImpl::style() { return style_; } void WidgetKitImpl::update_style_info() { Style* s = style_; Session* session = Session::instance(); Display* d = session->default_display(); String v; // ---- load a font ---- if (s->find_attribute("font", v) || s->find_attribute("Font", v)) { const Font* f = Font::lookup(v); if (f == nil) { if (font_ == nil) { #if defined(CYGWIN) || defined(MINGW) const char* default_font = "*Arial*bold*--12*"; #else const char* default_font = "fixed"; #endif report_error(session, "open font", v, default_font); font_ = Font::lookup(default_font); Resource::ref(font_); } } else { Resource::ref(f); Resource::unref(font_); font_ = f; } } if (font_ == nil) { #if defined(CYGWIN) || defined(MINGW) font_ = Font::lookup("*Arial*bold*--12*"); #else font_ = Font::lookup("fixed"); #endif Resource::ref(font_); } // ---- load foreground color ---- if (s->find_attribute("foreground", v) || s->find_attribute("Foreground", v) ) { const Color* c = Color::lookup(d, v); if (c == nil) { if (foreground_ == nil) { const char* default_foreground = "#000000"; report_error(session, "find color", v, default_foreground); foreground_ = Color::lookup(d, default_foreground); Resource::ref(foreground_); } } else { Resource::ref(c); Resource::unref(foreground_); foreground_ = c; } } if (foreground_ == nil) { foreground_ = new Color(0.0, 0.0, 0.0, 1.0); Resource::ref(foreground_); } // ----- load a background color ----- if (s->find_attribute("background", v) || s->find_attribute("Background", v) ) { const Color* c = Color::lookup(d, v); if (c == nil) { if (background_ == nil) { const char* default_background = "#ffffff"; report_error(session, "find color", v, default_background); background_ = Color::lookup(d, default_background); Resource::ref(background_); } } else { Resource::ref(c); Resource::unref(background_); background_ = c; } } if (background_ == nil) { background_ = new Color(1.0, 1.0, 1.0, 1.0); Resource::ref(background_); } style_changed_ = false; } void WidgetKitImpl::report_error( Session* s, const char* op, const String& name, const char* value ) { #if defined(WIN32) || MAC printf( #else fprintf(stderr, #endif "%s: unable to %s \"%.*s\", using \"%s\"\n", s->name(), op, name.length(), name.string(), value ); } WidgetKitImpl* WidgetKitImpl::updated() { if (style_changed_) { update_style_info(); } return this; } WidgetKit* WidgetKitImpl::make_kit() { String gui; if (Session::instance()->style()->find_attribute("gui", gui)) { #ifdef bw_kit if (gui == "monochrome") { return new MonoKit; } #endif #ifdef mswin_kit if (gui == "mswin") { return new MWkit; } #endif #if defined(motif_kit) if (gui == "Motif" || gui == "motif") { return new MFKit; } #endif #ifdef openlook_kit if (gui == "OpenLook" || gui == "openlook") { return new OLKit; } #endif #ifdef sgi_motif_kit if (gui == "SGIMotif" || gui == "sgimotif") { return new SMFKit; } #endif } #ifdef bw_kit const Color* c1 = new Color(0.0, 0.0, 0.0, 1.0); Resource::ref(c1); const Color* c2 = new Color(1.0, 1.0, 1.0, 1.0); Resource::ref(c2); const Color* c3 = new Color(0.5, 0.5, 0.5, 1.0); Resource::ref(c3); if (!c3->distinguished(c1) || !c3->distinguished(c2)) { return new MonoKit; } Resource::unref(c1); Resource::unref(c2); Resource::unref(c3); #endif #ifdef default_kit return new default_kit; #else #ifdef sgi_motif_kit return new SMFKit; #endif #ifdef motif_kit return new MFKit; #endif #ifdef openlook_kit return new OLKit; #endif #ifdef bw_kit return new MonoKit; #endif #endif } TelltaleState* WidgetKitImpl::begin_style( const char* s1, const char* s2, TelltaleFlags f ) { if (s2 == nil) { kit_->begin_style(s1); } else { kit_->begin_style(s1, s2); } return new TelltaleState(f); } TelltaleState* WidgetKitImpl::begin_menubar_item_style() { return begin_style("MenuBar", "Menu", TelltaleState::is_enabled); } TelltaleState* WidgetKitImpl::begin_menu_item_style() { return begin_style("MenuItem", nil, TelltaleState::is_enabled); } TelltaleState* WidgetKitImpl::begin_check_menu_item_style() { return begin_style( "ToggleButton", "MenuItem", TelltaleState::is_enabled | TelltaleState::is_toggle ); } TelltaleState* WidgetKitImpl::begin_radio_menu_item_style(TelltaleGroup* g) { TelltaleState* t = begin_style( "RadioButton", "MenuItem", TelltaleState::is_enabled | TelltaleState::is_choosable ); t->join(g); return t; } TelltaleState* WidgetKitImpl::begin_menu_item_separator_style() { return begin_style("MenuSeparator", "MenuItem", 0); } MenuItem* WidgetKitImpl::end_menu_item_style(Glyph* g, TelltaleState* t) { MenuItem* i = new MenuItem(g, t); kit_->end_style(); return i; } TelltaleState* WidgetKitImpl::begin_push_button_style() { return begin_style("PushButton", "Button", TelltaleState::is_enabled); } TelltaleState* WidgetKitImpl::begin_default_button_style() { Style* s = new Style("DefaultButton", style()); s->alias("PushButton"); s->alias("Button"); kit_->push_style(s); return new TelltaleState(TelltaleState::is_enabled); } TelltaleState* WidgetKitImpl::begin_check_box_style() { return begin_style( "ToggleButton", "Button", TelltaleState::is_enabled | TelltaleState::is_toggle ); } TelltaleState* WidgetKitImpl::begin_palette_button_style() { return begin_style( "PaletteButton", "Button", TelltaleState::is_enabled | TelltaleState::is_toggle ); } TelltaleState* WidgetKitImpl::begin_radio_button_style(TelltaleGroup* g) { TelltaleState* t = begin_style( "RadioButton", "Button", TelltaleState::is_enabled | TelltaleState::is_choosable ); t->join(g); return t; } Button* WidgetKitImpl::end_button_style( Glyph* g, TelltaleState* t, Action* a ) { Button* b = new Button(g, style(), t, a); kit_->end_style(); return b; } class WidgetKitOverlay : public Glyph { public: WidgetKitOverlay(Glyph* g1, Glyph* g2, Glyph* g3); virtual ~WidgetKitOverlay(); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); private: Glyph* first_; Glyph* second_; Glyph* third_; }; WidgetKitOverlay::WidgetKitOverlay(Glyph* g1, Glyph* g2, Glyph* g3) { first_ = g1; Resource::ref(g1); second_ = g2; Resource::ref(g2); third_ = g3; Resource::ref(g3); } WidgetKitOverlay::~WidgetKitOverlay() { Resource::unref(first_); Resource::unref(second_); Resource::unref(third_); } void WidgetKitOverlay::request(Requisition& req) const { third_->request(req); } void WidgetKitOverlay::allocate( Canvas* c, const Allocation& a, Extension& ext ) { first_->allocate(c, a, ext); second_->allocate(c, a, ext); third_->allocate(c, a, ext); } void WidgetKitOverlay::draw(Canvas* c, const Allocation& a) const { first_->draw(c, a); second_->draw(c, a); third_->draw(c, a); } void WidgetKitOverlay::pick( Canvas* c, const Allocation& a, int depth, Hit& h ) { third_->pick(c, a, depth, h); } Glyph* WidgetKitImpl::build_fancy_label(Glyph* above, Glyph* below, Glyph* g) { LayoutKit& layout = *LayoutKit::instance(); Coord offset = 1.0; Glyph* g1, * g2, * g3; if (above != nil) { g1 = layout.margin(above, 0.0, offset, offset, 0.0); g2 = layout.margin(above, 0.0, offset, 0.0, 0.0); g3 = layout.margin(g, offset, 0.0, 0.0, offset); } else { g1 = layout.margin(below, offset, 0.0, 0.0, offset); g2 = layout.margin(below, 0.0, 0.0, 0.0, offset); g3 = layout.margin(g, 0.0, offset, offset, 0.0); } return new WidgetKitOverlay(g1, g2, g3); } ColorIntensity WidgetKitImpl::label_shading() { ColorIntensity shading = 0.9; style()->find_attribute("labelShading", shading); return shading; } neuron-7.6.3/src/lib/InterViews/label.cpp000077500000000000000000000076311340731477100202750ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Label - ASCII text glyph with font */ #include #include #include #include #include #include Label::Label(const String& s, const Font* f, const Color* c) : Glyph() { text_ = new CopyString(s); font_ = f; Resource::ref(font_); color_ = c; Resource::ref(color_); compute_metrics(); } Label::Label(const char* text, const Font* f, const Color* c) : Glyph() { text_ = new CopyString(text); font_ = f; Resource::ref(font_); color_ = c; Resource::ref(color_); compute_metrics(); } Label::Label( const char* text, int length, const Font* f, const Color* c ) : Glyph() { text_ = new CopyString(text, length); font_ = f; Resource::ref(font_); color_ = c; Resource::ref(color_); compute_metrics(); } Label::~Label() { delete text_; Resource::unref(font_); Resource::unref(color_); delete [] char_widths_; } void Label::compute_metrics() { const Font* f = font_; const char* str = text_->string(); int len = text_->length(); FontBoundingBox b; f->string_bbox(str, len, b); ascent_ = b.font_ascent(); descent_ = b.font_descent(); left_ = b.left_bearing(); right_ = b.right_bearing(); width_ = b.width(); char_widths_ = new Coord[len]; for (int i = 0; i < len; i++) { char_widths_[i] = f->width(((u_char*)str)[i]); } } void Label::request(Requisition& requisition) const { Coord height = ascent_ + descent_; float alignment = (height == 0) ? 0 : descent_ / height; Requirement rx(width_, 0, 0, 0); Requirement ry(height, 0, 0, alignment); requisition.require(Dimension_X, rx); requisition.require(Dimension_Y, ry); } void Label::allocate(Canvas* c, const Allocation& a, Extension& ext) { Coord x = a.x(); Coord y = a.y(); ext.set_xy(c, x - left_, y - descent_, x + right_, y + ascent_); } void Label::draw(Canvas* c, const Allocation& a) const { Coord x = a.x(); Coord y = a.y(); const Font* f = font_; const Color* color = color_; const char* p = text_->string(); const char* q = &p[text_->length()]; Coord* cw = &char_widths_[0]; for (; p < q; p++, cw++) { Coord width = *cw; c->character(f, *p, width, color, x, y); x += width; } } void Label::pick(Canvas*, const Allocation& a, int depth, Hit& h) { Coord x = h.left(); if (h.right() >= a.left() && x < a.right() && h.top() >= a.bottom() && h.bottom() < a.top() ) { int index = font_->index( text_->string(), text_->length(), x - a.x(), true ); h.target(depth, this, index); } } neuron-7.6.3/src/lib/InterViews/layout.cpp000077500000000000000000000571351340731477100205370ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Layout - geometry management */ #include #include #include #include #include #include #include #include #include #include #include #include Layout::Layout() { } Layout::~Layout() { } void Layout::request(GlyphIndex, const Requisition*, Requisition&) { } void Layout::allocate( const Allocation&, GlyphIndex, const Requisition*, Allocation* ) { } /* * LayoutKit -- create glyphs for layout */ class Discretionary : public Glyph { public: Discretionary(int penalty, Glyph*); Discretionary(int penalty, Glyph* no, Glyph* pre, Glyph* in, Glyph* post); virtual ~Discretionary(); virtual void request(Requisition&) const; virtual Glyph* compose(GlyphBreakType); private: int penalty_; Glyph* nobreak_; Glyph* prebreak_; Glyph* inbreak_; Glyph* postbreak_; }; class LayoutLayer : public MonoGlyph { public: LayoutLayer(Glyph* between, Glyph* under, Glyph* over); virtual ~LayoutLayer(); virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void print(Printer*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); virtual void undraw(); private: Glyph* under_; Glyph* over_; }; class ShapeOf : public Glyph { public: ShapeOf(Glyph*, Glyph*); virtual ~ShapeOf(); virtual void request(Requisition&) const; private: Glyph* x_; Glyph* y_; }; class Space : public Glyph { public: Space(int count, Coord each, const Font*, const Color*); virtual ~Space(); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); private: int count_; Coord each_; const Font* font_; const Color* color_; Coord width_; Coord height_; float alignment_; }; class Strut : public Glyph { public: Strut( const Font*, Coord natural = 0, Coord stretch = 0, Coord shrink = 0 ); virtual ~Strut(); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); private: const Font* font_; Coord natural_; Coord stretch_; Coord shrink_; Coord height_; float alignment_; }; class HStrut : public Glyph { public: HStrut( Coord right_bearing, Coord left_bearing = 0, Coord natural = 0, Coord stretch = 0, Coord shrink = 0 ); virtual ~HStrut(); virtual void request(Requisition&) const; private: Coord left_bearing_; Coord right_bearing_; Coord natural_; Coord stretch_; Coord shrink_; }; class VStrut : public Glyph { public: VStrut( Coord ascent, Coord descent = 0, Coord natural = 0, Coord stretch = 0, Coord shrink = 0 ); virtual ~VStrut(); virtual void request(Requisition&) const; private: Coord ascent_; Coord descent_; Coord natural_; Coord stretch_; Coord shrink_; }; class LayoutKitImpl { friend class LayoutKit; static LayoutKit* instance_; static PolyGlyph* add( PolyGlyph*, Glyph* g1, Glyph* g2, Glyph* g3, Glyph* g4, Glyph* g5, Glyph* g6, Glyph* g7, Glyph* g8, Glyph* g9, Glyph* g10 ); }; LayoutKit* LayoutKitImpl::instance_; LayoutKit::LayoutKit() { } LayoutKit::~LayoutKit() { } LayoutKit* LayoutKit::instance() { if (LayoutKitImpl::instance_ == nil) { LayoutKitImpl::instance_ = new LayoutKit; } return LayoutKitImpl::instance_; } PolyGlyph* LayoutKit::box(Layout* layout, GlyphIndex size) const { return new Box(layout, size); } PolyGlyph* LayoutKit::hbox(GlyphIndex size) const { return new Box( new Superpose(new Tile(Dimension_X), new Align(Dimension_Y)), size ); } PolyGlyph* LayoutKit::hbox( Glyph* g1, Glyph* g2, Glyph* g3, Glyph* g4, Glyph* g5, Glyph* g6, Glyph* g7, Glyph* g8, Glyph* g9, Glyph* g10 ) const { return LayoutKitImpl::add( hbox(10), g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 ); } PolyGlyph* LayoutKit::vbox(GlyphIndex size) const { return new Box( new Superpose(new TileReversed(Dimension_Y), new Align(Dimension_X)), size ); } PolyGlyph* LayoutKit::vbox( Glyph* g1, Glyph* g2, Glyph* g3, Glyph* g4, Glyph* g5, Glyph* g6, Glyph* g7, Glyph* g8, Glyph* g9, Glyph* g10 ) const { return LayoutKitImpl::add( vbox(10), g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 ); } PolyGlyph* LayoutKit::hbox_first_aligned(GlyphIndex size) const { return new Box( new Superpose( new TileFirstAligned(Dimension_X), new Align(Dimension_Y) ), size ); } PolyGlyph* LayoutKit::hbox_first_aligned( Glyph* g1, Glyph* g2, Glyph* g3, Glyph* g4, Glyph* g5, Glyph* g6, Glyph* g7, Glyph* g8, Glyph* g9, Glyph* g10 ) const { return LayoutKitImpl::add( hbox_first_aligned(10), g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 ); } PolyGlyph* LayoutKit::vbox_first_aligned(GlyphIndex size) const { return new Box( new Superpose( new TileReversedFirstAligned(Dimension_Y), new Align(Dimension_X) ), size ); } PolyGlyph* LayoutKit::vbox_first_aligned( Glyph* g1, Glyph* g2, Glyph* g3, Glyph* g4, Glyph* g5, Glyph* g6, Glyph* g7, Glyph* g8, Glyph* g9, Glyph* g10 ) const { return LayoutKitImpl::add( vbox_first_aligned(10), g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 ); } ScrollBox* LayoutKit::vscrollbox(GlyphIndex size) const { return new TBScrollBox(size); } PolyGlyph* LayoutKit::overlay( Glyph* g1, Glyph* g2, Glyph* g3, Glyph* g4, Glyph* g5, Glyph* g6, Glyph* g7, Glyph* g8, Glyph* g9, Glyph* g10 ) const { return LayoutKitImpl::add( new Box( new Superpose(new Align(Dimension_X), new Align(Dimension_Y)), 10 ), g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 ); } Deck* LayoutKit::deck(GlyphIndex size) const { return new Deck(size); } Deck* LayoutKit::deck( Glyph* g1, Glyph* g2, Glyph* g3, Glyph* g4, Glyph* g5, Glyph* g6, Glyph* g7, Glyph* g8, Glyph* g9, Glyph* g10 ) const { Deck* d = new Deck(10); LayoutKitImpl::add(d, g1, g2, g3, g4, g5, g6, g7, g8, g9, g10); return d; } PolyGlyph* LayoutKitImpl::add( PolyGlyph* p, Glyph* g1, Glyph* g2, Glyph* g3, Glyph* g4, Glyph* g5, Glyph* g6, Glyph* g7, Glyph* g8, Glyph* g9, Glyph* g10 ) { if (g1 != nil) { p->append(g1); } if (g2 != nil) { p->append(g2); } if (g3 != nil) { p->append(g3); } if (g4 != nil) { p->append(g4); } if (g5 != nil) { p->append(g5); } if (g6 != nil) { p->append(g6); } if (g7 != nil) { p->append(g7); } if (g8 != nil) { p->append(g8); } if (g9 != nil) { p->append(g9); } if (g10 != nil) { p->append(g10); } return p; } MonoGlyph* LayoutKit::back(Glyph* g, Glyph* under) const { return new LayoutLayer(g, under, nil); } MonoGlyph* LayoutKit::front(Glyph* g, Glyph* over) const { return new LayoutLayer(g, nil, over); } MonoGlyph* LayoutKit::between(Glyph* g, Glyph* under, Glyph* over) const { return new LayoutLayer(g, under, over); } Glyph* LayoutKit::glue( DimensionName d, Coord natural, Coord stretch, Coord shrink, float alignment ) const { return new Glue(d, natural, stretch, shrink, alignment); } Glyph* LayoutKit::glue(const Requisition& r) const { return new Glue(r); } Glyph* LayoutKit::hglue() const { return new Glue(Dimension_X, 0, fil, 0, 0.0); } Glyph* LayoutKit::hglue(Coord natural) const { return new Glue(Dimension_X, natural, fil, 0, 0.0); } Glyph* LayoutKit::hglue(Coord natural, Coord stretch, Coord shrink) const { return new Glue(Dimension_X, natural, stretch, shrink, 0.0); } Glyph* LayoutKit::hglue( Coord natural, Coord stretch, Coord shrink, float alignment ) const { return new Glue(Dimension_X, natural, stretch, shrink, alignment); } Glyph* LayoutKit::hspace(Coord natural) const { return new Glue(Dimension_X, natural, 0, 0, 0.0); } Glyph* LayoutKit::vglue() const { return new Glue(Dimension_Y, 0, fil, 0, 0.0); } Glyph* LayoutKit::vglue(Coord natural) const { return new Glue(Dimension_Y, natural, fil, 0, 0.0); } Glyph* LayoutKit::vglue( Coord natural, Coord stretch, Coord shrink ) const { return new Glue(Dimension_Y, natural, stretch, shrink, 0.0); } Glyph* LayoutKit::vglue( Coord natural, Coord stretch, Coord shrink, float alignment ) const { return new Glue(Dimension_Y, natural, stretch, shrink, alignment); } Glyph* LayoutKit::vspace(Coord natural) const { return new Glue(Dimension_Y, natural, 0, 0, 0.0); } Glyph* LayoutKit::shape_of(Glyph* g) const { return new ShapeOf(g, g); } Glyph* LayoutKit::shape_of_xy(Glyph* x, Glyph* y) const { return new ShapeOf(x, y); } Glyph* LayoutKit::discretionary(int penalty, Glyph* g) const { return new Discretionary(penalty, g); } Glyph* LayoutKit::discretionary( int penalty, Glyph* no, Glyph* before, Glyph* in, Glyph* after ) const { return new Discretionary(penalty, no, before, in, after); } Glyph* LayoutKit::strut( const Font* f, Coord natural, Coord stretch, Coord shrink ) const { return new Strut(f, natural, stretch, shrink); } Glyph* LayoutKit::hstrut( Coord right_bearing, Coord left_bearing, Coord natural, Coord stretch, Coord shrink ) const { return new HStrut(right_bearing, left_bearing, natural, stretch, shrink); } Glyph* LayoutKit::vstrut( Coord ascent, Coord descent, Coord natural, Coord stretch, Coord shrink ) const { return new VStrut(ascent, descent, natural, stretch, shrink); } Glyph* LayoutKit::spaces( int count, Coord each, const Font* f, const Color* c ) const { return new Space(count, each, f, c); } MonoGlyph* LayoutKit::center(Glyph* g, float xalign, float yalign) const { return new Placement( g, new Superpose( new CenterLayout(Dimension_X, xalign), new CenterLayout(Dimension_Y, yalign) ) ); } MonoGlyph* LayoutKit::center_dimension( Glyph* g, DimensionName d, float align ) const { return new Placement(g, new CenterLayout(d, align)); } MonoGlyph* LayoutKit::hcenter(Glyph* g, float x) const { return center_dimension(g, Dimension_X, x); } MonoGlyph* LayoutKit::vcenter(Glyph* g, float y) const { return center_dimension(g, Dimension_Y, y); } MonoGlyph* LayoutKit::fixed(Glyph* g, Coord x, Coord y) const { return new Placement( g, new Superpose( new FixedLayout(Dimension_X, x), new FixedLayout(Dimension_Y, y) ) ); } MonoGlyph* LayoutKit::fixed_dimension( Glyph* g, DimensionName d, Coord span ) const { return new Placement(g, new FixedLayout(d, span)); } MonoGlyph* LayoutKit::hfixed(Glyph* g, Coord x) const { return fixed_dimension(g, Dimension_X, x); } MonoGlyph* LayoutKit::vfixed(Glyph* g, Coord y) const { return fixed_dimension(g, Dimension_Y, y); } MonoGlyph* LayoutKit::flexible( Glyph* g, Coord stretch, Coord shrink ) const { return new Placement( g, new Superpose( new VariableLayout(Dimension_X, stretch, shrink), new VariableLayout(Dimension_Y, stretch, shrink) ) ); } MonoGlyph* LayoutKit::flexible_dimension( Glyph* g, DimensionName d, Coord stretch, Coord shrink ) const { return new Placement(g, new VariableLayout(d, stretch, shrink)); } MonoGlyph* LayoutKit::hflexible( Glyph* g, Coord stretch, Coord shrink ) const { return flexible_dimension(g, Dimension_X, stretch, shrink); } MonoGlyph* LayoutKit::vflexible( Glyph* g, Coord stretch, Coord shrink ) const { return flexible_dimension(g, Dimension_Y, stretch, shrink); } MonoGlyph* LayoutKit::natural( Glyph* g, Coord x, Coord y ) const { return new Placement( g, new Superpose( new NaturalLayout(Dimension_X, x), new NaturalLayout(Dimension_Y, y) ) ); } MonoGlyph* LayoutKit::natural_dimension( Glyph* g, DimensionName d, Coord span ) const { return new Placement(g, new NaturalLayout(d, span)); } MonoGlyph* LayoutKit::hnatural(Glyph* g, Coord x) const { return natural_dimension(g, Dimension_X, x); } MonoGlyph* LayoutKit::vnatural(Glyph* g, Coord y) const { return natural_dimension(g, Dimension_Y, y); } MonoGlyph* LayoutKit::margin(Glyph* g, Coord size) const { return new Placement(g, new MarginLayout(size)); } MonoGlyph* LayoutKit::margin( Glyph* g, Coord hmargin, Coord vmargin ) const { return new Placement(g, new MarginLayout(hmargin, vmargin)); } MonoGlyph* LayoutKit::margin( Glyph* g, Coord lmargin, Coord rmargin, Coord bmargin, Coord tmargin ) const { return new Placement( g, new MarginLayout(lmargin, rmargin, bmargin, tmargin) ); } MonoGlyph* LayoutKit::margin( Glyph* g, Coord lmargin, Coord lstretch, Coord lshrink, Coord rmargin, Coord rstretch, Coord rshrink, Coord bmargin, Coord bstretch, Coord bshrink, Coord tmargin, Coord tstretch, Coord tshrink ) const { return new Placement( g, new MarginLayout( lmargin, lstretch, lshrink, rmargin, rstretch, rshrink, bmargin, bstretch, bshrink, tmargin, tstretch, tshrink ) ); } MonoGlyph* LayoutKit::hmargin(Glyph* g, Coord size) const { return margin(g, size, size, 0, 0); } MonoGlyph* LayoutKit::hmargin( Glyph* g, Coord lmargin, Coord rmargin ) const { return margin(g, lmargin, rmargin, 0, 0); } MonoGlyph* LayoutKit::hmargin( Glyph* g, Coord lmargin, Coord lstretch, Coord lshrink, Coord rmargin, Coord rstretch, Coord rshrink ) const { return margin( g, lmargin, lstretch, lshrink, rmargin, rstretch, rshrink, 0, 0, 0, 0, 0, 0 ); } MonoGlyph* LayoutKit::vmargin(Glyph* g, Coord size) const { return margin(g, 0, 0, size, size); } MonoGlyph* LayoutKit::vmargin( Glyph* g, Coord bmargin, Coord tmargin ) const { return margin(g, 0, 0, bmargin, tmargin); } MonoGlyph* LayoutKit::vmargin( Glyph* g, Coord bmargin, Coord bstretch, Coord bshrink, Coord tmargin, Coord tstretch, Coord tshrink ) const { return margin( g, 0, 0, 0, 0, 0, 0, bmargin, bstretch, bshrink, tmargin, tstretch, tshrink ); } MonoGlyph* LayoutKit::lmargin(Glyph* g, Coord size) const { return margin(g, size, 0, 0, 0); } MonoGlyph* LayoutKit::lmargin( Glyph* g, Coord size, Coord stretch, Coord shrink ) const { return margin(g, size, stretch, shrink, 0, 0, 0, 0, 0, 0, 0, 0, 0); } MonoGlyph* LayoutKit::rmargin(Glyph* g, Coord size) const { return margin(g, 0, size, 0, 0); } MonoGlyph* LayoutKit::rmargin( Glyph* g, Coord size, Coord stretch, Coord shrink ) const { return margin(g, 0, 0, 0, size, stretch, shrink, 0, 0, 0, 0, 0, 0); } MonoGlyph* LayoutKit::bmargin(Glyph* g, Coord size) const { return margin(g, 0, 0, size, 0); } MonoGlyph* LayoutKit::bmargin( Glyph* g, Coord size, Coord stretch, Coord shrink ) const { return margin(g, 0, 0, 0, 0, 0, 0, size, stretch, shrink, 0, 0, 0); } MonoGlyph* LayoutKit::tmargin(Glyph* g, Coord size) const { return margin(g, 0, 0, 0, size); } MonoGlyph* LayoutKit::tmargin( Glyph* g, Coord size, Coord stretch, Coord shrink ) const { return margin(g, 0, 0, 0, 0, 0, 0, 0, 0, 0, size, stretch, shrink); } /* class Discretionary */ Discretionary::Discretionary(int penalty, Glyph* glyph) : Glyph() { penalty_ = penalty; nobreak_ = glyph; if (nobreak_ != nil) { nobreak_->ref(); } prebreak_ = glyph; if (prebreak_ != nil) { prebreak_->ref(); } inbreak_ = nil; postbreak_ = nil; } Discretionary::Discretionary( int penalty, Glyph* no, Glyph* pre, Glyph* in, Glyph* post ) : Glyph() { penalty_ = penalty; nobreak_ = no; if (nobreak_ != nil) { nobreak_->ref(); } prebreak_ = pre; if (prebreak_ != nil) { prebreak_->ref(); } inbreak_ = in; if (inbreak_ != nil) { inbreak_->ref(); } postbreak_ = post; if (postbreak_ != nil) { postbreak_->ref(); } } Discretionary::~Discretionary() { if (nobreak_ != nil) { nobreak_->unref(); } if (prebreak_ != nil) { prebreak_->unref(); } if (inbreak_ != nil) { inbreak_->unref(); } if (postbreak_ != nil) { postbreak_->unref(); } } void Discretionary::request(Requisition& requisition) const { if (nobreak_ != nil) { nobreak_->request(requisition); } requisition.penalty(penalty_); } Glyph* Discretionary::compose(GlyphBreakType b) { if (b == no_break) { return nobreak_; } else if (b == pre_break) { return prebreak_; } else if (b == in_break) { return inbreak_; } else if (b == post_break) { return postbreak_; } else { return nil; } } /* class Glue */ Glue::Glue( DimensionName d, Coord natural, Coord stretch, Coord shrink, float alignment ) : Glyph() { Requirement r(natural, stretch, shrink, alignment); requisition_.require(d, r); } Glue::Glue(const Requisition& r) : Glyph() { requisition_ = r; } Glue::~Glue() { } void Glue::request(Requisition& r) const { r = requisition_; } void Glue::allocate(Canvas* c, const Allocation& a, Extension& ext) { ext.merge(c, a); } /* class Space */ Space::Space(int count, float each, const Font* f, const Color* c) : Glyph() { count_ = count; each_ = each; font_ = f; Resource::ref(font_); color_ = c; Resource::ref(color_); if (font_ != nil) { FontBoundingBox b; font_->font_bbox(b); Coord ascent = b.ascent(); Coord descent = b.descent(); width_ = font_->width(' ') * each_ * count_; height_ = ascent + descent; alignment_ = (height_ == 0) ? 0 : descent / height_; } else { width_ = 0; height_ = 0; alignment_ = 0; } } Space::~Space() { Resource::unref(font_); Resource::unref(color_); } void Space::request(Requisition& requisition) const { Requirement rx(width_, width_*4, width_/3, 0); Requirement ry(height_, 0, 0, alignment_); requisition.require(Dimension_X, rx); requisition.require(Dimension_Y, ry); } void Space::allocate(Canvas* c, const Allocation& a, Extension& ext) { ext.merge(c, a); } void Space::pick(Canvas*, const Allocation& a, int depth, Hit& h) { Coord x = h.left(); Coord left = a.left(); Coord right = a.right(); if (x >= left && x < right) { h.target(depth, this, (x > (left+right)/2) ? 1 : 0); } } void Space::draw(Canvas* c, const Allocation& a) const { if (count_ > 0) { Coord x = a.x(); Coord y = a.y(); Coord each = (a.right() - a.left()) / count_; for (int i = 0; i < count_; ++i) { c->character(font_, ' ', each, color_, x, y); x += each; } } } /* class Strut */ Strut::Strut( const Font* font, Coord natural, Coord stretch, Coord shrink ) : Glyph() { font_ = font; Resource::ref(font_); if (font_ != nil) { FontBoundingBox b; font_->font_bbox(b); height_ = b.ascent() + b.descent(); alignment_ = (height_ == 0) ? 0 : b.descent() / height_; } natural_ = natural; stretch_ = stretch; shrink_ = shrink; } Strut::~Strut() { Resource::unref(font_); } void Strut::request(Requisition& requisition) const { Requirement rx(natural_, stretch_, shrink_, 0); Requirement ry(height_, 0, 0, alignment_); requisition.require(Dimension_X, rx); requisition.require(Dimension_Y, ry); } void Strut::allocate(Canvas* c, const Allocation& a, Extension& ext) { ext.merge(c, a); } HStrut::HStrut( Coord right_bearing, Coord left_bearing, Coord natural, Coord stretch, Coord shrink ) : Glyph() { left_bearing_ = left_bearing; right_bearing_ = right_bearing; natural_ = natural; stretch_ = stretch; shrink_ = shrink; } HStrut::~HStrut() { } void HStrut::request(Requisition& requisition) const { Coord width = left_bearing_ + right_bearing_; Requirement rx(width, 0, 0, (width == 0) ? 0 : left_bearing_ / width); Requirement ry(natural_, stretch_, shrink_, 0); requisition.require(Dimension_X, rx); requisition.require(Dimension_Y, ry); } VStrut::VStrut( Coord ascent, Coord descent, Coord natural, Coord stretch, Coord shrink ) : Glyph() { ascent_ = ascent; descent_ = descent; natural_ = natural; stretch_ = stretch; shrink_ = shrink; } VStrut::~VStrut() { } void VStrut::request(Requisition& requisition) const { Coord height = ascent_ + descent_; Requirement rx(natural_, stretch_, shrink_, 0); Requirement ry(height, 0, 0, (height == 0) ? 0 : descent_ / height); requisition.require(Dimension_X, rx); requisition.require(Dimension_Y, ry); } /* class LayoutLayer */ LayoutLayer::LayoutLayer( Glyph* between, Glyph* under, Glyph* over ) : MonoGlyph(between) { Resource::ref(under); under_ = under; Resource::ref(over); over_ = over; } LayoutLayer::~LayoutLayer() { Resource::unref(under_); Resource::unref(over_); } void LayoutLayer::allocate(Canvas* c, const Allocation& a, Extension& ext) { if (under_ != nil) { under_->allocate(c, a, ext); } MonoGlyph::allocate(c, a, ext); if (over_ != nil) { over_->allocate(c, a, ext); } } void LayoutLayer::draw(Canvas* c, const Allocation& a) const { if (under_ != nil) { under_->draw(c, a); } MonoGlyph::draw(c, a); if (over_ != nil) { over_->draw(c, a); } } void LayoutLayer::print(Printer* p, const Allocation& a) const { if (under_ != nil) { under_->print(p, a); } MonoGlyph::print(p, a); if (over_ != nil) { over_->print(p, a); } } void LayoutLayer::pick(Canvas* c, const Allocation& a, int depth, Hit& h) { if (under_ != nil) { under_->pick(c, a, depth, h); } MonoGlyph::pick(c, a, depth, h); if (over_ != nil) { over_->pick(c, a, depth, h); } } void LayoutLayer::undraw() { if (under_ != nil) { under_->undraw(); } MonoGlyph::undraw(); if (over_ != nil) { over_->undraw(); } } /* class ShapeOf */ ShapeOf::ShapeOf(Glyph* x, Glyph* y) { x_ = x; y_ = y; Resource::ref(x_); Resource::ref(y_); } ShapeOf::~ShapeOf() { Resource::unref(x_); Resource::unref(y_); } void ShapeOf::request(Requisition& requisition) const { if (x_ == y_) { x_->request(requisition); } else { Requisition req; if (x_ != nil) { x_->request(req); requisition.require_x(req.x_requirement()); } if (y_ != nil) { y_->request(req); requisition.require_y(req.y_requirement()); } } } neuron-7.6.3/src/lib/InterViews/lrmarker.cpp000077500000000000000000000142271340731477100210340ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * LRMarker - mark text region */ #include #include #include #include LRMarker::LRMarker( Glyph* body, const Color* overlay, const Color* underlay ) : MonoGlyph(body) { overlay_ = overlay; Resource::ref(overlay_); underlay_ = underlay; Resource::ref(underlay_); marked_ = false; bounded_ = false; canvas_ = nil; } LRMarker::~LRMarker() { Resource::unref(overlay_); Resource::unref(underlay_); canvas_ = nil; } void LRMarker::unmark() { if (marked_) { mark(x1_, y1_, h1_, x1_, y1_, h1_); marked_ = false; } } static void do_draw( Canvas* canvas, const Color* color, Coord left, Coord right, Coord x1, Coord b1, Coord t1, Coord x2, Coord b2, Coord t2 ) { if (x1 < x2) { canvas->fill_rect(left, b1, x1, b2, color); canvas->fill_rect(x2, t1, right, t2, color); canvas->fill_rect(x1, b2, x2, t1, color); } else if (x1 > x2) { canvas->fill_rect(left, b1, x2, b2, color); canvas->fill_rect(x1, t1, right, t2, color); canvas->fill_rect(x1, b1, x2, t2, color); } else { canvas->fill_rect(left, b1, x1, b2, color); canvas->fill_rect(x2, t1, right, t2, color); } } static void do_damage( Canvas* c, Coord left, Coord right, Coord x1, Coord b1, Coord t1, Coord x2, Coord b2, Coord t2 ) { if (x1 < x2) { if (b1 != b2) { c->damage(left, Math::min(b1, b2), x1, Math::max(b1, b2)); } if (t1 != t2) { c->damage(x2, Math::min(t1, t2), right, Math::max(t1, t2)); } if (b2 != t1) { c->damage(x1, Math::min(b2, t1), x2, Math::max(b2, t1)); } } else if (x1 > x2) { if (b1 != b2) { c->damage(left, Math::min(b1, b2), x2, Math::max(b1, b2)); } if (t1 != t2) { c->damage(x1, Math::min(t1, t2), right, Math::max(t1, t2)); } if (b1 != t2) { c->damage(x2, Math::min(t2, b1), x1, Math::max(t2, b1)); } } else { if (b1 != b2) { c->damage(left, Math::min(b1, b2), x2, Math::max(b1, b2)); } if (t1 != t2) { c->damage(x2, Math::min(t1, t2), right, Math::max(t1, t2)); } } } void LRMarker::bound(Coord left, Coord bottom, Coord right, Coord top) { if (canvas_ != nil) { if (!bounded_) { canvas_->damage(left, bottom, right, top); } else { Coord lx = Math::max(left_, left); Coord ln = Math::min(left_, left); Coord bx = Math::max(bottom_, bottom); Coord bn = Math::min(bottom_, bottom); Coord rx = Math::max(right_, right); Coord rn = Math::min(right_, right); Coord tx = Math::max(top_, top); Coord tn = Math::min(top_, top); if (ln != lx) { canvas_->damage(ln, bn, lx, tn); } if (tn != tx) { canvas_->damage(ln, tn, rn, tx); } if (rn != rx) { canvas_->damage(rn, bx, rx, tx); } if (bn != bx) { canvas_->damage(lx, bn, rx, bx); } } } left_ = left; bottom_ = bottom; right_ = right; top_ = top; bounded_ = true; } void LRMarker::mark( Coord x1, Coord y1, Coord h1, Coord x2, Coord y2, Coord h2 ) { if (canvas_ != nil) { if (!marked_) { do_damage( canvas_, left_, right_, x1, y1, y1 + h1, x2, y2, y2 + h2 ); } else if ( (y2 > y1_ || (y2 == y1_ && x2 < x1_)) || (y1 < y2_ || (y1 == y2_ && x1 > x2_)) ) { do_damage( canvas_, left_, right_, x1_, y1_, y1_ + h1_, x2_, y2_, y2_ + h2_ ); do_damage( canvas_, left_, right_, x1, y1, y1 + h1, x2, y2, y2 + h2 ); } else { do_damage( canvas_, left_, right_, x1_, y1_, y1_ + h1_, x1, y1, y1 + h1 ); do_damage( canvas_, left_, right_, x2_, y2_, y2_ + h2_, x2, y2, y2 + h2 ); } } x1_ = x1; y1_ = y1; h1_ = h1; x2_ = x2; y2_ = y2; h2_ = h2; marked_ = true; } void LRMarker::allocate(Canvas* c, const Allocation& a, Extension& ext) { MonoGlyph::allocate(c, a, ext); ext.merge(c, a); canvas_ = c; } void LRMarker::draw(Canvas* c, const Allocation& a) const { if (c != nil) { if (marked_ && underlay_ != nil) { do_draw( c, underlay_, left_, right_, x1_, y1_, y1_ + h1_, x2_, y2_, y2_ + h2_ ); } } MonoGlyph::draw(c, a); if (c != nil) { if (marked_ && overlay_ != nil) { do_draw( c, overlay_, left_, right_, x1_, y1_, y1_ + h1_, x2_, y2_, y2_ + h2_ ); } } } void LRMarker::undraw() { MonoGlyph::undraw(); canvas_ = nil; } neuron-7.6.3/src/lib/InterViews/menu.cpp000066400000000000000000000274741340731477100201660ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Menu -- visible list of Actions */ #include #include #include #include #include #include #include #include #include #include #if !defined(WIN32) && !MAC #include #endif declarePtrList(MenuItemList,MenuItem) implementPtrList(MenuItemList,MenuItem) class MenuImpl { private: friend class Menu; friend class MenuItem; MenuItemList itemlist_; GlyphIndex item_; float x1_, y1_, x2_, y2_; bool saved_cursor_; Cursor* cursor_; bool grabbed_; static Cursor* menu_cursor_; Menu* selected_menu() const; void save_cursor(Canvas*); void restore_cursor(Canvas*); void grab(Menu*, const Event&); void ungrab(Menu*, const Event&); static Cursor* menu_cursor(); }; Cursor* MenuImpl::menu_cursor_; MenuItem::MenuItem(Glyph* g, TelltaleState* t) { init(g, t); action_ = nil; menu_ = nil; window_ = nil; } MenuItem::MenuItem(Glyph* g, TelltaleState* t, Action* a) { init(g, t); Resource::ref(a); action_ = a; menu_ = nil; window_ = nil; } MenuItem::MenuItem(Glyph* g, TelltaleState* t, Menu* m, Window* w) { init(g, t); action_ = nil; Resource::ref(m); menu_ = m; if (w == nil) { w = new PopupWindow(menu_); } w->cursor(MenuImpl::menu_cursor()); window_ = w; } MenuItem::~MenuItem() { state_->detach(this); Resource::unref(state_); Resource::unref(action_); Resource::unref(menu_); Resource::unref(patch_); delete window_; } void MenuItem::init(Glyph* g, TelltaleState* t) { patch_ = new Patch(g); Resource::ref(patch_); state_ = t; Resource::ref(state_); state_->attach(this); } Glyph* MenuItem::body() const { return patch_; } void MenuItem::action(Action* a) { Resource::ref(a); Resource::unref(action_); action_ = a; } void MenuItem::menu(Menu* m, Window* w) { Resource::ref(m); Resource::unref(menu_); menu_ = m; if (window_) { delete window_; } if (w == nil) { w = new PopupWindow(menu_); } w->cursor(MenuImpl::menu_cursor()); window_ = w; } void MenuItem::update(Observable*) { patch_->redraw(); } Menu::Menu( Glyph* g, Style* s, float x1, float y1, float x2, float y2 ) : InputHandler(g, s) { impl_ = new MenuImpl; MenuImpl& i = *impl_; i.item_ = -1; i.x1_ = x1; i.y1_ = y1; i.x2_ = x2; i.y2_ = y2; i.saved_cursor_ = false; i.grabbed_ = false; } Menu::~Menu() { for (ListItr(MenuItemList) i(impl_->itemlist_); i.more(); i.next()) { MenuItem* m = i.cur(); Resource::unref(m); } delete impl_; } void Menu::append_item(MenuItem* item) { MenuImpl& i = *impl_; Resource::ref(item); i.itemlist_.append(item); append(item->body()); } void Menu::prepend_item(MenuItem* item) { MenuImpl& i = *impl_; Resource::ref(item); i.itemlist_.prepend(item); prepend(item->body()); } void Menu::insert_item(GlyphIndex index, MenuItem* item) { MenuImpl& i = *impl_; Resource::ref(item); i.itemlist_.insert(index, item); insert(index, item->body()); } void Menu::remove_item(GlyphIndex index) { MenuImpl& i = *impl_; MenuItem* mi = i.itemlist_.item(index); i.itemlist_.remove(index); remove(index); Resource::unref(mi); } void Menu::replace_item(GlyphIndex index, MenuItem* item) { MenuImpl& i = *impl_; if (index >= 0 && index < i.itemlist_.count()) { MenuItem* mi = i.itemlist_.item(index); i.itemlist_.remove(index); Resource::ref(item); i.itemlist_.insert(index, item); replace(index, item->body()); Resource::unref(mi); } } GlyphIndex Menu::item_count() const { MenuImpl& i = *impl_; return i.itemlist_.count(); } MenuItem* Menu::item(GlyphIndex index) const { MenuImpl& i = *impl_; if (index < 0 || index >= i.itemlist_.count()) { return nil; } return i.itemlist_.item(index); } void Menu::select(GlyphIndex index) { MenuImpl& i = *impl_; if (index != i.item_ && index >= 0 && index < i.itemlist_.count()) { close(); i.item_ = index; open(); } } #if carbon // want to handle menu in a dialog box extern int iv_carbon_in_menu_; #endif void Menu::open() { MenuImpl& i = *impl_; GlyphIndex index = i.item_; if (index >= 0) { MenuItem* mi = item(index); TelltaleState* t = mi->state(); if (t != nil && t->test(TelltaleState::is_enabled)) { t->set(TelltaleState::is_active, true); if (mi->menu() != nil) { mi->menu()->unselect(); Action* a = mi->action(); if (a != nil) { a->execute(); } } if ((mi->window() != nil) && (mi->patch_->canvas() != nil)) { const Window& rel = *mi->patch_->canvas()->window(); const Allocation& a = mi->patch_->allocation(); Window& w = *mi->window(); w.display(rel.display()); #if defined(WIN32) || defined(MAC) if (!w.bound()) { // got to get it sized before align w.place(-10000, 10000); // will work w.map(); w.unmap(); } #endif w.place( rel.left() + (1 - i.x1_) * a.left() + i.x1_ * a.right(), rel.bottom() + (1 - i.y1_) * a.bottom() + i.y1_ * a.top() ); w.align(i.x2_, i.y2_); #ifdef WIN32 // force onto screen. Well, almost, there is a problem if menu items overlay // previous menus. so only check if bottom is negative. if (w.bottom() < 0) { w.place(w.left(), 0); } #endif w.map(); #if carbon ++iv_carbon_in_menu_; #endif } } } } void Menu::close() { MenuImpl& i = *impl_; GlyphIndex index = i.item_; if (index >= 0) { MenuItem* mi = item(index); #if MAC Window* w = mi->window(); if (w != nil) { w->unmap(); #if carbon --iv_carbon_in_menu_; #endif } #endif TelltaleState* t = mi->state(); if (t != nil && t->test(TelltaleState::is_enabled)) { t->set(TelltaleState::is_active, false); } if (mi->menu() != nil) { mi->menu_->unselect(); } #if !MAC Window* w = mi->window(); if (w != nil) { w->unmap(); } #endif } } GlyphIndex Menu::selected() const { return impl_->item_; } void Menu::unselect() { MenuImpl& i = *impl_; if (i.item_ != -1) { close(); i.item_ = -1; } } #if carbon extern bool need_motion_on_deactivate_; #define NEEDMOTION(arg) need_motion_on_deactivate_ = arg; #else #define NEEDMOTION(arg) /**/ #endif void Menu::press(const Event& e) { NEEDMOTION(false) Canvas* c = canvas(); if (c != nil) { impl_->save_cursor(c); drag(e); } } #if defined(WIN32) || MAC extern void iv_window_coords(const Event&, Window*, Coord&, Coord&); #endif void Menu::drag(const Event& e) { Canvas* c = canvas(); if (c == nil) { unselect(); return; } Window* w = c->window(); #if defined(WIN32) Coord x, y; iv_window_coords(e, w, x, y); Hit hit(x, y); #else Hit hit(e.pointer_root_x() - w->left(), e.pointer_root_y() - w->bottom()); #endif pick(c, allocation(), 0, hit); if (hit.any()) { GlyphIndex index = hit.index(0); Menu* submenu = item(index)->menu(); if (submenu != nil) { submenu->unselect(); } select(index); } else { GlyphIndex index = selected(); if (index >= 0) { Menu* submenu = item(index)->menu(); if (submenu != nil) { submenu->drag(e); return; } } unselect(); } } void Menu::release(const Event& e) { #if carbon extern bool session_deactivating_; if (session_deactivating_) { unselect(); return; } #endif Menu* m = this; GlyphIndex index; for (;;) { index = m->selected(); if (index < 0) { break; } Menu* submenu = m->item(index)->menu(); if (submenu == nil) { break; } m = submenu; } if (index >= 0) { GlyphIndex top_index = selected(); TelltaleState* top_t = item(top_index)->state(); Resource::ref(top_t); top_t->set(TelltaleState::is_running, true); impl_->ungrab(this, e); Canvas* c = canvas(); if (c != nil) { impl_->restore_cursor(c); } unselect(); MenuItem* mi = m->item(index); TelltaleState* t = mi->state(); Action* a = mi->action(); if (t != nil && t->test(TelltaleState::is_enabled)) { bool act = !t->test(TelltaleState::is_chosen); if (t->test(TelltaleState::is_toggle)) { t->set(TelltaleState::is_chosen, act); act = true; } else if (t->test(TelltaleState::is_choosable)) { t->set(TelltaleState::is_chosen, true); } if (act && a != nil) { a->execute(); } } top_t->set(TelltaleState::is_running, false); Resource::unref(top_t); } else { /* * If we hit an item with a submenu, then we leave * the submenu open (with item 0 selected), grab, and return. */ Canvas* c; Menu* submenu; for (m = this, c = canvas(); c != nil; m = submenu, c = m->canvas()) { Window* w = c->window(); Hit hit( e.pointer_root_x() - w->left(), e.pointer_root_y() - w->bottom() ); m->pick(c, m->allocation(), 0, hit); if (hit.any()) { m = m->item(hit.index(0))->menu(); if (m != nil) { m->select(0); #if 0 && defined(WIN32) //twice clicking on a menu that opens a submenu gets it into a state //where it is hard to close except by clicking on a submenu item and //dragging the mouse off the subment and releasing. // or clicking on any neuron window. Unfortunately, this fix broke the // ability to click on an item with submenus and have the submenu persist. // Therefore we are backing out of it. impl_->ungrab(this, e); #endif impl_->grab(this, e); return; } break; } submenu = m->impl_->selected_menu(); if (submenu == nil) { break; } } impl_->ungrab(this, e); c = canvas(); if (c != nil) { impl_->restore_cursor(c); } unselect(); } } /* class MenuImpl */ Menu* MenuImpl::selected_menu() const { Menu* m = nil; if (item_ >= 0) { m = itemlist_.item(item_)->menu(); } return m; } void MenuImpl::save_cursor(Canvas* c) { if (!saved_cursor_) { Window* w = c->window(); cursor_ = w->cursor(); saved_cursor_ = true; w->cursor(menu_cursor()); } } void MenuImpl::restore_cursor(Canvas* c) { if (saved_cursor_) { c->window()->cursor(cursor_); saved_cursor_ = false; } } void MenuImpl::grab(Menu* m, const Event& e) { if (!grabbed_) { e.grab(m->handler()); e.window()->grab_pointer(nil); grabbed_ = true; } } void MenuImpl::ungrab(Menu* m, const Event& e) { if (grabbed_) { e.window()->ungrab_pointer(); e.ungrab(m->handler()); grabbed_ = false; } } Cursor* MenuImpl::menu_cursor() { if (menu_cursor_ == nil) { #if defined(WIN32) || MAC menu_cursor_ = arrow; #else menu_cursor_ = new Cursor(XC_arrow); #endif } return menu_cursor_; } neuron-7.6.3/src/lib/InterViews/mf_dialogs.cpp000077500000000000000000000035771340731477100213270ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * MFDialogKit -- object for creating common Motif-ish dialog boxes */ #include #include #include #include class MFDialogKitImpl { private: friend class MFDialogKit; }; MFDialogKit::MFDialogKit() { } MFDialogKit::~MFDialogKit() { } FieldEditor* MFDialogKit::make_field_editor( const String& sample, WidgetKit* k, Style* s, FieldEditorAction* a ) const { return new FieldEditor(sample, k, s, a); } FileChooser* MFDialogKit::make_file_chooser( const String& dir, WidgetKit* k, Style* s, FileChooserAction* a ) const { return new FileChooser(dir, k, s, a); } neuron-7.6.3/src/lib/InterViews/mf_kit.cpp000066400000000000000000000462411340731477100204640ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * MFKit -- object for creating common UI Motif-ish objects */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static PropertyData kit_props[] = { { "*flat", "#aaaaaa" }, { "*frameThickness", "2.0" }, { "*moverSize", "20.0" }, { "*radioScale", "0.7" }, { "*sliderSize", "20.0" }, { "*toggleScale", "0.5" }, { "*FileChooser*filter", "off" }, { "*FieldEditor*beveled", "on" }, { "*FieldEditor*background", "#e0e0e0" }, { "*FieldEditor*flat", "#e0e0e0" }, { "*Panner*minimumThumbSize", "18.0" }, { "*ScrollBar*minimumThumbSize", "28.0" }, { nil } }; class MFKitInfo : public Resource { public: MFKitInfo(Style*); virtual ~MFKitInfo(); Style* style() const; Coord thickness() const; float toggle_scale() const; float radio_scale() const; Coord mover_size() const; Coord slider_size() const; const Color* flat() const; const Color* light() const; const Color* dull() const; const Color* dark() const; const Color* gray_out() const; private: Style* style_; Coord thickness_; float toggle_scale_; float radio_scale_; Coord mover_size_; Coord slider_size_; const Color* flat_; const Color* light_; const Color* dull_; const Color* dark_; const Color* gray_out_; void load(); void unload(); }; inline Style* MFKitInfo::style() const { return style_; } inline Coord MFKitInfo::thickness() const { return thickness_; } inline float MFKitInfo::toggle_scale() const { return toggle_scale_; } inline float MFKitInfo::radio_scale() const { return radio_scale_; } inline Coord MFKitInfo::mover_size() const { return mover_size_; } inline Coord MFKitInfo::slider_size() const { return slider_size_; } inline const Color* MFKitInfo::flat() const { return flat_; } inline const Color* MFKitInfo::light() const { return light_; } inline const Color* MFKitInfo::dull() const { return dull_; } inline const Color* MFKitInfo::dark() const { return dark_; } inline const Color* MFKitInfo::gray_out() const { return gray_out_; } class MFKitInfo; declarePtrList(MFKitInfoList,MFKitInfo) implementPtrList(MFKitInfoList,MFKitInfo) class MFKitFrame : public BevelFrame { public: MFKitFrame( Glyph*, TelltaleState*, MFKitInfo*, Coord, bool target, bool choosable ); virtual ~MFKitFrame(); const MFKitInfo& info() const; virtual void draw(Canvas*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); virtual void draw_frame(Canvas*, const Allocation&, Coord) const; private: TelltaleState* state_; MFKitInfo* info_; bool target_; bool choosable_; }; const MFKitInfo& MFKitFrame::info() const { return *info_; } class MFKitMenuItem : public MonoGlyph { public: MFKitMenuItem(Glyph*, TelltaleState*); virtual ~MFKitMenuItem(); virtual void draw(Canvas*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); private: TelltaleState* state_; }; class MFKitForeground : public MonoGlyph { public: MFKitForeground(Glyph*, const Color*); virtual ~MFKitForeground(); virtual void draw(Canvas*, const Allocation&) const; private: const Color* foreground_; }; class MFKitImpl { private: friend class MFKit; MFKit* kit_; LayoutKit* layout_; MFKitInfo* info_; MFKitInfoList info_list_; MFKitImpl(MFKit*); ~MFKitImpl(); bool match(const Style&, const Style&, const char*); Glyph* make_menu_item(TelltaleState*, Glyph* check, Glyph*); ChoiceItem* make_button(TelltaleState*, Glyph* normal, Glyph* pressed); ChoiceItem* make_toggle(TelltaleState*, Beveler, float scale); ChoiceItem* make_mover(TelltaleState*, Beveler); Slider* make_slider(Slider*); }; MFKit::MFKit() { impl_ = new MFKitImpl(this); Style* s = Session::instance()->style(); for (PropertyData* p = kit_props; p->path != nil; p++) { s->attribute(p->path, p->value, -10); } } MFKit::~MFKit() { delete impl_; } const char* MFKit::gui() const { return "Motif"; } static const char* style_attributes[] = { "flat", "frameThickness", "moverSize", "sliderSize", nil }; void MFKit::style_changed(Style* style) { MFKitImpl& i = *impl_; for (ListItr(MFKitInfoList) s(i.info_list_); s.more(); s.next()) { MFKitInfo* info = s.cur(); if (info->style() == style) { i.info_ = info; return; } } const Style& s1 = *style; for (ListItr(MFKitInfoList) t(i.info_list_); t.more(); t.next()) { MFKitInfo* info = t.cur(); const Style& s2 = *info->style(); for (const char** p = style_attributes; ; p++) { if (*p == nil) { i.info_ = info; return; } if (!i.match(s1, s2, *p)) { break; } } } i.info_ = new MFKitInfo(style); Resource::ref(i.info_); i.info_list_.append(i.info_); } MonoGlyph* MFKit::outset_frame(Glyph* g) const { const MFKitInfo& i = *impl_->info_; return new Bevel( g, &Bevel::rect, i.light(), i.flat(), i.dark(), i.thickness() ); } MonoGlyph* MFKit::inset_frame(Glyph* g) const { const MFKitInfo& i = *impl_->info_; return new Bevel( g, &Bevel::rect, i.dark(), i.flat(), i.light(), i.thickness() ); } MonoGlyph* MFKit::bright_inset_frame(Glyph* g) const { const MFKitInfo& i = *impl_->info_; return new Bevel( g, &Bevel::rect, i.dark(), i.light(), i.light(), 1.0, 0.0, 0.0, false, false ); } Glyph* MFKit::menubar_look() const { MFKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; return outset_frame(layout.r_margin(layout.hbox(), 0.0, fil, 0.0)); } Glyph* MFKit::pulldown_look() const { MFKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; return outset_frame(layout.vbox()); } Glyph* MFKit::menubar_item_look(Glyph* g, TelltaleState* t) const { MFKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; MFKitInfo* info = i.info_; Glyph* item = layout.h_margin(g, 2.0); return new MFKitFrame(item, t, info, info->thickness(), true, true); } Glyph* MFKit::menu_item_look(Glyph* g, TelltaleState* t) const { MFKitImpl& i = *impl_; MFKitInfo* info = i.info_; return new MFKitFrame(g, t, info, info->thickness(), true, true); } Glyph* MFKit::check_menu_item_look(Glyph* g, TelltaleState* t) const { MFKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; const MFKitInfo& info = *i.info_; Coord box_size = font()->width('m') * info.toggle_scale(); Glyph* dot = new Bevel( layout.center(layout.fixed_span(nil, box_size, box_size), 0.0, 0.0), &Bevel::rect, info.dark(), info.dull(), info.light(), info.thickness(), false, false ); return i.make_menu_item(t, dot, g); } Glyph* MFKit::radio_menu_item_look(Glyph* g, TelltaleState* t) const { MFKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; const MFKitInfo& info = *i.info_; Coord box_size = font()->width('m') * info.radio_scale(); Glyph* diamond = new Bevel( layout.center(layout.fixed_span(nil, box_size, box_size), 0.0, 0.0), &Bevel::diamond, info.dark(), info.dull(), info.light(), info.thickness(), false, false ); return i.make_menu_item(t, diamond, g); } Glyph* MFKit::menu_item_separator_look() const { MFKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; return layout.v_margin( layout.v_fixed_span( layout.h_margin(inset_frame(nil), 3.0), 3.0 ), 2.0 ); } Glyph* MFKit::push_button_look(Glyph* g, TelltaleState* t) const { MFKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; Coord margin = 5.0; Coord offset = 0.5 * i.info_->thickness(); return i.make_button( t, layout.margin(g, margin), layout.margin(g, margin + offset, margin - offset) ); } Glyph* MFKit::default_button_look(Glyph* g, TelltaleState* t) const { MFKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; return inset_frame(layout.margin(push_button_look(g, t), 3.0)); } Glyph* MFKit::palette_button_look(Glyph* g, TelltaleState* t) const { return push_button_look(g, t); } Glyph* MFKit::check_box_look(Glyph* g, TelltaleState* t) const { MFKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; return layout.hbox( layout.vcenter( i.make_toggle(t, &Bevel::rect, i.info_->toggle_scale()) ), layout.hspace(5.0), layout.vcenter(g) ); } Glyph* MFKit::radio_button_look(Glyph* g, TelltaleState* t) const { MFKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; return layout.hbox( layout.vcenter( i.make_toggle(t, &Bevel::diamond, i.info_->radio_scale()) ), layout.hspace(5.0), layout.vcenter(g) ); } Glyph* MFKit::slider_look(DimensionName d, Adjustable* a) const { MFKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; const MFKitInfo& info = *i.info_; Coord slider_margin = 2.0; Coord size = info.slider_size() - slider_margin - slider_margin; Glyph* g; switch (d) { case Dimension_X: g = layout.v_fixed_span( i.make_slider(new XSlider(style(), a)), size ); break; case Dimension_Y: g = layout.h_fixed_span( i.make_slider(new YSlider(style(), a)), size ); break; default: return nil; } return new Bevel( g, &Bevel::rect, info.dark(), info.dull(), info.light(), info.thickness() ); } Glyph* MFKit::scroll_bar_look(DimensionName d, Adjustable* a) const { MFKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; const MFKitInfo& info = *i.info_; Glyph* g, * box, * sep, * mover1, * slider, * mover2; Coord xspan, yspan; float align; Coord slider_margin = 2.0; switch (d) { case Dimension_X: xspan = info.mover_size(); yspan = info.slider_size(); align = 0.0; box = layout.hbox(); g = layout.v_fixed_span(box, yspan); sep = layout.hspace(1.0); mover1 = left_mover(a); slider = layout.v_margin( layout.v_fixed_span( i.make_slider(new XSlider(style(), a)), yspan - slider_margin - slider_margin ), slider_margin ); mover2 = right_mover(a); break; case Dimension_Y: xspan = info.slider_size(); yspan = info.mover_size(); align = 1.0; box = layout.vbox(); g = layout.h_fixed_span(box, xspan); sep = layout.vspace(1.0); mover1 = up_mover(a); slider = layout.h_margin( layout.h_fixed_span( i.make_slider(new YSlider(style(), a)), xspan - slider_margin - slider_margin ), slider_margin ); mover2 = down_mover(a); break; } box->append( layout.center_dimension( layout.fixed_span(mover1, xspan, yspan), d, align ) ); box->append(sep); box->append(slider); box->append(sep); box->append(layout.fixed_span(mover2, xspan, yspan)); Coord t = info.thickness(); return new Bevel( g, &Bevel::rect, info.dark(), info.dull(), info.light(), t ); } Glyph* MFKit::panner_look(Adjustable* x, Adjustable* y) const { MFKitImpl& i = *impl_; return i.make_slider(new XYSlider(style(), x, y)); } Glyph* MFKit::enlarger_look(TelltaleState*) const { return nil; } Glyph* MFKit::reducer_look(TelltaleState*) const { return nil; } Glyph* MFKit::up_mover_look(TelltaleState* t) const { return impl_->make_mover(t, &Bevel::up_arrow); } Glyph* MFKit::down_mover_look(TelltaleState* t) const { return impl_->make_mover(t, &Bevel::down_arrow); } Glyph* MFKit::left_mover_look(TelltaleState* t) const { return impl_->make_mover(t, &Bevel::left_arrow); } Glyph* MFKit::right_mover_look(TelltaleState* t) const { return impl_->make_mover(t, &Bevel::right_arrow); } /* class MFKitFrame */ MFKitFrame::MFKitFrame( Glyph* g, TelltaleState* t, MFKitInfo* i, Coord thickness, bool target, bool choosable ) : BevelFrame(g, thickness) { state_ = t; Resource::ref(state_); info_ = i; Resource::ref(info_); target_ = target; choosable_ = choosable; } MFKitFrame::~MFKitFrame() { Resource::unref(state_); Resource::unref(info_); } void MFKitFrame::draw(Canvas* c, const Allocation& a) const { BevelFrame::draw(c, a); if (!state_->test(TelltaleState::is_enabled)) { c->fill_rect( a.left(), a.bottom(), a.right(), a.top(), info_->gray_out() ); } } void MFKitFrame::pick(Canvas* c, const Allocation& a, int depth, Hit& h) { if (target_) { Coord x = h.left(); Coord y = h.bottom(); if (x >= a.left() && x < a.right() && y >= a.bottom() && y < a.top()) { h.target(depth, this, 0); } } else { BevelFrame::pick(c, a, depth, h); } } void MFKitFrame::draw_frame(Canvas* c, const Allocation& a, Coord t) const { const MFKitInfo& i = info(); const Color* c1, * c2, * c3; c2 = i.flat(); if (state_->test(TelltaleState::is_enabled_active)) { c1 = i.light(); c3 = i.dark(); } else if (choosable_ && state_->test(TelltaleState::is_enabled_chosen)) { c1 = i.dark(); c3 = i.light(); } else { c1 = c2; c3 = c2; } Bevel::rect(c, c1, c2, c3, t, a.left(), a.bottom(), a.right(), a.top()); } /* class MFKitMenuItem */ MFKitMenuItem::MFKitMenuItem(Glyph* g, TelltaleState* s) : MonoGlyph(g) { Resource::ref(s); state_ = s; } MFKitMenuItem::~MFKitMenuItem() { Resource::unref(state_); } void MFKitMenuItem::draw(Canvas* c, const Allocation& a) const { if (state_->test(TelltaleState::is_chosen)) { MonoGlyph::draw(c, a); } } void MFKitMenuItem::pick(Canvas* c, const Allocation& a, int depth, Hit& h) { if (state_->test(TelltaleState::is_chosen)) { MonoGlyph::pick(c, a, depth, h); } } /* class MFKitForeground */ MFKitForeground::MFKitForeground(Glyph* g, const Color* c) : MonoGlyph(g) { foreground_ = c; Resource::ref(foreground_); } MFKitForeground::~MFKitForeground() { Resource::unref(foreground_); } void MFKitForeground::draw(Canvas* c, const Allocation& a) const { MonoGlyph::draw(c, a); c->fill_rect(a.left(), a.bottom(), a.right(), a.top(), foreground_); } /* class MFKitImpl */ MFKitImpl::MFKitImpl(MFKit* k) { kit_ = k; layout_ = LayoutKit::instance(); } MFKitImpl::~MFKitImpl() { for (ListItr(MFKitInfoList) i(info_list_); i.more(); i.next()) { MFKitInfo* info = i.cur(); Resource::unref(info); } } bool MFKitImpl::match(const Style& s1, const Style& s2, const char* n) { String v1, v2; bool b1 = s1.find_attribute(n, v1); bool b2 = s2.find_attribute(n, v2); return !(b1 || b2) || (b1 && b2 && v1 == v2); } Glyph* MFKitImpl::make_menu_item( TelltaleState* t, Glyph* check, Glyph* g ) { const LayoutKit& layout = *layout_; return new MFKitFrame( layout.hbox( new MFKitMenuItem(layout.vcenter(check), t), layout.hspace(5), layout.vcenter(g) ), t, info_, info_->thickness(), true, false ); } ChoiceItem* MFKitImpl::make_button( TelltaleState* t, Glyph* normal, Glyph* pressed ) { const MFKitInfo& i = *info_; Glyph* enabled = new Bevel( normal, &Bevel::rect, i.light(), i.flat(), i.dark(), i.thickness(), false, false ); Glyph* disabled = new MFKitForeground(enabled, i.gray_out()); Glyph* active = new Bevel( pressed, &Bevel::rect, i.dark(), i.flat(), i.light(), i.thickness(), false, false ); return new ChoiceItem( t, disabled, enabled, enabled, active, enabled, active, active, active, active, disabled ); } ChoiceItem* MFKitImpl::make_toggle(TelltaleState* t, Beveler b, float scale) { const MFKitInfo& i = *info_; Coord box_size = kit_->font()->width('m') * scale; Glyph* box = layout_->fixed_span(nil, box_size, box_size); Glyph* toggle_out = new Bevel( box, b, i.light(), i.flat(), i.dark(), i.thickness(), false, false ); Glyph* toggle_in = new Bevel( box, b, i.dark(), i.dull(), i.light(), i.thickness(), false, false ); return new ChoiceItem( t, new MFKitForeground(toggle_out, i.gray_out()), toggle_out, toggle_out, toggle_in, toggle_in, toggle_in, toggle_in, toggle_in, toggle_in, new MFKitForeground(toggle_in, i.gray_out()) ); } ChoiceItem* MFKitImpl::make_mover(TelltaleState* t, Beveler b) { const MFKitInfo& i = *info_; Coord m = 2.0; Glyph* enabled = layout_->margin( new Bevel(nil, b, i.light(), i.flat(), i.dark(), i.thickness()), m ); Glyph* active = layout_->margin( new Bevel(nil, b, i.dark(), i.flat(), i.light(), i.thickness()), m ); Glyph* disabled = new MFKitForeground(enabled, i.gray_out()); return new ChoiceItem( t, disabled, enabled, enabled, active, active, enabled, active, active, active, disabled ); } Slider* MFKitImpl::make_slider(Slider* slider) { const MFKitInfo& i = *info_; slider->normal_thumb( new Bevel( nil, &Bevel::rect, i.light(), i.flat(), i.dark(), i.thickness() ) ); return slider; } /* class MFKitInfo */ MFKitInfo::MFKitInfo(Style* s) { style_ = s; Resource::ref(style_); load(); } MFKitInfo::~MFKitInfo() { unload(); Resource::unref(style_); } void MFKitInfo::load() { Style& s = *style_; s.find_attribute("frameThickness", thickness_); s.find_attribute("toggleScale", toggle_scale_); s.find_attribute("radioScale", radio_scale_); s.find_attribute("moverSize", mover_size_); s.find_attribute("sliderSize", slider_size_); String v; s.find_attribute("flat", v); const Color* c = Color::lookup(Session::instance()->default_display(), v); if (c == nil) { c = new Color(0.7, 0.7, 0.7, 1.0); } flat_ = c; light_ = c->brightness(0.5); dull_ = c->brightness(-0.2); dark_ = c->brightness(-0.4); gray_out_ = new Color(*c, 0.2); Resource::ref(flat_); Resource::ref(light_); Resource::ref(dull_); Resource::ref(dark_); Resource::ref(gray_out_); } void MFKitInfo::unload() { Resource::unref(flat_); Resource::unref(light_); Resource::unref(dull_); Resource::unref(dark_); Resource::unref(gray_out_); } neuron-7.6.3/src/lib/InterViews/mono_kit.cpp000066400000000000000000000542121340731477100210270ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * MonoKit -- object for creating common UI Motif-ish objects */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static PropertyData kit_props[] = { { "*frameThickness", "2.0" }, { "*moverSize", "20.0" }, { "*radioScale", "0.7" }, { "*sliderSize", "20.0" }, { "*toggleScale", "0.5" }, { "*FileChooser*filter", "on" }, { "*FieldEditor*beveled", "on" }, { "*Panner*minimumThumbSize", "18.0" }, { "*ScrollBar*minimumThumbSize", "20.0" }, { "*double_buffered", "on" }, { nil } }; class MonoKitInfo : public Resource { public: MonoKitInfo(Style*); virtual ~MonoKitInfo(); Style* style() const; Coord thickness() const; float toggle_scale() const; float radio_scale() const; Coord mover_size() const; Coord slider_size() const; const Color* flat() const; const Color* light() const; const Color* dull() const; const Color* dark() const; const Color* gray_out() const; private: Style* style_; Coord thickness_; float toggle_scale_; float radio_scale_; Coord mover_size_; Coord slider_size_; const Color* flat_; const Color* light_; const Color* dull_; const Color* dark_; const Color* gray_out_; void load(); void unload(); }; inline Style* MonoKitInfo::style() const { return style_; } inline Coord MonoKitInfo::thickness() const { return thickness_; } inline float MonoKitInfo::toggle_scale() const { return toggle_scale_; } inline float MonoKitInfo::radio_scale() const { return radio_scale_; } inline Coord MonoKitInfo::mover_size() const { return mover_size_; } inline Coord MonoKitInfo::slider_size() const { return slider_size_; } inline const Color* MonoKitInfo::flat() const { return flat_; } inline const Color* MonoKitInfo::light() const { return light_; } inline const Color* MonoKitInfo::dull() const { return dull_; } inline const Color* MonoKitInfo::dark() const { return dark_; } inline const Color* MonoKitInfo::gray_out() const { return gray_out_; } class MonoKitInfo; declarePtrList(MonoKitInfoList,MonoKitInfo) implementPtrList(MonoKitInfoList,MonoKitInfo) class MonoKitFrame : public BevelFrame { public: MonoKitFrame( Glyph*, TelltaleState*, MonoKitInfo*, Coord, bool target, bool choosable ); virtual ~MonoKitFrame(); const MonoKitInfo& info() const; virtual void draw(Canvas*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); virtual void draw_frame(Canvas*, const Allocation&, Coord) const; private: TelltaleState* state_; MonoKitInfo* info_; bool target_; bool choosable_; }; const MonoKitInfo& MonoKitFrame::info() const { return *info_; } class MonoKitMenuItem : public MonoGlyph { public: MonoKitMenuItem(Glyph*, TelltaleState*); virtual ~MonoKitMenuItem(); virtual void draw(Canvas*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int depth, Hit&); private: TelltaleState* state_; }; class MonoKitForeground : public MonoGlyph { public: MonoKitForeground(Glyph*, const Color*); virtual ~MonoKitForeground(); virtual void draw(Canvas*, const Allocation&) const; private: const Color* foreground_; }; class MonoKitImpl { private: friend class MonoKit; MonoKit* kit_; LayoutKit* layout_; MonoKitInfo* info_; MonoKitInfoList info_list_; const char * saved_text_; MonoKitImpl(MonoKit*); ~MonoKitImpl(); bool match(const Style&, const Style&, const char*); Glyph* make_menu_item(TelltaleState*, Glyph* check, Glyph*); ChoiceItem* make_button(TelltaleState*, Glyph* normal, Glyph* pressed); ChoiceItem* make_button( TelltaleState*, Glyph* normal, Glyph* pressed, Glyph* disabled ); ChoiceItem* make_toggle(TelltaleState*, Beveler, float scale); ChoiceItem* make_mover(TelltaleState*, Beveler); Slider* make_slider(Slider*); }; MonoKit::MonoKit() { impl_ = new MonoKitImpl(this); Style* s = Session::instance()->style(); for (PropertyData* p = kit_props; p->path != nil; p++) { s->attribute(p->path, p->value, -5); } } MonoKit::~MonoKit() { delete impl_; } const char* MonoKit::gui() const { return "monochrome"; } static const char* style_attributes[] = { "flat", "frameThickness", "moverSize", "sliderSize", nil }; void MonoKit::style_changed(Style* style) { MonoKitImpl& i = *impl_; for (ListItr(MonoKitInfoList) s(i.info_list_); s.more(); s.next()) { MonoKitInfo* info = s.cur(); if (info->style() == style) { i.info_ = info; return; } } const Style& s1 = *style; for (ListItr(MonoKitInfoList) t(i.info_list_); t.more(); t.next()) { MonoKitInfo* info = t.cur(); const Style& s2 = *info->style(); for (const char** p = style_attributes; ; p++) { if (*p == nil) { i.info_ = info; return; } if (!i.match(s1, s2, *p)) { break; } } } i.info_ = new MonoKitInfo(style); Resource::ref(i.info_); i.info_list_.append(i.info_); } MonoGlyph* MonoKit::outset_frame(Glyph* g) const { const MonoKitInfo& i = *impl_->info_; return new Bevel( g, &Bevel::rect, i.light(), i.flat(), i.dark(), i.thickness() ); } MonoGlyph* MonoKit::inset_frame(Glyph* g) const { const MonoKitInfo& i = *impl_->info_; return new Bevel( g, &Bevel::rect, i.dark(), i.flat(), i.light(), i.thickness() ); } MonoGlyph* MonoKit::bright_inset_frame(Glyph* g) const { const MonoKitInfo& i = *impl_->info_; return new Bevel( g, &Bevel::rect, i.dark(), i.flat(), i.light(), 1.0, 0.0, 0.0, false, false ); } Glyph* MonoKit::menubar_look() const { MonoKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; return outset_frame(layout.r_margin(layout.hbox(), 0.0, fil, 0.0)); } Glyph* MonoKit::pulldown_look() const { MonoKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; return outset_frame(layout.vbox()); } Glyph* MonoKit::menubar_item_look(Glyph* g, TelltaleState* t) const { MonoKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; MonoKitInfo* info = i.info_; Glyph* item = layout.h_margin(g, 2.0); return new MonoKitFrame(item, t, info, info->thickness(), true, true); } Glyph* MonoKit::menu_item_look(Glyph* g, TelltaleState* t) const { MonoKitImpl& i = *impl_; MonoKitInfo* info = i.info_; return new MonoKitFrame(g, t, info, info->thickness(), true, true); } Glyph* MonoKit::check_menu_item_look(Glyph* g, TelltaleState* t) const { MonoKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; const MonoKitInfo& info = *i.info_; Coord box_size = font()->width('m') * info.toggle_scale(); Glyph* dot = new Bevel( layout.center(layout.fixed_span(nil, box_size, box_size), 0.0, 0.0), &Bevel::rect, info.dark(), info.dull(), info.light(), info.thickness(), false, false ); return i.make_menu_item(t, dot, g); } Glyph* MonoKit::radio_menu_item_look(Glyph* g, TelltaleState* t) const { MonoKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; const MonoKitInfo& info = *i.info_; Coord box_size = font()->width('m') * info.radio_scale(); Glyph* diamond = new Bevel( layout.center(layout.fixed_span(nil, box_size, box_size), 0.0, 0.0), &Bevel::diamond, info.dark(), info.dull(), info.light(), info.thickness(), false, false ); return i.make_menu_item(t, diamond, g); } Glyph* MonoKit::menu_item_separator_look() const { MonoKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; return layout.v_margin( layout.v_fixed_span( layout.h_margin(inset_frame(nil), 3.0), 3.0 ), 2.0 ); } /* * This uses a kludge to avoid changing kit.c. If label() has just been * called immediately prior to push_button_look, then we still have a char * pointer to the original text and we can create an inverse video label for * the pressed state. There's probably a better way to do this, but I'm * just hacking right now to get things to work as quickly as possible. * Would be nice if I could specify multiple glyphs to push_button_look(). */ Glyph* MonoKit::label(const char * text) const { MonoKit* kludge = (MonoKit*)this; kludge->impl_->saved_text_ = text; return WidgetKit::label(text); } Glyph* MonoKit::label(const String& string) const { MonoKit* kludge = (MonoKit*)this; kludge->impl_->saved_text_ = string.string(); return WidgetKit::label(string); } Glyph* MonoKit::push_button_look(Glyph* g, TelltaleState* t) const { MonoKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; Coord margin = 5.0; Coord offset = 0.5 * i.info_->thickness(); Glyph* pressed; Glyph* disabled; if (i.saved_text_) { const MonoKitInfo& info = *i.info_; pressed = new Label(i.saved_text_, font(), background()); disabled = new Label(i.saved_text_, font(), info.light()); MonoKit* kludge = (MonoKit*)this; kludge->impl_->saved_text_ = nil; } else { pressed = g; disabled = g; } return i.make_button( t, layout.margin(g, margin), layout.margin(pressed, margin + offset, margin - offset), layout.margin(disabled, margin) ); } Glyph* MonoKit::default_button_look(Glyph* g, TelltaleState* t) const { MonoKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; return inset_frame(layout.margin(push_button_look(g, t), 3.0)); } Glyph* MonoKit::palette_button_look(Glyph* g, TelltaleState* t) const { return push_button_look(g, t); } Glyph* MonoKit::check_box_look(Glyph* g, TelltaleState* t) const { MonoKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; return layout.hbox( layout.vcenter( i.make_toggle(t, &Bevel::rect, i.info_->toggle_scale()) ), layout.hspace(5.0), layout.vcenter(g) ); } Glyph* MonoKit::radio_button_look(Glyph* g, TelltaleState* t) const { MonoKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; return layout.hbox( layout.vcenter( i.make_toggle(t, &Bevel::diamond, i.info_->radio_scale()) ), layout.hspace(5.0), layout.vcenter(g) ); } Glyph* MonoKit::slider_look(DimensionName d, Adjustable* a) const { MonoKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; const MonoKitInfo& info = *i.info_; Coord slider_margin = 2.0; Coord size = info.slider_size() - slider_margin - slider_margin; Glyph* g; switch (d) { case Dimension_X: g = layout.v_fixed_span( i.make_slider(new XSlider(style(), a)), size ); break; case Dimension_Y: g = layout.h_fixed_span( i.make_slider(new YSlider(style(), a)), size ); break; default: g = nil; break; } return g; } Glyph* MonoKit::scroll_bar_look(DimensionName d, Adjustable* a) const { MonoKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; const MonoKitInfo& info = *i.info_; Glyph* g, * box, * sep, * mover1, * slider, * mover2; Coord xspan, yspan; float align; Coord slider_margin = 2.0; switch (d) { case Dimension_X: xspan = info.mover_size(); yspan = info.slider_size(); align = 0.0; box = layout.hbox(); g = layout.v_fixed_span(box, yspan); sep = layout.hspace(1.0); mover1 = left_mover(a); slider = layout.v_margin( layout.v_fixed_span( i.make_slider(new XSlider(style(), a)), yspan - slider_margin - slider_margin ), slider_margin ); mover2 = right_mover(a); break; case Dimension_Y: xspan = info.slider_size(); yspan = info.mover_size(); align = 1.0; box = layout.vbox(); g = layout.h_fixed_span(box, xspan); sep = layout.vspace(1.0); mover1 = up_mover(a); slider = layout.h_margin( layout.h_fixed_span( i.make_slider(new YSlider(style(), a)), xspan - slider_margin - slider_margin ), slider_margin ); mover2 = down_mover(a); break; } box->append( layout.center_dimension( layout.fixed_span(mover1, xspan, yspan), d, align ) ); box->append(sep); box->append(slider); box->append(sep); box->append(layout.fixed_span(mover2, xspan, yspan)); Coord t = info.thickness(); return new Bevel( g, &Bevel::rect, info.dark(), info.dull(), info.light(), t ); } Glyph* MonoKit::panner_look(Adjustable* x, Adjustable* y) const { MonoKitImpl& i = *impl_; return i.make_slider(new XYSlider(style(), x, y)); } Glyph* MonoKit::enlarger_look(TelltaleState*) const { return nil; } Glyph* MonoKit::reducer_look(TelltaleState*) const { return nil; } Glyph* MonoKit::up_mover_look(TelltaleState* t) const { return impl_->make_mover(t, &Bevel::up_arrow); } Glyph* MonoKit::down_mover_look(TelltaleState* t) const { return impl_->make_mover(t, &Bevel::down_arrow); } Glyph* MonoKit::left_mover_look(TelltaleState* t) const { return impl_->make_mover(t, &Bevel::left_arrow); } Glyph* MonoKit::right_mover_look(TelltaleState* t) const { return impl_->make_mover(t, &Bevel::right_arrow); } /* class MonoKitFrame */ MonoKitFrame::MonoKitFrame( Glyph* g, TelltaleState* t, MonoKitInfo* i, Coord thickness, bool target, bool choosable ) : BevelFrame(g, thickness) { state_ = t; Resource::ref(state_); info_ = i; Resource::ref(info_); target_ = target; choosable_ = choosable; } MonoKitFrame::~MonoKitFrame() { Resource::unref(state_); Resource::unref(info_); } void MonoKitFrame::draw(Canvas* c, const Allocation& a) const { BevelFrame::draw(c, a); if (!state_->test(TelltaleState::is_enabled)) { c->fill_rect( a.left(), a.bottom(), a.right(), a.top(), info_->gray_out() ); } } void MonoKitFrame::pick(Canvas* c, const Allocation& a, int depth, Hit& h) { if (target_) { Coord x = h.left(); Coord y = h.bottom(); if (x >= a.left() && x < a.right() && y >= a.bottom() && y < a.top()) { h.target(depth, this, 0); } } else { BevelFrame::pick(c, a, depth, h); } } void MonoKitFrame::draw_frame(Canvas* c, const Allocation& a, Coord t) const { const MonoKitInfo& i = info(); const Color* c1, * c2, * c3; c2 = i.flat(); if (state_->test(TelltaleState::is_enabled_active)) { c1 = i.light(); c3 = i.dark(); } else if (choosable_ && state_->test(TelltaleState::is_enabled_chosen)) { c1 = i.dark(); c3 = i.light(); } else { c1 = c2; c3 = c2; } Bevel::rect(c, c1, c2, c3, t, a.left(), a.bottom(), a.right(), a.top()); } /* class MonoKitMenuItem */ MonoKitMenuItem::MonoKitMenuItem(Glyph* g, TelltaleState* s) : MonoGlyph(g) { Resource::ref(s); state_ = s; } MonoKitMenuItem::~MonoKitMenuItem() { Resource::unref(state_); } void MonoKitMenuItem::draw(Canvas* c, const Allocation& a) const { if (state_->test(TelltaleState::is_chosen)) { MonoGlyph::draw(c, a); } } void MonoKitMenuItem::pick(Canvas* c, const Allocation& a, int depth, Hit& h) { if (state_->test(TelltaleState::is_chosen)) { MonoGlyph::pick(c, a, depth, h); } } /* class MonoKitForeground */ MonoKitForeground::MonoKitForeground(Glyph* g, const Color* c) : MonoGlyph(g) { foreground_ = c; Resource::ref(foreground_); } MonoKitForeground::~MonoKitForeground() { Resource::unref(foreground_); } void MonoKitForeground::draw(Canvas* c, const Allocation& a) const { MonoGlyph::draw(c, a); c->fill_rect(a.left(), a.bottom(), a.right(), a.top(), foreground_); } /* class MonoKitImpl */ MonoKitImpl::MonoKitImpl(MonoKit* k) { kit_ = k; layout_ = LayoutKit::instance(); } MonoKitImpl::~MonoKitImpl() { for (ListItr(MonoKitInfoList) i(info_list_); i.more(); i.next()) { MonoKitInfo* info = i.cur(); Resource::unref(info); } } bool MonoKitImpl::match(const Style& s1, const Style& s2, const char* n) { String name(n); String v1, v2; bool b1 = s1.find_attribute(n, v1); bool b2 = s2.find_attribute(n, v2); return (!b1 && !b2) || (b1 && b2 && v1 == v2); } Glyph* MonoKitImpl::make_menu_item( TelltaleState* t, Glyph* check, Glyph* g ) { const LayoutKit& layout = *layout_; return new MonoKitFrame( layout.hbox( new MonoKitMenuItem(layout.vcenter(check), t), layout.hspace(5), layout.vcenter(g) ), t, info_, info_->thickness(), true, false ); } ChoiceItem* MonoKitImpl::make_button( TelltaleState* t, Glyph* normal, Glyph* pressed ) { const MonoKitInfo& i = *info_; Glyph* enabled = new Bevel( normal, &Bevel::rect, i.light(), i.flat(), i.dark(), i.thickness(), false, false ); Glyph* disabled = new MonoKitForeground(enabled, i.gray_out()); Glyph* active = new Bevel( pressed, &Bevel::rect, i.dark(), i.dull(), i.light(), i.thickness(), false, false ); return new ChoiceItem( t, disabled, enabled, enabled, active, enabled, active, active, active, active, disabled ); } /* * Added because the above doesn't look very good with monochrome because it * makes the left and top bevel disappear. This accepts a third glyph so the * disabling looks right. */ ChoiceItem* MonoKitImpl::make_button( TelltaleState* t, Glyph* normal, Glyph* pressed, Glyph* disabled ) { const MonoKitInfo& i = *info_; Glyph* enabled = new Bevel( normal, &Bevel::rect, i.light(), i.flat(), i.dark(), i.thickness(), false, false ); Glyph* unenabled = new Bevel( disabled, &Bevel::rect, i.light(), i.flat(), i.dark(), i.thickness(), false, false ); Glyph* active = new Bevel( pressed, &Bevel::rect, i.dark(), i.dull(), i.light(), i.thickness(), false, false ); return new ChoiceItem( t, unenabled, enabled, enabled, active, enabled, active, active, active, active, unenabled ); } ChoiceItem* MonoKitImpl::make_toggle( TelltaleState* t, Beveler b, float scale ) { const MonoKitInfo& i = *info_; Coord box_size = kit_->font()->width('m') * scale; Glyph* box = layout_->fixed_span(nil, box_size, box_size); Glyph* toggle_out = new Bevel( box, b, i.light(), i.flat(), i.dark(), i.thickness(), false, false ); Glyph* toggle_in = new Bevel( box, b, i.dark(), i.dull(), i.light(), i.thickness(), false, false ); return new ChoiceItem( t, new MonoKitForeground(toggle_out, i.gray_out()), toggle_out, toggle_out, toggle_in, toggle_in, toggle_in, toggle_in, toggle_in, toggle_in, new MonoKitForeground(toggle_in, i.gray_out()) ); } ChoiceItem* MonoKitImpl::make_mover(TelltaleState* t, Beveler b) { const MonoKitInfo& i = *info_; Coord m = 2.0; Glyph* enabled = layout_->margin( new Bevel(nil, b, i.light(), i.flat(), i.dark(), i.thickness()), m ); Glyph* active = layout_->margin( new Bevel(nil, b, i.dark(), i.flat(), i.light(), i.thickness()), m ); Glyph* disabled = new MonoKitForeground(enabled, i.gray_out()); return new ChoiceItem( t, disabled, enabled, enabled, active, active, enabled, active, active, active, disabled ); } Slider* MonoKitImpl::make_slider(Slider* slider) { const MonoKitInfo& i = *info_; slider->normal_thumb( new Bevel( nil, &Bevel::rect, i.light(), i.flat(), i.dark(), i.thickness() ) ); return slider; } /* class MonoKitInfo */ MonoKitInfo::MonoKitInfo(Style* s) { style_ = s; Resource::ref(style_); load(); } MonoKitInfo::~MonoKitInfo() { unload(); Resource::unref(style_); } void MonoKitInfo::load() { Style& s = *style_; s.find_attribute("frameThickness", thickness_); s.find_attribute("toggleScale", toggle_scale_); s.find_attribute("radioScale", radio_scale_); s.find_attribute("moverSize", mover_size_); s.find_attribute("sliderSize", slider_size_); String v("#000000"); if (!s.find_attribute("background", v)) { s.find_attribute("Background", v); } const Color* c = Color::lookup(Session::instance()->default_display(), v); if (c == nil) { c = new Color(0.0, 0.0, 0.0, 1.0); } flat_ = c; gray_out_ = new Color(*c, 0.5); v = "#ffffff"; if (!s.find_attribute("foreground", v)) { s.find_attribute("Foreground", v); } c = Color::lookup(Session::instance()->default_display(), v); if (c == nil) { c = new Color(1.0, 1.0, 1.0, 1.0); } dull_ = c; light_ = new Color(*c, 0.5, Color::Xor); dark_ = c; /* Set the flat style attribute explicitly. FieldEditors depend on it. */ Color* black = new Color(0.0, 0.0, 0.0, 1.0); Resource::ref(black); if (!flat_->distinguished(black)) { s.attribute("flat", "black"); } else { s.attribute("flat", "white"); } Resource::unref(black); Resource::ref(flat_); Resource::ref(light_); Resource::ref(dull_); Resource::ref(dark_); Resource::ref(gray_out_); } void MonoKitInfo::unload() { Resource::unref(flat_); Resource::unref(light_); Resource::unref(dull_); Resource::unref(dark_); Resource::unref(gray_out_); } neuron-7.6.3/src/lib/InterViews/monoglyph.cpp000077500000000000000000000074151340731477100212320ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include MonoGlyph::MonoGlyph(Glyph* glyph) : Glyph() { Resource::ref(glyph); body_ = glyph; } MonoGlyph::~MonoGlyph() { Resource::unref(body_); } void MonoGlyph::body(Glyph* glyph) { Resource::ref(glyph); if (body_ != nil) { body_->undraw(); Resource::unref_deferred(body_); } body_ = glyph; } Glyph* MonoGlyph::body() const { return body_; } void MonoGlyph::request(Requisition& requisition) const { if (body_ != nil) { body_->request(requisition); } else { Glyph::request(requisition); } } void MonoGlyph::allocate(Canvas* c, const Allocation& a, Extension& ext) { if (body_ != nil) { body_->allocate(c, a, ext); } else { Glyph::allocate(c, a, ext); } } void MonoGlyph::draw(Canvas* c, const Allocation& a) const { if (body_ != nil) { body_->draw(c, a); } else { Glyph::draw(c, a); } } void MonoGlyph::print(Printer* p, const Allocation& a) const { if (body_ != nil) { body_->print(p, a); } else { Glyph::print(p, a); } } void MonoGlyph::pick(Canvas* c, const Allocation& a, int depth, Hit& h) { if (body_ != nil) { body_->pick(c, a, depth, h); } else { Glyph::pick(c, a, depth, h); } } void MonoGlyph::undraw() { if (body_ != nil) { body_->undraw(); } } void MonoGlyph::append(Glyph* glyph) { if (body_ != nil) { body_->append(glyph); } } void MonoGlyph::prepend(Glyph* glyph) { if (body_ != nil) { body_->prepend(glyph); } } void MonoGlyph::insert(GlyphIndex index, Glyph* glyph) { if (body_ != nil) { body_->insert(index, glyph); } } void MonoGlyph::remove(GlyphIndex index) { if (body_ != nil) { body_->remove(index); } } void MonoGlyph::replace(GlyphIndex index, Glyph* glyph) { if (body_ != nil) { body_->replace(index, glyph); } } GlyphIndex MonoGlyph::count() const { if (body_ != nil) { return body_->count(); } else { return Glyph::count(); } } Glyph* MonoGlyph::component(GlyphIndex index) const { if (body_ != nil) { return body_->component(index); } else { return Glyph::component(index); } } void MonoGlyph::change(GlyphIndex index) { if (body_ != nil) { body_->change(index); } } void MonoGlyph::allotment( GlyphIndex index, DimensionName res, Allotment& a ) const { if (body_ != nil) { body_->allotment(index, res, a); } else { Glyph::allotment(index, res, a); } } neuron-7.6.3/src/lib/InterViews/observe.cpp000077500000000000000000000047431340731477100206640ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1992 Stanford University * Copyright (c) 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Observable - object to observe */ #include #include declarePtrList(ObserverList,Observer) implementPtrList(ObserverList,Observer) Observable::Observable() { observers_ = nil; } Observable::~Observable() { ObserverList* list = observers_; if (list != nil) { // in case a disconnect removes items from the ObserverList for (long i = list->count() - 1; i >= 0; --i) { list->item(i)->disconnect(this); if (i > list->count()) { i = list->count(); } } delete list; } } void Observable::attach(Observer* o) { ObserverList* list = observers_; if (list == nil) { list = new ObserverList(5); observers_ = list; } list->append(o); } void Observable::detach(Observer* o) { ObserverList* list = observers_; if (list != nil) { for (ListUpdater(ObserverList) i(*list); i.more(); i.next()) { if (i.cur() == o) { i.remove_cur(); break; } } } } void Observable::notify() { ObserverList* list = observers_; if (list != nil) { for (ListItr(ObserverList) i(*list); i.more(); i.next()) { i.cur()->update(this); } } } Observer::Observer() { } Observer::~Observer() { } void Observer::update(Observable*) { } void Observer::disconnect(Observable*) { } neuron-7.6.3/src/lib/InterViews/ol_dialogs.cpp000077500000000000000000000100001340731477100213120ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1992 Stanford University * Copyright (c) 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * OLDialogKit -- object for creating common OpenLook-ish dialog boxes */ #include #include #include #include #include #include #include class OL_FieldEditor : public FieldEditor { public: OL_FieldEditor(const String&, WidgetKit*, Style*, FieldEditorAction*); virtual ~OL_FieldEditor(); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int, Hit&); private: const Color* white_; const Color* dark_; Allocation field_allocation_; }; OL_FieldEditor::OL_FieldEditor( const String& s, WidgetKit* k, Style* style, FieldEditorAction* a) : FieldEditor(s, k, style, a), field_allocation_() { OLKit& kit = *(OLKit*)k; white_ = kit.white(); dark_ = kit.bg3(); Resource::ref(white_); Resource::ref(dark_); } OL_FieldEditor::~OL_FieldEditor() { Resource::unref(white_); Resource::unref(dark_); } void OL_FieldEditor::request(Requisition& req) const { FieldEditor::request(req); const Requirement& r = req.y_requirement(); Requirement r_y(r.natural() + 2.0, r.stretch(), r.shrink(), r.alignment()); req.require_y(r_y); } void OL_FieldEditor::allocate(Canvas* c, const Allocation& a, Extension& e) { const Allotment& ay = a.y_allotment(); Coord field_span = ay.span() - 2.0; Coord field_origin = ay.begin() + ay.alignment() * ay.span() + 2.0; Allotment fy(field_origin, field_span, ay.alignment()); field_allocation_.allot_y(fy); field_allocation_.allot_x(a.x_allotment()); FieldEditor::allocate(c, field_allocation_, e); e.set_xy(c, e.left(), e.bottom() - 2.0, e.right(), e.top()); } void OL_FieldEditor::pick(Canvas* c, const Allocation&, int depth, Hit& h) { FieldEditor::pick(c, field_allocation_, depth, h); } void OL_FieldEditor::draw(Canvas* c, const Allocation& a) const { FieldEditor::draw(c, field_allocation_); Coord l = a.left(), b = a.bottom(), r = a.right(), t = a.top(); c->fill_rect(l, b, l + 1.0, b + 2.0, white_); c->fill_rect(l + 1.0 , b + 1.0, r, b + 2.0, white_); c->fill_rect(l + 1.0, b, r - 1.0, b + 1.0, dark_); c->fill_rect(r - 1.0, b, r, b + 2.0, dark_); } OLDialogKit::OLDialogKit() { } OLDialogKit::~OLDialogKit() { } FieldEditor* OLDialogKit::make_field_editor( const String& sample, WidgetKit* k, Style* s, FieldEditorAction* a ) const { return new OL_FieldEditor(sample, k, s, a); } FileChooser* OLDialogKit::make_file_chooser( const String& dir, WidgetKit* k, Style* s, FileChooserAction* a ) const { return new FileChooser(dir, k, s, a); } neuron-7.6.3/src/lib/InterViews/ol_kit.cpp000066400000000000000000003250271340731477100204760ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991, 1992 Stanford University * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* * character definitions */ #define OLG_VSB_ELEVATOR 1 #define OLG_VSB_ELEVATOR_LINE_BACKWARD 2 #define OLG_VSB_ELEVATOR_ABSOL_UTE 3 #define OLG_VSB_ELEVATOR_LINE_FORWARD 4 #define OLG_VSB_REDUCED_ELEVATOR 5 #define OLG_VSB_REDUCED_ELEVATOR_LINE_BACKWARD 6 #define OLG_VSB_REDUCED_ELEVATOR_LINE_FORWARD 7 #define OLG_VSB_ANCHOR 8 #define OLG_VSB_ANCHOR_INVERTED 9 #define OLG_HSB_ELEVATOR 10 #define OLG_HSB_ELEVATOR_LINE_BACKWARD 11 #define OLG_HSB_ELEVATOR_ABSOLUTE 12 #define OLG_HSB_ELEVATOR_LINE_FORWARD 13 #define OLG_HSB_REDUCED_ELEVATOR 14 #define OLG_HSB_REDUCED_ELEVATOR_LINE_BACKWARD 15 #define OLG_HSB_REDUCED_ELEVATOR_LINE_FORWARD 16 #define OLG_HSB_ANCHOR 17 #define OLG_HSB_ANCHOR_INVERTED 18 #define OLG_MENU_PIN_OUT 19 #define OLG_MENU_PIN_IN 20 #define OLG_MENU_DEFAULT_PIN_OUT 21 #define OLG_ABBREV_MENU_BUTTON 22 #define OLG_ABBREV_MENU_BUTTON_INVERTED 23 /* new extension */ #define BUTTON_UL 24 #define BUTTON_LL 25 #define BUTTON_LEFT_ENDCAP_FILL 26 #define BUTTON_LR 27 #define BUTTON_UR 28 #define BUTTON_RIGHT_ENDCAP_FILL 29 #define BUTTON_TOP_1 30 #define BUTTON_TOP_2 31 #define BUTTON_TOP_4 32 #define BUTTON_TOP_8 33 #define BUTTON_TOP_16 34 #define BUTTON_BOTTOM_1 35 #define BUTTON_BOTTOM_2 36 #define BUTTON_BOTTOM_4 37 #define BUTTON_BOTTOM_8 38 #define BUTTON_BOTTOM_16 39 #define BUTTON_FILL_1 40 #define BUTTON_FILL_2 41 #define BUTTON_FILL_4 42 #define BUTTON_FILL_8 43 #define BUTTON_FILL_16 44 #define VERT_MENU_MARK_UL 45 #define VERT_MENU_MARK_LR 46 #define VERT_MENU_MARK_FILL 47 #define HORIZ_MENU_MARK_UL 48 #define HORIZ_MENU_MARK_LR 49 #define HORIZ_MENU_MARK_FILL 50 #define ABBREV_MENU_UL 51 #define ABBREV_MENU_LR 52 #define ABBREV_MENU_FILL 53 #define VERT_SB_UL 54 #define VERT_SB_LR 55 #define VERT_SB_TOPBOX_FILL 56 #define HORIZ_SB_UL 57 #define HORIZ_SB_LR 58 #define VERT_SB_BOTBOX_FILL 59 #define HORIZ_SLIDER_CONTROL_UL 60 #define HORIZ_SLIDER_CONTROL_LR 61 #define HORIZ_SLIDER_CONTROL_FILL 62 #define HORIZ_SLIDER_UL 63 #define HORIZ_SLIDER_LL 64 #define HORIZ_SLIDER_UR 65 #define HORIZ_SLIDER_LR 66 #define HORIZ_SLIDER_BOTTOM_1 67 #define HORIZ_SLIDER_BOTTOM_2 68 #define HORIZ_SLIDER_BOTTOM_4 69 #define HORIZ_SLIDER_BOTTOM_8 70 #define HORIZ_SLIDER_BOTTOM_16 71 #define HORIZ_SLIDER_FILL_1 72 #define HORIZ_SLIDER_FILL_2 73 #define HORIZ_SLIDER_FILL_4 74 #define HORIZ_SLIDER_FILL_8 75 #define HORIZ_SLIDER_FILL_16 76 #define HORIZ_SLIDER_LEFT_ENDCAP_FILL 77 #define HORIZ_SLIDER_RIGHT_ENDCAP_FILL 78 #define VERT_SLIDER_UL 79 #define VERT_SLIDER_UR 80 #define VERT_SLIDER_TOP_ENDCAP_FILL 81 #define VERT_SLIDER_LL 82 #define VERT_SLIDER_LR 83 #define VERT_SLIDER_BOTTOM_ENDCAP_FILL 84 #define VERT_SLIDER_CONTROL_UL 85 #define VERT_SLIDER_CONTROL_LR 86 #define VERT_SLIDER_CONTROL_FILL 87 #define UL_RESIZE_UL 88 #define UL_RESIZE_LR 89 #define UL_RESIZE_FILL 90 #define UR_RESIZE_UL 91 #define UR_RESIZE_LR 92 #define UR_RESIZE_FILL 93 #define LR_RESIZE_UL 94 #define LR_RESIZE_LR 95 #define LR_RESIZE_FILL 96 #define LL_RESIZE_UL 97 #define LL_RESIZE_LR 98 #define LL_RESIZE_FILL 99 #define PUSHPIN_OUT_TOP 100 #define PUSHPIN_OUT_BOTTOM 101 #define PUSHPIN_OUT_MIDDLE 102 #define PUSHPIN_IN_TOP 103 #define PUSHPIN_IN_BOTTOM 104 #define PUSHPIN_IN_MIDDLE 105 #define DFLT_BUTTON_LEFT_ENDCAP 106 #define DFLT_BUTTON_RIGHT_ENDCAP 107 #define DFLT_BUTTON_MIDDLE_1 108 #define DFLT_BUTTON_MIDDLE_2 109 #define DFLT_BUTTON_MIDDLE_4 110 #define DFLT_BUTTON_MIDDLE_8 111 #define DFLT_BUTTON_MIDDLE_16 112 #define BASE_OFF_SPECIALCHAR 113 /*special char */ #define UNCHECKED_BOX_UL 114 #define UNCHECKED_BOX_LR 115 #define UNCHECKED_BOX_FILL 116 #define CHECK_MARK 117 #define CHECKED_BOX_FILL 118 #define UNCHECKED_BOX_OUTLINE 119 #define HORIZ_GAUGE_UL 120 #define HORIZ_GAUGE_LL 121 #define HORIZ_GAUGE_UR 122 #define HORIZ_GAUGE_LR 123 #define HORIZ_GAUGE_BOTTOM_1 124 #define HORIZ_GAUGE_BOTTOM_2 125 #define HORIZ_GAUGE_BOTTOM_4 126 #define HORIZ_GAUGE_BOTTOM_8 127 #define HORIZ_GAUGE_BOTTOM_16 128 #define VERT_GAUGE_UL 129 #define VERT_GAUGE_UR 130 #define VERT_GAUGE_LL 131 #define VERT_GAUGE_LR 132 #define VERT_ABBREV_SB_UL 133 #define VERT_ABBREV_SB_LR 134 #define HORIZ_SB_RIGHTBOX_FILL 135 #define HORIZ_ABBREV_SB_UL 136 #define HORIZ_ABBREV_SB_LR 137 #define HORIZ_SB_LEFTBOX_FILL 138 #define BUTTON_OUTLINE_LEFT_ENDCAP 139 #define BUTTON_OUTLINE_RIGHT_ENDCAP 140 #define BUTTON_OUTLINE_MIDDLE_1 141 #define BUTTON_OUTLINE_MIDDLE_2 142 #define BUTTON_OUTLINE_MIDDLE_4 143 #define BUTTON_OUTLINE_MIDDLE_8 144 #define BUTTON_OUTLINE_MIDDLE_16 145 #define BUTTON_FILL_2D_LEFTENDCAP 146 #define BUTTON_FILL_2D_RIGHTENDCAP 147 #define BUTTON_FILL_2D_MIDDLE_1 148 #define BUTTON_FILL_2D_MIDDLE_2 149 #define BUTTON_FILL_2D_MIDDLE_4 150 #define BUTTON_FILL_2D_MIDDLE_8 151 #define BUTTON_FILL_2D_MIDDLE_16 152 #define MENU_DFLT_OUTLINE_LEFT_ENDCAP 153 #define MENU_DFLT_OUTLINE_RIGHT_ENDCAP 154 #define MENU_DFLT_OUTLINE_MIDDLE_1 155 #define MENU_DFLT_OUTLINE_MIDDLE_2 156 #define MENU_DFLT_OUTLINE_MIDDLE_4 157 #define MENU_DFLT_OUTLINE_MIDDLE_8 158 #define MENU_DFLT_OUTLINE_MIDDLE_16 159 #define PIXLABEL_BUTTON_UL 160 #define PIXLABEL_BUTTON_LL 161 #define UL_RESIZE_OUTLINE 162 #define UR_RESIZE_OUTLINE 163 #define LR_RESIZE_OUTLINE 164 #define LL_RESIZE_OUTLINE 165 #define VERT_SB_NO_BACK_OUTLINE 166 #define VERT_SB_NO_FWD_OUTLINE 167 #define VERT_SB_INACTIVE_OUTLINE 168 #define HORIZ_SB_NO_BACK_OUTLINE 169 #define HORIZ_SB_NO_FWD_OUTLINE 170 #define HORIZ_SB_INACTIVE_OUTLINE 171 #define HORIZ_SLIDER_CONTROL_OUTLINE 172 #define HORIZ_SLIDER_LEFT_ENDCAP_OUTLINE 173 #define HORIZ_SLIDER_RIGHT_ENDCAP_OUTLINE 174 #define HORIZ_SLIDER_OUTLINE_1 175 #define HORIZ_SLIDER_OUTLINE_2 176 #define HORIZ_SLIDER_OUTLINE_4 177 #define HORIZ_SLIDER_OUTLINE_8 178 #define HORIZ_SLIDER_OUTLINE_16 179 #define VERT_SLIDER_TOP_ENDCAP_OUTLINE 180 #define VERT_SLIDER_BOTTOM_ENDCAP_OUTLINE 181 #define VERT_SLIDER_CONTROL_OUTLINE 182 #define PUSHPIN_OUT_DEFAULT_TOP 183 #define PUSHPIN_OUT_DEFAULT_BOTTOM 184 #define PUSHPIN_OUT_DEFAULT_MIDDLE 185 #define HORIZ_GAUGE_LEFT_ENDCAP_OUTLINE 186 #define HORIZ_GAUGE_RIGHT_ENDCAP_OUTLINE 187 #define HORIZ_GAUGE_OUTLINE_MIDDLE_1 188 #define HORIZ_GAUGE_OUTLINE_MIDDLE_2 189 #define HORIZ_GAUGE_OUTLINE_MIDDLE_4 190 #define HORIZ_GAUGE_OUTLINE_MIDDLE_8 191 #define HORIZ_GAUGE_OUTLINE_MIDDLE_16 192 #define CHECK_BOX_CLEAR_FILL 193 #define VERT_SB_BOX_UL 194 #define VERT_SB_BOX_LR 195 #define DIMPLE_UL 196 #define DIMPLE_LR 197 #define DIMPLE_FILL 198 #define SLIDER_CHANNEL_OFFSET 199 /* special char */ #define HORIZ_SB_BOX_UL 200 #define HORIZ_SB_BOX_LR 201 #define VERT_BACK_MENU_MARK_UL 202 #define VERT_BACK_MENU_MARK_LR 203 #define VERT_BACK_MENU_MARK_FILL 204 #define HORIZ_BACK_MENU_MARK_UL 205 #define HORIZ_BACK_MENU_MARK_LR 206 #define HORIZ_BACK_MENU_MARK_FILL 207 #define OLGX_ACTIVE_CARET 208 #define OLGX_INACTIVE_CARET 209 #define VERT_GAUGE_TOPENDCAP 210 #define VERT_GAUGE_BOTENDCAP 211 #define PIXLABEL_BUTTON_UR 212 #define PIXLABEL_BUTTON_LR 213 #define PIXLABEL_BUTTON_2D_LR 214 #define PIXLABEL_DEF_BUTTON_UL 215 #define PIXLABEL_DEF_BUTTON_LL 216 #define PIXLABEL_DEF_BUTTON_UR 217 #define PIXLABEL_DEF_BUTTON_LR 218 #define HORIZ_GAUGE_LEFT_ENDFILL 219 #define HORIZ_GAUGE_MIDDLE_FILL_1 220 #define HORIZ_GAUGE_MIDDLE_FILL_2 221 #define HORIZ_GAUGE_MIDDLE_FILL_4 222 #define HORIZ_GAUGE_MIDDLE_FILL_8 223 #define HORIZ_GAUGE_MIDDLE_FILL_16 224 #define HORIZ_GAUGE_RIGHT_ENDFILL 225 #define VERT_GAUGE_TOP_FILL 226 #define VERT_GAUGE_BOT_FILL 227 #define TEXTSCROLLBUTTON_LEFT 228 #define TEXTSCROLLBUTTON_RIGHT 229 #define TEXTSCROLLBUTTON_LEFT_INV 230 #define TEXTSCROLLBUTTON_RIGHT_INV 231 #define NUMERIC_SCROLL_BUTTON_NORMAL 232 #define NUMERIC_SCROLL_BUTTON_LEFT_INV 233 #define NUMERIC_SCROLL_BUTTON_RIGHT_INV 234 static PropertyData kit_props[] = { { "*flat", "#aaaaaa" }, { "*PaletteButton*minimumWidth", "72.0" }, { "*PushButton*minimumWidth", "72.0" }, { nil } }; /* Table B-20 */ struct OL_ScrollbarSpecs { float a_, b_, c_, d_, e_, f_, g_, h_, i_, j_, k_, m_, n_, p_, r_; }; static OL_ScrollbarSpecs sb_10 = { 13.0, 5.0, 1.6, 40.6, 13.0, 13.0, 4.9, 1.6, 2.4, 0.8, 1.2, 0.8, 3.7, 5.3, 0.8 }; static OL_ScrollbarSpecs sb_12 = { 15.0, 6.0, 2.0, 47.0, 15.0, 15.0, 5.5, 2.0, 3.0, 1.0, 1.5, 1.0, 4.0, 6.0, 1.0 }; static OL_ScrollbarSpecs sb_14 = { 17.0, 7.0, 2.4, 53.4, 17.0, 17.0, 6.1, 2.4, 3.6, 1.2, 1.8, 1.2, 4.3, 6.7, 1.2 }; static OL_ScrollbarSpecs sb_19 = { 22.0, 9.0, 3.2, 69.2, 22.0, 22.0, 7.8, 3.6, 4.8, 1.6, 2.4, 1.6, 5.4, 8.6, 1.6 }; struct OL_ButtonSpecs { float a_, b_, c_, d_, e_, f_; }; static OL_ButtonSpecs bt_10 = { 18.0, 8.0, 0.8, 0.8, 0.8, 0.8 }; static OL_ButtonSpecs bt_12 = { 20.0, 10.0, 1.0, 1.0, 1.0, 1.0 }; static OL_ButtonSpecs bt_14 = { 22.0, 12.0, 1.2, 1.2, 1.2, 1.2 }; static OL_ButtonSpecs bt_19 = { 28.0, 16.0, 1.6, 1.6, 1.6, 1.6 }; struct OL_SettingSpecs { float a_, b_, c_, d_, e_; }; static OL_SettingSpecs stg_10 = { 18.0, 8.0, 6.0, 5.0, 0.8 }; static OL_SettingSpecs stg_12 = { 20.0, 10.0, 6.0, 6.0, 1.0 }; static OL_SettingSpecs stg_14 = { 22.0, 12.0, 7.0, 8.0, 1.2 }; static OL_SettingSpecs stg_19 = { 27.0, 16.0, 8.0, 10.0, 1.6}; struct OL_CheckboxSpecs { float a_, b_, c_, d_, e_, f_; }; static OL_CheckboxSpecs cbx_10 = { 11.0, 5.5, 7.0, 11.0, 3.0, 0.8 }; static OL_CheckboxSpecs cbx_12 = { 13.0, 6.5, 9.0, 13.0, 3.6, 1.0 }; static OL_CheckboxSpecs cbx_14 = { 15.0, 7.5, 11., 16.0, 4.2, 1.2 }; static OL_CheckboxSpecs cbx_19 = { 20.0, 10., 16., 21.0, 5.5, 1.6 }; /* Table B-28 */ struct OL_MenuButtonSpecs { float a_; }; static OL_MenuButtonSpecs mb_10 = { 7.0 }; static OL_MenuButtonSpecs mb_12 = { 8.0 }; static OL_MenuButtonSpecs mb_14 = { 10.0 }; static OL_MenuButtonSpecs mb_19 = { 12.0 }; /* Table B-29 */ struct OL_MenuMarkSpecs { float a_, b_, c_; }; static OL_MenuMarkSpecs mm_10 = { 0.8, 7.0, 0.8 }; static OL_MenuMarkSpecs mm_12 = { 1.0, 8.0, 1.0 }; static OL_MenuMarkSpecs mm_14 = { 1.2, 9.0, 1.2 }; static OL_MenuMarkSpecs mm_19 = { 1.6, 11., 1.6 }; /* Table B-38 */ struct OL_SliderSpecs { float a_, b_, c_, f_; }; static OL_SliderSpecs sl_10 = { 13.0, 9.0, 0.8, 4.0 }; static OL_SliderSpecs sl_12 = { 15.0, 10.0, 1.0, 5.0 }; static OL_SliderSpecs sl_14 = { 17.0, 11.0, 1.2, 6.0 }; static OL_SliderSpecs sl_19 = { 21.0, 14.0, 1.6, 8.0 }; /* Table B-40 */ struct OL_TickSpecs { float a_; }; static OL_TickSpecs tk_10 = { 5.0 }; static OL_TickSpecs tk_12 = { 6.0 }; static OL_TickSpecs tk_14 = { 7.0 }; static OL_TickSpecs tk_19 = { 9.0 }; /* Table B-44 */ struct OL_GaugeSpecs { float a_, b_, c_, d_, f_; }; static OL_GaugeSpecs gg_10 = { 4, 10.0, 7.0, 0.8, 2.0 }; static OL_GaugeSpecs gg_12 = { 5, 11.0, 8.0, 1.0, 2.0 }; static OL_GaugeSpecs gg_14 = { 6, 13.2, 9.6, 1.2, 2.6 }; static OL_GaugeSpecs gg_19 = { 8, 17.6, 12.8, 1.6, 3.8 }; /* Table B-51 */ struct OL_ButtonMenuSpecs { float a_, b_, c_, i_; // incomplete }; static OL_ButtonMenuSpecs bm_10 = { 8.0, 14.0, 17.0, 25.0 }; static OL_ButtonMenuSpecs bm_12 = { 9.0, 16.0, 19.0, 27.0 }; static OL_ButtonMenuSpecs bm_14 = { 10.0, 17.0, 21.0, 32.0 }; static OL_ButtonMenuSpecs bm_19 = { 14.0, 22.0, 25.0, 37.0 }; /* Table B-52 */ struct OL_SubMenuSpecs { float a_, b_, e_, g_, h_; // incomplete }; static OL_SubMenuSpecs sm_10 = { 8.0, 17.0, 12.0, 5.0, 0.8 }; static OL_SubMenuSpecs sm_12 = { 9.0, 19.0, 14.0, 6.0, 1.0 }; static OL_SubMenuSpecs sm_14 = { 10., 21.0, 16.0, 7.0, 1.2 }; static OL_SubMenuSpecs sm_19 = { 14., 25.0, 20.0, 9.0, 1.6 }; static const CursorPattern question_pat = { 0x0000, 0x0000, 0x0000, 0x7c00, 0xce00, 0x0600, 0x0600, 0x0c00, 0x3000, 0x6000, 0x6000, 0x6000, 0x0000, 0x0000, 0x6000, 0x6000 }; static const CursorPattern question_mask = { 0x0000, 0x0000, 0x7c00, 0xfe00, 0xff00, 0xcf00, 0x0f00, 0x3e00, 0x7c00, 0xf000, 0xf000, 0xf000, 0xf000, 0xf000, 0xf000, 0xf000 }; static Cursor* question_mark_cursor; static void init_ol_cursors() { question_mark_cursor = new Cursor(1, 15, question_pat, question_mask); } static const GlyphIndex ivnormal = 0; static const GlyphIndex backward_arrow_highlighted = 1; static const GlyphIndex dragging = 2; static const GlyphIndex forward_arrow_highlighted = 3; static const GlyphIndex backward_arrow_dimmed = 4; static const GlyphIndex forward_arrow_dimmed = 5; static const GlyphIndex both_arrows_dimmed = 6; typedef unsigned char OL_ButtonType; typedef unsigned char OL_Direction; class OL_Cable; class OL_Channel; class OL_Elevator; class OL_Specs : public Resource { public: OL_Specs(Style*); ~OL_Specs(); const Font* font() const; Coord anchor_height() const; Coord anchor_rule() const; Coord anchor_to_side_gap() const; Coord anchor_width() const; Coord arrow_length() const; Coord button_default_ring_radius() const; Coord button_gap() const; Coord button_height() const; Coord button_radius() const; Coord button_rule_width() const; Coord button_vertical_margin() const; Coord cable_gap() const; Coord cable_width() const; Coord channel_cap_width() const; Coord channel_gap() const; Coord channel_highlight() const; Coord channel_length() const; Coord channel_rule() const; Coord channel_width() const; Coord checkbox_thickness() const; Coord checkbox_width() const; Coord checkmark_height() const; Coord checkmark_width() const; Coord dragbox_length() const; Coord dragbox_width() const; Coord elevator_length() const; Coord elevator_to_anchor_gap() const; Coord elevator_to_side_gap() const; Coord elevator_width() const; Coord gauge_cap_width() const; Coord gauge_end_width() const; Coord gauge_indent() const; Coord gauge_origin() const; Coord gauge_rule() const; Coord gauge_shimmer_gap() const; Coord gauge_shimmer_width() const; Coord gauge_width() const; Coord gauge_min_length() const; Coord menu_bmargin() const; Coord menu_button_height() const; Coord menu_hmargin() const; Coord menu_mark_gap() const; Coord menu_mark_height() const; Coord menu_mark_width() const; Coord menu_pushpin_gap() const; Coord menu_pushpin_height() const; Coord menu_tmargin() const; Coord menu_to_button_gap() const; Coord setting_default_ring_thickness() const; Coord setting_gap() const; Coord setting_height() const; Coord setting_horizontal_margin() const; Coord setting_thickness() const; Coord setting_vertical_margin() const; Coord shaft_length() const; Coord shaft_gap() const; Coord tick_length() const; Coord to_coord(float) const; private: long points_; const Font* font_; Coord coords_per_point_; OL_ScrollbarSpecs* sb_; OL_ButtonSpecs* bt_; OL_SettingSpecs* stg_; OL_CheckboxSpecs* cbx_; OL_SliderSpecs* sl_; OL_TickSpecs* tk_; OL_GaugeSpecs* gg_; OL_MenuButtonSpecs* mb_; OL_ButtonMenuSpecs* bm_; OL_MenuMarkSpecs* mm_; OL_SubMenuSpecs* sm_; }; class OL_AbbrevMenuButton : public Glyph { public: OL_AbbrevMenuButton( const OLKit*, const OL_Specs*, DimensionName, TelltaleState* ); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; private: const OLKit* kit_; const OL_Specs* specs_; DimensionName dimension_; TelltaleState* state_; Coord width_, height_, lgap_, tgap_; }; /* * Cable anchor for Open Look scroll bars * * Pane-splitting functionality not implemented */ class OL_Anchor : public Glyph { public: OL_Anchor( const OLKit*, Coord width, Coord height, Coord thick, TelltaleState*); virtual ~OL_Anchor(); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; private: const OLKit* kit_; Coord width_; Coord height_; Coord thickness_; TelltaleState* state_; }; class OL_Button : public MonoGlyph, public Observer { public: enum { PushButton, MenuButton, DefaultButton }; OL_Button( const OLKit*, const OL_Specs*, Glyph*, TelltaleState*, OL_ButtonType, bool extend = true); virtual ~OL_Button(); virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int, Hit&); protected: virtual void path (Canvas*, int, Coord, Coord, Coord, Coord) const; virtual void top_path( Canvas*, int inset, Coord l, Coord b, Coord r, Coord t ) const; virtual void bottom_path( Canvas*, int inset, Coord l, Coord b, Coord r, Coord t ) const; virtual void fill(Canvas*, const Allocation&, const Color*) const; virtual void draw_background(Canvas*, const Allocation&) const; virtual void draw_frame(Canvas*, const Allocation&) const; private: const OLKit* kit_; const OL_Specs* specs_; TelltaleState* state_; OL_ButtonType type_; Brush* brush_; }; class OL_CheckMark : public Glyph { public: OL_CheckMark(const OLKit*, TelltaleState*, const OL_Specs*); virtual ~OL_CheckMark(); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; private: const OLKit* kit_; const TelltaleState* state_; const OL_Specs* specs_; const Font* font_; long code_; Coord width_, height_; }; class OL_Dragbox : public Glyph { public: OL_Dragbox(const OLKit*, const OL_Specs*, DimensionName); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void undraw(); bool inside(const Event&) const; bool less_than(const Event&) const; bool greater_than(const Event&) const; void press(const Event&); void release(const Event&); bool dragging() { return dragging_; } private: const OLKit* kit_; const OL_Specs* specs_; DimensionName dimension_; bool dragging_; Canvas* canvas_; Extension extension_; }; class OL_ElevatorGlyph : public Glyph { public: OL_ElevatorGlyph(const OLKit*, const OL_Specs*, DimensionName); virtual ~OL_ElevatorGlyph(); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void undraw(); virtual void flip_to(GlyphIndex); virtual bool inside(const Event&); virtual bool backward_arrow_contains(Coord x, Coord y) const; virtual bool forward_arrow_contains(Coord x, Coord y) const; virtual bool less_than(const Event&) const; virtual bool greater_than(const Event&) const; virtual float forward_arrow_center() const; virtual float backward_arrow_center() const; virtual GlyphIndex index() const; protected: const OLKit* kit_; const OL_Specs* specs_; const DimensionName dimension_; const Font* font_; Canvas* canvas_; Extension extension_; GlyphIndex index_; }; class OL_Indicator : public Glyph { public: OL_Indicator(const OLKit*, const OL_Specs*, DimensionName); virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; protected: const OLKit* kit_; const OL_Specs* specs_; const DimensionName dimension_; }; class OL_Frame : public BevelFrame { public: OL_Frame(const OLKit*, Glyph*, TelltaleState*, Coord thickness); virtual ~OL_Frame(); virtual void draw(Canvas*, const Allocation&) const; virtual void draw_background(Canvas*, const Allocation&) const; virtual void draw_frame(Canvas*, const Allocation&, Coord thickness) const; protected: const OLKit* kit_; TelltaleState* state_; Coord thickness_; }; class OL_Gauge : public Glyph, public Observer { public: OL_Gauge(const OLKit*, const OL_Specs*, DimensionName, Adjustable*,Patch*); virtual ~OL_Gauge(); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; void update(Observable*); void disconnect(Observable*); private: const OLKit* kit_; const OL_Specs* specs_; const DimensionName dimension_; Adjustable* adjustable_; Patch* patch_; }; class OL_MenuMark : public Glyph { public: OL_MenuMark(const OLKit*, const OL_Specs*, bool is_pulldown); virtual ~OL_MenuMark(); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; private: const OLKit* kit_; const OL_Specs* specs_; const Font* font_; long fill_code_, ul_code_, lr_code_; Coord fill_width_, fill_height_; Coord ul_width_, ul_height_; Coord lr_width_, lr_height_; }; typedef unsigned int OL_MoverFlags; class OL_Mover : public Glyph { public: enum { up, down, left, right }; OL_Mover(const OLKit*, const OL_Specs*, OL_MoverFlags, TelltaleState*); virtual ~OL_Mover(); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; private: const OLKit* kit_; const OL_Specs* specs_; const TelltaleState* state_; const Font* font_; Coord height_, width_; Coord box_ul_, fill_, box_lr_; }; class OL_Pushpin : public Action { public: OL_Pushpin(TelltaleState*, const Window* unpinned, Window* pinned); virtual ~OL_Pushpin(); virtual void execute(); private: TelltaleState* state_; const Window* unpinned_; Window* pinned_; bool placed_; }; class OL_PushpinLook : public Glyph { public: OL_PushpinLook(const OLKit*, const OL_Specs*, TelltaleState*); virtual ~OL_PushpinLook(); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; private: virtual void draw_pinned(Canvas*, const Allocation&) const; virtual void draw_unpinned(Canvas*, const Allocation&) const; private: const OLKit* kit_; const OL_Specs* specs_; TelltaleState* state_; Coord width_; Coord height_; }; class OL_Scrollbar : public ActiveHandler, public Observer { public: OL_Scrollbar( const OL_Specs*, Adjustable*, Style*, DimensionName, OL_Cable*, OL_Elevator* ); virtual ~OL_Scrollbar(); virtual void allocation_changed(Canvas*, const Allocation&); virtual void press(const Event&); virtual void drag(const Event&); virtual void release(const Event&); virtual void update(Observable*); virtual void disconnect(Observable*); protected: const OL_Specs* specs_; Adjustable* adjustable_; const DimensionName dimension_; OL_Cable* cable_; OL_Elevator* elevator_; PolyGlyph* overlay_; }; // Both exclusive and non-exclusive settings use OL_Setting. Non-exclusive // settings are responsible to put margins between each other. class OL_Setting : public OL_Frame, public Observer { public: OL_Setting( const OLKit*, Glyph*, TelltaleState*, const OL_Specs*, bool is_default = false ); virtual ~OL_Setting(); virtual void draw(Canvas*, const Allocation&) const; virtual void pick(Canvas*, const Allocation&, int, Hit&); virtual void draw_background(Canvas*, const Allocation&) const; virtual void draw_frame(Canvas*, const Allocation&, Coord thickness) const; protected: const OL_Specs* specs_; bool is_default_; Brush* brush_; }; class OL_Slider : public ActiveHandler, public Observer { public: OL_Slider( const OL_Specs*, Adjustable*, Style*, DimensionName, OL_Channel*, OL_Dragbox* ); virtual ~OL_Slider(); virtual void allocation_changed(Canvas* c, const Allocation&); virtual void press(const Event&); virtual void drag(const Event&); virtual void release(const Event&); virtual void update(Observable*); virtual void disconnect(Observable*); protected: const OL_Specs* specs_; Adjustable* adjustable_; const DimensionName dimension_; OL_Channel* channel_; OL_Dragbox* box_; PolyGlyph* overlay_; }; class OL_Stepper : public MonoGlyph { public: virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; virtual void redraw(); virtual void press(const Event&); virtual void release(const Event&); virtual bool grabbing() const; virtual void tick(long, long); protected: OL_Stepper(const OL_Specs*, Adjustable*, DimensionName, Patch* thumb); virtual ~OL_Stepper(); virtual Requirement requirement_x() const = 0; virtual Requirement requirement_y() const = 0; virtual void allocate_thumb(const Allocation&, Allocation&) = 0; virtual void allot_major_axis( const Allotment&, Coord length, Coord gap, Allotment&) const; virtual float percent_visible() const; virtual Coord thumb_position(const Allotment&, Coord thumb_length, Coord gap) const; virtual void allot_minor_axis(const Allotment&, Coord width, Allotment&) const; virtual void adjust_pointer(Coord x, Coord y) const = 0; virtual void move_pointer(Coord x, Coord y) const; virtual void save_pointer(const Event&); virtual void press_select(); virtual void release_select(); virtual void press_undefined(); virtual void release_undefined(); virtual bool is_forward(Coord x, Coord y) const = 0; virtual bool is_backward(Coord x, Coord y) const = 0; virtual void step_forward() = 0; virtual void step_backward() = 0; virtual bool at_start() const; virtual bool at_end() const; virtual void start_stepping(); virtual void next_step(); virtual void stop_stepping(); protected: const OL_Specs* specs_; Adjustable* adjustable_; const DimensionName dimension_; Patch* thumb_; Canvas* canvas_; Allocation allocation_; Allocation thumb_allocation_; Coord pointer_x_, pointer_y_; bool forward_; bool backward_; bool grabbing_; float initial_delay_; float interval_; IOHandler* timer_; Cursor* saved_cursor_; }; class OL_Tick : public Glyph { public: OL_Tick(const OLKit*, const OL_Specs*, DimensionName); virtual void request(Requisition&) const; virtual void allocate(Canvas*, const Allocation&, Extension&); virtual void draw(Canvas*, const Allocation&) const; private: const OLKit* kit_; const OL_Specs* specs_; DimensionName dimension_; }; class OL_ToLimit : public Action { public: enum { start, end }; OL_ToLimit(Adjustable*, DimensionName, OL_Direction); virtual void execute(); private: Adjustable* adjustable_; const DimensionName dimension_; OL_Direction direction_; }; class OL_Cable : public OL_Stepper { public: OL_Cable(const OL_Specs*, Adjustable*, DimensionName, OL_Indicator*); virtual ~OL_Cable(); virtual void draw(Canvas*, const Allocation&) const; protected: virtual Requirement requirement_x() const; virtual Requirement requirement_y() const; virtual void allocate_thumb(const Allocation&, Allocation&); virtual void adjust_pointer(Coord x, Coord y) const; virtual bool is_forward(Coord x, Coord y) const; virtual bool is_backward(Coord x, Coord y) const; virtual void step_forward(); virtual void step_backward(); virtual Coord elevator_min() const; virtual Coord elevator_max() const; private: OL_Indicator* indicator_; const Color* gray_; }; class OL_CheckBox : public OL_Frame { public: OL_CheckBox(const OLKit*, TelltaleState*, const OL_Specs*); virtual void pick(Canvas*, const Allocation&, int, Hit&); virtual void draw_background(Canvas*, const Allocation&) const; }; class OL_Channel : public OL_Stepper { public: OL_Channel( const OLKit*, const OL_Specs*, Adjustable*, DimensionName, OL_Dragbox* ); virtual void draw(Canvas*, const Allocation&) const; void drag_to(const Event&); protected: virtual Requirement requirement_x() const; virtual Requirement requirement_y() const; virtual void allocate_thumb(const Allocation&, Allocation&); virtual void adjust_pointer(Coord x, Coord y) const; virtual Coord thumb_min() const; virtual Coord thumb_max() const; virtual bool is_forward(Coord x, Coord y) const; virtual bool is_backward(Coord x, Coord y) const; virtual void step_forward(); virtual void step_backward(); private: const OLKit* kit_; }; class OL_Elevator : public OL_Stepper { public: OL_Elevator( const OL_Specs*, Adjustable*, DimensionName, OL_ElevatorGlyph* ); virtual void draw(Canvas*, const Allocation&) const; virtual bool inside(const Event&) const; virtual bool less_than(const Event&) const; virtual bool greater_than(const Event&) const; virtual void press(const Event&); virtual void drag(const Event&); protected: virtual Requirement requirement_x() const; virtual Requirement requirement_y() const; virtual void allocate_thumb(const Allocation&, Allocation&); virtual void adjust_pointer(Coord x, Coord y) const; virtual bool is_forward(Coord x, Coord y) const; virtual bool is_backward(Coord x, Coord y) const; virtual void step_forward(); virtual void step_backward(); virtual void drag_to(const Event&); virtual void release_select(); virtual void adjust_for_dimming(); private: OL_ElevatorGlyph* glyph_; bool dragging_; }; class OLKitImpl { private: friend class OLKit; OLKitImpl(OLKit*); ~OLKitImpl(); Glyph* cable_anchor(Adjustable*, OL_Direction, DimensionName) const; Glyph* scrollbar(Adjustable*, DimensionName) const; Coord frame_thickness() const; const Color* color( Display*, const char* name, const char* alias, ColorIntensity r, ColorIntensity g, ColorIntensity b, float alpha ); private: OLKit* kit_; LayoutKit* layout_; Style* style_; OL_Specs* specs_; Coord frame_thickness_; const Color* white_; const Color* black_; const Color* bg1_; const Color* bg2_; const Color* bg3_; const Color* inactive_; const Color* busy_; }; OL_Specs::OL_Specs (Style* style) : Resource(), points_(12) { style->find_attribute("olglyph", points_); char fontname[20]; sprintf(fontname, "olglyph-%ld", points_); font_ = Font::lookup(fontname); if (font_ == nil) { fprintf(stderr, "font for OLKit not found: \'%s\'\n", fontname); fflush(stderr); } Resource::ref(font_); coords_per_point_ = Session::instance()->default_display()->to_coord(1); switch(points_) { case 10: sb_ = &sb_10; bt_ = &bt_10; stg_ = &stg_10; cbx_ = &cbx_10; sl_ = &sl_10; tk_ = &tk_10; gg_ = &gg_10; mb_ = &mb_10; bm_ = &bm_10; mm_ = &mm_10; sm_ = &sm_10; break; default: case 12: sb_ = &sb_12; bt_ = &bt_12; stg_ = &stg_12; cbx_ = &cbx_12; sl_ = &sl_12; tk_ = &tk_12; gg_ = &gg_12; mb_ = &mb_12; bm_ = &bm_12; mm_ = &mm_12; sm_ = &sm_12; break; case 14: sb_ = &sb_14; bt_ = &bt_14; stg_ = &stg_14; cbx_ = &cbx_14; sl_ = &sl_14; tk_ = &tk_14; gg_ = &gg_14; mb_ = &mb_14; bm_ = &bm_14; mm_ = &mm_14; sm_ = &sm_14; break; case 19: sb_ = &sb_19; bt_ = &bt_19; stg_ = &stg_19; cbx_ = &cbx_19; sl_ = &sl_19; tk_ = &tk_19; gg_ = &gg_19; mb_ = &mb_19; bm_ = &bm_19; mm_ = &mm_19; sm_ = &sm_19; break; } } OL_Specs::~OL_Specs() { Resource::unref(font_); } inline Coord OL_Specs::to_coord(float point) const { return coords_per_point_ * point; } inline const Font* OL_Specs::font() const { return font_; } inline Coord OL_Specs::anchor_height() const { return to_coord(sb_->b_); } inline Coord OL_Specs::anchor_rule() const { return to_coord(sb_->r_); } inline Coord OL_Specs::anchor_to_side_gap() const { return to_coord(sb_->h_); } inline Coord OL_Specs::anchor_width() const { return to_coord(sb_->a_ - sb_->r_); // "- r" compensates for shadow } inline Coord OL_Specs::arrow_length() const { return to_coord(sb_->e_); } inline Coord OL_Specs::button_default_ring_radius() const { return to_coord(bt_->a_ - 2.0) * 0.5; } inline Coord OL_Specs::button_gap() const { return to_coord(bt_->c_); } inline Coord OL_Specs::button_height() const { return to_coord(bt_->a_); } inline Coord OL_Specs::button_radius() const { return to_coord(bt_->a_) * 0.5; } inline Coord OL_Specs::button_vertical_margin() const { return to_coord(bt_->a_) * 0.20; // estimated 20% } inline Coord OL_Specs::button_rule_width() const { return to_coord(1.0); } inline Coord OL_Specs::cable_gap() const { return to_coord(sb_->j_); } inline Coord OL_Specs::cable_width() const { return to_coord(sb_->a_ - sb_->p_ - sb_->p_); } inline Coord OL_Specs::channel_cap_width() const { return to_coord(sl_->f_ * 0.5); } inline Coord OL_Specs::channel_gap() const { return to_coord(sl_->c_); } inline Coord OL_Specs::channel_highlight() const { return channel_gap(); // guessing } inline Coord OL_Specs::channel_length() const { return to_coord(sl_->c_ + sl_->b_ + sl_->c_); } inline Coord OL_Specs::channel_rule() const { return to_coord(sl_->c_); } inline Coord OL_Specs::channel_width() const { return to_coord(sl_->f_); } inline Coord OL_Specs::checkbox_thickness() const { return to_coord(cbx_->f_); } inline Coord OL_Specs::checkbox_width() const { return to_coord(cbx_->a_); } inline Coord OL_Specs::checkmark_height() const { return to_coord(cbx_->d_); } inline Coord OL_Specs::checkmark_width() const { return to_coord(cbx_->b_ + cbx_->c_ - cbx_->f_); } inline Coord OL_Specs::dragbox_length() const { return to_coord(sl_->b_); } inline Coord OL_Specs::dragbox_width() const { return to_coord(sl_->a_); } inline Coord OL_Specs::elevator_length() const { return to_coord(sb_->d_); } inline Coord OL_Specs::elevator_width() const { return to_coord(sb_->a_ - sb_->r_); // "- r" compensates for shadow } inline Coord OL_Specs::elevator_to_anchor_gap() const { return to_coord(sb_->c_); } inline Coord OL_Specs::elevator_to_side_gap() const { return to_coord(sb_->h_); } inline Coord OL_Specs::gauge_cap_width() const { return to_coord(gg_->a_ / 2.0); } inline Coord OL_Specs::gauge_end_width() const { return to_coord(gg_->b_ / 2.0); } inline Coord OL_Specs::gauge_indent() const { return to_coord((gg_->b_ - gg_->a_) / 2.0); } inline Coord OL_Specs::gauge_origin() const { return to_coord(gg_->c_); } inline Coord OL_Specs::gauge_rule() const { return to_coord(gg_->d_); } inline Coord OL_Specs::gauge_shimmer_gap() const { return gauge_rule(); // guessing } inline Coord OL_Specs::gauge_shimmer_width() const { return gauge_rule(); // guessing } inline Coord OL_Specs::gauge_width() const { return to_coord(gg_->b_); } inline Coord OL_Specs::gauge_min_length() const { return gauge_origin() + gauge_origin(); } inline Coord OL_Specs::menu_bmargin () const { return to_coord(0.7 * sm_->e_); // 0.7 guessed } inline Coord OL_Specs::menu_button_height() const { return to_coord(bm_->c_); } inline Coord OL_Specs::menu_hmargin() const { return to_coord(bm_->a_); } inline Coord OL_Specs::menu_mark_gap() const { return to_coord(mb_->a_); } inline Coord OL_Specs::menu_mark_height() const { return to_coord(mm_->b_); } inline Coord OL_Specs::menu_mark_width() const { const float tangent = 0.57735; Coord side = to_coord(tangent * mm_->b_); return side + side; } inline Coord OL_Specs::menu_pushpin_gap() const { return to_coord(bm_->i_ - bm_->c_); } inline Coord OL_Specs::menu_pushpin_height() const { return to_coord(bm_->b_); } inline Coord OL_Specs::menu_tmargin () const { return to_coord(0.3 * sm_->b_); // 0.3 guessed } inline Coord OL_Specs::menu_to_button_gap() const { return to_coord(sm_->h_); } inline Coord OL_Specs::setting_default_ring_thickness() const { return to_coord(stg_->e_); } inline Coord OL_Specs::setting_gap() const { return to_coord(stg_->e_); } inline Coord OL_Specs::setting_height() const { return to_coord(stg_->a_); } inline Coord OL_Specs::setting_thickness() const { return to_coord(stg_->e_); } inline Coord OL_Specs::setting_vertical_margin() const { return to_coord(stg_->a_ * 0.20); // estimated 20% } inline Coord OL_Specs::setting_horizontal_margin() const { return to_coord(stg_->d_); } inline Coord OL_Specs::shaft_length() const { return to_coord(sb_->c_ + sb_->d_ + sb_->c_); } inline Coord OL_Specs::shaft_gap() const { return to_coord(sb_->h_); } inline Coord OL_Specs::tick_length() const { return to_coord(tk_->a_); } OL_AbbrevMenuButton::OL_AbbrevMenuButton( const OLKit* k, const OL_Specs* s, DimensionName d, TelltaleState* state ) : kit_(k), specs_(s), dimension_(d), state_(state) { const Font* f = specs_->font(); if (f != nil) { FontBoundingBox box; f->char_bbox(ABBREV_MENU_UL, box); width_ = box.left_bearing() + box.right_bearing(); height_ = box.ascent() + box.descent(); if (d == Dimension_X) { f->char_bbox(VERT_MENU_MARK_UL, box); } else { f->char_bbox(HORIZ_MENU_MARK_UL, box); } lgap_ = (width_ - (box.left_bearing() + box.right_bearing())) * 0.5; tgap_ = (height_ - (box.ascent() + box.descent())) * 0.5; } else { width_ = height_ = 16; // filler } } void OL_AbbrevMenuButton::request(Requisition& r) const { Requirement height(height_); Requirement width(width_); r.require_x(width); r.require_y(height); } void OL_AbbrevMenuButton::allocate( Canvas* c, const Allocation& a, Extension& e ) { e.set(c, a); } void OL_AbbrevMenuButton::draw(Canvas* c, const Allocation& a) const { const Font* f = specs_->font(); if (f != nil) { Coord l = a.left(), t = a.top(); const Color* white = kit_->white(), *bg2 = kit_->bg2(), *bg3 = kit_->bg3(); const Color* ul, *lr, *fill; if (state_->test(TelltaleState::is_active)) { ul = bg3; lr = white; fill = bg2; } else { ul = white; lr = bg3; fill = kit_->bg1(); } c->character(f, ABBREV_MENU_UL, width_, ul, l, t); c->character(f, ABBREV_MENU_LR, width_, lr, l, t); c->character(f, ABBREV_MENU_FILL, width_, fill, l, t); Coord ll = l + lgap_, tt = t - tgap_; if (dimension_ == Dimension_X) { c->character(f, VERT_MENU_MARK_UL, width_, bg3, ll, tt); c->character(f, VERT_MENU_MARK_LR, width_, white, ll, tt); c->character(f, VERT_MENU_MARK_FILL, width_, bg2, ll, tt); } else { c->character(f, HORIZ_MENU_MARK_UL, width_, bg3, ll, tt); c->character(f, HORIZ_MENU_MARK_LR, width_, white, ll, tt); c->character(f, HORIZ_MENU_MARK_FILL, width_, bg2, ll, tt); } if (state_->test(TelltaleState::is_running)) { c->character(f, ABBREV_MENU_FILL, width_, kit_->busy(), l, t); } else if (!state_->test(TelltaleState::is_enabled)) { c->character(f, ABBREV_MENU_FILL, width_, kit_->inactive(), l, t); } } } OL_Anchor::OL_Anchor( const OLKit* k, Coord w, Coord h, Coord t, TelltaleState* s ) : Glyph(), kit_(k), width_(w), height_(h), thickness_(t), state_(s) { Resource::ref(state_); } OL_Anchor::~OL_Anchor() { Resource::unref(state_); } void OL_Anchor::allocate(Canvas* c, const Allocation& a, Extension& e) { e.set(c, a); } void OL_Anchor::request(Requisition& r) const { Requirement x(width_, 0, 0, 0.5); Requirement y(height_, 0, 0, 0.5); r.require_x(x); r.require_y(y); } void OL_Anchor::draw(Canvas* c, const Allocation& a) const { const Color* upper_left, *lower_right, *fill; if (state_->test(TelltaleState::is_active)) { upper_left = kit_->bg3(); fill = kit_->bg2(); lower_right = kit_->white(); } else { upper_left = kit_->white(); fill = kit_->bg1(); lower_right = kit_->bg3(); } Coord l = a.left(), b = a.bottom(), r = a.right(), t = a.top(); Bevel::rect(c, upper_left, fill, lower_right, thickness_, l, b, r, t); } OL_Button::OL_Button( const OLKit* k, const OL_Specs* s, Glyph* g, TelltaleState* t, OL_ButtonType type, bool extend ) : MonoGlyph(nil), Observer(), kit_(k), specs_(s), state_(t), type_(type), brush_(new Brush(s->button_rule_width())) { Resource::ref(brush_); Resource::ref(state_); Requisition r; g->request(r); Coord min_width = 72.0; k->style()->find_attribute("minimumWidth", min_width); Requirement& rx = r.x_requirement(); Coord radius = s->button_radius(); Coord width = radius + rx.natural() + radius; Coord rm = 0; if (extend && width < min_width) { rm = min_width - width; } Coord vm = (s->button_height() - r.y_requirement().natural()) * 0.5; if (vm < s->button_vertical_margin()) { vm = s->button_vertical_margin(); } body(LayoutKit::instance()->margin(g, radius, rm + radius, vm, vm)); } OL_Button::~OL_Button() { Resource::unref(state_); Resource::unref(brush_); } void OL_Button::allocate(Canvas* c, const Allocation& a, Extension& e) { MonoGlyph::allocate(c, a, e); e.set(c, a); } void OL_Button::draw(Canvas* c, const Allocation& a) const { draw_background(c, a); MonoGlyph::draw(c, a); if (!state_->test(TelltaleState::is_enabled)) { fill(c, a, kit_->inactive()); } if (type_ != MenuButton || state_->test(TelltaleState::is_active)) { draw_frame(c, a); } if (state_->test(TelltaleState::is_running)) { fill(c, a, kit_->busy()); } if (type_ == DefaultButton && !state_->test(TelltaleState::is_active)) { const Color* color = kit_->bg3(); Coord l = a.left(), b = a.bottom(), r = a.right(), t = a.top(); path(c, 4, l, b, r, t); c->stroke(color, brush_); } } void OL_Button::pick(Canvas*, const Allocation& a, int depth, Hit& h) { Coord x = h.left(); Coord y = h.bottom(); if (a.left() <= x && x < a.right() && a.bottom() <= y && y < a.top()) { h.target(depth, this, 0); } } void OL_Button::draw_background(Canvas* c, const Allocation& a) const { const Color* background; if (state_->test(TelltaleState::is_active)) { background = kit_->bg2(); } else { background = kit_->bg1(); } fill(c, a, background); } void OL_Button::fill( Canvas* c, const Allocation& a, const Color* color ) const { Coord w = brush_->width(); Coord l = a.left()+w, b = a.bottom()+w, r = a.right()-w, t = a.top()-w; path(c, 1, l, b, r, t); c->close_path(); c->fill(color); } void OL_Button::draw_frame(Canvas* c, const Allocation& a) const { const Color* top, *bottom; if (state_->test(TelltaleState::is_active)) { top = kit_->bg3(); bottom = kit_->white(); } else { top = kit_->white(); bottom = kit_->bg3(); } Coord w = brush_->width(); Coord l = a.left()+w, b = a.bottom()+w, r = a.right()-w, t = a.top()-w; top_path(c, 1, l, b, r, t); c->stroke(top, brush_); bottom_path(c, 1, l, b, r, t); c->stroke(bottom, brush_); } /* * Draw button end caps using a polygon. Numbers determined experimentally. * Looks good for font sizes 10, 12, 14, bad for 19. */ static const int l1 = 2; static const int l2 = 3; static const int l3 = 6; void OL_Button::path ( Canvas* canvas, int inset, Coord l, Coord b, Coord r, Coord t ) const { Coord d0 = specs_->to_coord(inset); Coord d1 = specs_->to_coord(inset + l1); Coord d2 = specs_->to_coord(inset + l2); Coord d3 = specs_->to_coord(inset + l3); canvas->new_path(); canvas->move_to(l + d1, b + d2); canvas->line_to(l + d0, b + d3); canvas->line_to(l + d0, t - d3); canvas->line_to(l + d1, t - d2); canvas->line_to(l + d2, t - d1); canvas->line_to(l + d3, t - d0); canvas->line_to(r - d3, t - d0); canvas->line_to(r - d2, t - d1); canvas->line_to(r - d1, t - d2); canvas->line_to(r - d0, t - d3); canvas->line_to(r - d0, b + d3); canvas->line_to(r - d1, b + d2); canvas->line_to(r - d2, b + d1); canvas->line_to(r - d3, b + d0); canvas->line_to(l + d3, b + d0); canvas->line_to(l + d2, b + d1); canvas->close_path(); } void OL_Button::top_path( Canvas* c, int inset, Coord l, Coord b, Coord r, Coord t ) const { Coord d0 = specs_->to_coord(inset); Coord d1 = specs_->to_coord(inset + l1); Coord d2 = specs_->to_coord(inset + l2); Coord d3 = specs_->to_coord(inset + l3); c->move_to(l + d1, b + d2); c->line_to(l + d0, b + d3); c->line_to(l + d0, t - d3); c->line_to(l + d1, t - d2); c->line_to(l + d2, t - d1); c->line_to(l + d3, t - d0); c->line_to(r - d3, t - d0); c->line_to(r - d2, t - d1); } void OL_Button::bottom_path( Canvas* c, int inset, Coord l, Coord b, Coord r, Coord t ) const { Coord d0 = specs_->to_coord(inset); Coord d1 = specs_->to_coord(inset + l1); Coord d2 = specs_->to_coord(inset + l2); Coord d3 = specs_->to_coord(inset + l3); c->move_to(r - d1, t - d2); c->line_to(r - d0, t - d3); c->line_to(r - d0, b + d3); c->line_to(r - d1, b + d2); c->line_to(r - d2, b + d1); c->line_to(r - d3, b + d0); c->line_to(l + d3, b + d0); c->line_to(l + d2, b + d1); } OL_CheckMark::OL_CheckMark( const OLKit* k, TelltaleState* t, const OL_Specs* s ) : Glyph(), kit_(k), state_(t), specs_(s), font_(s->font()), code_(CHECK_MARK), width_(0), height_(0) { Resource::ref(state_); Resource::ref(font_); if (font_ != nil) { FontBoundingBox box; font_->char_bbox(code_, box); width_ = box.width(); height_ = box.ascent() + box.descent(); } } OL_CheckMark::~OL_CheckMark() { Resource::unref(state_); Resource::unref(font_); } void OL_CheckMark::request(Requisition& r) const { Coord rule = specs_->checkbox_thickness(); Coord side = specs_->checkbox_width() - (rule + rule); r.x_requirement().natural(side); r.y_requirement().natural(side); } void OL_CheckMark::allocate(Canvas* c, const Allocation& a, Extension& e) { Coord left = a.left(), bottom = a.bottom(); e.set_xy(c, left, bottom, left + width_, bottom + height_); } void OL_CheckMark::draw(Canvas* c, const Allocation& a) const { if (state_->test(TelltaleState::is_chosen)) { if (font_ != nil) { Coord l = a.left(), b = a.bottom(); c->character(font_, code_, width_, kit_->black(), l, b + height_); } } } OL_ElevatorGlyph::OL_ElevatorGlyph( const OLKit* k, const OL_Specs* s, DimensionName d ) : Glyph(), kit_(k), specs_(s), dimension_(d), font_(s->font()), canvas_(nil), extension_(), index_(ivnormal) { Resource::ref(font_); } OL_ElevatorGlyph::~OL_ElevatorGlyph() { Resource::unref(font_); } void OL_ElevatorGlyph::request(Requisition& r) const { DimensionName major_d = dimension_; DimensionName minor_d = (major_d == Dimension_X)? Dimension_Y: Dimension_X; r.requirement(major_d).natural(specs_->elevator_length()); r.requirement(minor_d).natural(specs_->elevator_width()); } /* * Return an extension that extends beyond the actual drawing by 1 point * to eliminate roundoff errors in redraw which may leave doodoos. */ void OL_ElevatorGlyph::allocate(Canvas* c, const Allocation& a, Extension& e) { canvas_ = c; extension_.set(c, a); e.set_xy(c, a.left() - 1, a.bottom() - 1, a.right() + 1, a.top() + 1); } void OL_ElevatorGlyph::draw(Canvas* c, const Allocation& a) const { bool h = dimension_ == Dimension_X; unsigned char ul = h ? HORIZ_SB_UL : VERT_SB_UL; unsigned char lr = h ? HORIZ_SB_LR : VERT_SB_LR; unsigned char box_ul = h ? HORIZ_SB_BOX_UL : VERT_SB_BOX_UL; unsigned char box1_fill = h ? HORIZ_SB_LEFTBOX_FILL : VERT_SB_BOTBOX_FILL; unsigned char box_lr = h ? HORIZ_SB_BOX_LR : VERT_SB_BOX_LR; unsigned char box2_fill = h ? HORIZ_SB_RIGHTBOX_FILL : VERT_SB_TOPBOX_FILL; Coord l = a.left(), b = a.bottom(), r = a.right(), t = a.top(); Coord width = specs_->elevator_width(); Coord arrow_length = specs_->arrow_length(); const Font* f = font_; const Color* white = kit_->white(); const Color* bg1 = kit_->bg1(), *bg2 = kit_->bg2(), *bg3 = kit_->bg3(); const Color* dim = kit_->inactive(); c->fill_rect(l, b, r, t, bg1); if (f != nil) { c->character(f, ul, width, white, l, t); c->character(f, lr, width, bg3, l, t); } switch (index_) { case backward_arrow_highlighted: if (!h) { t -= arrow_length + arrow_length; } if (f != nil) { c->character(f, box_ul, arrow_length, bg3, l, t); c->character(f, box1_fill, arrow_length, bg2, l, t); c->character(f, box_lr, width, white, l, t); } break; case dragging: if (h) { l += arrow_length; } else { t -= arrow_length; } if (f != nil) { c->character(f, DIMPLE_UL, arrow_length, bg3, l, t); c->character(f, DIMPLE_FILL, arrow_length, bg2, l, t); c->character(f, DIMPLE_LR, arrow_length, white, l, t); } break; case forward_arrow_highlighted: if (h) { l += arrow_length + arrow_length; } if (f != nil) { c->character(f, box_ul, arrow_length, bg3, l, t); c->character(f, box2_fill, arrow_length, bg2, l, t); c->character(f, box_lr, arrow_length, white, l, t); } break; case backward_arrow_dimmed: if (h) { c->fill_rect(l, b, l + arrow_length, t, dim); } else { c->fill_rect(l, b, r, t - arrow_length - arrow_length, dim); } break; case forward_arrow_dimmed: if (h) { c->fill_rect(l + arrow_length + arrow_length, b, r, t, dim); } else { c->fill_rect(l, t - arrow_length, r, t, dim); } break; case both_arrows_dimmed: c->fill_rect(l, b, r, t, dim); break; } } void OL_ElevatorGlyph::undraw() { canvas_ = nil; } void OL_ElevatorGlyph::flip_to(GlyphIndex i) { if (i != index_) { if (canvas_ != nil) { canvas_->damage(extension_); } index_ = i; } } bool OL_ElevatorGlyph::inside(const Event& p) { Coord x = p.pointer_x(); Coord y = p.pointer_y(); const Extension& e = extension_; return e.left() <= x && x < e.right() && e.bottom() <= y && y < e.top(); } bool OL_ElevatorGlyph::backward_arrow_contains(Coord x, Coord y) const { Coord arrow = specs_->arrow_length(); const Extension& e = extension_; Coord l = e.left(), b = e.bottom(), r = e.right(), t = e.top(); if (dimension_ == Dimension_X) { return l <= x && x < l + arrow && b <= y && y < t; } else { return l <= x && x < r && b <= y && y < t - arrow - arrow; } } bool OL_ElevatorGlyph::forward_arrow_contains(Coord x, Coord y) const { Coord arrow = specs_->arrow_length(); const Extension& e = extension_; Coord l = e.left(), b = e.bottom(), r = e.right(), t = e.top(); if (dimension_ == Dimension_X) { return l + arrow + arrow <= x && x < r && b <= y && y < t; } else { return l <= x && x < r && t - arrow <= y && y < t; } } bool OL_ElevatorGlyph::less_than(const Event& e) const { if (dimension_ == Dimension_X) { return extension_.right() < e.pointer_x(); } else { return extension_.top() < e.pointer_y(); } } bool OL_ElevatorGlyph::greater_than(const Event& e) const { if (dimension_ == Dimension_X) { return extension_.left() > e.pointer_x(); } else { return extension_.bottom() > e.pointer_y(); } } float OL_ElevatorGlyph::forward_arrow_center() const { if (dimension_ == Dimension_X) { return extension_.right() - specs_->arrow_length() * 0.5; } else { return extension_.top() - specs_->arrow_length() * 0.5; } } float OL_ElevatorGlyph::backward_arrow_center() const { if (dimension_ == Dimension_X) { return extension_.left() + specs_->arrow_length() * 0.5; } else { return extension_.bottom() + specs_->arrow_length() * 0.5; } } GlyphIndex OL_ElevatorGlyph::index() const { return index_; } OL_Indicator::OL_Indicator( const OLKit* k, const OL_Specs* s, DimensionName d ) : Glyph(), kit_(k), specs_(s), dimension_(d) {} void OL_Indicator::allocate(Canvas* c, const Allocation& a, Extension& e) { Coord gap = specs_->cable_gap(); if (dimension_ == Dimension_X) { e.set_xy(c, a.left() - gap, a.bottom(), a.right() + gap, a.top()); } else { e.set_xy(c, a.left(), a.bottom() - gap, a.right(), a.top() + gap); } e.set_xy(c, e.left() - 1, e.bottom() - 1, e.right() + 1, e.top() + 1); } void OL_Indicator::draw(Canvas* c, const Allocation& a) const { Coord gap = specs_->cable_gap(); Coord l = a.left(), b = a.bottom(), r = a.right(), t = a.top(); if (dimension_ == Dimension_X) { c->fill_rect(l - gap, b, r + gap, t, kit_->bg1()); } else { c->fill_rect(l, b - gap, r, t + gap, kit_->bg1()); } c->fill_rect(l, b, r, t, kit_->bg3()); } OL_Frame::OL_Frame( const OLKit* k, Glyph* g, TelltaleState* t, Coord thickness ) : BevelFrame(g, thickness), kit_(k), state_(t), thickness_(thickness) { Resource::ref(state_); } OL_Frame::~OL_Frame() { Resource::unref(state_); } void OL_Frame::draw(Canvas* c, const Allocation& a) const { draw_background(c, a); BevelFrame::draw(c, a); if (!state_->test(TelltaleState::is_enabled)) { Coord l = a.left(), b = a.bottom(), r = a.right(), t = a.top(); Coord th = thickness_; c->fill_rect(l + th, b + th, r - th, t - th, kit_->inactive()); } } void OL_Frame::draw_frame( Canvas* c, const Allocation& a, Coord thickness ) const { const Color* ul, *lr; if (!state_->test(TelltaleState::is_active)) { ul = kit_->white(); lr = kit_->bg3(); } else { ul = kit_->bg3(); lr = kit_->white(); } Coord l = a.left(), b = a.bottom(), r = a.right(), t = a.top(); Bevel::rect(c, ul, nil, lr, thickness, l, b, r, t); } void OL_Frame::draw_background(Canvas* c, const Allocation& a) const { c->fill_rect(a.left(), a.bottom(), a.right(), a.top(), kit_->bg1()); } OL_Gauge::OL_Gauge( const OLKit* k, const OL_Specs* s, DimensionName d, Adjustable* a, Patch* p ) : kit_(k), specs_(s), dimension_(d), adjustable_(a), patch_(p) { adjustable_->attach(dimension_, this); } OL_Gauge::~OL_Gauge() { if (adjustable_ != nil) { adjustable_->detach(dimension_, this); } } void OL_Gauge::request(Requisition& r) const { Requirement width(specs_->gauge_width()); Requirement length(specs_->gauge_min_length(), fil, 0.0, 0.0); if (dimension_ == Dimension_X) { r.require_x(length); r.require_y(width); } else { r.require_x(width); r.require_y(length); } } void OL_Gauge::allocate(Canvas* c, const Allocation& a, Extension& e) { e.set(c, a); } void OL_Gauge::draw(Canvas* c, const Allocation& a) const { bool horizontal = dimension_ == Dimension_X; Coord l = a.left(), b = a.bottom(), r = a.right(), t = a.top(); const Color* white = kit_->white(), *black = kit_->black(); const Color* bg1 = kit_->bg1(), *bg2 = kit_->bg2(), *bg3 = kit_->bg3(); const Font* f = specs_->font(); Coord cw = specs_->gauge_cap_width(); Coord rule = specs_->gauge_rule(); Coord ew, eh; if (f != nil) { FontBoundingBox box; if (horizontal) { f->char_bbox(HORIZ_GAUGE_LEFT_ENDFILL, box); } else { f->char_bbox(VERT_GAUGE_BOT_FILL, box); } ew = box.width(); eh = box.ascent() + box.descent(); } else { ew = eh = specs_->gauge_end_width(); } /* background */ if (horizontal) { if (f != nil) { c->character(f, HORIZ_GAUGE_LEFT_ENDFILL, ew, bg2, l, t); c->character(f, HORIZ_GAUGE_RIGHT_ENDFILL, ew, bg2, r - ew, t); } c->fill_rect(l + ew, b, r - ew, t, bg2); } else { if (f != nil) { c->character(f, VERT_GAUGE_TOP_FILL, ew, bg2, l, t); c->character(f, VERT_GAUGE_BOT_FILL, ew, bg2, l, b + eh); } c->fill_rect(l, b + eh, r, t - eh, bg2); } /* outline */ if (horizontal) { if (f != nil) { c->character(f, HORIZ_GAUGE_UL, ew, bg3, l, t); c->character(f, HORIZ_GAUGE_UR, ew, bg3, r - ew, t); c->character(f, HORIZ_GAUGE_LL, ew, white, l, t); c->character(f, HORIZ_GAUGE_LR, ew, white, r - ew, t); } c->fill_rect(l + ew, t - rule, r - ew, t, bg3); c->fill_rect(l + ew, b, r - ew, b + rule, white); } else { if (f != nil) { c->character(f, VERT_GAUGE_LL, ew, bg3, l, b + eh); c->character(f, VERT_GAUGE_UL, ew, bg3, l, t); c->character(f, VERT_GAUGE_UR, ew, white, l, t); c->character(f, VERT_GAUGE_LR, ew, white, l, b + eh); } c->fill_rect(l, b + eh, l + rule, t - eh, bg3); c->fill_rect(r - rule, b + eh, r, t - eh, white); } /* interior */ Coord indent = specs_->gauge_indent(); Coord ll = l + indent, bb = b + indent, rr = r - indent, tt = t - indent; float percent = adjustable_->cur_upper(dimension_) / adjustable_->upper(dimension_); Coord origin = specs_->gauge_origin(); Coord filled; if (horizontal) { if (f != nil) { c->character(f, HORIZ_SLIDER_LEFT_ENDCAP_FILL, ew, black, ll, tt); } filled = l + origin + (r - l - origin - origin) * percent; c->fill_rect(ll + cw, bb, filled, tt, black); if (percent > 0) { Coord ttt = tt - specs_->gauge_shimmer_gap(); c->fill_rect( l + origin, ttt - specs_->gauge_shimmer_width(), filled,ttt,bg3 ); } } else { if (f != nil) { c->character( f, VERT_SLIDER_BOTTOM_ENDCAP_FILL, ew, black, ll, bb + cw ); } filled = b + origin + (t - b - origin - origin) * percent; c->fill_rect(ll, bb + cw, rr, filled, black); if (percent > 0) { Coord lll = ll + specs_->gauge_shimmer_gap(); c->fill_rect( lll, b + origin, lll + specs_->gauge_shimmer_width(),filled,bg3 ); } } } void OL_Gauge::update(Observable*) { patch_->redraw(); } void OL_Gauge::disconnect(Observable*) { patch_->undraw(); adjustable_ = nil; } OL_MenuMark::OL_MenuMark( const OLKit* k, const OL_Specs* s, bool pulldown ) : Glyph(), kit_(k), specs_(s), font_(s->font()) { Resource::ref(font_); if (pulldown) { fill_code_ = VERT_MENU_MARK_FILL; ul_code_ = VERT_MENU_MARK_UL; lr_code_ = VERT_MENU_MARK_LR; } else { fill_code_ = HORIZ_MENU_MARK_FILL; ul_code_ = HORIZ_MENU_MARK_UL; lr_code_ = HORIZ_MENU_MARK_LR; } if (font_ != nil) { FontBoundingBox box; font_->char_bbox(fill_code_, box); fill_width_ = box.width(); fill_height_ = box.ascent() + box.descent(); font_->char_bbox(ul_code_, box); ul_width_ = box.width(); ul_height_ = box.ascent() + box.descent(); font_->char_bbox(lr_code_, box); lr_width_ = box.width(); lr_height_ = box.ascent() + box.descent(); } } OL_MenuMark::~OL_MenuMark () { Resource::unref(font_); } void OL_MenuMark::request(Requisition& r) const { r.x_requirement().natural(specs_->menu_mark_width()); r.y_requirement().natural(specs_->menu_mark_height()); } void OL_MenuMark::allocate(Canvas* c, const Allocation& a, Extension& e) { e.set(c, a); } void OL_MenuMark::draw(Canvas* c, const Allocation& a) const { if (font_ != nil) { const Font* f = font_; Coord x = a.x(); Coord y = a.y(); c->character( f, fill_code_, fill_width_, kit_->bg2(), x, y + fill_height_); c->character(f, ul_code_, ul_width_, kit_->bg3(), x, y + ul_height_); c->character(f, lr_code_, lr_width_, kit_->white(), x, y + lr_height_); } } OL_Mover::OL_Mover( const OLKit* k, const OL_Specs* s, OL_MoverFlags f, TelltaleState* t ) : kit_(k), specs_(s), state_(t), font_(s->font()) { Resource::ref(state_); if (f == up || f == down) { box_ul_ = VERT_SB_BOX_UL; box_lr_ = VERT_SB_BOX_LR; if (f == up) { fill_ = VERT_SB_TOPBOX_FILL; } else { fill_ = VERT_SB_BOTBOX_FILL; } } else { box_ul_ = HORIZ_SB_BOX_UL; box_lr_ = HORIZ_SB_BOX_LR; if (f == left) { fill_ = HORIZ_SB_LEFTBOX_FILL; } else { fill_ = HORIZ_SB_RIGHTBOX_FILL; } } if (font_ != nil) { FontBoundingBox box; font_->char_bbox(long(box_ul_), box); width_ = box.width() + 1; height_ = box.ascent() + box.descent() + 1; } else { width_ = height_ = specs_->arrow_length(); } } OL_Mover::~OL_Mover() { Resource::unref(state_); } void OL_Mover::request(Requisition& r) const { Requirement r_x(width_); Requirement r_y(height_); r.require_x(r_x); r.require_y(r_y); } void OL_Mover::allocate(Canvas* c, const Allocation& a, Extension& e) { e.set(c, a); } void OL_Mover::draw(Canvas* c, const Allocation& a) const { if (font_ != nil) { const Color* white = kit_->white(); const Color* bg1 = kit_->bg1(), *bg2 = kit_->bg2(), *bg3 = kit_->bg3(); Coord l = a.left(), b = a.bottom(), r = a.right(), t = a.top(); c->fill_rect(l + 1, b + 1, r - 1, t - 1, bg3); // arrow if (state_->test(TelltaleState::is_active)) { c->character(font_, long(fill_), width_, bg2, l, t); c->character(font_, long(box_ul_), width_, bg3, l, t); c->character(font_, long(box_lr_), width_, white, l, t); } else { c->character(font_, long(fill_), width_, bg1, l, t); c->character(font_, long(box_ul_), width_, white, l, t); c->character(font_, long(box_lr_), width_, bg3, l, t); } if (state_->test(TelltaleState::is_running)) { c->fill_rect(l, r, b, t, kit_->busy()); } else if (!state_->test(TelltaleState::is_enabled)) { c->fill_rect(l, r, b, t, kit_->inactive()); } } } OL_Pushpin::OL_Pushpin( TelltaleState* s, const Window* u, Window* p ) : Action(), state_(s), unpinned_(u), pinned_(p), placed_(false) { Resource::ref(state_); } OL_Pushpin::~OL_Pushpin() { Resource::unref(state_); } void OL_Pushpin::execute() { if (state_->test(TelltaleState::is_chosen)) { if (!placed_) { pinned_->place(unpinned_->left(), unpinned_->bottom()); pinned_->align(0.0, 0.0); placed_ = true; } pinned_->map(); } else { pinned_->unmap(); } } OL_PushpinLook::OL_PushpinLook( const OLKit* k, const OL_Specs* specs, TelltaleState* state ) : Glyph(), kit_(k), specs_(specs), state_(state), width_(0), height_(0) { Resource::ref(state_); const Font* font = specs->font(); if (font != nil) { FontBoundingBox box; font->char_bbox(PUSHPIN_OUT_BOTTOM, box); width_ = box.width(); height_ = box.ascent() + box.descent(); } } OL_PushpinLook::~OL_PushpinLook() { Resource::unref(state_); } void OL_PushpinLook::request(Requisition& r) const { Requirement x(width_); Requirement y(height_); r.require_x(x); r.require_y(y); } void OL_PushpinLook::allocate(Canvas* c, const Allocation& a, Extension& e) { e.set(c, a); } void OL_PushpinLook::draw(Canvas* c, const Allocation& a) const { if (state_->test(TelltaleState::is_chosen)) { if (state_->test(TelltaleState::is_active)) { draw_unpinned(c, a); } else { draw_pinned(c, a); } } else { if (state_->test(TelltaleState::is_active)) { draw_pinned(c, a); } else { draw_unpinned(c, a); } } } void OL_PushpinLook::draw_pinned(Canvas* c, const Allocation& a) const { Coord x = a.x(), y = a.y() + height_; const Font* font = specs_->font(); c->character(font, PUSHPIN_IN_TOP, width_, kit_->white(), x, y); c->character(font, PUSHPIN_IN_BOTTOM, width_, kit_->bg3(), x, y); c->character(font, PUSHPIN_IN_MIDDLE, width_, kit_->bg2(), x, y); } void OL_PushpinLook::draw_unpinned(Canvas* c, const Allocation& a) const { Coord x = a.x(), y = a.y() + height_; const Font* font = specs_->font(); c->character(font, PUSHPIN_OUT_TOP, width_, kit_->white(), x, y); c->character(font, PUSHPIN_OUT_BOTTOM, width_, kit_->bg3(), x, y); c->character(font, PUSHPIN_OUT_MIDDLE, width_, kit_->bg2(), x, y); } OL_Scrollbar::OL_Scrollbar( const OL_Specs* specs, Adjustable* a, Style* style, DimensionName d, OL_Cable* c, OL_Elevator* e ) : ActiveHandler(nil, style), Observer(), specs_(specs), adjustable_(a), dimension_(d), cable_(c), elevator_(e), overlay_(LayoutKit::instance()->overlay(c, e)) { body(overlay_); adjustable_->attach(dimension_, this); } OL_Scrollbar::~OL_Scrollbar() { if (adjustable_ != nil) { adjustable_->detach(dimension_, this); } } void OL_Scrollbar::allocation_changed(Canvas* c, const Allocation& a) { Extension e; e.clear(); overlay_->modified(0); MonoGlyph::allocate(c, a, e); } void OL_Scrollbar::press(const Event& e) { if (elevator_->inside(e) || elevator_->grabbing()) { elevator_->press(e); } else { cable_->press(e); } ActiveHandler::press(e); } void OL_Scrollbar::drag(const Event& e) { if (elevator_->inside(e) || elevator_->grabbing()) { elevator_->drag(e); } ActiveHandler::drag(e); } void OL_Scrollbar::release(const Event& e) { if (cable_->grabbing()) { cable_->release(e); } else if (elevator_->grabbing()) { elevator_->release(e); } else { if (elevator_->inside(e)) { elevator_->release(e); } else if (elevator_->less_than(e) || elevator_->greater_than(e)) { cable_->release(e); } } ActiveHandler::release(e); } void OL_Scrollbar::update(Observable*) { Canvas* c = canvas(); if (c != nil) { cable_->redraw(); elevator_->redraw(); Extension ext; ext.clear(); allocate(c, allocation(), ext); cable_->redraw(); elevator_->redraw(); } } void OL_Scrollbar::disconnect(Observable*) { adjustable_ = nil; } OL_Slider::OL_Slider( const OL_Specs* specs, Adjustable* a, Style* style, DimensionName d, OL_Channel* c, OL_Dragbox* b ) : ActiveHandler(nil, style), Observer(), specs_(specs), adjustable_(a), dimension_(d), channel_(c), box_(b) { body(channel_); adjustable_->attach(dimension_, this); } OL_Slider::~OL_Slider() { if (adjustable_ != nil) { adjustable_->detach(dimension_, this); } } void OL_Slider::allocation_changed(Canvas* c, const Allocation& a) { Extension e; e.clear(); MonoGlyph::allocate(c, a, e); } void OL_Slider::press(const Event& e) { if ((box_->inside(e) || box_->dragging()) && e.pointer_button() == Event::left) { box_->press(e); channel_->drag_to(e); } else { channel_->press(e); } ActiveHandler::press(e); } void OL_Slider::drag(const Event& e) { if (box_->dragging()) { channel_->drag_to(e); } ActiveHandler::drag(e); } void OL_Slider::release(const Event& e) { if (box_->dragging()) { box_->release(e); } else { channel_->release(e); } ActiveHandler::release(e); } void OL_Slider::update(Observable*) { Canvas* c = canvas(); if (c != nil) { channel_->redraw(); Extension ext; ext.clear(); allocate(c, allocation(), ext); channel_->redraw(); } } void OL_Slider::disconnect(Observable*) { adjustable_ = nil; } OL_Setting::OL_Setting( const OLKit* k, Glyph* g, TelltaleState* t, const OL_Specs* s, bool d ) : OL_Frame(k, g, t, s->setting_thickness()), Observer(), specs_(s), is_default_(d), brush_(new Brush(s->setting_default_ring_thickness())) { Resource::ref(brush_); Requisition r; g->request(r); Coord vm = (s->setting_height() - r.y_requirement().natural()) * 0.5; if (vm < s->setting_vertical_margin()) { vm = s->setting_vertical_margin(); } Coord min_width = 72.0; k->style()->find_attribute("minimumWidth", min_width); Coord hm = s->setting_horizontal_margin(); Coord width = hm + r.x_requirement().natural() + hm; Coord rm = 0; if (width < min_width) { rm = min_width - width; } LayoutKit& l = *LayoutKit::instance(); body(l.margin(g, hm, rm + hm, vm, vm)); } OL_Setting::~OL_Setting() { Resource::unref(brush_); } void OL_Setting::draw(Canvas* c, const Allocation& a) const { OL_Frame::draw(c, a); if (is_default_ && !state_->test(TelltaleState::is_active)) { const OL_Specs& s = *specs_; Coord i = s.setting_thickness() + s.setting_gap() + s.setting_default_ring_thickness() * 0.5; Coord l = a.left()+i, b = a.bottom()+i, r = a.right()-i, t = a.top()-i; c->rect(l, b, r, t, kit_->bg3(), brush_); } } void OL_Setting::pick(Canvas*, const Allocation& a, int depth, Hit& h) { Coord x = h.left(); Coord y = h.bottom(); if (a.left() <= x && x < a.right() && a.bottom() <= y && y < a.top()) { h.target(depth, this, 0); } } void OL_Setting::draw_background(Canvas* c, const Allocation& a) const { const Color* background; if (state_->test(TelltaleState::is_active) || state_->test(TelltaleState::is_chosen) ) { background = kit_->bg2(); } else { background = kit_->bg1(); } c->fill_rect(a.left(), a.bottom(), a.right(), a.top(), background); } void OL_Setting::draw_frame( Canvas* c, const Allocation& a, Coord thickness ) const { const Color* ul, *lr; if (state_->test(TelltaleState::is_active) || state_->test(TelltaleState::is_chosen) ) { ul = kit_->bg3(); lr = kit_->white(); } else { ul = kit_->white(); lr = kit_->bg3(); } Coord l = a.left(), b = a.bottom(), r = a.right(), t = a.top(); Bevel::rect(c, ul, nil, lr, thickness, l, b, r, t); } const long one_second = 1000000; declareIOCallback(OL_Stepper) implementIOCallback(OL_Stepper) OL_Stepper::OL_Stepper( const OL_Specs* specs, Adjustable* a, DimensionName d, Patch* t ) : MonoGlyph(t), specs_(specs), adjustable_(a), dimension_(d), thumb_(t), canvas_(nil), allocation_(), thumb_allocation_(), pointer_x_(0.0), pointer_y_(0.0), forward_(false), backward_(false), grabbing_(false), initial_delay_(0.40 * one_second), interval_(0.10 * one_second), timer_(new IOCallback(OL_Stepper)(this, &OL_Stepper::tick)), saved_cursor_(nil) {} OL_Stepper::~OL_Stepper() { delete timer_; } void OL_Stepper::request(Requisition& r) const { Requirement r_x = requirement_x(); Requirement r_y = requirement_y(); r.require(Dimension_X, r_x); r.require(Dimension_Y, r_y); } /* * Position the thumb by calculating it's exact allocation. * * However, we need to tell the enclosing ActiveHandler (the Slider) * that we want events from the entire area. */ void OL_Stepper::allocate(Canvas* c, const Allocation& a, Extension& e) { allocation_ = a; canvas_ = c; allocate_thumb(a, thumb_allocation_); MonoGlyph::allocate(c, thumb_allocation_, e); e.set(c, a); } void OL_Stepper::draw(Canvas* c, const Allocation&) const { MonoGlyph::draw(c, thumb_allocation_); if (grabbing_) { adjust_pointer(pointer_x_, pointer_y_); } } void OL_Stepper::redraw() { thumb_->redraw(); } bool OL_Stepper::grabbing() const { return grabbing_; } void OL_Stepper::press(const Event& e) { save_pointer(e); switch(e.pointer_button()) { case Event::left: press_select(); break; case Event::middle: press_undefined(); break; case Event::right: press_undefined(); break; } } void OL_Stepper::release(const Event& e) { switch (e.pointer_button()) { case Event::left: release_select(); break; case Event::middle: release_undefined(); break; case Event::right: release_undefined(); break; } // discard multiple clicks Event queued(e); while (queued.pending()) { queued.read(); } } void OL_Stepper::tick(long, long) { if (forward_) { if (!at_end()) { step_forward(); } if (!at_end()) { next_step(); } } else if (backward_) { if (!at_start()) { step_backward(); } if (!at_start()) { next_step(); } } } void OL_Stepper::allot_major_axis( const Allotment& a, Coord length, Coord gap, Allotment& result ) const { Coord position = thumb_position(a, length, gap); result.span(length); result.origin(position); result.alignment(0.5); } float OL_Stepper::percent_visible() const { Adjustable& s = *adjustable_; DimensionName d = dimension_; float cur_upper = s.cur_upper(d); float cur_lower = s.cur_lower(d); return (cur_upper - cur_lower) / (s.upper(d) - s.lower(d)); } Coord OL_Stepper::thumb_position( const Allotment& a, Coord thumb_length, Coord gap ) const { const Adjustable& s = *adjustable_; DimensionName d = dimension_; float normalized_position; float cur_upper = s.cur_upper(d); float upper = s.upper(d); float cur_lower = s.cur_lower(d); float lower = s.lower(d); if (cur_upper == upper) { normalized_position = 1.0; } else if (cur_lower == lower) { normalized_position = 0.0; } else { float visible_position = (cur_upper + cur_lower) * 0.5; float half_visible_length = s.cur_length(d) * 0.5; float visible_min = s.lower(d) + half_visible_length; float visible_max = s.upper(d) - half_visible_length; normalized_position = (visible_position - visible_min) / (visible_max - visible_min); } Coord half_thumb = thumb_length * 0.5; Coord scrollable_min = a.begin() + gap + half_thumb; Coord scrollable_max = a.end() - gap - half_thumb; Coord scrollable = scrollable_max - scrollable_min; return scrollable_min + scrollable * normalized_position; } void OL_Stepper::allot_minor_axis( const Allotment& a, Coord width, Allotment& result ) const { result.origin((a.begin() + a.end()) * 0.5); result.span(width); result.alignment(0.5); } void OL_Stepper::move_pointer(Coord x, Coord y) const { Window* w = canvas_->window(); Coord l = w->left(); Coord b = w->bottom(); Session::instance()->default_display()->move_pointer(l + x, b + y); OL_Stepper& self = *(OL_Stepper*)this; self.pointer_x_ = x; self.pointer_y_ = y; } void OL_Stepper::save_pointer(const Event& e) { pointer_x_ = e.pointer_x(); pointer_y_ = e.pointer_y(); forward_ = is_forward(pointer_x_, pointer_y_); backward_ = is_backward(pointer_x_, pointer_y_); } void OL_Stepper::press_select() { grabbing_ = true; if (forward_) { step_forward(); start_stepping(); } else if (backward_) { step_backward(); start_stepping(); } } void OL_Stepper::release_select() { grabbing_ = false; stop_stepping(); } void OL_Stepper::press_undefined() { Window* window = canvas_->window(); saved_cursor_ = window->cursor(); window->cursor(question_mark_cursor); } void OL_Stepper::release_undefined() { canvas_->window()->cursor(saved_cursor_); } bool OL_Stepper::at_start() const { Adjustable& a = *adjustable_; DimensionName d = dimension_; return a.cur_lower(d) == a.lower(d); } bool OL_Stepper::at_end() const { Adjustable& a = *adjustable_; DimensionName d = dimension_; return a.cur_upper(d) == a.upper(d); } void OL_Stepper::start_stepping() { if (initial_delay_ > 10) { Dispatcher::instance().startTimer(0, long(initial_delay_), timer_); } } void OL_Stepper::next_step() { Dispatcher::instance().startTimer(0, long(interval_), timer_); } void OL_Stepper::stop_stepping() { Dispatcher::instance().stopTimer(timer_); } OL_Tick::OL_Tick(const OLKit* k, const OL_Specs* s, DimensionName d) : kit_(k), specs_(s), dimension_(d) {} void OL_Tick::request(Requisition& r) const { Requirement width(2.0); // using Table B-40 may cause uneven widths Requirement length(specs_->tick_length()); if (dimension_ == Dimension_X) { r.require_x(width); r.require_y(length); } else { r.require_x(length); r.require_y(width); } } void OL_Tick::allocate(Canvas* c, const Allocation& a, Extension& e) { e.set(c, a); } void OL_Tick::draw(Canvas* c, const Allocation& a) const { Coord l = a.left(), b = a.bottom(), r = a.right(), t = a.top(); Coord hcenter = (l + r) * 0.5, vcenter = (t + b) * 0.5; const Color* white = kit_->white(), *bg3 = kit_->bg3(); if (dimension_ == Dimension_X) { c->fill_rect(l, t - 1.0, r, t, white); c->fill_rect(l, b, hcenter, t, white); c->fill_rect(hcenter, b, r, t - 1.0, bg3); c->fill_rect(l, b, r, b + 1.0, bg3); } else { c->fill_rect(l, vcenter, r, t, white); c->fill_rect(l, b, l + 1.0, t, white); c->fill_rect(l + 1.0, b, r, vcenter, bg3); c->fill_rect(r - 1.0, b, r, t, bg3); } } OL_ToLimit::OL_ToLimit( Adjustable* a, DimensionName dimension, OL_Direction direction ) : Action(), adjustable_(a), dimension_(dimension), direction_(direction) { if (dimension == Dimension_Y) { // Y coords are from bottom to up. if (direction == start) { direction_ = end; } else { direction_ = start; } } } void OL_ToLimit::execute() { Coord limit; if (direction_ == start) { limit = 0.0; } else { limit = adjustable_->length(dimension_); } adjustable_->scroll_to(dimension_, limit); } OL_Cable::OL_Cable( const OL_Specs* specs, Adjustable* a, DimensionName d, OL_Indicator* i ) : OL_Stepper(specs, a, d, new Patch(i)), indicator_(i), gray_(new Color(0.0, 0.0, 0.0, 0.5)) { Resource::ref(gray_); } OL_Cable::~OL_Cable() { Resource::unref(gray_); } void OL_Cable::draw(Canvas* c, const Allocation& a) const { DimensionName d = (dimension_ == Dimension_X)? Dimension_Y: Dimension_X; const Allotment& allot = a.allotment(d); Coord center = (allot.begin() + allot.end()) * 0.5; Coord cable_width = specs_->cable_width(); Coord g = specs_->cable_gap(); if (dimension_ == Dimension_X) { Coord b = center - cable_width * 0.5; c->fill_rect(a.left() + g, b, a.right() - g, b + cable_width, gray_); } else { Coord l = center - cable_width * 0.5; c->fill_rect(l, a.bottom() + g, l + cable_width, a.top() - g, gray_); } OL_Stepper::draw(c, a); } Requirement OL_Cable::requirement_x() const { Requirement result; if (dimension_ == Dimension_X) { result = Requirement(specs_->shaft_length(), fil, 0, 0.0); } else { result = Requirement (specs_->elevator_width(), fil, 0, 0.5); } return result; } Requirement OL_Cable::requirement_y() const { Requirement result; if (dimension_ == Dimension_X) { result = Requirement(specs_->elevator_width(), fil, 0, 0.5); } else { result = Requirement(specs_->shaft_length(), fil, 0, 0.0); } return result; } void OL_Cable::allocate_thumb(const Allocation& a, Allocation& result) { const OL_Specs& s = *specs_; DimensionName d = dimension_; const Allotment& allotment = a.allotment(d); Coord gap = s.elevator_to_anchor_gap() + s.cable_gap(); Coord length = percent_visible() * (allotment.span() - gap - gap); allot_major_axis(allotment, length, gap, result.allotment(d)); DimensionName minor_d = (d == Dimension_X) ? Dimension_Y : Dimension_X; allot_minor_axis( a.allotment(minor_d), s.cable_width(), result.allotment(minor_d) ); } void OL_Cable::adjust_pointer(Coord x, Coord y) const { Coord space = specs_->elevator_length() * 0.5; Coord elevator, p, begin, end; if (dimension_ == Dimension_X) { p = x; begin = allocation_.left(); end = allocation_.right(); } else { p = y; begin = allocation_.bottom(); end = allocation_.top(); } if (forward_) { elevator = elevator_max(); if (p <= elevator + space) { p = elevator + space; if (p >= end) { p = end - 1; } } } else if (backward_) { elevator = elevator_min(); if (p >= elevator - space) { p = elevator - space; if (p <= begin) { p = begin + 1; } } } if (dimension_ == Dimension_X) { move_pointer(p, y); } else { move_pointer(x, p); } } Coord OL_Cable::elevator_min() const { Coord l = specs_->elevator_length(); Coord g = specs_->elevator_to_anchor_gap(); const Allotment& a = allocation_.allotment(dimension_); return thumb_position(a, l, g) - l * 0.5; } Coord OL_Cable::elevator_max() const { Coord l = specs_->elevator_length(); Coord g = specs_->elevator_to_anchor_gap(); const Allotment& a = allocation_.allotment(dimension_); return thumb_position(a, l, g) + l * 0.5; } bool OL_Cable::is_forward(Coord x, Coord y) const { if (dimension_ == Dimension_X) { return elevator_max() < x; } else { return elevator_max() < y; } } bool OL_Cable::is_backward(Coord x, Coord y) const { if (dimension_ == Dimension_X) { return x < elevator_min(); } else { return y < elevator_min(); } } void OL_Cable::step_forward() { adjustable_->page_forward(dimension_); } void OL_Cable::step_backward() { adjustable_->page_backward(dimension_); } OL_Channel::OL_Channel( const OLKit* k, const OL_Specs* s, Adjustable* a, DimensionName d, OL_Dragbox* b ) : OL_Stepper(s, a, d, new Patch(b)), kit_(k) {} void OL_Channel::draw(Canvas* c, const Allocation& a) const { bool horizontal = dimension_ == Dimension_X; long ul, ll, ur, lr, lfill, rfill; if (horizontal) { ul = HORIZ_SLIDER_UL; ll = HORIZ_SLIDER_LL; ur = HORIZ_SLIDER_UR; lr = HORIZ_SLIDER_LR; lfill = HORIZ_SLIDER_LEFT_ENDCAP_FILL; rfill = HORIZ_SLIDER_RIGHT_ENDCAP_FILL; } else { ul = VERT_SLIDER_LL; ll = VERT_SLIDER_LR; ur = VERT_SLIDER_UL; lr = VERT_SLIDER_UR; lfill = VERT_SLIDER_BOTTOM_ENDCAP_FILL; rfill = VERT_SLIDER_TOP_ENDCAP_FILL; } const OL_Specs& s = *specs_; const Font* f = s.font(); const OLKit& k = *kit_; const Color* black = k.black(); const Color* white = k.white(); const Color* bg2 = k.bg2(); const Color* bg3 = k.bg3(); Coord channel_width = s.channel_width(); Coord cap_width = s.channel_cap_width(); Coord gap = s.channel_gap(); Coord highlight = s.channel_highlight(); Coord rule = s.channel_rule(); Coord l = a.left(), b = a.bottom(), r = a.right(), t = a.top(); if (horizontal) { b = (b + t - channel_width) * 0.5; t = b + channel_width; } else { l = (l + r - channel_width) * 0.5; r = l + channel_width; } const Allotment& al = allocation_.allotment(dimension_); Coord v = thumb_position(al, s.dragbox_length(), 0.0); /* bottom endcap */ Coord tt = horizontal ? t : b + cap_width; if (f != nil) { c->character(f, ul, cap_width, black, l, tt); c->character(f, ll, cap_width, black, l, tt); c->character(f, lfill, cap_width, black, l, tt); } /* filled region */ if (horizontal) { l += cap_width; c->fill_rect(l, b, v, t, black); c->fill_rect(l, t - gap, v, t - gap - highlight, bg3); } else { b += cap_width; c->fill_rect(l, b, r, v, black); c->fill_rect(l + gap, b, l + gap + highlight, v, bg3); } /* top section */ Coord rr = horizontal ? r - cap_width : l; if (horizontal) { c->fill_rect(v, b, rr, t, bg2); c->fill_rect(v, t - rule, rr, t, bg3); c->fill_rect(v, b, rr, b + rule, white); } else { tt = t - cap_width; c->fill_rect(l, v, r, tt, bg2); c->fill_rect(l, v, l + rule, tt, bg3); c->fill_rect(r - rule, v, r, tt, white); } if (f != nil) { c->character(f, ur, cap_width, bg3, rr, t); c->character(f, lr, cap_width, white, rr, t); c->character(f, rfill, cap_width, bg2, rr, t); } OL_Stepper::draw(c, thumb_allocation_); } /* * min and max refer to the minimim and maximum numbers of the midpoint of * the dragbox, which corresponds to the current value of the adjustable. */ void OL_Channel::drag_to(const Event& e) { const OL_Specs& s = *specs_; Adjustable& a = *adjustable_; DimensionName d = dimension_; const Allotment& allotment = allocation_.allotment(d); Coord half_length = s.dragbox_length() * 0.5; Coord min = allotment.begin() + half_length; Coord max = allotment.end() - half_length; Coord scrollable = max - min; Coord mouse = (dimension_ == Dimension_X) ? e.pointer_x() : e.pointer_y(); Coord adjusted_position = mouse - min; float fraction = adjusted_position / scrollable; a.scroll_to(d, a.lower(d) + a.length(d) * fraction); } Requirement OL_Channel::requirement_x() const { Requirement result; if (dimension_ == Dimension_X) { result = Requirement(specs_->channel_length(), fil, 0, 0.0); } else { result = Requirement (specs_->channel_width(), fil, 0, 0.0); } return result; } Requirement OL_Channel::requirement_y() const { Requirement result; if (dimension_ == Dimension_X) { result = Requirement(specs_->channel_width(), fil, 0, 0.0); } else { result = Requirement(specs_->channel_length(), fil, 0, 0.0); } return result; } void OL_Channel::allocate_thumb(const Allocation& a, Allocation& result) { const OL_Specs& s = *specs_; DimensionName major_d = dimension_; const Allotment& major_allot = a.allotment(major_d); Coord l = s.dragbox_length(); allot_major_axis(major_allot, l, 0.0, result.allotment(major_d)); DimensionName minor_d = (major_d == Dimension_X)? Dimension_Y: Dimension_X; const Allotment& minor_allot = a.allotment(minor_d); Coord w = s.dragbox_width(); allot_minor_axis(minor_allot, w, result.allotment(minor_d)); } void OL_Channel::adjust_pointer(Coord x, Coord y) const { Coord space = specs_->dragbox_length() * 0.5; Coord thumb, p, begin, end; if (dimension_ == Dimension_X) { p = x; begin = allocation_.left(); end = allocation_.right(); } else { p = y; begin = allocation_.bottom(); end = allocation_.top(); } if (forward_) { thumb = thumb_max(); if (p <= thumb + space) { p = thumb + space; if (p >= end) { p = end - 1; } } } else if (backward_) { thumb = thumb_min(); if (p >= thumb - space) { p = thumb - space; if (p <= begin) { p = begin + 1; } } } if (dimension_ == Dimension_X) { move_pointer(p, y); } else { move_pointer(x, p); } } Coord OL_Channel::thumb_min() const { Coord l = specs_->dragbox_length(); const Allotment& a = allocation_.allotment(dimension_); return thumb_position(a, l, 0.0) - l * 0.5; } Coord OL_Channel::thumb_max() const { Coord l = specs_->dragbox_length(); const Allotment& a = allocation_.allotment(dimension_); return thumb_position(a, l, 0.0) + l * 0.5; } bool OL_Channel::is_forward(Coord x, Coord y) const { if (dimension_ == Dimension_X) { return thumb_max() < x; } else { return thumb_max() < y; } } bool OL_Channel::is_backward(Coord x, Coord y) const { if (dimension_ == Dimension_X) { return x < thumb_min(); } else { return y < thumb_min(); } } void OL_Channel::step_forward() { adjustable_->page_forward(dimension_); } void OL_Channel::step_backward() { adjustable_->page_backward(dimension_); } OL_CheckBox::OL_CheckBox( const OLKit* k, TelltaleState* t, const OL_Specs* s ) : OL_Frame(k, nil, t, s->checkbox_thickness()) { body(new OL_CheckMark(k, t, s)); } void OL_CheckBox::pick(Canvas*, const Allocation& a, int depth, Hit& h) { Coord x = h.left(), y = h.bottom(); if (a.left() <= x && x < a.right() && a.bottom() <= y && y < a.top()) { h.target(depth, this, 0); } } void OL_CheckBox::draw_background(Canvas* c, const Allocation& a) const { const Color* background; if (state_->test(TelltaleState::is_active)) { background = kit_->bg2(); } else { background = kit_->bg1(); } c->fill_rect(a.left(), a.bottom(), a.right(), a.top(), background); } OL_Dragbox::OL_Dragbox(const OLKit* k, const OL_Specs* s, DimensionName d) : Glyph(), kit_(k), specs_(s), dimension_(d), dragging_(false), canvas_(nil), extension_() {} void OL_Dragbox::request(Requisition& r) const { Requirement length(specs_->dragbox_length(), 0, 0, 0.0); Requirement width(specs_->dragbox_width(), 0, 0, 0.0); if (dimension_ == Dimension_X) { r.require_x(length); r.require_y(width); } else { r.require_x(width); r.require_y(length); } } /* * Return an extension that extends beyond the actual drawing by 1 point * to eliminate roundoff errors in redraw which may leave doodoos. */ void OL_Dragbox::allocate(Canvas* c, const Allocation& a, Extension& e) { canvas_ = c; extension_.set(c, a); e.set_xy(c, a.left() - 1, a.bottom() - 1, a.right() + 1, a.top() + 1); } void OL_Dragbox::draw(Canvas* c, const Allocation& a) const { Coord l = a.left(), b = a.bottom(), r = a.right(), t = a.top(); Coord ul, lr, box; if (dimension_ == Dimension_X) { ul = HORIZ_SLIDER_CONTROL_UL; lr = HORIZ_SLIDER_CONTROL_LR; box = HORIZ_SLIDER_CONTROL_FILL; } else { ul = VERT_SLIDER_CONTROL_UL; lr = VERT_SLIDER_CONTROL_LR; box = VERT_SLIDER_CONTROL_FILL; } const OLKit& k = *kit_; const OL_Specs& s = *specs_; Coord width = s.dragbox_width(); const Color* upper_left, *fill, *lower_right; if (dragging_) { upper_left = k.bg3(); fill = k.bg2(); lower_right = k.white(); } else { upper_left = k.white(); fill = k.bg1(); lower_right = k.bg3(); } const Font* f = s.font(); if (f != nil) { c->character(f, long(ul), width, upper_left, l, t); c->character(f, long(box), width, fill, l, t); c->character(f, long(lr), width, lower_right, l, t); } } void OL_Dragbox::undraw() { canvas_ = nil; } bool OL_Dragbox::inside(const Event& p) const { Coord x = p.pointer_x(); Coord y = p.pointer_y(); const Extension& e = extension_; return e.left() <= x && x < e.right() && e.bottom() <= y && y < e.top(); } bool OL_Dragbox::less_than(const Event& e) const { if (dimension_ == Dimension_X) { return extension_.right() < e.pointer_x(); } else { return extension_.top() < e.pointer_y(); } } bool OL_Dragbox::greater_than(const Event& e) const { if (dimension_ == Dimension_X) { return extension_.left() > e.pointer_x(); } else { return extension_.bottom() > e.pointer_y(); } } void OL_Dragbox::press(const Event&e) { if (e.pointer_button() == Event::left) { dragging_ = true; } } void OL_Dragbox::release(const Event& e) { if (e.pointer_button() == Event::left) { dragging_ = false; if (canvas_ != nil) { canvas_->damage(extension_); } } } OL_Elevator::OL_Elevator( const OL_Specs* specs, Adjustable* a, DimensionName d, OL_ElevatorGlyph* g ) : OL_Stepper(specs, a, d, new Patch(g)), glyph_(g), dragging_(false) { } /* * Since draw might be initiated by Slider::update, we dim the * OL_ElevatorGlyph if the position of the Adjustable has reached an * end or undim it if otherwise. */ void OL_Elevator::draw(Canvas* c, const Allocation& a) const { OL_Elevator& self = *(OL_Elevator*)this; self.adjust_for_dimming(); OL_Stepper::draw(c, a); } bool OL_Elevator::inside(const Event& e) const { return glyph_->inside(e); } bool OL_Elevator::less_than(const Event& e) const { return glyph_->less_than(e); } bool OL_Elevator::greater_than(const Event& e) const { return glyph_->greater_than(e); } void OL_Elevator::press(const Event& e) { OL_Stepper::press(e); if (!forward_ && !backward_) { dragging_ = true; glyph_->flip_to(dragging); } } void OL_Elevator::drag(const Event& e) { if (dragging_) { if (!(at_start() && at_end())) { drag_to(e); } } } Requirement OL_Elevator::requirement_x() const { Requirement result; if (dimension_ == Dimension_X) { result = Requirement(specs_->shaft_length(), fil, 0, 0.0); } else { result = Requirement(specs_->elevator_width(), fil, 0, 0.5); } return result; } Requirement OL_Elevator::requirement_y() const { Requirement result; if (dimension_ == Dimension_X) { result = Requirement(specs_->elevator_width(), fil, 0, 0.5); } else { result = Requirement(specs_->shaft_length(), fil, 0, 0.0); } return result; } void OL_Elevator::allocate_thumb(const Allocation& a, Allocation& result) { const OL_Specs& s = *specs_; DimensionName major_d = dimension_; const Allotment& major_allot = a.allotment(major_d); Coord l = s.elevator_length(); Coord g = s.elevator_to_anchor_gap(); allot_major_axis(major_allot, l, g, result.allotment(major_d)); DimensionName minor_d = (major_d == Dimension_X)? Dimension_Y: Dimension_X; const Allotment& minor_allot = a.allotment(minor_d); Coord w = s.elevator_width(); allot_minor_axis(minor_allot, w, result.allotment(minor_d)); } void OL_Elevator::adjust_pointer(Coord x, Coord y) const { if (!dragging_) { if (dimension_ == Dimension_X) { if (forward_) { x = glyph_->forward_arrow_center(); } else if (backward_) { x = glyph_->backward_arrow_center(); } } else { if (forward_) { y = glyph_->forward_arrow_center(); } else if (backward_) { y = glyph_->backward_arrow_center(); } } move_pointer(x, y); } } bool OL_Elevator::is_forward(Coord x, Coord y) const { return glyph_->forward_arrow_contains(x, y); } bool OL_Elevator::is_backward(Coord x, Coord y) const { return glyph_->backward_arrow_contains(x, y); } void OL_Elevator::step_backward() { dragging_ = false; glyph_->flip_to(backward_arrow_highlighted); adjustable_->scroll_backward(dimension_); } void OL_Elevator::step_forward() { dragging_ = false; glyph_->flip_to(forward_arrow_highlighted); adjustable_->scroll_forward(dimension_); } /* * min and max refer to the minimim and maximum numbers the midpoint of * the elevator, which corresponds to the current value of the adjustable. */ void OL_Elevator::drag_to(const Event& e) { const OL_Specs& s = *specs_; Adjustable& a = *adjustable_; DimensionName d = dimension_; const Allotment& allotment = allocation_.allotment(d); Coord gap = s.elevator_to_anchor_gap(); Coord elevator_half_length = s.elevator_length() * 0.5; Coord min = allotment.begin() + gap + elevator_half_length; Coord max = allotment.end() - gap - elevator_half_length; Coord scrollable = max - min; Coord mouse = (dimension_ == Dimension_X) ? e.pointer_x() : e.pointer_y(); Coord adjusted_position = mouse - min; float fraction = adjusted_position / scrollable; a.scroll_to(d, a.lower(d) + a.length(d) * fraction); } void OL_Elevator::release_select() { OL_Stepper::release_select(); glyph_->flip_to(ivnormal); dragging_ = false; } void OL_Elevator::adjust_for_dimming() { if (!dragging_) { if (at_start() && at_end()) { glyph_->flip_to(both_arrows_dimmed); } else if (at_start()) { glyph_->flip_to(backward_arrow_dimmed); } else if (at_end()) { glyph_->flip_to(forward_arrow_dimmed); } else { GlyphIndex i = glyph_->index(); if (i == both_arrows_dimmed || i == backward_arrow_dimmed || i == forward_arrow_dimmed ) { glyph_->flip_to(ivnormal); } } } } OLKit::OLKit() { impl_ = new OLKitImpl(this); Style* s = Session::instance()->style(); for (PropertyData* p = kit_props; p->path != nil; p++) { s->attribute(p->path, p->value, -10); } } OLKit::~OLKit() { delete impl_; } const char* OLKit::gui() const { return "OpenLook"; } MonoGlyph* OLKit::outset_frame(Glyph* g) const { TelltaleState* state = new TelltaleState(TelltaleState::is_enabled); return new OL_Frame(this, g, state, impl_->frame_thickness()); } MonoGlyph* OLKit::inset_frame(Glyph* g) const { TelltaleState* state = new TelltaleState(TelltaleState::is_enabled_active); return new OL_Frame(this, g, state, impl_->frame_thickness()); } MonoGlyph* OLKit::bright_inset_frame(Glyph* g) const { return inset_frame(g); // for now } /* * OL pulldown menus align in the center horizontally */ Menu* OLKit::menubar() const { WidgetKit* k = (WidgetKit*)this; k->begin_style("MenuBar", "Menu"); Menu* m = new Menu(menubar_look(), style(), 0.5, -0.05, 0.5, 1.0); k->end_style(); return m; } Glyph* OLKit::menubar_look() const { const LayoutKit& l = *impl_->layout_; return l.r_margin(l.hbox(), 0.0, fil, 0.0); } Glyph* OLKit::pulldown_look() const { const LayoutKit& l = *impl_->layout_; const OL_Specs& s = *impl_->specs_; Coord hmargin = s.menu_hmargin(); Coord bottom = s.menu_bmargin(); Coord top = s.menu_tmargin(); return outset_frame(l.margin(l.vbox(), hmargin, hmargin, bottom, top)); } /* * Simple alignment first. * * An OL pullright menu should be aligned so that its default item aligns * vertically with the control that pops it up (not implemented). */ Glyph* OLKit::pullright_look() const { return pulldown_look(); } Glyph* OLKit::menubar_item_look(Glyph* g, TelltaleState* state) const { const OLKitImpl& i = *impl_; const LayoutKit& l = *i.layout_; const OL_Specs* s = i.specs_; Glyph* hspace = l.hspace(s->menu_mark_gap()); Glyph* menu_mark = new OL_MenuMark(this, s, true); Glyph* inner = l.hbox(l.vcenter(g), hspace, l.vcenter(menu_mark)); Coord hm = s->menu_hmargin() * 0.5; return l.hmargin( new OL_Button(this, s, inner, state, OL_Button::PushButton, false), hm ); } Glyph* OLKit::menu_item_look(Glyph* g, TelltaleState* t) const { OLKitImpl& i = *impl_; const OL_Specs* s = i.specs_; return new OL_Button(this, s, g, t, OL_Button::MenuButton); } Glyph* OLKit::check_menu_item_look(Glyph* g, TelltaleState* t) const { OLKitImpl& i = *impl_; Coord height = i.specs_->menu_button_height(); const LayoutKit& l = *i.layout_; return l.vnatural(check_box_look(g, t), height); } Glyph* OLKit::radio_menu_item_look(Glyph* g, TelltaleState* t) const { return radio_button_look(g, t); } Glyph* OLKit::menu_item_separator_look() const { return impl_->layout_->vspace(4.0); // for now } Glyph* OLKit::push_button_look(Glyph* g, TelltaleState* t) const { return new OL_Button(this, impl_->specs_, g, t, OL_Button::PushButton); } Glyph* OLKit::default_button_look(Glyph* g, TelltaleState* t) const { return new OL_Button(this, impl_->specs_, g, t, OL_Button::DefaultButton); } Glyph* OLKit::check_box_look(Glyph* g, TelltaleState* t) const { OLKitImpl& i = *impl_; const LayoutKit& l = *i.layout_; const OL_Specs* s = i.specs_; return l.hbox( l.vcenter(new OL_CheckBox(this, t, s)), l.hspace(6.0), l.vcenter(g) ); } Glyph* OLKit::palette_button_look(Glyph* g, TelltaleState* t) const { return new OL_Setting(this, g, t, impl_->specs_); } Glyph* OLKit::radio_button_look(Glyph* g, TelltaleState* t) const { return new OL_Setting(this, g, t, impl_->specs_); } Glyph* OLKit::slider_look(DimensionName d, Adjustable* a) const { const OLKitImpl& i = *impl_; const OL_Specs* s = i.specs_; OL_Dragbox* b = new OL_Dragbox(this, s, d); OL_Channel* c = new OL_Channel(this, s, a, d, b); return new OL_Slider(s, a, i.style_, d, c, b); } Glyph* OLKit::scroll_bar_look(DimensionName d, Adjustable* a) const { OLKitImpl& i = *impl_; LayoutKit& l = *LayoutKit::instance(); Coord shaft_gap = i.specs_->shaft_gap(); Glyph* anchor1 = i.cable_anchor(a, OL_ToLimit::start, d); Glyph* anchor2 = i.cable_anchor(a, OL_ToLimit::end, d); Glyph* scrollbar = i.scrollbar(a, d); Glyph* result; if (d == Dimension_X) { Glyph* vspace = l.vspace(shaft_gap); result = l.vbox(vspace, l.hbox(anchor1, scrollbar, anchor2), vspace); } else { Glyph* hspace = l.hspace(shaft_gap); result = l.hbox(hspace, l.vbox(anchor1, scrollbar, anchor2), hspace); } return result; } /* unimplmented */ Glyph* OLKit::panner_look(Adjustable*, Adjustable*) const { return nil; } Glyph* OLKit::enlarger_look(TelltaleState*) const { return nil; } Glyph* OLKit::reducer_look(TelltaleState*) const { return nil; } Glyph* OLKit::up_mover_look(TelltaleState* s) const { return new OL_Mover(this, impl_->specs_, OL_Mover::up, s); } Glyph* OLKit::down_mover_look(TelltaleState* s) const { return new OL_Mover(this, impl_->specs_, OL_Mover::down, s); } Glyph* OLKit::left_mover_look(TelltaleState* s) const { return new OL_Mover(this, impl_->specs_, OL_Mover::left, s); } Glyph* OLKit::right_mover_look(TelltaleState* s) const { return new OL_Mover(this, impl_->specs_, OL_Mover::right, s); } const Color* OLKit::white() const { return impl_->white_; } const Color* OLKit::bg1() const { return impl_->bg1_; } const Color* OLKit::bg2() const { return impl_->bg2_; } const Color* OLKit::bg3() const { return impl_->bg3_; } const Color* OLKit::black() const { return impl_->black_; } const Color* OLKit::inactive() const { return impl_->inactive_; } const Color* OLKit::busy() const { return impl_->busy_; } Button* OLKit::pushpin(const Window* unpinned, Window* pinned) const { const OLKitImpl& i = *impl_; TelltaleState* state = new TelltaleState( TelltaleState::is_enabled | TelltaleState::is_toggle | TelltaleState::is_choosable ); Glyph* pushpin = new OL_PushpinLook(this, i.specs_, state); Action* action = new OL_Pushpin(state, unpinned, pinned); return new Button(pushpin, i.style_, state, action); } void OLKit::pinnable(Menu* menu, const Window* unpinned) const { const OLKitImpl& i = *impl_; const LayoutKit& l = *i.layout_; const OL_Specs& s = *i.specs_; Button* pin = pushpin(unpinned, new TransientWindow(menu)); Coord h = s.menu_pushpin_height(); Glyph* item = l.vbox(l.vnatural(pin, h), l.vspace(s.menu_pushpin_gap())); menu->insert_item(0, new MenuItem(item, pin->state(), pin->action())); } MenuItem* OLKit::habbrev_menu_button() const{ TelltaleState* state = new TelltaleState(TelltaleState::is_enabled); WidgetKit* k = (WidgetKit*)this; k->begin_style("MenuItem"); MenuItem* m = new MenuItem( new OL_AbbrevMenuButton(this, impl_->specs_, Dimension_X, state), state ); k->end_style(); return m; } MenuItem* OLKit::vabbrev_menu_button() const{ TelltaleState* state = new TelltaleState(TelltaleState::is_enabled); WidgetKit* k = (WidgetKit*)this; k->begin_style("MenuItem"); MenuItem* m = new MenuItem( new OL_AbbrevMenuButton(this, impl_->specs_, Dimension_Y, state), state ); k->end_style(); return m; } Glyph* OLKit::hgauge(Adjustable* a) const { Patch* patch = new Patch(nil); patch->body(new OL_Gauge(this, impl_->specs_, Dimension_X, a, patch)); return patch; } Glyph* OLKit::vgauge(Adjustable* a) const { Patch* patch = new Patch(nil); patch->body(new OL_Gauge(this, impl_->specs_, Dimension_Y, a, patch)); return patch; } Glyph* OLKit::htick() const { return new OL_Tick(this, impl_->specs_, Dimension_X); } Glyph* OLKit::vtick() const { return new OL_Tick(this, impl_->specs_, Dimension_Y); } Glyph* OLKit::top_end_box(Adjustable* a) const { return impl_->cable_anchor(a, OL_ToLimit::start, Dimension_Y); } Glyph* OLKit::bottom_end_box(Adjustable* a) const { return impl_->cable_anchor(a, OL_ToLimit::end, Dimension_Y); } Glyph* OLKit::left_end_box(Adjustable* a) const { return impl_->cable_anchor(a, OL_ToLimit::start, Dimension_X); } Glyph* OLKit::right_end_box(Adjustable* a) const { return impl_->cable_anchor(a, OL_ToLimit::end, Dimension_X); } OLKitImpl::OLKitImpl(OLKit* kit) : kit_(kit), layout_(LayoutKit::instance()), style_(kit->style()), specs_(new OL_Specs(style_)), frame_thickness_(2.0) { Display* d = Session::instance()->default_display(); white_ = color(d, "white", "White", 1.0, 1.0, 1.0, 1.0); black_ = color(d, "black", "Black", 0.0, 0.0, 0.0, 1.0); String v; const Color* c = nil; if (style_->find_attribute("flat", v)) { c = Color::lookup(d, v); } if (c == nil) { c = color(d, "#aaaaaa", "#aaaaaa", 0.7, 0.7, 0.7, 1.0); } bg1_ = c; bg2_ = bg1_->brightness(-0.125); bg3_ = bg1_->brightness(-0.5); inactive_ = new Color(*bg1_, 0.5); busy_ = new Color(*black_, 0.15); Resource::ref(white_); Resource::ref(black_); Resource::ref(bg1_); Resource::ref(bg2_); Resource::ref(bg3_); Resource::ref(inactive_); Resource::ref(busy_); init_ol_cursors(); } OLKitImpl::~OLKitImpl() { Resource::unref(white_); Resource::unref(black_); Resource::unref(bg1_); Resource::unref(bg2_); Resource::unref(bg3_); Resource::unref(inactive_); Resource::unref(busy_); } Glyph* OLKitImpl::cable_anchor( Adjustable* a, OL_Direction direction, DimensionName dimension ) const { TelltaleState* state = new TelltaleState(TelltaleState::is_enabled); const OL_Specs& s = *specs_; Coord w, h; if (dimension == Dimension_X) { w = s.anchor_height(); h = s.anchor_width(); } else { w = s.anchor_width(); h = s.anchor_height(); } OL_Anchor* anchor = new OL_Anchor(kit_, w, h, s.anchor_rule(), state); Action* action = new OL_ToLimit(a, dimension, direction); return new Button(anchor, style_, state, action); } Glyph* OLKitImpl::scrollbar(Adjustable* a, DimensionName d) const { const OL_Specs* s = specs_; const OLKit* k = kit_; OL_Cable* c = new OL_Cable(s, a, d, new OL_Indicator(k, s, d)); OL_Elevator* e = new OL_Elevator(s, a, d, new OL_ElevatorGlyph(k, s, d)); return new OL_Scrollbar(s, a, style_, d, c, e); } Coord OLKitImpl::frame_thickness() const { return frame_thickness_; } const Color* OLKitImpl::color( Display* d, const char* name, const char* alias, ColorIntensity r, ColorIntensity g, ColorIntensity b, float alpha ) { const Color* c = Color::lookup(d, name); if (c == nil) { c = Color::lookup(d, alias); if (c == nil) { c = new Color(r, g, b, alpha); } } return c; } neuron-7.6.3/src/lib/InterViews/page.cpp000066400000000000000000000230341340731477100201220ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Page - arbitrary placements */ #include #include #include #include #include static const int PageInfoAllocated = 0x01; static const int PageInfoExtended = 0x02; // static const int PageInfoPositioned = 0x04; static const int PageInfoHidden = 0x08; class PageInfo { public: PageInfo(); Glyph* glyph_; Allocation allocation_; Extension extension_; Coord x_; Coord y_; int status_; }; PageInfo::PageInfo() { glyph_ = nil; x_ = 0; y_ = 0; status_ = 0; } declareList(PageInfo_List,PageInfo) implementList(PageInfo_List,PageInfo) static const float epsilon = 0.1; Page::Page(Glyph* bg) : Glyph() { Resource::ref(bg); background_ = bg; canvas_ = nil; info_ = new PageInfo_List(); } Page::~Page() { GlyphIndex count = info_->count(); for (GlyphIndex i = 0; i < count; ++i) { PageInfo& info = info_->item_ref(i); Resource::unref(info.glyph_); } delete info_; info_ = nil; Resource::unref(background_); canvas_ = nil; } Coord Page::left() const { return allocation_.left(); } Coord Page::right() const { return allocation_.right(); } Coord Page::bottom() const { return allocation_.bottom(); } Coord Page::top() const { return allocation_.top(); } Coord Page::x() const { return allocation_.x(); } Coord Page::y() const { return allocation_.y(); } void Page::show(GlyphIndex index, bool showing) { PageInfo& info = info_->item_ref(index); if (((info.status_ & PageInfoHidden) == 0) != showing) { if (canvas_ != nil) { canvas_->damage(info.extension_); } if (showing) { info.status_ &= ~PageInfoHidden; } else { info.status_ |= PageInfoHidden; } } } bool Page::showing(GlyphIndex index) const { return (info_->item_ref(index).status_ & PageInfoHidden) == 0; } void Page::move(GlyphIndex index, Coord x, Coord y) { PageInfo& info = info_->item_ref(index); if ( (info.status_ & PageInfoAllocated) && (info.x_ != x || info.y_ != y) ) { Extension& b = info.extension_; Allocation& a = info.allocation_; Allotment& ax = a.allotment(Dimension_X); Allotment& ay = a.allotment(Dimension_Y); Coord newx = allocation_.x() + x; Coord newy = allocation_.y() + y; Allotment n_ax(newx, ax.span(), ax.alignment()); Allotment n_ay(newy, ay.span(), ay.alignment()); a.allot(Dimension_X, n_ax); a.allot(Dimension_Y, n_ay); if (canvas_ != nil) { canvas_->damage(b); } b.clear(); info.glyph_->allocate(canvas_, a, b); if (canvas_ != nil) { canvas_->damage(b); } } info.x_ = x; info.y_ = y; } void Page::location(GlyphIndex index, Coord& x, Coord& y) { PageInfo& info = info_->item_ref(index); x = info.x_; y = info.y_; } GlyphIndex Page::count() const { return info_->count(); } Glyph* Page::component(GlyphIndex index) const { return info_->item_ref(index).glyph_; } void Page::allotment(GlyphIndex index, DimensionName res, Allotment& a) const { a = info_->item_ref(index).allocation_.allotment(res); } void Page::change(GlyphIndex index) { PageInfo& info = info_->item_ref(index); info.status_ &= ~(PageInfoAllocated); } void Page::append(Glyph* glyph) { PageInfo info; info.glyph_ = glyph; info.status_ = 0; info.x_ = 0; info.y_ = 0; info_->append(info); Resource::ref(glyph); } void Page::prepend(Glyph* glyph) { PageInfo info; info.glyph_ = glyph; info.status_ = 0; info.x_ = 0; info.y_ = 0; info_->prepend(info); Resource::ref(glyph); } void Page::insert(GlyphIndex index, Glyph* glyph) { PageInfo info; info.glyph_ = glyph; info.status_ = 0; info.x_ = 0; info.y_ = 0; info_->insert(index, info); Resource::ref(glyph); } void Page::remove(GlyphIndex index) { PageInfo& info = info_->item_ref(index); if (canvas_ != nil && (info.status_ & PageInfoAllocated)) { canvas_->damage(info.extension_); } Resource::unref(info.glyph_); info_->remove(index); } void Page::replace(GlyphIndex index, Glyph* glyph) { PageInfo& info = info_->item_ref(index); if (canvas_ != nil && (info.status_ & PageInfoAllocated)) { canvas_->damage(info.extension_); } Resource::ref(glyph); Resource::unref(info.glyph_); info.glyph_ = glyph; info.status_ &= ~(PageInfoAllocated); } void Page::request(Requisition& requisition) const { if (background_ != nil) { background_->request(requisition); } } void Page::allocate(Canvas* c, const Allocation& allocation, Extension& ext) { canvas_ = c; allocation_ = allocation; if (background_ != nil) { background_->allocate(c, allocation, ext); } GlyphIndex count = info_->count(); for (GlyphIndex index = 0; index < count; ++index) { PageInfo& info = info_->item_ref(index); if (info.glyph_ != nil) { Allocation& a = info.allocation_; Extension& b = info.extension_; Requisition s; info.glyph_->request(s); Allotment ax = Allotment( allocation.x() + info.x_, s.requirement(Dimension_X).natural(), s.requirement(Dimension_X).alignment() ); Allotment ay = Allotment( allocation.y() + info.y_, s.requirement(Dimension_Y).natural(), s.requirement(Dimension_Y).alignment() ); if ( !(info.status_ & PageInfoAllocated) || !ax.equals(a.allotment(Dimension_X), epsilon) || !ay.equals(a.allotment(Dimension_Y), epsilon) ) { if (c != nil && (info.status_ & PageInfoExtended)) { c->damage(b); } a.allot(Dimension_X, ax); a.allot(Dimension_Y, ay); b.clear(); info.glyph_->allocate(c, a, b); if (c != nil) { c->damage(b); } } info.status_ |= PageInfoAllocated|PageInfoExtended; ext.merge(b); } } } void Page::draw(Canvas* canvas, const Allocation& a) const { if (background_ != nil) { background_->draw(canvas, a); } GlyphIndex count = info_->count(); for (GlyphIndex index = 0; index < count; ++index) { PageInfo& info = info_->item_ref(index); if (info.glyph_ != nil && !(info.status_ & PageInfoHidden)) { Allocation& a = info.allocation_; Extension& b = info.extension_; if (canvas->damaged(b)) { info.glyph_->draw(canvas, a); } } } } void Page::print(Printer* p, const Allocation& a) const { if (background_ != nil) { background_->print(p, a); } GlyphIndex count = info_->count(); for (GlyphIndex index = 0; index < count; ++index) { PageInfo& info = info_->item_ref(index); if (info.glyph_ != nil && !(info.status_ & PageInfoHidden)) { Allocation& a = info.allocation_; Extension& b = info.extension_; if (p->damaged(b)) { info.glyph_->print(p, a); } } } } void Page::undraw() { if (background_ != nil) { background_->undraw(); } GlyphIndex count = info_->count(); for (GlyphIndex i = 0; i < count; i++) { const PageInfo& info = info_->item_ref(i); Glyph* g = info.glyph_; if (g != nil) { g->undraw(); } } canvas_ = nil; } void Page::pick(Canvas* c, const Allocation& a, int depth, Hit& h) { if (background_ != nil) { background_->pick(c, a, depth, h); } GlyphIndex count = info_->count(); for (GlyphIndex index = 0; index < count; ++index) { PageInfo& info = info_->item_ref(index); if (info.glyph_ != nil && !(info.status_ & PageInfoHidden)) { Allocation& a = info.allocation_; if (h.right() >= a.left() && h.left() < a.right() && h.top() >= a.bottom() && h.bottom() < a.top() ) { h.begin(depth, this, index); info.glyph_->pick(c, a, depth + 1, h); h.end(); } } } } neuron-7.6.3/src/lib/InterViews/patch.cpp000077500000000000000000000046611340731477100203150ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Patch - for repairing glyphs */ #include #include Patch::Patch(Glyph* body) : MonoGlyph(body) { canvas_ = nil; } Patch::~Patch() { } void Patch::redraw() const { Canvas* c = canvas_; if (c != nil) { c->damage(extension_); } } void Patch::reallocate() { Canvas* c = canvas_; if (c != nil) { /* remove these two lines when doc otherwise works */ Requisition s; request(s); c->push_transform(); c->transformer(transformer_); extension_.clear(); allocate(c, allocation_, extension_); c->pop_transform(); } } void Patch::repick(int depth, Hit& h) { Canvas* c = canvas_; if (c != nil) { c->push_transform(); c->transformer(transformer_); pick(c, allocation_, depth, h); c->pop_transform(); } } void Patch::allocate(Canvas* c, const Allocation& a, Extension& ext) { canvas_ = c; transformer_ = c->transformer(); allocation_ = a; MonoGlyph::allocate(c, a, ext); extension_ = ext; } void Patch::draw(Canvas* c, const Allocation& a) const { if (c->damaged(extension_)) { MonoGlyph::draw(c, a); } } void Patch::undraw() { MonoGlyph::undraw(); canvas_ = nil; } neuron-7.6.3/src/lib/InterViews/place.cpp000077500000000000000000000200071340731477100202720ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Placement - monoglyph with layout */ #include #include #include #include Placement::Placement(Glyph* body, Layout* layout) : MonoGlyph(body) { layout_ = layout; } Placement::~Placement() { delete layout_; } void Placement::request(Requisition& requisition) const { Glyph* g = body(); if (g != nil) { g->request(requisition); } layout_->request(0, nil, requisition); } static void place( Glyph* g, const Allocation& given, Layout* layout, Allocation& result ) { Requisition r; g->request(r); layout->allocate(given, 1, &r, &result); } void Placement::allocate(Canvas* c, const Allocation& a, Extension& ext) { Glyph* g = body(); if (g != nil) { Allocation b(a); place(g, a, layout_, b); g->allocate(c, b, ext); } } void Placement::draw(Canvas* c, const Allocation& a) const { Glyph* g = body(); if (g != nil) { Allocation b(a); place(g, a, layout_, b); g->draw(c, b); } } void Placement::print(Printer* p, const Allocation& a) const { Glyph* g = body(); if (g != nil) { Allocation b(a); place(g, a, layout_, b); g->print(p, b); } } void Placement::pick(Canvas* c, const Allocation& a, int depth, Hit& h) { Glyph* g = body(); if (g != nil) { Allocation b(a); place(g, a, layout_, b); g->pick(c, b, depth, h); } } CenterLayout::CenterLayout(const DimensionName d, float alignment) { dimension_ = d; alignment_ = alignment; } CenterLayout::~CenterLayout() { } void CenterLayout::request( GlyphIndex, const Requisition*, Requisition& result ) { Requirement& r = result.requirement(dimension_); r.alignment(alignment_); } void CenterLayout::allocate( const Allocation&, GlyphIndex, const Requisition* r, Allocation* result ) { Allotment& a = result[0].allotment(dimension_); float calign = r[0].requirement(dimension_).alignment(); a.offset(Coord(float(a.span()) * (calign - a.alignment()))); a.alignment(calign); } FixedLayout::FixedLayout(const DimensionName d, Coord span) { dimension_ = d; span_ = span; } FixedLayout::~FixedLayout() { } void FixedLayout::request( GlyphIndex, const Requisition*, Requisition& result ) { Requirement& r = result.requirement(dimension_); r.natural(span_); r.stretch(0.0); r.shrink(0.0); } void FixedLayout::allocate( const Allocation&, GlyphIndex, const Requisition*, Allocation* result ) { Allotment& a = result[0].allotment(dimension_); a.span(span_); } VariableLayout::VariableLayout( const DimensionName d, Coord stretch, Coord shrink ) { dimension_ = d; stretch_ = stretch; shrink_ = shrink; } VariableLayout::~VariableLayout() { } void VariableLayout::request( GlyphIndex, const Requisition*, Requisition& result ) { Requirement& r = result.requirement(dimension_); r.stretch(stretch_); r.shrink(Math::min(shrink_, r.natural())); } void VariableLayout::allocate( const Allocation&, GlyphIndex, const Requisition*, Allocation* ) { /* leave it as is */ } NaturalLayout::NaturalLayout(const DimensionName d, Coord natural) { dimension_ = d; natural_ = natural; } NaturalLayout::~NaturalLayout() { } void NaturalLayout::request( GlyphIndex, const Requisition*, Requisition& result ) { Requirement& r = result.requirement(dimension_); r.natural(natural_); } void NaturalLayout::allocate( const Allocation&, GlyphIndex, const Requisition*, Allocation* ) { /* leave it as is */ } MarginLayout::MarginLayout(Coord margin) { lnatural_ = margin; lstretch_ = 0; lshrink_ = 0; rnatural_ = margin; rstretch_ = 0; rshrink_ = 0; bnatural_ = margin; bstretch_ = 0; bshrink_ = 0; tnatural_ = margin; tstretch_ = 0; tshrink_ = 0; } MarginLayout::MarginLayout(Coord hmargin, Coord vmargin) { lnatural_ = hmargin; lstretch_ = 0; lshrink_ = 0; rnatural_ = hmargin; rstretch_ = 0; rshrink_ = 0; bnatural_ = vmargin; bstretch_ = 0; bshrink_ = 0; tnatural_ = vmargin; tstretch_ = 0; tshrink_ = 0; } MarginLayout::MarginLayout( Coord lmargin, Coord rmargin, Coord bmargin, Coord tmargin ) { lnatural_ = lmargin; lstretch_ = 0; lshrink_ = 0; rnatural_ = rmargin; rstretch_ = 0; rshrink_ = 0; bnatural_ = bmargin; bstretch_ = 0; bshrink_ = 0; tnatural_ = tmargin; tstretch_ = 0; tshrink_ = 0; } MarginLayout::MarginLayout( Coord lmargin, Coord lstretch, Coord lshrink, Coord rmargin, Coord rstretch, Coord rshrink, Coord bmargin, Coord bstretch, Coord bshrink, Coord tmargin, Coord tstretch, Coord tshrink ) { lnatural_ = lmargin; lstretch_ = lstretch; lshrink_ = lshrink; rnatural_ = rmargin; rstretch_ = rstretch; rshrink_ = rshrink; bnatural_ = bmargin; bstretch_ = bstretch; bshrink_ = bshrink; tnatural_ = tmargin; tstretch_ = tstretch; tshrink_ = tshrink; } MarginLayout::~MarginLayout() { } void MarginLayout::request( GlyphIndex, const Requisition*, Requisition& result ) { requisition_ = result; Requirement& x = requisition_.x_requirement(); if (x.defined()) { x.natural(x.natural() + lnatural_ + rnatural_); x.stretch(x.stretch() + lstretch_ + rstretch_); x.shrink(x.shrink() + lshrink_ + rshrink_); } Requirement& y = requisition_.y_requirement(); if (y.defined()) { y.natural(y.natural() + bnatural_ + tnatural_); y.stretch(y.stretch() + bstretch_ + tstretch_); y.shrink(y.shrink() + bshrink_ + tshrink_); } result = requisition_; } void MarginLayout::allocate( const Allocation&, GlyphIndex, const Requisition*, Allocation* result ) { Allotment& x = result[0].x_allotment(); const Requirement& rx = requisition_.x_requirement(); Coord lmargin = span(x.span(), rx, lnatural_, lstretch_, lshrink_); Coord rmargin = span(x.span(), rx, rnatural_, rstretch_, rshrink_); x.span(x.span() - (lmargin + rmargin)); x.offset(Coord((1 - rx.alignment()) * lmargin - rx.alignment() * rmargin)); Allotment& y = result[0].y_allotment(); const Requirement& ry = requisition_.y_requirement(); Coord bmargin = span(y.span(), ry, bnatural_, bstretch_, bshrink_); Coord tmargin = span(y.span(), ry, tnatural_, tstretch_, tshrink_); y.span(y.span() - (bmargin + tmargin)); y.offset(Coord((1 - ry.alignment()) * bmargin - ry.alignment() * tmargin)); } Coord MarginLayout::span( Coord span, const Requirement& total, Coord natural, Coord stretch, Coord shrink ) { Coord extra = span - total.natural(); Coord result = natural; float ss = 0.0; Coord total_stretch = total.stretch(); Coord total_shrink = total.shrink(); if (extra > 0 && total_stretch > 0) { ss = stretch / total_stretch; } else if (extra < 0 && total_shrink > 0) { ss = shrink / total_shrink; } return result + Coord(ss * extra); } neuron-7.6.3/src/lib/InterViews/polyglyph.cpp000077500000000000000000000064141340731477100212430ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * PolyGlyph - list of glyphs */ #include #include declarePtrList(PolyGlyphList,Glyph) implementPtrList(PolyGlyphList,Glyph) class PolyGlyphImpl { private: friend class PolyGlyph; PolyGlyphImpl(GlyphIndex size); PolyGlyphList components_; }; PolyGlyph::PolyGlyph(GlyphIndex size) { impl_ = new PolyGlyphImpl(size); } PolyGlyph::~PolyGlyph() { PolyGlyphList& p = impl_->components_; for (ListItr(PolyGlyphList) i(p); i.more(); i.next()) { Resource::unref(i.cur()); } delete impl_; } void PolyGlyph::undraw() { PolyGlyphList& p = impl_->components_; for (ListItr(PolyGlyphList) i(p); i.more(); i.next()) { Glyph* g = i.cur(); if (g != nil) { g->undraw(); } } } void PolyGlyph::append(Glyph* g) { PolyGlyphList& p = impl_->components_; Resource::ref(g); GlyphIndex i = p.count(); p.append(g); modified(i); } void PolyGlyph::prepend(Glyph* g) { PolyGlyphList& p = impl_->components_; Resource::ref(g); p.prepend(g); modified(0); } void PolyGlyph::insert(GlyphIndex i, Glyph* g) { PolyGlyphList& p = impl_->components_; Resource::ref(g); p.insert(i, g); modified(i); } void PolyGlyph::remove(GlyphIndex i) { PolyGlyphList& p = impl_->components_; Glyph* g = p.item(i); if (g != nil) { g->undraw(); Resource::unref_deferred(g); } p.remove(i); modified(i); } void PolyGlyph::replace(GlyphIndex i, Glyph* g) { PolyGlyphList& p = impl_->components_; Glyph* old_g = p.item(i); if (g != old_g) { Resource::ref(g); if (old_g != nil) { old_g->undraw(); Resource::unref_deferred(old_g); } p.remove(i); p.insert(i, g); modified(i); } } void PolyGlyph::change(GlyphIndex i) { modified(i); } GlyphIndex PolyGlyph::count() const { return impl_->components_.count(); } Glyph* PolyGlyph::component(GlyphIndex i) const { return impl_->components_.item(i); } void PolyGlyph::modified(GlyphIndex) { } PolyGlyphImpl::PolyGlyphImpl(GlyphIndex size) : components_(size) { } neuron-7.6.3/src/lib/InterViews/printer.cpp000066400000000000000000000354741340731477100207040ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Printer - draw for PostScript printer */ #ifdef MAC #define WIN32 #endif #include #include #include #include #include #include #include #include #include #include #include #include static const float PAGE_WIDTH = 8.5 * 72; static const float PAGE_HEIGHT = 11 * 72; static const float epsilon = 0.01; static const char* ps_prolog = "\ save 20 dict begin\n\ \n\ /sf { % scale /fontName => - (set current font)\n\ {findfont} stopped {pop /Courier findfont} if\n\ exch scalefont setfont\n\ } def\n\ \n\ /ws {\n\ 4 index 6 4 roll moveto sub\n\ 2 index stringwidth pop sub\n\ exch div 0 8#40 4 3 roll\n\ widthshow\n\ } def\n\ \n\ /as {\n\ 4 index 6 4 roll moveto sub\n\ 2 index stringwidth pop sub\n\ exch div 0 3 2 roll\n\ ashow\n\ } def\n\ \n\ "; static const char* ps_epilog = "\ end restore\n\ "; #ifdef WIN32 declareList(PRtransformerList,Transformer) implementList(PRtransformerList,Transformer) #endif class PrinterInfo { public: const Color* color_; const Brush* brush_; const Font* font_; }; class PrinterInfoList; class PrinterRep { public: ostream* out_; int page_; PrinterInfoList* info_; float x_; float y_; Coord text_curx_; Coord text_cury_; int text_chars_; int text_spaces_; #ifdef WIN32 Transformer tr_; PRtransformerList trl_; #endif }; declareList(PrinterInfoList,PrinterInfo) implementList(PrinterInfoList,PrinterInfo) static void do_color(ostream& out, const Color* color) { // alpha supported added by cd1f 21-may-95 float r, g, b, a; a = color->alpha(); color->intensities(r, g, b); if(a == 1.0) { out << r << " " << g << " " << b << " setrgbcolor\n"; } else { float c = (r + g + b)/3.0; if(c < 0.5) out << (1.0 - a) << " " << "setgray\n"; else out << a << " " << "setgray\n"; } } static void do_brush(ostream& out, const Brush* brush) { Coord linewidth = brush ? brush->width() : 1; out << linewidth << " setlinewidth\n"; #if !defined(WIN32) && !MAC // Should do something about patterned brushes. // Maybe something like this: int dcnt = brush ? brush->dash_count() : 0; if(dcnt == 0) out << "[] 0 setdash\n"; else { out << "["; for(int i=0; i < dcnt; i++) { out << " " << brush->dash_list(i); } out << "] 0 setdash\n"; } #endif } static void do_font(ostream& out, const Font* font) { out << font->size() << " /"; const char* p = font->name(); while (*p != '\0') { out << char(*p == ' ' ? '-' : *p); ++p; } out << " sf\n"; } Printer::Printer(ostream* out) { PrinterRep* p = new PrinterRep; rep_ = p; p->out_ = out; p->page_ = 1; p->x_ = 0; p->y_ = 0; p->text_curx_ = 0; p->text_cury_ = 0; p->text_chars_ = 0; p->text_spaces_ = 0; PrinterInfo info; info.color_ = nil; info.brush_ = nil; info.font_ = nil; p->info_ = new PrinterInfoList(); p->info_->append(info); } Printer::~Printer() { flush(); delete rep_->info_; delete rep_; } PixelCoord Printer::to_pixels(Coord p, DimensionName) const { return (PixelCoord)p; } Coord Printer::to_coord(PixelCoord p, DimensionName) const { return p; } Coord Printer::to_pixels_coord(Coord p, DimensionName) const { return p; } #ifdef WIN32 void Printer::size(Coord width, Coord height){} void Printer::psize(PixelCoord width, PixelCoord height){} Coord Printer::width() const {return 8.5*72;} Coord Printer::height() const {return 11.*72;} PixelCoord Printer::pwidth() const {return (PixelCoord)8.5*72;} PixelCoord Printer::pheight() const {return (PixelCoord)11.*72;} void Printer::transformer(const Transformer& t){ rep_->tr_ = t; } const Transformer& Printer::transformer() const { return rep_->tr_; } void Printer::damage(const Extension&){} void Printer::damage(Coord, Coord, Coord, Coord){} bool Printer::damaged(const Extension&) const{return true;} bool Printer::damaged( Coord, Coord, Coord, Coord ) const{return true;} void Printer::damage_area(Extension& ex){ ex.set_xy(this, 0.0, 0.0, width(), height()); } void Printer::damage_all(){} bool Printer::any_damage() const{return true;} void Printer::restrict_damage(const Extension&){} void Printer::restrict_damage( Coord, Coord, Coord, Coord ){} void Printer::redraw(Coord, Coord, Coord, Coord){} void Printer::repair(){} #endif void Printer::resize(Coord left, Coord bottom, Coord right, Coord top) { PrinterRep* p = rep_; ostream& out = *p->out_; p->x_ = (float(left + right) - PAGE_WIDTH)/2; p->y_ = (float(top + bottom) - PAGE_HEIGHT)/2; flush(); size(right - left, top - bottom); damage(left, bottom, right, top); } void Printer::prolog(const char* creator) { ostream& out = *rep_->out_; out << "%!PS-Adobe-2.0\n"; out << "%%Creator: " << creator << "\n"; out << "%%Pages: atend\n"; out << "%%EndComments\n"; out << ps_prolog; out << "%%EndProlog\n"; } void Printer::epilog () { PrinterRep* p = rep_; ostream& out = *p->out_; flush(); out << "showpage\n"; out << "%%Trailer\n"; out << ps_epilog; out << "%%Pages: " << p->page_ - 1 << "\n"; } void Printer::comment(const char* text) { ostream& out = *rep_->out_; flush(); out << "%% " << text << "\n"; } void Printer::page(const char* label) { PrinterRep* p = rep_; flush(); if (p->page_ > 1) { *p->out_ << "showpage\n"; } *p->out_ << "%%Page: " << label << " " << p->page_ << "\n"; *p->out_ << -(p->x_) << " " << -(p->y_) << " translate\n"; PrinterInfo& info = p->info_->item_ref(p->info_->count() - 1); info.font_ = nil; info.color_ = nil; info.brush_ = nil; p->page_ += 1; } void Printer::push_transform() { PrinterRep* p = rep_; #ifdef WIN32 p->trl_.append(p->tr_); #else Canvas::push_transform(); #endif flush(); long depth = p->info_->count(); PrinterInfo info = p->info_->item_ref(depth - 1); p->info_->insert(depth, info); *p->out_ << "gsave\n"; } void Printer::pop_transform() { PrinterRep* p = rep_; flush(); long depth = p->info_->count(); p->info_->remove(depth - 1); *p->out_ << "grestore\n"; #ifdef WIN32 long tcnt = p->trl_.count(); if (tcnt) { p->tr_ = p->trl_.item(tcnt - 1); p->trl_.remove(tcnt - 1); } #else Canvas::pop_transform(); #endif } void Printer::transform(const Transformer& t) { PrinterRep* p = rep_; #ifdef WIN32 p->tr_.premultiply(t); #else Canvas::transform(t); #endif flush(); float a00, a01, a10, a11, a20, a21; t.matrix(a00, a01, a10, a11, a20, a21); *p->out_ << "[" << a00 << " " << a01; *p->out_ << " " << a10 << " " << a11; *p->out_ << " " << a20 << " " << a21 << "] concat\n"; } /* * The current transform push/pop just saves and restores state, * so we can use it for clipping as well. */ #if defined(WIN32) || MAC void Printer::push_clipping(bool) { #else void Printer::push_clipping() { #endif PrinterRep* p = rep_; flush(); long depth = p->info_->count(); PrinterInfo info = p->info_->item_ref(depth - 1); p->info_->insert(depth, info); *p->out_ << "gsave\n"; } void Printer::pop_clipping() { PrinterRep* p = rep_; flush(); long depth = p->info_->count(); p->info_->remove(depth - 1); *p->out_ << "grestore\n"; } void Printer::new_path() { ostream& out = *rep_->out_; flush(); out << "newpath\n"; } void Printer::move_to(Coord x, Coord y) { ostream& out = *rep_->out_; flush(); out << x << " " << y << " moveto\n"; } void Printer::line_to(Coord x, Coord y) { ostream& out = *rep_->out_; flush(); out << x << " " << y << " lineto\n"; } void Printer::curve_to( Coord x, Coord y, Coord x1, Coord y1, Coord x2, Coord y2 ) { ostream& out = *rep_->out_; flush(); out << x1 << " " << y1 << " " << x2 << " " << y2 << " "; out << x << " " << y << " curveto\n"; } void Printer::close_path() { ostream& out = *rep_->out_; flush(); out << "closepath\n"; } void Printer::stroke(const Color* color, const Brush* brush) { PrinterRep* p = rep_; ostream& out = *p->out_; flush(); PrinterInfo& info = p->info_->item_ref(p->info_->count() - 1); if (info.color_ != color) { do_color(out, color); info.color_ = color; } if (info.brush_ != brush) { do_brush(out, brush); info.brush_ = brush; } out << "gsave stroke grestore\n"; } void Printer::fill(const Color* color) { PrinterRep* p = rep_; ostream& out = *p->out_; flush(); PrinterInfo& info = p->info_->item_ref(p->info_->count() - 1); if (info.color_ != color) { do_color(out, color); info.color_ = color; } out << "gsave eofill grestore\n"; } void Printer::clip() { ostream& out = *rep_->out_; flush(); out << "eoclip\n"; } void Printer::character( const Font* font, long c, Coord width, const Color* color, Coord x, Coord y ) { #if defined(__GNUC__) char g3[40]; #endif PrinterRep* p = rep_; ostream& out = *p->out_; PrinterInfo& info = p->info_->item_ref(p->info_->count() - 1); if (info.color_ != color) { flush(); do_color(out, color); info.color_ = color; } if (!Math::equal(y, p->text_cury_, epsilon)) { flush(); } if (!Math::equal(x, p->text_curx_, epsilon)) { flush(); } if (info.font_ != font) { flush(); do_font(out, font); info.font_ = font; } if (p->text_chars_ == 0) { out << x << " " << y << "("; } p->text_curx_ = x + width; p->text_cury_ = y; if (c == '\\' || c == ')' || c == '(') { out << "\\" << char(c); } else if (c > 127) { #if defined(__GNUC__) // out.form("\\%03o", c); sprintf(g3, "\\%03lo", c); out << g3; #else out << "\\"; int old_width = out.width(3); char old_fill = out.fill('0'); out << oct << c << dec; out.width(old_width); out.fill(old_fill); #endif } else { out << char(c); } p->text_chars_ += 1; if (c == ' ') { p->text_spaces_ += 1; } } void Printer::flush() { PrinterRep* p = rep_; ostream& out = *p->out_; if (p->text_chars_ > 0) { out << ") "; if (p->text_spaces_ > 0) { out << p->text_spaces_ << " " << p->text_curx_ << " ws\n"; } else { out << p->text_chars_ << " " << p->text_curx_ << " as\n"; } p->text_chars_ = 0; p->text_spaces_ = 0; } } void Printer::stencil( const Bitmap* mask, const Color* color, Coord x, Coord y ) { #if defined(__GNUC__) char g3[24]; #endif PrinterRep* p = rep_; ostream& out = *p->out_; flush(); PrinterInfo& info = p->info_->item_ref(p->info_->count() - 1); if (info.color_ != color) { do_color(out, color); info.color_ = color; } unsigned long width = mask->pwidth(); unsigned long height = mask->pheight(); unsigned long bytes = (width-1)/8 + 1; Coord left = x - mask->left_bearing(); Coord right = x + mask->right_bearing(); Coord bottom = y - mask->descent(); Coord top = y + mask->ascent(); out << "gsave\n"; out << "/picstr " << bytes << " string def\n"; out << left << " " << bottom << " translate\n"; out << right - left << " " << top - bottom << " scale\n"; out << width << " " << height << " true\n"; out << "[" << width << " 0 0 " << height << " 0 0]\n"; out << "{currentfile picstr readhexstring pop} imagemask\n"; #ifndef __GNUC__ int old_width = out.width(1); out << hex; #endif for (int iy = 0; iy < height; ++iy) { for (int ix = 0; ix < bytes; ++ix) { int byte = 0; for (int bit = 0; bit < 8; ++bit) { if (mask->peek(ix*8 + bit, iy)) { byte |= 0x80 >> bit; } } #if defined(__GNUC__) //out.form("%02x", byte); sprintf(g3, "%02x", byte); out << g3; #else out << ((byte>>4) & 0x0f) << (byte & 0x0f); #endif } out << "\n"; } #ifndef __GNUC__ out << dec; out.width(old_width); #endif out << "grestore\n"; } void Printer::image(const Raster* raster, Coord x, Coord y) { #if defined(__GNUC__) char g3[8]; #endif PrinterRep* p = rep_; ostream& out = *p->out_; flush(); unsigned long width = raster->pwidth(); unsigned long height = raster->pheight(); float left = float(x) - raster->left_bearing(); float right = float(x) + raster->right_bearing(); float bottom = float(y) - raster->descent(); float top = float(y) + raster->ascent(); out << "gsave\n"; out << "/picstr " << width << " string def\n"; out << left << " " << bottom << " translate\n"; out << right - left << " " << top - bottom << " scale\n"; out << width << " " << height << " 8\n"; out << "[" << width << " 0 0 " << height << " 0 0]\n"; out << "{currentfile picstr readhexstring pop} image\n"; #ifndef __GNUC__ int old_width = out.width(1); out << hex; #endif for (int iy = 0; iy < height; ++iy) { for (int ix = 0; ix < width; ++ix) { float r, g, b, alpha; raster->peek(ix, iy, r, g, b, alpha); int byte = int(0xff * (r + g + b) / 3); #if defined(__GNUC__) // out.vform("%02x", byte); sprintf(g3, "%02x", byte); out << g3; #else out << ((byte>>4) & 0x0f) << (byte & 0x0f); #endif } out << "\n"; } #ifndef __GNUC__ out << dec; out.width(old_width); #endif out << "grestore\n"; } neuron-7.6.3/src/lib/InterViews/psfont.cpp000066400000000000000000000067141340731477100205250ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * PSFont - use PostScript font metrics */ #include #include #include #include /* * Users can also override this by setting the PSFONTDIR environment variable. */ #ifndef ps_metrics_dir #define ps_metrics_dir "/usr/lib/ps" #endif class PSFontImpl { private: friend class PSFont; char* name; char* encoding; Coord size; Coord widths[256]; static char* psfile(const char* name); }; PSFont::PSFont( const char* psname, Coord size, const char* name, float scale ) : Font(name, scale) { PSFontImpl* p = new PSFontImpl; impl_ = p; p->name = nil; p->encoding = nil; p->size = size; char* metrics_file = PSFontImpl::psfile(psname); FILE* file = fopen(metrics_file, "r"); if (file != nil) { p->name = new char[256]; p->encoding = new char[256]; char line[256]; int c; int w; while (fgets(line, 255, file) != NULL) { if (sscanf(line, "FullName %[a-zA-Z ]", p->name) == 1) { ; } else if (sscanf(line, "EncodingScheme %s", p->encoding) == 1) { ; } else if (sscanf(line, "C %d ; WX %d ;", &c, &w) == 2) { if (c != -1) { p->widths[c] = float(w) / 1000 * p->size; } } } fclose(file); } delete [] metrics_file; } PSFont::~PSFont() { delete [] impl_->name; delete [] impl_->encoding; delete impl_; } const char* PSFont::name() const { return impl_->name; } const char* PSFont::encoding() const { return impl_->encoding; } Coord PSFont::size() const { return impl_->size; } Coord PSFont::width(long c) const { return impl_->widths[c]; } Coord PSFont::width(const char* s, int n) const { return Font::width(s, n); } bool PSFont::exists(const char* psname) { char* metrics_file = PSFontImpl::psfile(psname); FILE* f = fopen(metrics_file, "r"); delete [] metrics_file; if (f == nil) { return false; } fclose(f); return true; } char* PSFontImpl::psfile(const char* name) { const char* dir = getenv("PSFONTDIR"); if (dir == nil) { dir = ps_metrics_dir; } char* metrics_file = new char[ strlen(dir) + strlen("/") + strlen(name) + strlen(".afm") + 1 ]; sprintf(metrics_file, "%s/%s.afm", dir, name); return metrics_file; } neuron-7.6.3/src/lib/InterViews/regexp.cpp000066400000000000000000000730521340731477100205050ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Regexp - regular expression searching */ #include #include #include /* * This version is based on the Henry Spencers public domain reimplementation * of the regular expression matching subroutines. They are included as * static subroutines after the externally accessible routines. */ /* * Forward declarations for regcomp()'s friends. */ static regexp* regcomp(char* exp); static char* reg(int paren, int* flagp); static char* regbranch(int* flagp); static char* regpiece(int* flagp); static char* regatom(int* flagp); static char* regnode(char op); static char* regnext(register char* p); static void regc(char b); static void reginsert(char op, char* opnd); static void regtail(char* p, char* val); static void regoptail(char* p, char* val); static void regerror(const char* s); static int regexec(register regexp* prog, register char* string); static int regtry(regexp* prog, char* string); static int regmatch(char* prog); static int regrepeat(char* p); inline char * FindNewline(char* s) { return strchr(s, '\n'); } inline char * NextLine(char* s) { char* newstart; if ((newstart = FindNewline(s)) != nil) newstart++; return newstart; } Regexp::Regexp (const char* pat) { int length = strlen(pat); pattern_ = new char[length+1]; strncpy(pattern_, pat, length); pattern_[length] = '\0'; c_pattern = regcomp(pattern_); if (!c_pattern) { delete [] pattern_; pattern_ = nil; } } Regexp::Regexp (const char* pat, int length) { pattern_ = new char[length+1]; strncpy(pattern_, pat, length); pattern_[length] = '\0'; c_pattern = regcomp(pattern_); if (!c_pattern) { delete [] pattern_; pattern_ = nil; } } Regexp::~Regexp () { if (pattern_) { delete [] pattern_; } if (c_pattern) { delete [] (char*)c_pattern; } } const char* Regexp::pattern() const { return pattern_; } int Regexp::Search (const char* text, int length, int index, int range) { bool forwardSearch; bool frontAnchored; bool endAnchored; char* searchStart; char* searchLimit; char* endOfLine = nil; char* lastMatch = nil; char csave; /* * A small sanity check. Otherwise length is unused in this function. * This is really what the logic embedded in the old version of this * routine enforced. */ if (index + range > length) { range = length - index; if (range < 0) return -1; } if (c_pattern == nil) { return -1; } c_pattern->startp[0] = nil; if (range < 0) { forwardSearch = false; searchLimit = (char *) text + index; searchStart = (char *) searchLimit + range; /* range is negative */ } else { forwardSearch = true; searchStart = (char *) text + index; searchLimit = (char *) searchStart + range; } /* Mark end of text string so search will stop */ char save = *searchLimit; *searchLimit = '\0'; frontAnchored = pattern_[0] == '^'; endAnchored = pattern_[strlen(pattern_)-1] == '$'; if (frontAnchored && (searchStart != text || searchStart[-1] == '\n')) { searchStart = NextLine(searchStart); } while (searchStart && searchStart < searchLimit) { int result; if (endAnchored && (endOfLine = FindNewline(searchStart)) != nil) { csave = *endOfLine; *endOfLine = '\0'; } result = regexec(c_pattern, searchStart); if (endOfLine) *endOfLine = csave; if (result) { /* Found a match */ if (forwardSearch) break; /* Done */ else { lastMatch = c_pattern->startp[0]; searchStart = c_pattern->endp[0]; if (frontAnchored) searchStart = NextLine(searchStart); continue; } } /* Did not find a match */ if (frontAnchored || endAnchored) searchStart = NextLine(searchStart); else break; } if (!forwardSearch && lastMatch) { if (endAnchored && (endOfLine = FindNewline(lastMatch)) != nil) { csave = *endOfLine; *endOfLine = '\0'; } (void) regexec(c_pattern, lastMatch); /* Refill startp and endp */ if (endOfLine) *endOfLine = csave; } *searchLimit = save; c_pattern->textStart = (char *) text; return c_pattern->startp[0] - c_pattern->textStart; } int Regexp::Match (const char* text, int length, int index) { if (c_pattern == nil) return -1; c_pattern->startp[0] = nil; char save = *(text+length); *(char*)(text+length) = '\0'; c_pattern->textStart = (char *) text; (void) regexec(c_pattern, (char *) text + index); *(char*)(text+length) = save; if (c_pattern->startp[0] != nil) return c_pattern->endp[0] - c_pattern->startp[0]; else return -1; } int Regexp::BeginningOfMatch (int subexp) { if (subexp < 0 || subexp > NSUBEXP || c_pattern == nil || c_pattern->startp[0] == nil) return -1; return c_pattern->startp[subexp] - c_pattern->textStart; } int Regexp::EndOfMatch (int subexp) { if (subexp < 0 || subexp > NSUBEXP || c_pattern == nil || c_pattern->startp[0] == nil) return -1; return c_pattern->endp[subexp] - c_pattern->textStart; } /* * regcomp and regexec * * Copyright (c) 1986 by University of Toronto. * Written by Henry Spencer. Not derived from licensed software. * * Permission is granted to anyone to use this software for any * purpose on any computer system, and to redistribute it freely, * subject to the following restrictions: * * 1. The author is not responsible for the consequences of use of * this software, no matter how awful, even if they arise * from defects in it. * * 2. The origin of this software must not be misrepresented, either * by explicit claim or by omission. * * 3. Altered versions must be plainly marked as such, and must not * be misrepresented as being the original software. * * Beware that some of this code is subtly aware of the way operator * precedence is structured in regular expressions. Serious changes in * regular-expression syntax might require a total rethink. */ /* * The "internal use only" fields in regexp.h are present to pass info from * compile to execute that permits the execute phase to run lots faster on * simple cases. They are: * * regstart char that must begin a match; '\0' if none obvious * reganch is the match anchored (at beginning-of-line only)? * regmust string (pointer into program) that match must include, or nil * regmlen length of regmust string * * Regstart and reganch permit very fast decisions on suitable starting points * for a match, cutting down the work a lot. Regmust permits fast rejection * of lines that cannot possibly match. The regmust tests are costly enough * that regcomp() supplies a regmust only if the r.e. contains something * potentially expensive (at present, the only such thing detected is * or + * at the start of the r.e., which can involve a lot of backup). Regmlen is * supplied because the test in regexec() needs it and regcomp() is computing * it anyway. */ /* * Structure for regexp "program". This is essentially a linear encoding * of a nondeterministic finite-state machine (aka syntax charts or * "railroad normal form" in parsing technology). Each node is an opcode * plus a "next" pointer, possibly plus an operand. "Next" pointers of * all nodes except BRANCH implement concatenation; a "next" pointer with * a BRANCH on both ends of it is connecting two alternatives. (Here we * have one of the subtle syntax dependencies: an individual BRANCH (as * opposed to a collection of them) is never concatenated with anything * because of operator precedence.) The operand of some types of node is * a literal string; for others, it is a node leading into a sub-FSM. In * particular, the operand of a BRANCH node is the first node of the branch. * (NB this is *not* a tree structure: the tail of the branch connects * to the thing following the set of BRANCHes.) The opcodes are: */ /* definition number opnd? meaning */ #define END 0 /* no End of program. */ #define BOL 1 /* no Match "" at beginning of line. */ #define EOL 2 /* no Match "" at end of line. */ #define ANY 3 /* no Match any one character. */ #define ANYOF 4 /* str Match any character in this string. */ #define ANYBUT 5 /* str Match any character not in this string. */ #define BRANCH 6 /* node Match this alternative, or the next... */ #define BACK 7 /* no Match "", "next" ptr points backward. */ #define EXACTLY 8 /* str Match this string. */ #define NOTHING 9 /* no Match empty string. */ #define STAR 10 /* node Match this (simple) thing 0 or more times. */ #define PLUS 11 /* node Match this (simple) thing 1 or more times. */ #define OPEN 20 /* no Mark this point in input as start of #n. */ /* OPEN+1 is number 1, etc. */ #define CLOSE 30 /* no Analogous to OPEN. */ /* * Opcode notes: * * BRANCH The set of branches constituting a single choice are hooked * together with their "next" pointers, since precedence prevents * anything being concatenated to any individual branch. The * "next" pointer of the last BRANCH in a choice points to the * thing following the whole choice. This is also where the * final "next" pointer of each individual branch points; each * branch starts with the operand node of a BRANCH node. * * BACK Normal "next" pointers all implicitly point forward; BACK * exists to make loop structures possible. * * STAR,PLUS '?', and complex '*' and '+', are implemented as circular * BRANCH structures using BACK. Simple cases (one character * per match) are implemented with STAR and PLUS for speed * and to minimize recursive plunges. * * OPEN,CLOSE ...are numbered at compile time. */ /* * A node is one char of opcode followed by two chars of "next" pointer. * "Next" pointers are stored as two 8-bit pieces, high order first. The * value is a positive offset from the opcode of the node containing it. * An operand, if any, simply follows the node. (Note that much of the * code generation knows about this implicit relationship.) * * Using two bytes for the "next" pointer is vast overkill for most things, * but allows patterns to get big without disasters. */ #define OP(p) (*(p)) #define NEXT(p) (((*((p)+1)&0377)<<8) + (*((p)+2)&0377)) #define OPERAND(p) ((p) + 3) /* * Utility definitions. */ #ifndef RE_CHARBITS #define RE_CHARBITS 0xff #endif #define UCHARAT(p) ((int)*(p)&RE_CHARBITS) #define FAIL(m) { regerror(m); return(nil); } #define ISMULT(c) ((c) == '*' || (c) == '+' || (c) == '?') #define META "^$.[()|?+*\\" /* * Flags to be passed up and down. */ #define HASWIDTH 01 /* Known never to match null string. */ #define SIMPLE 02 /* Simple enough to be STAR/PLUS operand. */ #define SPSTART 04 /* Starts with * or +. */ #define WORST 0 /* Worst case. */ /* * Global work variables for regcomp(). */ static char *regparse; /* Input-scan pointer. */ static int regnpar; /* () count. */ static char regdummy; static char *regcode; /* Code-emit pointer; ®dummy = don't. */ static long regsize; /* Code size. */ /* - regcomp - compile a regular expression into internal code * * We can't allocate space until we know how big the compiled form will be, * but we can't compile it (and thus know how big it is) until we've got a * place to put the code. So we cheat: we compile it twice, once with code * generation turned off and size counting turned on, and once "for real". * This also means that we don't allocate space until we are sure that the * thing really will compile successfully, and we never have to move the * code and thus invalidate pointers into it. (Note that it has to be in * one piece because free() must be able to free it all.) * * Beware that the optimization-preparation code in here knows about some * of the structure of the compiled regexp. */ static regexp * regcomp(char* exp) { register regexp *r; register char *scan; register char *longest; register int len; int flags; if (exp == nil) FAIL("nil argument"); /* First pass: determine size, legality. */ regparse = exp; regnpar = 1; regsize = 0L; regcode = ®dummy; regc(REGEXP_MAGIC); if (reg(0, &flags) == nil) return(nil); /* Small enough for pointer-storage convention? */ if (regsize >= 32767L) /* Probably could be 65535L. */ FAIL("regexp too big"); /* Allocate space. */ r = (regexp *) new char[sizeof(regexp) + (unsigned)regsize]; /* Second pass: emit code. */ regparse = exp; regnpar = 1; regcode = r->program; regc(REGEXP_MAGIC); if (reg(0, &flags) == nil) { delete [] (char*)r; return(nil); } /* Dig out information for optimizations. */ r->regstart = '\0'; /* Worst-case defaults. */ r->reganch = 0; r->regmust = nil; r->regmlen = 0; scan = r->program+1; /* First BRANCH. */ if (OP(regnext(scan)) == END) { /* Only one top-level choice. */ scan = OPERAND(scan); /* Starting-point info. */ if (OP(scan) == EXACTLY) r->regstart = *OPERAND(scan); else if (OP(scan) == BOL) r->reganch++; /* * If there's something expensive in the r.e., find the * longest literal string that must appear and make it the * regmust. Resolve ties in favor of later strings, since * the regstart check works with the beginning of the r.e. * and avoiding duplication strengthens checking. Not a * strong reason, but sufficient in the absence of others. */ if (flags&SPSTART) { longest = nil; len = 0; for (; scan != nil; scan = regnext(scan)) if (OP(scan) == EXACTLY && strlen(OPERAND(scan)) >= len) { longest = OPERAND(scan); len = strlen(OPERAND(scan)); } r->regmust = longest; r->regmlen = len; } } return(r); } /* - reg - regular expression, i.e. main body or parenthesized thing * * Caller must absorb opening parenthesis. * * Combining parenthesis handling with the base level of regular expression * is a trifle forced, but the need to tie the tails of the branches to what * follows makes it hard to avoid. */ static char * reg(int paren, int* flagp) { register char *ret; register char *br; register char *ender; register int parno; int flags; *flagp = HASWIDTH; /* Tentatively. */ /* Make an OPEN node, if parenthesized. */ if (paren) { if (regnpar >= NSUBEXP) FAIL("too many ()"); parno = regnpar; regnpar++; ret = regnode(OPEN+parno); } else ret = nil; /* Pick up the branches, linking them together. */ br = regbranch(&flags); if (br == nil) return(nil); if (ret != nil) regtail(ret, br); /* OPEN -> first. */ else ret = br; if (!(flags&HASWIDTH)) *flagp &= ~HASWIDTH; *flagp |= flags&SPSTART; while (*regparse == '|') { regparse++; br = regbranch(&flags); if (br == nil) return(nil); regtail(ret, br); /* BRANCH -> BRANCH. */ if (!(flags&HASWIDTH)) *flagp &= ~HASWIDTH; *flagp |= flags&SPSTART; } /* Make a closing node, and hook it on the end. */ ender = regnode((paren) ? CLOSE+parno : END); regtail(ret, ender); /* Hook the tails of the branches to the closing node. */ for (br = ret; br != nil; br = regnext(br)) regoptail(br, ender); /* Check for proper termination. */ if (paren && *regparse++ != ')') { FAIL("unmatched ()"); } else if (!paren && *regparse != '\0') { if (*regparse == ')') { FAIL("unmatched ()"); } else FAIL("junk on end"); /* "Can't happen". */ /* NOTREACHED */ } return(ret); } /* - regbranch - one alternative of an | operator * * Implements the concatenation operator. */ static char * regbranch(int* flagp) { register char *ret; register char *chain; register char *latest; int flags; *flagp = WORST; /* Tentatively. */ ret = regnode(BRANCH); chain = nil; while (*regparse != '\0' && *regparse != '|') { if (*regparse == '\\' && regparse[1] == ')') { regparse++; break; } latest = regpiece(&flags); if (latest == nil) return(nil); *flagp |= flags&HASWIDTH; if (chain == nil) /* First piece. */ *flagp |= flags&SPSTART; else regtail(chain, latest); chain = latest; } if (chain == nil) /* Loop ran zero times. */ (void) regnode(NOTHING); return(ret); } /* - regpiece - something followed by possible [*+?] * * Note that the branching code sequences used for ? and the general cases * of * and + are somewhat optimized: they use the same NOTHING node as * both the endmarker for their branch list and the body of the last branch. * It might seem that this node could be dispensed with entirely, but the * endmarker role is not redundant. */ static char * regpiece(int* flagp) { register char *ret; register char op; register char *next; int flags; ret = regatom(&flags); if (ret == nil) return(nil); op = *regparse; if (!ISMULT(op)) { *flagp = flags; return(ret); } if (!(flags&HASWIDTH) && op != '?') FAIL("*+ operand could be empty"); *flagp = (op != '+') ? (WORST|SPSTART) : (WORST|HASWIDTH); if (op == '*' && (flags&SIMPLE)) reginsert(STAR, ret); else if (op == '*') { /* Emit x* as (x&|), where & means "self". */ reginsert(BRANCH, ret); /* Either x */ regoptail(ret, regnode(BACK)); /* and loop */ regoptail(ret, ret); /* back */ regtail(ret, regnode(BRANCH)); /* or */ regtail(ret, regnode(NOTHING)); /* null. */ } else if (op == '+' && (flags&SIMPLE)) reginsert(PLUS, ret); else if (op == '+') { /* Emit x+ as x(&|), where & means "self". */ next = regnode(BRANCH); /* Either */ regtail(ret, next); regtail(regnode(BACK), ret); /* loop back */ regtail(next, regnode(BRANCH)); /* or */ regtail(ret, regnode(NOTHING)); /* null. */ } else if (op == '?') { /* Emit x? as (x|) */ reginsert(BRANCH, ret); /* Either x */ regtail(ret, regnode(BRANCH)); /* or */ next = regnode(NOTHING); /* null. */ regtail(ret, next); regoptail(ret, next); } regparse++; if (ISMULT(*regparse)) FAIL("nested *?+"); return(ret); } /* - regatom - the lowest level * * Optimization: gobbles an entire sequence of ordinary characters so that * it can turn them into a single node, which is smaller to store and * faster to run. Backslashed characters are exceptions, each becoming a * separate node; the code is simpler that way and it's not worth fixing. */ static char * regatom(int* flagp) { register char *ret; int flags; *flagp = WORST; /* Tentatively. */ switch (*regparse++) { case '^': ret = regnode(BOL); break; case '$': ret = regnode(EOL); break; case '.': ret = regnode(ANY); *flagp |= HASWIDTH|SIMPLE; break; case '[': { register int classbeg; register int classend; if (*regparse == '^') { /* Complement of range. */ ret = regnode(ANYBUT); regparse++; } else ret = regnode(ANYOF); if (*regparse == ']' || *regparse == '-') regc(*regparse++); while (*regparse != '\0' && *regparse != ']') { if (*regparse == '-') { regparse++; if (*regparse == ']' || *regparse == '\0') regc('-'); else { classbeg = UCHARAT(regparse-2)+1; classend = UCHARAT(regparse); if (classbeg > classend+1) FAIL("invalid [] range"); for (; classbeg <= classend; classbeg++) regc(classbeg); regparse++; } } else regc(*regparse++); } regc('\0'); if (*regparse != ']') FAIL("unmatched []"); regparse++; *flagp |= HASWIDTH|SIMPLE; } break; case '\0': case '|': FAIL("internal urp"); /* Supposed to be caught earlier. */ break; case '?': case '+': case '*': FAIL("?+* follows nothing"); break; case '\\': if (*regparse == '\0') FAIL("trailing \\"); if (*regparse == '(') { regparse++; ret = reg(1, &flags); if (ret == nil) return(nil); *flagp |= flags&(HASWIDTH|SPSTART); } else { ret = regnode(EXACTLY); regc(*regparse++); regc('\0'); *flagp |= HASWIDTH|SIMPLE; } break; default: { register int len; register char ender; regparse--; len = strcspn(regparse, META); if (len <= 0) FAIL("internal disaster"); ender = *(regparse+len); if (len > 1 && ISMULT(ender)) len--; /* Back off clear of ?+* operand. */ *flagp |= HASWIDTH; if (len == 1) *flagp |= SIMPLE; ret = regnode(EXACTLY); while (len > 0) { regc(*regparse++); len--; } regc('\0'); } break; } return(ret); } /* - regnode - emit a node */ static char * /* Location. */ regnode(char op) { register char *ret; register char *ptr; ret = regcode; if (ret == ®dummy) { regsize += 3; return(ret); } ptr = ret; *ptr++ = op; *ptr++ = '\0'; /* Null "next" pointer. */ *ptr++ = '\0'; regcode = ptr; return(ret); } /* - regc - emit (if appropriate) a byte of code */ static void regc(char b) { if (regcode != ®dummy) *regcode++ = b; else regsize++; } /* - reginsert - insert an operator in front of already-emitted operand * * Means relocating the operand. */ static void reginsert(char op, char* opnd) { register char *src; register char *dst; register char *place; if (regcode == ®dummy) { regsize += 3; return; } src = regcode; regcode += 3; dst = regcode; while (src > opnd) *--dst = *--src; place = opnd; /* Op node, where operand used to be. */ *place++ = op; *place++ = '\0'; *place++ = '\0'; } /* - regtail - set the next-pointer at the end of a node chain */ static void regtail(char* p, char* val) { register char *scan; register char *temp; register int offset; if (p == ®dummy) return; /* Find last node. */ scan = p; for (;;) { temp = regnext(scan); if (temp == nil) break; scan = temp; } if (OP(scan) == BACK) offset = scan - val; else offset = val - scan; *(scan+1) = (offset>>8)&0377; *(scan+2) = offset&0377; } /* - regoptail - regtail on operand of first argument; nop if operandless */ static void regoptail(char* p, char* val) { /* "Operandless" and "op != BRANCH" are synonymous in practice. */ if (p == nil || p == ®dummy || OP(p) != BRANCH) return; regtail(OPERAND(p), val); } /* * regexec and friends */ /* * Global work variables for regexec(). */ static char *reginput; /* String-input pointer. */ static char *regbol; /* Beginning of input, for ^ check. */ static char **regstartp; /* Pointer to startp array. */ static char **regendp; /* Ditto for endp. */ /* - regexec - match a regexp against a string */ static int regexec(register regexp* prog, register char* string) { register char *s; /* Be paranoid... */ if (prog == nil || string == nil) { regerror("nil parameter"); return(0); } /* Check validity of program. */ if (UCHARAT(prog->program) != REGEXP_MAGIC) { regerror("corrupted program"); return(0); } /* If there is a "must appear" string, look for it. */ if (prog->regmust != nil) { s = string; while ((s = strchr(s, prog->regmust[0])) != nil) { if (strncmp(s, prog->regmust, prog->regmlen) == 0) break; /* Found it. */ s++; } if (s == nil) /* Not present. */ return(0); } /* Mark beginning of line for ^ . */ regbol = string; /* Simplest case: anchored match need be tried only once. */ if (prog->reganch) return(regtry(prog, string)); /* Messy cases: unanchored match. */ s = string; if (prog->regstart != '\0') /* We know what char it must start with. */ while ((s = strchr(s, prog->regstart)) != nil) { if (regtry(prog, s)) return(1); s++; } else /* We don't -- general case. */ do { if (regtry(prog, s)) return(1); } while (*s++ != '\0'); /* Failure. */ return(0); } /* - regtry - try match at specific point */ static int /* 0 failure, 1 success */ regtry(regexp* prog, char* string) { register int i; register char **sp; register char **ep; reginput = string; regstartp = prog->startp; regendp = prog->endp; sp = prog->startp; ep = prog->endp; for (i = NSUBEXP; i > 0; i--) { *sp++ = nil; *ep++ = nil; } if (regmatch(prog->program + 1)) { prog->startp[0] = string; prog->endp[0] = reginput; return(1); } else return(0); } /* - regmatch - main matching routine * * Conceptually the strategy is simple: check to see whether the current * node matches, call self recursively to see whether the rest matches, * and then act accordingly. In practice we make some effort to avoid * recursion, in particular by going through "ordinary" nodes (that don't * need to know whether the rest of the match failed) by a loop instead of * by recursion. */ static int /* 0 failure, 1 success */ regmatch(char* prog) { register char *scan; /* Current node. */ char *next; /* Next node. */ scan = prog; while (scan != nil) { next = regnext(scan); switch (OP(scan)) { case BOL: if (reginput != regbol) return(0); break; case EOL: if (*reginput != '\0') return(0); break; case ANY: if (*reginput == '\0') return(0); reginput++; break; case EXACTLY: { register int len; register char *opnd; opnd = OPERAND(scan); /* Inline the first character, for speed. */ if (*opnd != *reginput) return(0); len = strlen(opnd); if (len > 1 && strncmp(opnd, reginput, len) != 0) return(0); reginput += len; } break; case ANYOF: if (*reginput == '\0') return(0); if (strchr(OPERAND(scan), *reginput) == nil) return(0); reginput++; break; case ANYBUT: if (*reginput == '\0') return(0); if (strchr(OPERAND(scan), *reginput) != nil) return(0); reginput++; break; case NOTHING: break; case BACK: break; case OPEN+1: case OPEN+2: case OPEN+3: case OPEN+4: case OPEN+5: case OPEN+6: case OPEN+7: case OPEN+8: case OPEN+9: { register int no; register char *save; no = OP(scan) - OPEN; save = reginput; if (regmatch(next)) { /* * Don't set startp if some later * invocation of the same parentheses * already has. */ if (regstartp[no] == nil) regstartp[no] = save; return(1); } else return(0); } break; case CLOSE+1: case CLOSE+2: case CLOSE+3: case CLOSE+4: case CLOSE+5: case CLOSE+6: case CLOSE+7: case CLOSE+8: case CLOSE+9: { register int no; register char *save; no = OP(scan) - CLOSE; save = reginput; if (regmatch(next)) { /* * Don't set endp if some later * invocation of the same parentheses * already has. */ if (regendp[no] == nil) regendp[no] = save; return(1); } else return(0); } break; case BRANCH: { register char *save; if (OP(next) != BRANCH) /* No choice. */ next = OPERAND(scan); /* Avoid recursion. */ else { do { save = reginput; if (regmatch(OPERAND(scan))) return(1); reginput = save; scan = regnext(scan); } while (scan != nil && OP(scan) == BRANCH); return(0); /* NOTREACHED */ } } break; case STAR: case PLUS: { register char nextch; register int no; register char *save; register int min; /* * Lookahead to avoid useless match attempts * when we know what character comes next. */ nextch = '\0'; if (OP(next) == EXACTLY) nextch = *OPERAND(next); min = (OP(scan) == STAR) ? 0 : 1; save = reginput; no = regrepeat(OPERAND(scan)); while (no >= min) { /* If it could work, try it. */ if (nextch == '\0' || *reginput == nextch) if (regmatch(next)) return(1); /* Couldn't or didn't -- back up. */ no--; reginput = save + no; } return(0); } break; case END: return(1); /* Success! */ default: regerror("memory corruption"); return(0); } scan = next; } /* * We get here only if there's trouble -- normally "case END" is * the terminating point. */ regerror("corrupted pointers"); return(0); } /* - regrepeat - repeatedly match something simple, report how many */ static int regrepeat(char* p) { register int count = 0; register char *scan; register char *opnd; scan = reginput; opnd = OPERAND(p); switch (OP(p)) { case ANY: count = strlen(scan); scan += count; break; case EXACTLY: while (*opnd == *scan) { count++; scan++; } break; case ANYOF: while (*scan != '\0' && strchr(opnd, *scan) != nil) { count++; scan++; } break; case ANYBUT: while (*scan != '\0' && strchr(opnd, *scan) == nil) { count++; scan++; } break; default: /* Oh dear. Called inappropriately. */ regerror("internal foulup"); count = 0; /* Best compromise. */ break; } reginput = scan; return(count); } /* - regnext - dig the "next" pointer out of a node */ static char * regnext(register char* p) { register int offset; if (p == ®dummy) return(nil); offset = NEXT(p); if (offset == 0) return(nil); if (OP(p) == BACK) return(p-offset); else return(p+offset); } static void regerror(const char* s) { cerr << "regexp: " << s << "\n"; } neuron-7.6.3/src/lib/InterViews/resource.cpp000066400000000000000000000061031340731477100210330ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include declarePtrList(ResourceList,Resource) implementPtrList(ResourceList,Resource) class ResourceImpl { friend class Resource; static bool deferred_; static ResourceList* deletes_; }; bool ResourceImpl::deferred_ = false; ResourceList* ResourceImpl::deletes_; Resource::Resource() { refcount_ = 0; } Resource::~Resource() { } void Resource::ref() const { Resource* r = (Resource*)this; r->refcount_ += 1; } void Resource::unref() const { Resource* r = (Resource*)this; if (r->refcount_ != 0) { r->refcount_ -= 1; } if (r->refcount_ == 0) { r->cleanup(); delete r; } } void Resource::unref_deferred() const { Resource* r = (Resource*)this; if (r->refcount_ != 0) { r->refcount_ -= 1; } if (r->refcount_ == 0) { r->cleanup(); if (ResourceImpl::deferred_) { if (ResourceImpl::deletes_ == nil) { ResourceImpl::deletes_ = new ResourceList; } ResourceImpl::deletes_->append(r); } else { delete r; } } } void Resource::cleanup() { } void Resource::ref(const Resource* r) { if (r != nil) { r->ref(); } } void Resource::unref(const Resource* r) { if (r != nil) { r->unref(); } } void Resource::unref_deferred(const Resource* r) { if (r != nil) { r->unref_deferred(); } } bool Resource::defer(bool b) { bool previous = ResourceImpl::deferred_; if (b != previous) { flush(); ResourceImpl::deferred_ = b; } return previous; } void Resource::flush() { ResourceList* list = ResourceImpl::deletes_; if (list != nil) { bool previous = ResourceImpl::deferred_; ResourceImpl::deferred_ = false; for (ListItr(ResourceList) i(*list); i.more(); i.next()) { Resource* r = i.cur(); delete r; } list->remove_all(); ResourceImpl::deferred_ = previous; } } neuron-7.6.3/src/lib/InterViews/rule.cpp000077500000000000000000000041111340731477100201530ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Rule - visible filler */ #include #include #include Rule::Rule(DimensionName d, const Color* c, Coord t) : Glyph() { dimension_ = d; color_ = c; Resource::ref(color_); thickness_ = t; } Rule::~Rule() { Resource::unref(color_); } void Rule::request(Requisition& req) const { Requirement r(thickness_, 0, 0, 0); req.require(dimension_, r); } void Rule::allocate(Canvas* c, const Allocation& a, Extension& ext) { ext.set(c, a); } void Rule::draw(Canvas* c, const Allocation& a) const { c->fill_rect(a.left(), a.bottom(), a.right(), a.top(), color_); } HRule::HRule(const Color* c, Coord t) : Rule(Dimension_Y, c, t) { } HRule::~HRule() { } VRule::VRule(const Color* c, Coord t) : Rule(Dimension_X, c, t) { } VRule::~VRule() { } neuron-7.6.3/src/lib/InterViews/scrbox.cpp000066400000000000000000000246051340731477100205130ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * ScrollBox - scrollable list of glyphs */ #include #include #include #include #include #include #include ScrollBox::ScrollBox(GlyphIndex size) : PolyGlyph(size) { } ScrollBox::~ScrollBox() { } bool ScrollBox::shown(GlyphIndex i) const { return i >= 0 && i < count(); } GlyphIndex ScrollBox::first_shown() const { return 0; } GlyphIndex ScrollBox::last_shown() const { return count() - 1; } struct TBScrollBoxInfo { /* workaround for g++ bug */ TBScrollBoxInfo() { } private: friend class TBScrollBox; friend class TBScrollBoxImpl; Glyph* glyph_; Allocation allocation_; }; declareList(TBScrollBoxList,TBScrollBoxInfo) implementList(TBScrollBoxList,TBScrollBoxInfo) class TBScrollBoxImpl { private: friend class TBScrollBox; ScrollBox* scrollbox_; GlyphIndex start_; GlyphIndex end_; bool changed_; Requisition requisition_; Canvas* canvas_; Transformer transformer_; Allocation allocation_; Extension extension_; TBScrollBoxList visible_; #if MAC #undef check #endif void check(Canvas*, const Allocation&); void refresh(); void reallocate(); void redraw(); void undraw_range(GlyphIndex begin, GlyphIndex end); }; TBScrollBox::TBScrollBox(GlyphIndex size) : ScrollBox(size) { impl_ = new TBScrollBoxImpl; TBScrollBoxImpl& sb = *impl_; sb.scrollbox_ = this; sb.start_ = 0; sb.end_ = 0; sb.changed_ = true; sb.canvas_ = nil; } TBScrollBox::~TBScrollBox() { delete impl_; } void TBScrollBox::request(Requisition& req) const { GlyphIndex n = count(); TBScrollBoxImpl& sb = *impl_; if (sb.changed_) { Requisition r; const Requirement& rx = r.x_requirement(); const Requirement& ry = r.y_requirement(); Coord natural_width = 0.0; Coord natural_height = 0.0; for (GlyphIndex i = 0; i < n; i++) { Glyph* g = component(i); if (g != nil) { g->request(r); Coord r_width = rx.natural(); if (r_width > natural_width) { natural_width = r_width; } natural_height += ry.natural(); } } Requirement& box_x = sb.requisition_.x_requirement(); box_x.natural(natural_width); box_x.stretch(fil); box_x.shrink(natural_width); box_x.alignment(0.0); Requirement& box_y = sb.requisition_.y_requirement(); box_y.natural(natural_height); box_y.stretch(fil); box_y.shrink(natural_height); box_y.alignment(1.0); sb.changed_ = false; } req = sb.requisition_; } void TBScrollBox::allocate(Canvas* c, const Allocation& a, Extension& ext) { TBScrollBoxImpl& sb = *impl_; if (sb.changed_) { Requisition req; request(req); } ext.set(c, a); sb.canvas_ = c; if (c != nil) { sb.transformer_ = c->transformer(); } sb.allocation_ = a; sb.extension_ = ext; sb.reallocate(); notify(Dimension_X); notify(Dimension_Y); } void TBScrollBox::draw(Canvas* c, const Allocation& a) const { TBScrollBoxImpl& sb = *impl_; sb.check(c, a); Extension& e = sb.extension_; if (sb.canvas_->damaged(e)) { if (sb.changed_) { sb.refresh(); } c->push_clipping(); c->clip_rect(a.left(), a.bottom(), a.right(), a.top()); for (ListItr(TBScrollBoxList) i(sb.visible_); i.more(); i.next()) { const TBScrollBoxInfo& info = i.cur_ref(); Glyph* g = info.glyph_; g->draw(c, info.allocation_); } c->pop_clipping(); } } void TBScrollBox::print(Printer* c, const Allocation& a) const { TBScrollBoxImpl& sb = *impl_; sb.check(c, a); Extension& e = sb.extension_; if (sb.canvas_->damaged(e)) { if (sb.changed_) { sb.refresh(); } c->push_clipping(); c->clip_rect(a.left(), a.bottom(), a.right(), a.top()); for (ListItr(TBScrollBoxList) i(sb.visible_); i.more(); i.next()) { const TBScrollBoxInfo& info = i.cur_ref(); Glyph* g = info.glyph_; g->print(c, info.allocation_); } c->pop_clipping(); } } void TBScrollBox::pick(Canvas* c, const Allocation& a, int depth, Hit& h) { TBScrollBoxImpl& sb = *impl_; sb.check(c, a); if (h.left() < a.right() && h.right() >= a.left() && h.bottom() < a.top() && h.top() >= a.bottom() ) { if (sb.changed_) { sb.refresh(); } GlyphIndex n = sb.start_; for (ListItr(TBScrollBoxList) i(sb.visible_); i.more(); i.next()) { const TBScrollBoxInfo& info = i.cur_ref(); Glyph* g = info.glyph_; h.begin(depth, this, n); g->pick(c, info.allocation_, depth + 1, h); h.end(); ++n; } } } void TBScrollBox::undraw() { impl_->canvas_ = nil; ScrollBox::undraw(); } void TBScrollBox::modified(GlyphIndex) { impl_->changed_ = true; } bool TBScrollBox::shown(GlyphIndex i) const { TBScrollBoxImpl& sb = impl(); return i >= sb.start_ && i < sb.end_; } GlyphIndex TBScrollBox::first_shown() const { TBScrollBoxImpl& sb = impl(); return sb.start_; } GlyphIndex TBScrollBox::last_shown() const { TBScrollBoxImpl& sb = impl(); return sb.end_ - 1; } void TBScrollBox::allotment( GlyphIndex i, DimensionName d, Allotment& a ) const { TBScrollBoxImpl& sb = impl(); if (i >= sb.start_ && i < sb.end_) { a = sb.visible_.item_ref(i - sb.start_).allocation_.allotment(d); } } Coord TBScrollBox::lower(DimensionName) const { return Coord(0); } Coord TBScrollBox::upper(DimensionName) const { return Coord(count() - 1); } Coord TBScrollBox::length(DimensionName) const { return Coord(count()); } Coord TBScrollBox::cur_lower(DimensionName) const { TBScrollBoxImpl& sb = impl(); return Coord(count() - sb.end_); } Coord TBScrollBox::cur_upper(DimensionName) const { TBScrollBoxImpl& sb = impl(); return Coord(count() - 1 - sb.start_); } Coord TBScrollBox::cur_length(DimensionName) const { TBScrollBoxImpl& sb = impl(); return Coord(sb.end_ - sb.start_); } void TBScrollBox::scroll_forward(DimensionName d) { scroll_by(d, -long(small_scroll(d))); } void TBScrollBox::scroll_backward(DimensionName d) { scroll_by(d, long(small_scroll(d))); } void TBScrollBox::page_forward(DimensionName d) { scroll_by(d, -long(large_scroll(d))); } void TBScrollBox::page_backward(DimensionName d) { scroll_by(d, long(large_scroll(d))); } void TBScrollBox::scroll_to(DimensionName d, Coord lower) { TBScrollBoxImpl& sb = impl(); GlyphIndex max_end = count(); GlyphIndex new_end = max_end - Math::round(lower); GlyphIndex new_start = new_end - sb.end_ + sb.start_; do_scroll(d, new_start, new_end); } TBScrollBoxImpl& TBScrollBox::impl() const { TBScrollBoxImpl& sb = *impl_; if (sb.changed_) { sb.refresh(); } return sb; } void TBScrollBox::scroll_by(DimensionName d, long offset) { TBScrollBoxImpl& sb = impl(); do_scroll(d, sb.start_ + offset, sb.end_ + offset); } void TBScrollBox::do_scroll( DimensionName d, GlyphIndex new_start, GlyphIndex new_end ) { TBScrollBoxImpl& sb = *impl_; GlyphIndex max_end = count(); if (new_start < 0) { new_start = 0; } if (new_end > max_end) { new_start -= (new_end - max_end); new_end = max_end; } if (new_start != sb.start_ || new_end != sb.end_) { sb.undraw_range(sb.start_, new_start - 1); GlyphIndex old_end = sb.end_; sb.start_ = new_start; sb.end_ = new_end; sb.reallocate(); sb.undraw_range(sb.end_, old_end - 1); sb.redraw(); notify(d); } } /* class TBScrollBoxImpl */ void TBScrollBoxImpl::check(Canvas* c, const Allocation& a) { if (canvas_ == nil || canvas_ != c || transformer_ != c->transformer() || !allocation_.equals(a, 1e-4) ) { Extension ext; scrollbox_->allocate(c, a, ext); } } void TBScrollBoxImpl::refresh() { Requisition req; scrollbox_->request(req); start_ = 0; reallocate(); redraw(); } void TBScrollBoxImpl::reallocate() { if (canvas_ == nil) { return; } ScrollBox* s = scrollbox_; GlyphIndex n = s->count(); end_ = n; TBScrollBoxList& list = visible_; list.remove_all(); Requisition req; TBScrollBoxInfo info; Extension e_i; const Requirement& r = req.y_requirement(); Coord p = allocation_.top(); Coord bottom = allocation_.bottom(); bool found_start = false; for (GlyphIndex i = start_; i < n; i++) { Glyph* g = s->component(i); if (g != nil) { g->request(req); Coord span = r.natural(); if (!Math::equal(span, Coord(0), float(1e-2))) { if (!found_start) { start_ = i; found_start = true; } Coord alignment = r.alignment(); p -= span; if (p < bottom) { end_ = i; break; } info.glyph_ = g; Allotment& ax = info.allocation_.x_allotment(); ax = allocation_.x_allotment(); Allotment& ay = info.allocation_.y_allotment(); ay.span(span); ay.origin(p + Coord(alignment * span)); ay.alignment(alignment); list.append(info); g->allocate(canvas_, info.allocation_, e_i); } } } } void TBScrollBoxImpl::redraw() { if (canvas_ != nil) { canvas_->damage(extension_); } } void TBScrollBoxImpl::undraw_range(GlyphIndex begin, GlyphIndex end) { ScrollBox* s = scrollbox_; for (GlyphIndex i = begin; i <= end; i++) { if (i >= 0 && i < s->count()) { Glyph* g = s->component(i); if (g != nil) { g->undraw(); } } } } neuron-7.6.3/src/lib/InterViews/shadow.cpp000066400000000000000000000110661340731477100204750ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Shadow - a shadowing Glyph */ #include #include #include #include #include Shadow::Shadow( Glyph* g, Coord x, Coord y, const Color* c, bool single ) : MonoGlyph(g) { x_offset_ = x; y_offset_ = y; color_ = c; Resource::ref(color_); single_ = single; } Shadow::~Shadow() { Resource::unref(color_); } void Shadow::request(Requisition& req) const { MonoGlyph::request(req); compute_requirement(req.x_requirement(), x_offset_); compute_requirement(req.y_requirement(), y_offset_); } void Shadow::compute_requirement(Requirement& r, Coord offset) const { if (r.defined()) { Coord n = r.natural(); if (offset > 0) { r.natural(n + offset); r.alignment(r.alignment() * n / r.natural()); } else { r.natural(n - offset); r.alignment((r.alignment() * n - offset) / r.natural()); } } } void Shadow::allocate(Canvas* c, const Allocation& a, Extension& ext) { Allocation b(a); compute_allocation(b); MonoGlyph::allocate(c, b, ext); ext.merge(c, a); } void Shadow::draw(Canvas* c, const Allocation& a) const { Allocation b(a); compute_allocation(b); if (!single_) { draw_shadow(c, b); draw_body(c, b); return; } Coord b_left = b.left(), s_left = b_left + x_offset_; Coord b_bottom = b.bottom(), s_bottom = b_bottom + y_offset_; Coord b_right = b.right(), s_right = b_right + x_offset_; Coord b_top = b.top(), s_top = b_top + y_offset_; Coord x1, y1, x2, y2, x3, y3, x4, y4; if (x_offset_ > 0) { x1 = s_left; x2 = s_right; x3 = b_right; x4 = s_right; } else { x1 = s_left; x2 = s_right; x3 = s_left; x4 = b_left; } if (y_offset_ > 0) { y1 = b_top; y2 = s_top; y3 = s_bottom; y4 = b_top; } else { y1 = s_bottom; y2 = b_bottom; y3 = b_bottom; y4 = s_top; } Extension e1, e2; e1.set_xy(c, x1, y1, x2, y2); e2.set_xy(c, x3, y3, x4, y4); if (!c->damaged(e1) && !c->damaged(e2)) { draw_body(c, b); return; } c->front_buffer(); draw_shadow(c, b); c->back_buffer(); Extension ext; ext.set(c, b); c->restrict_damage(ext); draw_body(c, b); } void Shadow::draw_shadow(Canvas* c, const Allocation& a) const { c->fill_rect( a.left() + x_offset_, a.bottom() + y_offset_, a.right() + x_offset_, a.top() + y_offset_, color_ ); } void Shadow::draw_body(Canvas* c, const Allocation& a) const { MonoGlyph::draw(c, a); } void Shadow::print(Printer* p, const Allocation& a) const { Allocation b(a); compute_allocation(b); p->fill_rect( b.left() + x_offset_, b.bottom() + y_offset_, b.right() + x_offset_, b.top() + y_offset_, color_ ); MonoGlyph::print(p, b); } void Shadow::pick(Canvas* c, const Allocation& a, int depth, Hit& h) { Allocation b(a); compute_allocation(b); MonoGlyph::pick(c, b, depth, h); } void Shadow::compute_allocation(Allocation& a) const { compute_allotment(a.x_allotment(), x_offset_); compute_allotment(a.y_allotment(), y_offset_); } void Shadow::compute_allotment(Allotment& a, Coord offset) const { Coord n = a.span(); if (offset > 0) { a.span(n - offset); a.alignment(a.alignment() * n / a.span()); } else { a.span(n + offset); a.alignment((a.alignment() * n + offset) / a.span()); } } neuron-7.6.3/src/lib/InterViews/simpcomp.cpp000066400000000000000000000047721340731477100210450ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include SimpleCompositor::SimpleCompositor() : Compositor() { } SimpleCompositor::~SimpleCompositor() { } CompositorIndex SimpleCompositor::compose( Coord* natural, Coord*, Coord*, int* penalties, CompositorIndex component_count, Coord* spans, CompositorIndex span_count, CompositorIndex* breaks, CompositorIndex break_count ) { Coord span = 0; bool breakable = false; CompositorIndex count = 0; int penalty; for (CompositorIndex i = 0; i < component_count; ++i) { if (i == component_count - 1) { penalty = PenaltyGood; span = fil; } else { penalty = penalties[i]; span += natural[i]; } if (penalty < PenaltyBad) { breakable = true; } if (span > spans[Math::min(count, long(span_count-1))]) { while (breakable && penalty == PenaltyBad) { --i; penalty = penalties[i]; } if (count < break_count) { breaks[count] = i; } span = 0; breakable = false; ++count; } } return Math::min(count, break_count); } neuron-7.6.3/src/lib/InterViews/slider.cpp000066400000000000000000000323471340731477100204770ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Slider - common slider behavior */ #include #include #include #include #include #include #include #include #include #include #include #include #include #define default_minimum_thumb_size 28.0 class SliderImpl { private: friend class Slider; Glyph* normal_thumb_; Glyph* visible_thumb_; Patch* thumb_patch_; Patch* old_thumb_; Coord min_thumb_size_; bool dragging_ : 1; bool aborted_ : 1; bool showing_old_thumb_ : 1; Stepper* forward_; Stepper* backward_; Stepper* stepper_; Coord xoffset_; Coord yoffset_; int hit_thumb(Slider*, const Event&); void get_position(Slider*, const Event&, Coord& x, Coord& y); }; Slider::Slider(Style* style) : ActiveHandler(nil, style) { SliderImpl* s = new SliderImpl; impl_ = s; s->normal_thumb_ = nil; s->visible_thumb_ = nil; s->thumb_patch_ = nil; s->old_thumb_ = nil; s->min_thumb_size_ = default_minimum_thumb_size; style->find_attribute("minimumThumbSize", s->min_thumb_size_); s->dragging_ = false; s->aborted_ = false; s->showing_old_thumb_ = false; s->forward_ = nil; s->backward_ = nil; s->stepper_ = nil; s->xoffset_ = 0.0; s->yoffset_ = 0.0; } Slider::~Slider() { SliderImpl* s = impl_; Resource::unref(s->normal_thumb_); Resource::unref(s->visible_thumb_); Resource::unref(s->old_thumb_); Resource::unref(s->thumb_patch_); Resource::unref(s->forward_); Resource::unref(s->backward_); delete s; } void Slider::normal_thumb(Glyph* g) { SliderImpl& s = *impl_; Resource::ref(g); Resource::unref(s.normal_thumb_); s.normal_thumb_ = g; Resource::unref(s.thumb_patch_); s.thumb_patch_ = new Patch(g); Resource::ref(s.thumb_patch_); } void Slider::visible_thumb(Glyph* g) { SliderImpl& s = *impl_; Resource::ref(g); Resource::unref(s.visible_thumb_); s.visible_thumb_ = g; } void Slider::old_thumb(Glyph* g) { SliderImpl& s = *impl_; Patch* patch = new Patch(g); Resource::ref(patch); Resource::unref(s.old_thumb_); s.old_thumb_ = patch; } Coord Slider::minimum_thumb_size() const { return impl_->min_thumb_size_; } void Slider::request(Requisition& req) const { Requirement default_size(22.0, fil, 22.0, 0.0); req.require(Dimension_X, default_size); req.require(Dimension_Y, default_size); } void Slider::allocate(Canvas* c, const Allocation& a, Extension& ext) { ext.merge(c, a); ActiveHandler::allocate(c, a, ext); } void Slider::draw(Canvas* c, const Allocation& a) const { SliderImpl& s = *impl_; c->push_clipping(); c->clip_rect(a.left(), a.bottom(), a.right(), a.top()); if (s.showing_old_thumb_) { s.old_thumb_->draw(c, s.old_thumb_->allocation()); } s.thumb_patch_->draw(c, s.thumb_patch_->allocation()); c->pop_clipping(); } void Slider::undraw() { SliderImpl& s = *impl_; if (s.thumb_patch_ != nil) { s.thumb_patch_->undraw(); } if (s.old_thumb_ != nil) { s.old_thumb_->undraw(); } ActiveHandler::undraw(); } void Slider::move(const Event& e) { SliderImpl& s = *impl_; if (s.visible_thumb_ != nil) { Glyph* g = (s.hit_thumb(this, e) == 0) ? s.visible_thumb_ : s.normal_thumb_; Patch& thumb = *s.thumb_patch_; if (thumb.body() != g) { thumb.body(g); thumb.reallocate(); thumb.redraw(); } } ActiveHandler::move(e); } void Slider::press(const Event& e) { EventButton b = e.pointer_button(); if (b == Event::right) { return; } Coord x, y; SliderImpl& s = *impl_; s.get_position(this, e, x, y); const Allocation& slider = allocation(); const Allocation& a = s.thumb_patch_->allocation(); int rel = s.hit_thumb(this, e); if (rel == 0) { apply_adjustment(&Adjustable::begin_adjustment); s.xoffset_ = slider.left() + x - a.left(); s.yoffset_ = slider.bottom() + y - a.bottom(); s.dragging_ = true; } else if (b == Event::left) { s.stepper_ = (rel == 1) ? s.forward_ : s.backward_; if (s.stepper_ != nil) { s.stepper_->start_stepping(); } } else { /* middle ==> drag */ apply_adjustment(&Adjustable::begin_adjustment); s.dragging_ = true; s.xoffset_ = slider.left() + (a.right() - a.left()) / 2.0; s.yoffset_ = slider.bottom() + (a.top() - a.bottom()) / 2.0; move_to(x - s.xoffset_, y - s.yoffset_); move(e); } } void Slider::drag(const Event& e) { SliderImpl& s = *impl_; if (!s.aborted_ && s.dragging_) { if (!s.showing_old_thumb_ && s.old_thumb_ != nil) { s.showing_old_thumb_ = true; Patch* p = s.thumb_patch_; Canvas* c = canvas(); c->push_transform(); c->transformer(transformer()); Extension ext; ext.clear(); s.old_thumb_->allocate(c, p->allocation(), ext); c->pop_transform(); } Coord x, y; s.get_position(this, e, x, y); move_to(x - s.xoffset_, y - s.yoffset_); } } void Slider::release(const Event& e) { SliderImpl& s = *impl_; if (s.dragging_) { if (s.showing_old_thumb_) { s.showing_old_thumb_ = false; s.old_thumb_->redraw(); } s.dragging_ = false; if (s.aborted_) { s.aborted_ = false; return; } Coord x, y; s.get_position(this, e, x, y); move_to(x - s.xoffset_, y - s.yoffset_); redraw_thumb(); move(e); apply_adjustment(&Adjustable::commit_adjustment); } else if (s.stepper_ != nil) { s.stepper_->stop_stepping(); s.stepper_ = nil; move(e); } } void Slider::allocation_changed(Canvas*, const Allocation& a) { allocate_thumb(a); } void Slider::update(Observable*) { if (canvas() != nil) { allocate_thumb(allocation()); } } void Slider::forward_stepper(Stepper* stepper) { SliderImpl& s = *impl_; Resource::ref(stepper); Resource::unref(s.forward_); s.forward_ = stepper; } void Slider::backward_stepper(Stepper* stepper) { SliderImpl& s = *impl_; Resource::ref(stepper); Resource::unref(s.backward_); s.backward_ = stepper; } void Slider::move_to(Coord, Coord) { } void Slider::allocate_thumb(const Allocation&) { } void Slider::apply_adjustment(SliderAdjustment) { } void Slider::do_adjustment( Adjustable* a, SliderAdjustment s, DimensionName d ) { if (a != nil) { (a->*s)(d); } } void Slider::allot_thumb_major_axis( const Allocation& slider, DimensionName d, Adjustable* adj, Coord min_thumb_size, float& scale, Allotment& new_a ) { const Allotment& a = slider.allotment(d); Coord length = adj->length(d); Coord cur_length = adj->cur_length(d); Coord slider_size = a.span(); Coord thumb_size; Coord thumb_start; if (Math::equal(length, float(0.0), float(1e-3)) || Math::equal(length, cur_length, float(1e-3)) ) { thumb_size = slider_size; thumb_start = 0.0; scale = 1.0; } else { thumb_size = slider_size * cur_length / length; if (thumb_size > slider_size) { thumb_size = slider_size; thumb_start = 0.0; scale = 1.0; } else { if (thumb_size < min_thumb_size) { thumb_size = min_thumb_size; } scale = (slider_size - thumb_size) / (length - cur_length); thumb_start = scale * (adj->cur_lower(d) - adj->lower(d)); } } new_a.origin(a.begin() + thumb_start); new_a.span(thumb_size); new_a.alignment(0.0); } void Slider::allot_thumb_minor_axis(const Allotment& a, Allotment& new_a) { new_a.origin(a.begin()); new_a.span(a.span()); new_a.alignment(0.0); } void Slider::redraw_thumb() { impl_->thumb_patch_->redraw(); } void Slider::reallocate_thumb(const Allocation& a) { Patch& thumb = *impl_->thumb_patch_; Canvas* c = canvas(); c->push_transform(); c->transformer(transformer()); Extension ext; ext.clear(); thumb.allocate(c, a, ext); c->pop_transform(); thumb.redraw(); } /* class SliderImpl */ int SliderImpl::hit_thumb(Slider* s, const Event& event) { Coord x = event.pointer_x(); Coord y = event.pointer_y(); const Extension& e = thumb_patch_->extension(); if (x >= e.left() && x < e.right() && y >= e.bottom() && y < e.top()) { Canvas* c = s->canvas(); const Transformer& t = s->transformer(); Hit hit(&event); hit.transform(t); c->push_transform(); c->transformer(t); thumb_patch_->pick(c, thumb_patch_->allocation(), 0, hit); c->pop_transform(); return hit.any() ? 0 : 1; } if (x < e.left() || y < e.bottom()) { return -1; } return 1; } void SliderImpl::get_position(Slider* s, const Event& e, Coord& x, Coord& y) { x = e.pointer_x(); y = e.pointer_y(); s->transformer().inverse_transform(x, y); } /* class XSlider */ XSlider::XSlider(Style* s, Adjustable* a) : Slider(s) { adjustable_ = a; a->attach(Dimension_X, this); TelltaleState* t = new TelltaleState; forward_stepper(new ForwardPager(nil, s, t, a, Dimension_X)); backward_stepper(new BackwardPager(nil, s, t, a, Dimension_X)); } XSlider::~XSlider() { if (adjustable_ != nil) { adjustable_->detach(Dimension_X, this); } } void XSlider::move_to(Coord x, Coord) { Adjustable* a = adjustable_; a->scroll_to(Dimension_X, a->lower(Dimension_X) + x / xscale_); } void XSlider::allocate_thumb(const Allocation& a) { redraw_thumb(); Allocation thumb_a; allot_thumb_major_axis( a, Dimension_X, adjustable_, minimum_thumb_size(), xscale_, thumb_a.x_allotment() ); allot_thumb_minor_axis(a.y_allotment(), thumb_a.y_allotment()); reallocate_thumb(thumb_a); } void XSlider::disconnect(Observable*) { adjustable_ = nil; } void XSlider::apply_adjustment(SliderAdjustment s) { do_adjustment(adjustable_, s, Dimension_X); } /* class YSlider */ YSlider::YSlider(Style* s, Adjustable* a) : Slider(s) { adjustable_ = a; a->attach(Dimension_Y, this); TelltaleState* t = new TelltaleState; forward_stepper(new ForwardPager(nil, s, t, a, Dimension_Y)); backward_stepper(new BackwardPager(nil, s, t, a, Dimension_Y)); } YSlider::~YSlider() { if (adjustable_ != nil) { adjustable_->detach(Dimension_Y, this); } } void YSlider::move_to(Coord, Coord y) { Adjustable* a = adjustable_; a->scroll_to(Dimension_Y, a->lower(Dimension_Y) + y / yscale_); } void YSlider::allocate_thumb(const Allocation& a) { redraw_thumb(); Allocation thumb_a; allot_thumb_major_axis( a, Dimension_Y, adjustable_, minimum_thumb_size(), yscale_, thumb_a.y_allotment() ); allot_thumb_minor_axis(a.x_allotment(), thumb_a.x_allotment()); reallocate_thumb(thumb_a); } void YSlider::disconnect(Observable*) { adjustable_ = nil; } void YSlider::apply_adjustment(SliderAdjustment s) { do_adjustment(adjustable_, s, Dimension_Y); } /* class XYSlider */ XYSlider::XYSlider(Style* s, Adjustable* x, Adjustable* y) : Slider(s) { x_adjustable_ = x; y_adjustable_ = y; x->attach(Dimension_X, this); y->attach(Dimension_Y, this); } XYSlider::~XYSlider() { if (x_adjustable_ != nil) { x_adjustable_->detach(Dimension_X, this); } if (y_adjustable_ != nil) { y_adjustable_->detach(Dimension_Y, this); } } void XYSlider::move_to(Coord x, Coord y) { Adjustable* x_adjust = x_adjustable_; Adjustable* y_adjust = y_adjustable_; x_adjust->scroll_to( Dimension_X, x_adjust->lower(Dimension_X) + x / xscale_ ); y_adjust->scroll_to( Dimension_Y, y_adjust->lower(Dimension_Y) + y / yscale_ ); } void XYSlider::allocate_thumb(const Allocation& a) { redraw_thumb(); Allocation thumb_a; allot_thumb_major_axis( a, Dimension_X, x_adjustable_, minimum_thumb_size(), xscale_, thumb_a.x_allotment() ); allot_thumb_major_axis( a, Dimension_Y, y_adjustable_, minimum_thumb_size(), yscale_, thumb_a.y_allotment() ); reallocate_thumb(thumb_a); } void XYSlider::disconnect(Observable*) { x_adjustable_ = nil; y_adjustable_ = nil; } void XYSlider::apply_adjustment(SliderAdjustment s) { do_adjustment(x_adjustable_, s, Dimension_X); do_adjustment(y_adjustable_, s, Dimension_Y); } neuron-7.6.3/src/lib/InterViews/smf_kit.cpp000066400000000000000000001160221340731477100206420ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991, 1992 Stanford University * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * SMFKit -- object for creating common SGI Motif controls */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static PropertyData kit_props[] = { { "*checkScale", "0.7" }, { "*flat", "#aaaaaa" }, { "*frameThickness", "2.0" }, { "*moverSize", "20.0" }, { "*radioScale", "0.9" }, { "*sliderSize", "20.0" }, { "*buttonBorder", "4.0" }, { "*arrowBorder", "6.0" }, { "*FileChooser*filter", "off" }, { "*FieldEditor*beveled", "on" }, { "*FieldEditor*background", "#b88d8d" }, { "*FieldEditor*flat", "#b88d8d" }, #if defined(WIN32) { "*MenuBar*font", "*Arial*bold*--14*" }, { "*MenuItem*font", "*Arial*bold*--14*" }, #else #if MAC { "*MenuBar*font", "*-helvetica-bold-o-normal--14-140-*" }, { "*MenuItem*font", "*-helvetica-bold-o-normal--14-140-*" }, #else { "*MenuBar*font", "*-helvetica-bold-o-normal--14-140-*" }, { "*MenuItem*font", "*-helvetica-bold-o-normal--14-140-*" }, #endif #endif { "*PaletteButton*minimumWidth", "72.0" }, { "*Panner*minimumThumbSize", "18.0" }, { "*PushButton*minimumWidth", "72.0" }, { "*ScrollBar*minimumThumbSize", "28.0" }, { "*ScrollBar*thumbRidges", "3" }, { "*Slider*thumbRidges", "1" }, { nil } }; static Coord button_border; static Coord arrow_border; #ifdef MAC #define shadow shadow_a #endif static const int black = 0; static const int very_dark_gray = 1; static const int dark_gray = 2; static const int medium_gray = 3; static const int light_gray = 4; static const int very_light_gray = 5; static const int white = 6; static const int gray_out = 7; static const int shadow = 8; static const int yellow = 9; static const int light_yellow = 10; static const int dark_yellow = 11; static const int medium_yellow = 12; static const int num_colors = 13; #if MAC static const unsigned int checkmark_width = 8; static const unsigned int checkmark_height = 8; #else static const unsigned int checkmark_width = 32; static const unsigned int checkmark_height = 12; #endif static unsigned char checkmark_bits[] = { 0x00, 0x00, 0x3e, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x04, 0xf0, 0x03, 0x00, 0x1e, 0xf8, 0x00, 0x00, 0x3f, 0x3e, 0x00, 0x00, 0xbf, 0x1f, 0x00, 0x00, 0xf8, 0x07, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static const unsigned int shadow1_width = 32; static const unsigned int shadow1_height = 13; static unsigned char shadow1_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x07, 0x38, 0x00, 0x00, 0x0f, 0x1c, 0x00, 0x00, 0x08, 0x06, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00 }; static const unsigned int shadow2_width = 32; static const unsigned int shadow2_height = 5; static unsigned char shadow2_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x03, 0x00 }; class SMFKitInfo : public Resource { public: SMFKitInfo(Style*); virtual ~SMFKitInfo(); Style* style() const; Coord thickness() const; float check_scale() const; float radio_scale() const; Coord mover_size() const; Coord slider_size() const; const Color* color(int) const; Stencil* checkmark() const; Stencil* shadow1() const; Stencil* shadow2() const; private: Style* style_; Coord thickness_; float check_scale_; float radio_scale_; Coord mover_size_; Coord slider_size_; const Color* color_[num_colors]; Stencil* checkmark_; Stencil* shadow1_; Stencil* shadow2_; void load(); void unload(); void update(); }; inline Style* SMFKitInfo::style() const { return style_; } inline Coord SMFKitInfo::thickness() const { return thickness_; } inline float SMFKitInfo::check_scale() const { return check_scale_; } inline float SMFKitInfo::radio_scale() const { return radio_scale_; } inline Coord SMFKitInfo::mover_size() const { return mover_size_; } inline Coord SMFKitInfo::slider_size() const { return slider_size_; } inline const Color* SMFKitInfo::color(int c) const { return color_[c]; } inline Stencil* SMFKitInfo::checkmark() const { return checkmark_; } inline Stencil* SMFKitInfo::shadow1() const { return shadow1_; } inline Stencil* SMFKitInfo::shadow2() const { return shadow2_; } declarePtrList(SMFKitInfoList,SMFKitInfo) implementPtrList(SMFKitInfoList,SMFKitInfo) static inline TelltaleFlags flags(TelltaleState* t) { return t->flags() & TelltaleState::is_enabled_visible_active_chosen; } class SMFKitFrame : public BevelFrame { public: SMFKitFrame( Glyph*, TelltaleState*, SMFKitInfo*, Coord thickness, float xalign = 0.5, float yalign = 0.5, bool hmargin = true, bool vmargin = true ); virtual ~SMFKitFrame(); TelltaleState* state() const; const SMFKitInfo& info() const; virtual void draw(Canvas*, const Allocation&) const; virtual void draw_frame(Canvas*, const Allocation&, Coord) const; private: TelltaleState* state_; SMFKitInfo* info_; }; inline TelltaleState* SMFKitFrame::state() const { return state_; } inline const SMFKitInfo& SMFKitFrame::info() const { return *info_; } class SMFKitButtonFrame : public SMFKitFrame { public: SMFKitButtonFrame( Glyph*, TelltaleState*, SMFKitInfo*, Coord thickness = button_border, float xalign = 0.5, float yalign = 0.5 ); virtual ~SMFKitButtonFrame(); virtual void pick(Canvas*, const Allocation&, int depth, Hit&); virtual void draw_frame(Canvas*, const Allocation&, Coord) const; }; class SMFKitPushButtonFrame : public SMFKitButtonFrame { public: SMFKitPushButtonFrame( Glyph*, TelltaleState*, SMFKitInfo*, Style*, Coord thickness = button_border, float xalign = 0.5, float yalign = 0.5 ); virtual ~SMFKitPushButtonFrame(); virtual void request(Requisition&) const; private: Coord minwidth_; }; class SMFKitMenuItemFrame : public SMFKitButtonFrame { public: SMFKitMenuItemFrame(Glyph*, TelltaleState*, SMFKitInfo*); virtual ~SMFKitMenuItemFrame(); virtual void draw_frame(Canvas*, const Allocation&, Coord) const; }; class SMFKitGlyph : public Glyph { public: SMFKitGlyph(SMFKitInfo*); virtual ~SMFKitGlyph(); const SMFKitInfo& info() const; virtual void allocate(Canvas*, const Allocation&, Extension&); private: SMFKitInfo* info_; }; inline const SMFKitInfo& SMFKitGlyph::info() const { return *info_; } class SMFKitCheckmark : public SMFKitGlyph { public: SMFKitCheckmark(TelltaleState*, SMFKitInfo*, const Font*); virtual ~SMFKitCheckmark(); virtual void request(Requisition&) const; virtual void draw(Canvas*, const Allocation&) const; private: TelltaleState* state_; const Font* font_; }; class SMFKitIndicator : public SMFKitGlyph { public: SMFKitIndicator(TelltaleState*, SMFKitInfo*); virtual ~SMFKitIndicator(); virtual void request(Requisition&) const; virtual void draw(Canvas*, const Allocation&) const; private: TelltaleState* state_; }; class SMFKitRadioFlag : public SMFKitGlyph { public: SMFKitRadioFlag(TelltaleState*, SMFKitInfo*, const Font*); virtual ~SMFKitRadioFlag(); TelltaleState* state() const; virtual void request(Requisition&) const; virtual void draw(Canvas*, const Allocation&) const; private: TelltaleState* state_; const Font* font_; }; inline TelltaleState* SMFKitRadioFlag::state() const { return state_; } class SMFKitRadioItem : public SMFKitRadioFlag { public: SMFKitRadioItem(TelltaleState*, SMFKitInfo*, const Font*); virtual ~SMFKitRadioItem(); virtual void draw(Canvas*, const Allocation&) const; }; class SMFKitDefaultArrow : public SMFKitGlyph { public: SMFKitDefaultArrow(const Font*, SMFKitInfo*); virtual ~SMFKitDefaultArrow(); virtual void request(Requisition&) const; virtual void draw(Canvas*, const Allocation&) const; private: const Font* font_; }; class SMFKitThumb : public SMFKitGlyph { public: SMFKitThumb(DimensionName, SMFKitInfo*, long ridges, const TelltaleFlags); virtual ~SMFKitThumb(); virtual void draw(Canvas*, const Allocation&) const; private: DimensionName dimension_; long ridges_; TelltaleFlags flags_; }; class SMFKitImpl { public: static void shade( Canvas*, const Allocation&, const SMFKitInfo&, const int* colors, int ncolors, Coord* ); private: friend class SMFKit; SMFKit* kit_; LayoutKit* layout_; SMFKitInfo* info_; SMFKitInfoList info_list_; SMFKitImpl(SMFKit*); ~SMFKitImpl(); bool match(const Style&, const Style&, const char*); void make_thumb(Slider*, DimensionName, SMFKitInfo*); }; SMFKit::SMFKit() { impl_ = new SMFKitImpl(this); Style* s = Session::instance()->style(); for (PropertyData* p = kit_props; p->path != nil; p++) { s->attribute(p->path, p->value, -10); } } SMFKit::~SMFKit() { delete impl_; } const char* SMFKit::gui() const { return "SGIMotif"; } static const char* style_attributes[] = { "flat", "frameThickness", "moverSize", "sliderSize", nil }; void SMFKit::style_changed(Style* style) { SMFKitImpl& i = *impl_; for (ListItr(SMFKitInfoList) s(i.info_list_); s.more(); s.next()) { SMFKitInfo* info = s.cur(); if (info->style() == style) { i.info_ = info; return; } } const Style& s1 = *style; for (ListItr(SMFKitInfoList) t(i.info_list_); t.more(); t.next()) { SMFKitInfo* info = t.cur(); const Style& s2 = *info->style(); for (const char** p = style_attributes; ; p++) { if (*p == nil) { i.info_ = info; return; } if (!i.match(s1, s2, *p)) { break; } } } i.info_ = new SMFKitInfo(style); Resource::ref(i.info_); i.info_list_.append(i.info_); } MonoGlyph* SMFKit::outset_frame(Glyph* g) const { SMFKitInfo* i = impl_->info_; return new SMFKitFrame( g, new TelltaleState(TelltaleState::is_enabled_active), i, i->thickness() ); } MonoGlyph* SMFKit::inset_frame(Glyph* g) const { SMFKitInfo* i = impl_->info_; return new SMFKitFrame( g, new TelltaleState(TelltaleState::is_enabled_chosen), i, i->thickness() ); } MonoGlyph* SMFKit::bright_inset_frame(Glyph* g) const { SMFKitInfo* i = impl_->info_; return new SMFKitFrame( g, new TelltaleState(TelltaleState::is_enabled_visible_active), i, 0.5 * i->thickness(), 0.0, 0.0, false, false ); } Glyph* SMFKit::menubar_look() const { SMFKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; return outset_frame(layout.r_margin(layout.hbox(), 0.0, fil, 0.0)); } Glyph* SMFKit::pulldown_look() const { SMFKitImpl& k = *impl_; const LayoutKit& layout = *k.layout_; const SMFKitInfo& i = *k.info_; #if defined(WIN32) || MAC return outset_frame(layout.vbox()); #else return layout.t_margin( new Shadow( outset_frame(layout.vbox()), 6, -6, i.color(shadow), true ), 4 ); #endif } Glyph* SMFKit::pullright_look() const { SMFKitImpl& k = *impl_; const LayoutKit& layout = *k.layout_; const SMFKitInfo& i = *k.info_; #if defined(WIN32) || MAC return outset_frame(layout.vbox()); #else return new Shadow( outset_frame(layout.vbox()), 6, -6, i.color(shadow), true ); #endif } Glyph* SMFKit::menubar_item_look(Glyph* g, TelltaleState* t) const { SMFKitImpl& k = *impl_; const LayoutKit& layout = *k.layout_; return new SMFKitMenuItemFrame(layout.h_margin(g, 4.0), t, k.info_); } Glyph* SMFKit::menu_item_look(Glyph* g, TelltaleState* t) const { SMFKitImpl& k = *impl_; return new SMFKitMenuItemFrame(g, t, k.info_); } Glyph* SMFKit::check_menu_item_look(Glyph* g, TelltaleState* t) const { SMFKitImpl& k = *impl_; const LayoutKit& layout = *k.layout_; SMFKitInfo* i = k.info_; return new SMFKitMenuItemFrame( layout.hbox(new SMFKitCheckmark(t, i, font()), layout.hspace(6.0), g), t, i ); } Glyph* SMFKit::radio_menu_item_look(Glyph* g, TelltaleState* t) const { SMFKitImpl& k = *impl_; const LayoutKit& layout = *k.layout_; SMFKitInfo* i = k.info_; return new SMFKitMenuItemFrame( layout.hbox(new SMFKitRadioItem(t, i, font()), layout.hspace(2.0), g), t, i ); } Glyph* SMFKit::menu_item_separator_look() const { SMFKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; return layout.v_margin( layout.v_fixed_span( layout.h_margin(inset_frame(nil), 3.0), 3.0 ), 2.0 ); } Glyph* SMFKit::push_button_look(Glyph* g, TelltaleState* t) const { SMFKitImpl& i = *impl_; return new SMFKitPushButtonFrame(g, t, i.info_, style()); } Glyph* SMFKit::default_button_look(Glyph* g, TelltaleState* t) const { SMFKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; Glyph* arrow = new SMFKitDefaultArrow(font(), i.info_); return push_button_look(layout.hbox(g, layout.hspace(3.0), arrow), t); } Glyph* SMFKit::check_box_look(Glyph* g, TelltaleState* t) const { SMFKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; return layout.hbox( layout.vcenter( new SMFKitButtonFrame( new SMFKitCheckmark(t, i.info_, font()), t, i.info_ ) ), layout.hspace(6.0), layout.vcenter(g) ); } Glyph* SMFKit::palette_button_look(Glyph* g, TelltaleState* t) const { SMFKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; return new SMFKitPushButtonFrame( layout.hbox( layout.hspace(3.0), new SMFKitIndicator(t, i.info_), layout.hspace(6.0), g ), t, i.info_, style(), button_border, 0.0, 0.5 ); } Glyph* SMFKit::radio_button_look(Glyph* g, TelltaleState* t) const { SMFKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; SMFKitInfo* info = i.info_; return layout.hbox( layout.vcenter( new SMFKitRadioFlag(t, info, font()) ), layout.hspace(6.0), layout.vcenter(g) ); } Glyph* SMFKit::slider_look(DimensionName d, Adjustable* a) const { SMFKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; SMFKitInfo* info = i.info_; Glyph* g; Slider* slider; switch (d) { case Dimension_X: slider = new XSlider(style(), a); g = layout.v_fixed_span(slider, info->slider_size()); break; case Dimension_Y: slider = new YSlider(style(), a); g = layout.h_fixed_span(slider, info->slider_size()); break; default: return nil; } i.make_thumb(slider, d, info); return new SMFKitFrame( g, new TelltaleState(TelltaleState::is_enabled), info, info->thickness() ); } Glyph* SMFKit::scroll_bar_look(DimensionName d, Adjustable* a) const { SMFKitImpl& i = *impl_; const LayoutKit& layout = *i.layout_; SMFKitInfo* info = i.info_; Glyph* g, * box, * mover1, * mover2; Slider* slider; Coord xspan, yspan; bool hmargin, vmargin; switch (d) { case Dimension_X: xspan = info->mover_size(); yspan = info->slider_size(); box = layout.hbox(); g = layout.v_fixed_span(box, yspan); mover1 = left_mover(a); slider = new XSlider(style(), a); mover2 = right_mover(a); hmargin = false; vmargin = true; break; case Dimension_Y: xspan = info->slider_size(); yspan = info->mover_size(); box = layout.vbox(); g = layout.h_fixed_span(box, xspan); mover1 = up_mover(a); slider = new YSlider(style(), a); mover2 = down_mover(a); hmargin = true; vmargin = false; break; default: return nil; } TelltaleState* t = new TelltaleState(TelltaleState::is_enabled); box->append(layout.fixed_span(mover1, xspan, yspan)); i.make_thumb(slider, d, info); box->append( new SMFKitFrame( slider, t, info, info->thickness(), 0.0, 0.0, hmargin, vmargin ) ); box->append(layout.fixed_span(mover2, xspan, yspan)); return g; } Glyph* SMFKit::panner_look(Adjustable* x, Adjustable* y) const { SMFKitImpl& k = *impl_; SMFKitInfo* i = k.info_; Slider* s = new XYSlider(style(), x, y); k.make_thumb(s, Dimension_Undefined, i); return s; } Glyph* SMFKit::enlarger_look(TelltaleState*) const { /* unimplemented */ return nil; } Glyph* SMFKit::reducer_look(TelltaleState*) const { /* unimplemented */ return nil; } Glyph* SMFKit::up_mover_look(TelltaleState* t) const { SMFKitImpl& i = *impl_; return new SMFKitButtonFrame( new UpArrow(i.info_->color(dark_gray)), t, i.info_, arrow_border ); } Glyph* SMFKit::down_mover_look(TelltaleState* t) const { SMFKitImpl& i = *impl_; return new SMFKitButtonFrame( new DownArrow(i.info_->color(dark_gray)), t, i.info_, arrow_border ); } Glyph* SMFKit::left_mover_look(TelltaleState* t) const { SMFKitImpl& i = *impl_; return new SMFKitButtonFrame( new LeftArrow(i.info_->color(dark_gray)), t, i.info_, arrow_border ); } Glyph* SMFKit::right_mover_look(TelltaleState* t) const { SMFKitImpl& i = *impl_; return new SMFKitButtonFrame( new RightArrow(i.info_->color(dark_gray)), t, i.info_, arrow_border ); } /* class SMFKitImpl */ SMFKitImpl::SMFKitImpl(SMFKit* k) { kit_ = k; layout_ = LayoutKit::instance(); } SMFKitImpl::~SMFKitImpl() { for (ListItr(SMFKitInfoList) i(info_list_); i.more(); i.next()) { SMFKitInfo* info = i.cur(); Resource::unref(info); } } bool SMFKitImpl::match(const Style& s1, const Style& s2, const char* n) { String name(n); String v1, v2; bool b1 = s1.find_attribute(n, v1); bool b2 = s2.find_attribute(n, v2); return (!b1 && !b2) || (b1 && b2 && v1 == v2); } void SMFKitImpl::make_thumb(Slider* s, DimensionName d, SMFKitInfo* i) { long r = 0; kit_->style()->find_attribute("thumbRidges", r); s->normal_thumb(new SMFKitThumb(d, i, r, TelltaleState::is_enabled)); s->visible_thumb(new SMFKitThumb(d, i, r, TelltaleState::is_visible)); s->old_thumb( new SMFKitFrame( nil, new TelltaleState(TelltaleState::is_enabled_active_chosen), i, i->thickness() ) ); } void SMFKitImpl::shade( Canvas* c, const Allocation& a, const SMFKitInfo& info, const int* colors, int ncolors, Coord* t ) { Coord x0 = a.left(), y0 = a.bottom(), x1 = a.right(), y1 = a.top(); int nbands = (ncolors - 1) >> 1; int b = nbands - 1; int n = ncolors - 1; for (int i = 0; i < b; i++) { Coord t1 = t[i]; Bevel::rect( c, info.color(colors[i]), nil, info.color(colors[n-i]), t1, x0, y0, x1, y1 ); x0 += t1; y0 += t1; x1 -= t1; y1 -= t1; } Bevel::rect( c, info.color(colors[b]), info.color(colors[nbands]), info.color(colors[nbands+1]), t[b], x0, y0, x1, y1 ); } /* class SMFKitInfo */ SMFKitInfo::SMFKitInfo(Style* style) { style_ = style; Resource::ref(style_); load(); } SMFKitInfo::~SMFKitInfo() { unload(); Resource::unref(style_); } void SMFKitInfo::load() { Display* d = Session::instance()->default_display(); const Style& s = *style_; s.find_attribute("frameThickness", thickness_); s.find_attribute("checkScale", check_scale_); s.find_attribute("radioScale", radio_scale_); s.find_attribute("moverSize", mover_size_); s.find_attribute("sliderSize", slider_size_); s.find_attribute("buttonBorder", button_border); s.find_attribute("arrowBorder", arrow_border); String v; s.find_attribute("flat", v); const Color* c = Color::lookup(d, v); if (c == nil) { c = new Color(0.7, 0.7, 0.7, 1.0); } color_[black] = c->brightness(-0.85); color_[very_dark_gray] = c->brightness(-0.66); color_[dark_gray] = c->brightness(-0.5); color_[medium_gray] = c->brightness(-0.33); color_[light_gray] = c; color_[very_light_gray] = c->brightness(0.45); color_[white] = c->brightness(0.7); color_[gray_out] = new Color(*c, 0.2); color_[shadow] = new Color(*color_[black], 0.5); color_[yellow] = new Color(1.0, 1.0, 0.0, 1.0); color_[light_yellow] = new Color(1.0, 1.0, 0.875, 1.0); color_[medium_yellow] = color_[yellow]->brightness(-0.3); color_[dark_yellow] = color_[yellow]->brightness(-0.5); for (int i = 0; i < num_colors; i++) { Resource::ref(color_[i]); } v = "red3"; s.find_attribute("checkmarkColor", v); const Color* checkmark_color = Color::lookup(d, v); if (checkmark_color == nil) { checkmark_color = new Color(0.9, 0.0, 0.0, 1.0); } checkmark_ = new Stencil( new Bitmap(checkmark_bits, checkmark_width, checkmark_height, 0, 13), checkmark_color ); shadow1_ = new Stencil( new Bitmap(shadow1_bits, shadow1_width, shadow1_height, 0, 13), color_[dark_gray] ); /* * Originally was light_gray, but that only looks reasonable * on certain backgrounds. */ shadow2_ = new Stencil( new Bitmap(shadow2_bits, shadow2_width, shadow2_height, 0, 13), color_[dark_gray] ); Resource::ref(checkmark_); Resource::ref(shadow1_); Resource::ref(shadow2_); } void SMFKitInfo::unload() { for (int i = 0; i < num_colors; i++) { Resource::unref(color_[i]); } Resource::unref(checkmark_); Resource::unref(shadow1_); Resource::unref(shadow2_); } void SMFKitInfo::update() { unload(); load(); } /* class SMFKitFrame */ SMFKitFrame::SMFKitFrame( Glyph* g, TelltaleState* t, SMFKitInfo* info, Coord thickness, float xalign, float yalign, bool hmargin, bool vmargin ) : BevelFrame(g, thickness, xalign, yalign, hmargin, vmargin) { state_ = t; Resource::ref(state_); info_ = info; Resource::ref(info_); } SMFKitFrame::~SMFKitFrame() { Resource::unref(state_); Resource::unref(info_); } void SMFKitFrame::draw(Canvas* c, const Allocation& a) const { BevelFrame::draw(c, a); if (!state()->test(TelltaleState::is_enabled)) { const SMFKitInfo& i = info(); Coord t = i.thickness(); c->fill_rect( a.left() + t, a.bottom() + t, a.right() - t, a.top() - t, i.color(gray_out) ); } } static int inset_colors[] = { dark_gray, very_dark_gray, light_gray, very_light_gray, white }; static int bright_inset_colors[] = { dark_gray, very_light_gray, white }; static int outset_colors[] = { black, white, light_gray, medium_gray, black }; static int trough_colors[] = { dark_gray, very_light_gray, light_gray, dark_gray, very_dark_gray }; static int visible_trough_colors[] = { medium_gray, white, very_light_gray, medium_gray, dark_gray }; static int old_thumb_colors[] = { very_dark_gray, dark_gray, medium_gray, light_gray, very_light_gray }; static int* frame_colors[] = { /* 0 */ nil, /* is_enabled */ trough_colors, /* is_visible */ nil, /* is_enabled_visible */ visible_trough_colors, /* is_active */ nil, /* is_enabled_active */ outset_colors, /* is_visible_active */ nil, /* is_enabled_visible_active */ bright_inset_colors, /* is_chosen */ nil, /* is_enabled_chosen */ inset_colors, /* is_visible_chosen */ nil, /* is_enabled_visible_chosen */ nil, /* is_active_chosen */ nil, /* is_enabled_active_chosen */ old_thumb_colors, /* is_visible_active_chosen */ nil, /* is_enabled_visible_active_chosen */ nil }; void SMFKitFrame::draw_frame( Canvas* canvas, const Allocation& a, Coord thickness ) const { const SMFKitInfo& i = info(); int* colors = frame_colors[flags(state())]; if (colors == nil) { canvas->fill_rect( a.left(), a.bottom(), a.right(), a.top(), i.color(light_gray) ); } else { int ncolors; Coord t[2]; if (colors == bright_inset_colors) { ncolors = 3; t[0] = thickness; } else { ncolors = 5; Coord tt = 0.5 * thickness; t[0] = tt; t[1] = tt; } SMFKitImpl::shade(canvas, a, i, colors, ncolors, t); } } /* class SMFKitButtonFrame */ SMFKitButtonFrame::SMFKitButtonFrame( Glyph* g, TelltaleState* t, SMFKitInfo* info, Coord thickness, float xalign, float yalign ) : SMFKitFrame(g, t, info, thickness, xalign, yalign, true, true) { } SMFKitButtonFrame::~SMFKitButtonFrame() { } void SMFKitButtonFrame::pick(Canvas*, const Allocation& a, int depth, Hit& h) { Coord x = h.left(); Coord y = h.bottom(); if (x >= a.left() && x < a.right() && y >= a.bottom() && y < a.top()) { h.target(depth, this, 0); } } static int disabled_button_colors[] = { medium_gray, light_gray, light_gray, light_gray, light_gray, light_gray, dark_gray }; static int enabled_button_colors[] = { dark_gray, white, very_light_gray, light_gray, medium_gray, dark_gray, very_dark_gray }; static int visible_button_colors[] = { dark_gray, white, white, very_light_gray, light_gray, dark_gray, very_dark_gray }; static int active_button_colors[] = { very_dark_gray, dark_gray, very_light_gray, light_gray, light_gray, black, white }; static int visible_active_button_colors[] = { very_dark_gray, dark_gray, white, very_light_gray, light_gray, black, white }; static int* button_colors[] = { /* 0 */ disabled_button_colors, /* is_enabled */ enabled_button_colors, /* is_visible */ disabled_button_colors, /* is_enabled_visible */ visible_button_colors, /* is_active */ disabled_button_colors, /* is_enabled_active */ active_button_colors, /* is_visible_active */ disabled_button_colors, /* is_enabled_visible_active */ visible_active_button_colors, /* is_chosen */ disabled_button_colors, /* is_enabled_chosen */ enabled_button_colors, /* is_visible_chosen */ disabled_button_colors, /* is_enabled_visible_chosen */ visible_button_colors, /* is_active_chosen */ disabled_button_colors, /* is_enabled_active_chosen */ active_button_colors, /* is_visible_active_chosen */ disabled_button_colors, /* is_enabled_visible_active_chosen */ visible_active_button_colors }; void SMFKitButtonFrame::draw_frame( Canvas* c, const Allocation& a, Coord ) const { Coord t1 = c->to_pixels_coord(1.0); Coord t[3]; t[0] = t1; t[1] = t1; t[2] = t1 + t1; SMFKitImpl::shade(c, a, info(), button_colors[flags(state())], 7, t); } /* class SMFKitPushButtonFrame */ SMFKitPushButtonFrame::SMFKitPushButtonFrame( Glyph* g, TelltaleState* t, SMFKitInfo* info, Style* s, Coord thickness, float xalign, float yalign ) : SMFKitButtonFrame(g, t, info, thickness, xalign, yalign) { minwidth_ = 72.0; s->find_attribute("minimumWidth", minwidth_); } SMFKitPushButtonFrame::~SMFKitPushButtonFrame() { } void SMFKitPushButtonFrame::request(Requisition& req) const { SMFKitButtonFrame::request(req); Requirement& rx = req.x_requirement(); Coord width = rx.natural() + button_border; if (width < minwidth_) { width = minwidth_; } rx.natural(width); Requirement& ry = req.y_requirement(); ry.natural(ry.natural() + button_border); } /* class SMFKitMenuItemFrame */ SMFKitMenuItemFrame::SMFKitMenuItemFrame( Glyph* g, TelltaleState* t, SMFKitInfo* info ) : SMFKitButtonFrame(g, t, info, info->thickness()) { } SMFKitMenuItemFrame::~SMFKitMenuItemFrame() { } void SMFKitMenuItemFrame::draw_frame( Canvas* c, const Allocation& a, Coord thickness ) const { const SMFKitInfo& i = info(); TelltaleState* t = state(); if (t->test(TelltaleState::is_active) || t->test(TelltaleState::is_running) ) { int* colors = outset_colors; Coord t[2]; Coord tt = 0.5 * thickness; t[0] = tt; t[1] = tt; SMFKitImpl::shade(c, a, i, colors, 5, t); } else { c->fill_rect( a.left(), a.bottom(), a.right(), a.top(), i.color(light_gray) ); } } /* class SMFKitGlyph */ SMFKitGlyph::SMFKitGlyph(SMFKitInfo* i) { info_ = i; Resource::ref(info_); } SMFKitGlyph::~SMFKitGlyph() { Resource::unref(info_); } void SMFKitGlyph::allocate(Canvas* c, const Allocation& a, Extension& ext) { ext.merge(c, a); } /* class SMFKitCheckmark */ SMFKitCheckmark::SMFKitCheckmark( TelltaleState* t, SMFKitInfo* info, const Font* f ) : SMFKitGlyph(info) { state_ = t; Resource::ref(state_); font_ = f; Resource::ref(font_); } SMFKitCheckmark::~SMFKitCheckmark() { Resource::unref(state_); Resource::unref(font_); } void SMFKitCheckmark::request(Requisition& req) const { FontBoundingBox b; font_->font_bbox(b); Coord size = (b.font_ascent() + b.font_descent()) * info().check_scale(); req.x_requirement().natural(size); req.y_requirement().natural(size); } void SMFKitCheckmark::draw(Canvas* c, const Allocation& a) const { if (state_->test(TelltaleState::is_chosen)) { #if MAC info().checkmark()->draw(c, a); #else #if !defined(CYGWIN) && !defined(MINGW) //printf("SMFKitCheckmark::draw %g %g %g %g %g %g\n", a.x(), a.y(), //a.left(), a.right(), a.bottom(), a.top()); Allocation a1; c->push_transform(); Transformer t; float s = (a.right() - a.left())/11.; // if (s < 1) { t.scale(s, s); t.translate(a.x(), a.y()); // }else{//suggested by Mike Neubig // t.scale(1., 1.); // t.translate((a.right()+a.left()-13)/2.0, (a.top()+a.bottom()-13)/2.0); // } c->transform(t); info().shadow1()->draw(c, a1); info().shadow2()->draw(c, a1); info().checkmark()->draw(c, a1); c->pop_transform(); #else info().shadow1()->draw(c, a); info().shadow2()->draw(c, a); info().checkmark()->draw(c, a); #endif #endif } } /* class SMFKitIndicator */ SMFKitIndicator::SMFKitIndicator( TelltaleState* t, SMFKitInfo* i ) : SMFKitGlyph(i) { state_ = t; Resource::ref(state_); } SMFKitIndicator::~SMFKitIndicator() { Resource::unref(state_); } void SMFKitIndicator::request(Requisition& req) const { req.x_requirement().natural(6.0); } static int disabled_indicator_colors[] = { dark_gray, medium_gray, white }; static int disabled_chosen_indicator_colors[] = { dark_gray, light_yellow, white }; static int enabled_indicator_colors[] = { black, dark_yellow, white }; static int active_indicator_colors[] = { black, yellow, white }; static int visible_indicator_colors[] = { black, medium_yellow, white }; static int* indicator_colors[] = { /* 0 */ disabled_indicator_colors, /* is_enabled */ enabled_indicator_colors, /* is_visible */ disabled_indicator_colors, /* is_enabled_visible */ visible_indicator_colors, /* is_active */ disabled_indicator_colors, /* is_enabled_active */ enabled_indicator_colors, /* is_visible_active */ disabled_indicator_colors, /* is_enabled_visible_active */ visible_indicator_colors, /* is_chosen */ disabled_chosen_indicator_colors, /* is_enabled_chosen */ active_indicator_colors, /* is_visible_chosen */ disabled_chosen_indicator_colors, /* is_enabled_visible_chosen */ active_indicator_colors, /* is_active_chosen */ disabled_chosen_indicator_colors, /* is_enabled_active_chosen */ active_indicator_colors, /* is_visible_active_chosen */ disabled_chosen_indicator_colors, /* is_enabled_visible_active_chosen */ active_indicator_colors }; void SMFKitIndicator::draw(Canvas* canvas, const Allocation& a) const { const SMFKitInfo& i = info(); int* c = indicator_colors[flags(state_)]; Coord t1 = canvas->to_pixels_coord(1.0); Coord t2 = t1 + t1; Bevel::rect( canvas, i.color(c[0]), i.color(c[1]), i.color(c[2]), t1, a.left(), a.bottom() + t2, a.right(), a.top() - t2 ); } /* class SMFKitRadioFlag */ SMFKitRadioFlag::SMFKitRadioFlag( TelltaleState* t, SMFKitInfo* i, const Font* f ) : SMFKitGlyph(i) { state_ = t; Resource::ref(state_); font_ = f; Resource::ref(font_); } SMFKitRadioFlag::~SMFKitRadioFlag() { Resource::unref(state_); Resource::unref(font_); } void SMFKitRadioFlag::request(Requisition& req) const { FontBoundingBox b; font_->char_bbox('M', b); Coord size = b.width() * info().radio_scale(); req.x_requirement().natural(size); req.y_requirement().natural(size); } static int outset_radio_colors[] = { very_light_gray, white, dark_gray }; static int visible_outset_radio_colors[] = { white, white, medium_gray }; static int inset_radio_colors[] = { dark_gray, black, very_light_gray }; static int visible_inset_radio_colors[] = { medium_gray, black, white }; static int* radio_colors[] = { /* 0 */ outset_radio_colors, /* is_enabled */ outset_radio_colors, /* is_visible */ outset_radio_colors, /* is_enabled_visible */ visible_outset_radio_colors, /* is_active */ outset_radio_colors, /* is_enabled_active */ inset_radio_colors, /* is_visible_active */ outset_radio_colors, /* is_enabled_visible_active */ visible_inset_radio_colors, /* is_chosen */ inset_radio_colors, /* is_enabled_chosen */ inset_radio_colors, /* is_visible_chosen */ inset_radio_colors, /* is_enabled_visible_chosen */ visible_inset_radio_colors, /* is_active_chosen */ inset_radio_colors, /* is_enabled_active_chosen */ inset_radio_colors, /* is_visible_active_chosen */ inset_radio_colors, /* is_enabled_visible_active_chosen */ visible_inset_radio_colors }; void SMFKitRadioFlag::draw(Canvas* c, const Allocation& a) const { const SMFKitInfo& i = info(); int* colors = radio_colors[flags(state_)]; Bevel::diamond( c, i.color(colors[0]), i.color(colors[1]), i.color(colors[2]), #if defined(WIN32) i.thickness()/2, a.left(), a.bottom(), a.right(), a.top() #else i.thickness(), a.left(), a.bottom(), a.right(), a.top() #endif ); } /* class SMFKitRadioItem */ SMFKitRadioItem::SMFKitRadioItem( TelltaleState* t, SMFKitInfo* i, const Font* f ) : SMFKitRadioFlag(t, i, f) { } SMFKitRadioItem::~SMFKitRadioItem() { } void SMFKitRadioItem::draw(Canvas* c, const Allocation& a) const { if (state()->test(TelltaleState::is_chosen)) { SMFKitRadioFlag::draw(c, a); } } /* class SMFKitThumb */ SMFKitThumb::SMFKitThumb( DimensionName d, SMFKitInfo* info, long ridges, const TelltaleFlags s ) : SMFKitGlyph(info) { dimension_ = d; ridges_ = ridges; flags_ = s; } SMFKitThumb::~SMFKitThumb() { } static int thumb_colors[] = { very_light_gray, very_light_gray, light_gray, medium_gray, dark_gray }; static int visible_thumb_colors[] = { white, white, very_light_gray, light_gray, dark_gray }; void SMFKitThumb::draw(Canvas* canvas, const Allocation& a) const { const SMFKitInfo& i = info(); int* colors; if ((flags_ & TelltaleState::is_visible) != 0) { colors = visible_thumb_colors; } else { colors = thumb_colors; } const Color* c[6]; for (int c_i = 0; c_i < 5; c_i++) { c[c_i] = i.color(colors[c_i]); } Coord x0 = a.left(), y0 = a.bottom(), x1 = a.right(), y1 = a.top(); Coord p = canvas->to_pixels_coord(1.0); Coord p2 = p + p, p3 = p2 + p, p4 = p3 + p, p5 = p4 + p; const Color* dark = i.color(very_dark_gray); switch (dimension_) { case Dimension_X: canvas->fill_rect(x0, y0, x0 + p, y1, dark); canvas->fill_rect(x1 - p, y0, x1, y1, dark); x0 += p; x1 -= p; break; case Dimension_Y: canvas->fill_rect(x0, y1 - p, x1, y1, dark); canvas->fill_rect(x0, y0, x1, y0 + p, dark); y0 += p; y1 -= p; } Bevel::rect(canvas, c[0], nil, c[4], p, x0, y0, x1, y1); Bevel::rect(canvas, c[1], c[2], c[3], p, x0 + p, y0 + p, x1 - p, y1 - p); Coord mid; Coord left[6], bottom[6], right[6], top[6]; switch (dimension_) { case Dimension_X: mid = canvas->to_pixels_coord(0.5 * (x0 + x1)); y0 += p; y1 -= p; c[0] = i.color(very_dark_gray); c[1] = i.color(white); left[0] = mid + p4; bottom[0] = y0; right[0] = mid + p5; top[0] = y1; left[1] = mid + p3; bottom[1] = y0; right[1] = mid + p4; top[1] = y1; left[2] = mid; bottom[2] = y0; right[2] = mid + p; top[2] = y1; left[3] = mid - p; bottom[3] = y0; right[3] = mid; top[3] = y1; left[4] = mid - p4; bottom[4] = y0; right[4] = mid - p3; top[4] = y1; left[5] = mid - p5; bottom[5] = y0; right[5] = mid - p4; top[5] = y1; break; case Dimension_Y: mid = canvas->to_pixels_coord(0.5 * (y0 + y1)); x0 += p; x1 -= p; c[0] = i.color(white); c[1] = i.color(very_dark_gray); left[0] = x0; bottom[0] = mid + p4; right[0] = x1; top[0] = mid + p5; left[1] = x0; bottom[1] = mid + p3; right[1] = x1; top[1] = mid + p4; left[2] = x0; bottom[2] = mid; right[2] = x1; top[2] = mid + p; left[3] = x0; bottom[3] = mid - p; right[3] = x1; top[3] = mid; left[4] = x0; bottom[4] = mid - p4; right[4] = x1; top[4] = mid - p3; left[5] = x0; bottom[5] = mid - p5; right[5] = x1; top[5] = mid - p4; break; default: return; } c[2] = c[0]; c[3] = c[1]; c[4] = c[0]; c[5] = c[1]; for (long r = 3 - ridges_; r < 3 + ridges_; r++) { canvas->fill_rect(left[r], bottom[r], right[r], top[r], c[r]); } } /* class SMFKitDefaultArrow */ SMFKitDefaultArrow::SMFKitDefaultArrow( const Font* f, SMFKitInfo* i ) : SMFKitGlyph(i) { font_ = f; Resource::ref(f); } SMFKitDefaultArrow::~SMFKitDefaultArrow() { Resource::unref(font_); } void SMFKitDefaultArrow::request(Requisition& req) const { FontBoundingBox b; font_->string_bbox("M", 1, b); Requirement& rx = req.requirement(Dimension_X); rx.natural(1.25 * b.width()); rx.stretch(0); rx.shrink(0); rx.alignment(0); Requirement& ry = req.requirement(Dimension_Y); Coord h = b.font_ascent() + b.font_descent(); ry.natural(h); ry.stretch(0); ry.shrink(0); ry.alignment(h == 0 ? 0.0 : b.font_descent() / h); } void SMFKitDefaultArrow::draw(Canvas* c, const Allocation& a) const { const SMFKitInfo& i = info(); FontBoundingBox b; font_->string_bbox("M", 1, b); Coord left = a.left(); Coord right = a.right(); Coord x0 = left + 0.4 * (right - left); Coord bottom = a.y(); Coord top = bottom + 0.9 * b.ascent(); Coord y0 = 0.5 * (bottom + top); const Color* bl = i.color(black); c->new_path(); c->move_to(left, y0); c->line_to(x0, top); c->line_to(x0, bottom); c->close_path(); c->fill(bl); Coord t = i.thickness(); y0 -= 0.5 * t; Coord y1 = y0 + t; c->fill_rect(x0, y0, right, y1, bl); c->fill_rect(right - t, y1, right, top, bl); } neuron-7.6.3/src/lib/InterViews/stencil.cpp000077500000000000000000000051431340731477100206530ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Stencil - mask glyph */ #include #include #include #include Stencil::Stencil(const Bitmap* mask, const Color* c) : Glyph() { mask_ = mask; Resource::ref(mask_); color_ = c; Resource::ref(color_); } Stencil::~Stencil() { Resource::unref(mask_); Resource::unref(color_); } void Stencil::request(Requisition& requisition) const { if (mask_ != nil) { Coord left_bearing = mask_->left_bearing(); Coord right_bearing = mask_->right_bearing(); Coord ascent = mask_->ascent(); Coord descent = mask_->descent(); Requirement rx( left_bearing, left_bearing, left_bearing, right_bearing, right_bearing, right_bearing ); Requirement ry( descent, descent, descent, ascent, ascent, ascent ); requisition.require(Dimension_X, rx); requisition.require(Dimension_Y, ry); } } void Stencil::allocate(Canvas* c, const Allocation& a, Extension& ext) { if (mask_ != nil) { Coord x = a.x(); Coord y = a.y(); ext.set_xy( c, x - mask_->left_bearing(), y - mask_->descent(), x + mask_->right_bearing(), y + mask_->ascent() ); } } void Stencil::draw(Canvas* c, const Allocation& a) const { if (mask_ != nil) { c->stencil(mask_, color_, a.x(), a.y()); } } neuron-7.6.3/src/lib/InterViews/stepper.cpp000077500000000000000000000113761340731477100207010ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Stepper -- button with auto-repeat */ #if !defined(WIN32) && !MAC #define UNIX 1 #endif #if UNIX #define USE_DISPATCH 1 #endif #if USE_DISPATCH #include #include #endif #include #include #include #include #include #if USE_DISPATCH declareIOCallback(Stepper) implementIOCallback(Stepper) #endif Stepper::Stepper( Glyph* g, Style* s, TelltaleState* t, Action* a ) : Button(new Target(g, TargetPrimitiveHit), s, t, a) { float seconds = 0.25; s->find_attribute("autorepeatStart", seconds); start_delay_ = long(seconds * 1000000); seconds = 0.05; s->find_attribute("autorepeatDelay", seconds); next_delay_ = long(seconds * 1000000); #if USE_DISPATCH timer_ = new IOCallback(Stepper)(this, &Stepper::tick); #endif } Stepper::~Stepper() { #if USE_DISPATCH delete timer_; #endif } void Stepper::press(const Event& e) { Button::press(e); start_stepping(); } void Stepper::release(const Event& e) { stop_stepping(); Button::release(e); } void Stepper::start_stepping() { adjust(); #if USE_DISPATCH if (start_delay_ > 10) { Dispatcher::instance().startTimer(0, start_delay_, timer_); } #endif } void Stepper::stop_stepping() { #if USE_DISPATCH Dispatcher::instance().stopTimer(timer_); #endif } void Stepper::tick(long, long) { adjust(); #if USE_DISPATCH Dispatcher::instance().startTimer(0, next_delay_, timer_); #endif } #define implementAdjustStepper(name,scroll) \ name::name( \ Glyph* g, Style* s, TelltaleState* t, Adjustable* a, DimensionName d \ ) : Stepper(g, s, t) { \ adjustable_ = a; \ dimension_ = d; \ } \ \ name::~name() { } \ \ void name::adjust() { adjustable_->scroll(dimension_); } implementAdjustStepper(ForwardScroller,scroll_forward) implementAdjustStepper(BackwardScroller,scroll_backward) implementAdjustStepper(ForwardPager,page_forward) implementAdjustStepper(BackwardPager,page_backward) #define implementArrowGlyph(name) \ name::name(const Color* c) { \ Resource::ref(c); \ color_ = c; \ } \ \ name::~name() { \ Resource::unref(color_); \ } implementArrowGlyph(UpArrow) implementArrowGlyph(DownArrow) implementArrowGlyph(LeftArrow) implementArrowGlyph(RightArrow) void UpArrow::draw(Canvas* c, const Allocation& a) const { Coord x1 = a.left(); Coord y1 = a.bottom(); Coord x2 = a.right(); Coord y2 = a.top(); c->new_path(); c->move_to(x1, y1); c->line_to(x2, y1); c->line_to((x1 + x2) * 0.5, y2); c->close_path(); c->fill(color_); } void DownArrow::draw(Canvas* c, const Allocation& a) const { Coord x1 = a.left(); Coord y1 = a.bottom(); Coord x2 = a.right(); Coord y2 = a.top(); c->new_path(); c->move_to(x1, y2); c->line_to(x2, y2); c->line_to((x1 + x2) * 0.5, y1); c->close_path(); c->fill(color_); } void LeftArrow::draw(Canvas* c, const Allocation& a) const { Coord x1 = a.left(); Coord y1 = a.bottom(); Coord x2 = a.right(); Coord y2 = a.top(); c->new_path(); c->move_to(x2, y1); c->line_to(x2, y2); c->line_to(x1, (y1 + y2) * 0.5); c->close_path(); c->fill(color_); } void RightArrow::draw(Canvas* c, const Allocation& a) const { Coord x1 = a.left(); Coord y1 = a.bottom(); Coord x2 = a.right(); Coord y2 = a.top(); c->new_path(); c->move_to(x1, y1); c->line_to(x1, y2); c->line_to(x2, (y1 + y2) * 0.5); c->close_path(); c->fill(color_); } neuron-7.6.3/src/lib/InterViews/style.cpp000066400000000000000000000575661340731477100203670ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Style - style information */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include declarePtrList(StyleList,Style) implementPtrList(StyleList,Style) declarePtrList(UniqueStringList,UniqueString) implementPtrList(UniqueStringList,UniqueString) struct StyleAttribute { private: friend class Style; friend class StyleRep; String* name_; UniqueStringList* path_; String* value_; int priority_; Macro* observers_; long index_; }; declarePtrList(StyleAttributeList,StyleAttribute) implementPtrList(StyleAttributeList,StyleAttribute) struct StyleAttributeTableEntry { StyleAttributeList** entries_; long avail_; long used_; }; inline unsigned long key_to_hash(UniqueString& s) { return s.hash(); } declareTable(StyleAttributeTable,UniqueString,StyleAttributeTableEntry*) implementTable(StyleAttributeTable,UniqueString,StyleAttributeTableEntry*) class StyleRep { private: friend class Style; UniqueString* name_; UniqueStringList* aliases_; Style* parent_; StyleAttributeTable* table_; StyleAttributeList* list_; StyleList* children_; Macro* observers_; bool modified_; StyleRep(UniqueString*); ~StyleRep(); void clear_info(); void modify(); void update(); StyleAttribute* add_attribute( const String& name, const String& value, int priority ); UniqueStringList* parse_name(String&, int& priority); String* parse_value(const String&); int find_separator(const String&); int match_name(const UniqueString&); bool same_path(const UniqueStringList&, const UniqueStringList&); void delete_path(UniqueStringList*); void delete_attribute(StyleAttribute*); String strip(const String&); void missing_colon(const String&); void bad_property_name(const String&); void bad_property_value(const String&); StyleAttributeTableEntry* find_entry(const UniqueString&); bool wildcard_match( const StyleAttributeTableEntry&, const StyleList&, String& value ); bool wildcard_match_name( const UniqueString& name, const StyleAttributeTableEntry&, const StyleList&, long s_index, String& value ); int finish_match( const StyleList&, long s_index, const UniqueStringList&, long p_index ); }; /* * Scan an attribute value, replace \ as follows: * * \ nothing * \n newline * \ \ */ class ValueString : public String { public: ValueString(char*, int len); virtual ~ValueString(); virtual bool null_terminated() const; }; ValueString::ValueString(char* str, int len) : String(str, len) { } ValueString::~ValueString() { char* s = (char*)string(); delete [] s; } bool ValueString::null_terminated() const { return true; } String* StyleRep::parse_value(const String& v) { if (v.index('\\') == -1) { return new NullTerminatedString(v); } const char* src = v.string(); int len = v.length(); const char* src_end = src + len; char* dst_start = new char[len + 1]; char* dst = dst_start; for (; src < src_end; src++) { if (*src == '\\') { ++src; switch (*src) { case '\n': /* eliminate */ break; case 'n': *dst++ = '\n'; break; case '\\': *dst++ = *src; break; default: *dst++ = '\\'; *dst++ = *src; break; } } else { *dst++ = *src; } } *dst = '\0'; return new ValueString(dst_start, dst - dst_start); } Style::Style() { rep_ = new StyleRep(nil); } Style::Style(const String& name) { rep_ = new StyleRep(new UniqueString(name)); } Style::Style(Style* p) { rep_ = new StyleRep(nil); p->append(this); } Style::Style(const String& name, Style* p) { rep_ = new StyleRep(new UniqueString(name)); p->append(this); } Style::Style(const Style& style) { StyleRep& s = *style.rep_; rep_ = new StyleRep(s.name_ == nil ? nil : new UniqueString(*s.name_)); if (s.parent_ != nil) { s.parent_->append(this); } s.update(); long n = style.alias_count(); long i; for (i = n - 1; i >= 0; i--) { alias(*style.alias(i)); } n = style.children(); for (i = 0; i < n; i++) { append(style.child(i)); } n = style.attribute_count(); for (i = 0; i < n; i++) { String name, value; if (style.attribute(i, name, value)) { attribute(name, value); } } rep_->modify(); } Style::~Style() { Style* p = rep_->parent_; if (p != nil) { p->remove(this); } delete rep_; } StyleRep::StyleRep(UniqueString* s) { name_ = s; aliases_ = nil; parent_ = nil; table_ = nil; list_ = nil; children_ = nil; observers_ = nil; modified_ = true; } StyleRep::~StyleRep() { clear_info(); delete name_; StyleAttributeTable* t = table_; if (t != nil) { for (TableIterator(StyleAttributeTable) i(*t); i.more(); i.next()) { StyleAttributeTableEntry* e = i.cur_value(); for (unsigned long j = 0; j < e->used_; j++) { StyleAttributeList* a = e->entries_[j]; if (a != nil) { for ( ListItr(StyleAttributeList) k(*a); k.more(); k.next() ) { delete_attribute(k.cur()); } delete a; } } delete [] e->entries_; delete e; } delete t; } delete list_; delete_path(aliases_); if (children_ != nil) { for (ListItr(StyleList) i(*children_); i.more(); i.next()) { Style* s = i.cur(); s->rep_->parent_ = nil; } delete children_; } Resource::unref(observers_); } const String* Style::name() const { return rep_->name_; } void Style::name(const String& str) { StyleRep& s = *rep_; delete s.name_; s.name_ = new UniqueString(str); } void Style::alias(const String& name) { StyleRep& s = *rep_; if (s.aliases_ == nil) { s.aliases_ = new UniqueStringList(5); } s.aliases_->prepend(new UniqueString(name)); s.modify(); } long Style::alias_count() const { StyleRep& s = *rep_; return s.aliases_ == nil ? 0 : s.aliases_->count(); } const String* Style::alias(long i) const { UniqueStringList* list = rep_->aliases_; if (list == nil || i < 0 || i >= list->count()) { return nil; } return list->item(i); } void Style::name(const char* s) { name(String(s)); } void Style::alias(const char* s) { alias(String(s)); } Style* Style::parent() const { return rep_->parent_; } /* * Add a child style. Implicitly remove the child from its current parent, * if it has one, and set its parent to this. Because reparenting may change * (cached) attributes, we must mark the child modified. */ void Style::append(Style* style) { Style* p = style->parent(); if (p == this) { return; } if (p != nil) { p->remove(style); } StyleRep& s = *rep_; if (s.children_ == nil) { s.children_ = new StyleList(5); } s.children_->append(style); Resource::ref(this); style->rep_->parent_ = this; style->rep_->modify(); } /* * Remove a child style. Do nothing if the given style isn't really a child. */ void Style::remove(Style* style) { StyleList* list = rep_->children_; if (list != nil) { for (ListUpdater(StyleList) i(*list); i.more(); i.next()) { if (i.cur() == style) { i.remove_cur(); style->rep_->parent_ = nil; Resource::unref(this); break; } } } } /* * Return the number of children styles. */ long Style::children() const { StyleList* list = rep_->children_; return list == nil ? 0 : list->count(); } /* * Return a particular child. */ Style* Style::child(long i) const { StyleList* list = rep_->children_; if (list != nil && i >= 0 && i < list->count()) { return list->item(i); } return nil; } /* * Put a pair on the attribute list. */ void Style::attribute(const String& name, const String& value, int priority) { rep_->add_attribute(name, value, priority); } StyleAttribute* StyleRep::add_attribute( const String& name, const String& value, int priority ) { String str(name); int p = priority; UniqueStringList* path = parse_name(str, p); if (path == nil) { /* irrelevant attribute: A*B where A doesn't match */ return nil; } if (table_ == nil) { table_ = new StyleAttributeTable(50); } UniqueString u(str); StyleAttributeTableEntry* e = find_entry(u); if (e == nil) { e = new StyleAttributeTableEntry; e->entries_ = new StyleAttributeList*[3]; e->avail_ = 3; e->used_ = 0; long i; for (i = 0; i < e->avail_; i++) { e->entries_[i] = nil; } table_->insert(u, e); } long n = path->count(); if (e->avail_ <= n) { long new_avail = n + 5; StyleAttributeList** new_list = new StyleAttributeList*[new_avail]; long i; for (i = 0; i < e->avail_; i++) { new_list[i] = e->entries_[i]; } for (i = e->avail_; i < new_avail; i++) { new_list[i] = nil; } delete [] e->entries_; e->entries_ = new_list; e->avail_ = new_avail; } if (e->entries_[n] == nil) { e->entries_[n] = new StyleAttributeList; } e->used_ = Math::max(e->used_, long(n + 1)); StyleAttributeList& list = *e->entries_[n]; for (ListItr(StyleAttributeList) i(list); i.more(); i.next()) { StyleAttribute* a = i.cur(); if (same_path(*a->path_, *path)) { if (p >= a->priority_) { delete a->value_; a->value_ = parse_value(value); a->priority_ = p; if (a->observers_ != nil) { a->observers_->execute(); } modify(); } delete_path(path); return a; } } StyleAttribute* a = new StyleAttribute; a->name_ = new CopyString(name); a->path_ = path; a->value_ = parse_value(value); a->priority_ = p; a->observers_ = nil; list.append(a); if (list_ == nil) { list_ = new StyleAttributeList; } a->index_ = list_->count(); list_->append(a); modify(); return a; } /* * Parse a name of the form *A*B*C into the list of names A, B, C. * Strip the first name (e.g., A) if it matches the style's name * or an alias. */ UniqueStringList* StyleRep::parse_name(String& s, int& priority) { bool leading_star = false; if (s[0] == '*') { leading_star = true; s.set_to_right(1); } UniqueStringList* list = new UniqueStringList; bool first = true; for (int i = find_separator(s); i != -1; i = find_separator(s)) { UniqueString name(s.left(i)); if (first) { first = false; int q = match_name(name); if (q != 0) { priority += (q == 1) ? 2 : 1; s.set_to_right(i + 1); continue; } else if (!leading_star) { delete_path(list); return nil; } } list->append(new UniqueString(name)); s.set_to_right(i + 1); } return list; } /* * Return the index of the next separator ("*" or ".") in the string. * If no separator is present, return -1. */ int StyleRep::find_separator(const String& s) { int n = s.length(); for (int i = 0; i < n; i++) { char c = s[i]; if (c == '*' || c == '.') { return i; } } return -1; } /* * Check to see if a given name matches the style's name * or any of its aliases. * * Return value: * 0 - no match * 1 - name match * 2 and up - index of alias match plus 2 */ int StyleRep::match_name(const UniqueString& name) { int match = 0; if (name_ != nil && name == *name_) { match = 1; } else if (aliases_ != nil) { int possible_match = 2; for (ListItr(UniqueStringList) i(*aliases_); i.more(); i.next()) { if (name == *i.cur()) { match = possible_match; break; } ++possible_match; } } return match; } /* * Compare to lists of strings. */ bool StyleRep::same_path( const UniqueStringList& p1, const UniqueStringList& p2 ) { if (p1.count() != p2.count()) { return false; } ListItr(UniqueStringList) i1(p1); ListItr(UniqueStringList) i2(p2); for (; i1.more(); i1.next(), i2.next()) { if (*i1.cur() != *i2.cur()) { return false; } } return true; } void StyleRep::delete_path(UniqueStringList* list) { if (list != nil) { for (ListItr(UniqueStringList) i(*list); i.more(); i.next()) { UniqueString* s = i.cur(); delete s; } delete list; } } /* * Clear out any cached information about this style. */ void StyleRep::clear_info() { } void StyleRep::modify() { modified_ = true; if (observers_ != nil) { observers_->execute(); } if (children_ != nil) { for (ListItr(StyleList) i(*children_); i.more(); i.next()) { i.cur()->rep_->modify(); } } } void StyleRep::update() { if (!modified_) { return; } clear_info(); if (parent_ != nil) { parent_->rep_->update(); } modified_ = false; } void Style::remove_attribute(const String& name) { StyleRep& s = *rep_; s.update(); if (s.table_ == nil) { return; } String tail(name); int priority = 0; UniqueStringList* path = s.parse_name(tail, priority); if (path == nil) { return; } UniqueString u(tail); StyleAttributeTableEntry* e = s.find_entry(u); long p = path->count(); if (e != nil && e->used_ > p) { StyleAttributeList* a = e->entries_[p]; if (a != nil) { for (ListUpdater(StyleAttributeList) i(*a); i.more(); i.next()) { StyleAttribute* attr = i.cur(); if (s.same_path(*attr->path_, *path)) { s.delete_attribute(attr); i.remove_cur(); break; } } if (a->count() == 0) { delete a; e->entries_[p] = nil; } } } s.delete_path(path); } void StyleRep::delete_attribute(StyleAttribute* a) { delete a->name_; list_->remove(a->index_); long n = list_->count(); for (long i = a->index_; i < n; i++) { StyleAttribute* attr = list_->item(i); attr->index_ -= 1; } delete_path(a->path_); delete a->value_; Resource::unref(a->observers_); delete a; } /* * Return number of attributes. */ long Style::attribute_count() const { StyleAttributeList* list = rep_->list_; return list == nil ? 0 : list->count(); } /* * Return an attribute name and value for a given index. */ bool Style::attribute(long i, String& name, String& value) const { StyleAttributeList* list = rep_->list_; if (list == nil || i < 0 || i >= list->count()) { return false; } StyleAttribute& a = *list->item(i); name = *a.name_; value = *a.value_; return true; } /* * Convenient short-hand */ void Style::attribute(const char* name, const char* value, int priority) { attribute(String(name), String(value), priority); } void Style::remove_attribute(const char* name) { remove_attribute(String(name)); } void Style::load_file(const String& filename, int priority) { InputFile* f = InputFile::open(filename); if (f == nil) { return; } const char* start; int len = f->read(start); if (len > 0) { load_list(String(start, len), priority); } f->close(); delete f; } void Style::load_list(const String& str, int priority) { const char* p = str.string(); const char* q = p + str.length(); const char* start = p; for (; p < q; p++) { if (*p == '\n') { if (p > start && *(p-1) != '\\') { const char* q = p; if (*(q-1) == '\r') { q--; } load_property(String(start, q - start), priority); start = p + 1; } } } } void Style::load_property(const String& prop, int priority) { StyleRep& s = *rep_; String p(s.strip(prop)); if (p.length() == 0 || p[0] == '!') { return; } int colon = p.index(':'); if (colon < 0) { s.missing_colon(p); } else { String name(s.strip(p.left(colon))); String value(s.strip(p.right(colon + 1))); if (name.length() <= 0) { s.bad_property_name(name); } else if (value.length() <= 0) { s.bad_property_value(value); } else { attribute(name, value, priority); } } } String StyleRep::strip(const String& s) { int i = 0; int len = s.length(); for (i = 0; i < len && isspace(s[i]); i++); int j = len - 1; for (; j >= 0 && isspace(s[j]); j--); return s.substr(i, j - i + 1); } /* * Errors are nops for now. */ void StyleRep::missing_colon(const String&) { } void StyleRep::bad_property_name(const String&) { } void StyleRep::bad_property_value(const String&) { } void Style::add_trigger(const String& name, Action* action) { String v("undefined"); StyleAttribute* a = rep_->add_attribute(name, v, -1000); if (a != nil) { if (a->observers_ == nil) { a->observers_ = new Macro; Resource::ref(a->observers_); } a->observers_->append(action); } } /* * If the action parameter is nil, remove all triggers associated * with the name. */ void Style::remove_trigger(const String& name, Action* action) { String v("undefined"); StyleAttribute* a = rep_->add_attribute(name, v, -1000); if (a != nil) { Macro* m = a->observers_; if (action == nil) { Resource::unref(m); a->observers_ = nil; } else { MacroIndex mcount = m->count(); for (MacroIndex i = 0; i < mcount; i++) { if (m->action(i) == action) { m->remove(i); break; } } } } } void Style::add_trigger_any(Action* action) { StyleRep& s = *rep_; if (s.observers_ == nil) { s.observers_ = new Macro; Resource::ref(s.observers_); } s.observers_->append(action); } void Style::remove_trigger_any(Action* action) { StyleRep& s = *rep_; Macro* m = s.observers_; MacroIndex mcount = m->count(); for (MacroIndex i = 0; i < mcount; i++) { if (m->action(i) == action) { m->remove(i); break; } } } void Style::add_trigger(const char* name, Action* a) { add_trigger(String(name), a); } void Style::remove_trigger(const char* name, Action* a) { remove_trigger(String(name), a); } /* * Find the value bound to a given name, if any. */ bool Style::find_attribute(const String& name, String& value) const { StyleRep* s = rep_; s->update(); UniqueString uname(name); StyleAttributeTableEntry* e = s->find_entry(uname); if (e != nil) { StyleAttributeList* list = e->entries_[0]; if (list != nil && list->count() != 0) { value = *list->item(0)->value_; return true; } } StyleList sl(20); Style* this_style = (Style*)this; sl.prepend(this_style); for (Style* style = s->parent_; style != nil; style = s->parent_) { s = style->rep_; e = s->find_entry(uname); if (e != nil) { if (e->used_ > 0 && s->wildcard_match(*e, sl, value)) { return true; } StyleAttributeList* list = e->entries_[0]; if (list != nil) { value = *list->item(0)->value_; return true; } } sl.prepend(style); } return false; } StyleAttributeTableEntry* StyleRep::find_entry(const UniqueString& name) { StyleAttributeTableEntry* e; if (table_ != nil) { /* avoid && to workaround cfront bug */ if (table_->find(e, name)) { return e; } } return nil; } /* * Check if the given table entry contains a match for the * given list of styles and if so copy the value. * * We start from the end of the style list so that we can find * the closest match. */ bool StyleRep::wildcard_match( const StyleAttributeTableEntry& e, const StyleList& sl, String& value ) { long n = sl.count(); for (long i = n - 1; i >= 0; i--) { StyleRep& s = *sl.item(i)->rep_; if (s.name_ != nil && wildcard_match_name(*s.name_, e, sl, i, value)) { return true; } UniqueStringList* list = s.aliases_; if (list != nil) { for (ListItr(UniqueStringList) a(*list); a.more(); a.next()) { if (wildcard_match_name(*a.cur(), e, sl, i, value)) { return true; } } } } return false; } bool StyleRep::wildcard_match_name( const UniqueString& name, const StyleAttributeTableEntry& e, const StyleList& sl, long s_index, String& value ) { long n = Math::min(s_index + 1, e.used_ - 1); for (long i = n; i >= 1; i--) { StyleAttributeList* list = e.entries_[i]; if (list != nil) { bool found_match = false; int best_match = 0; for (ListItr(StyleAttributeList) a(*list); a.more(); a.next()) { StyleAttribute& attr = *a.cur(); const UniqueStringList& path = *attr.path_; if (name == *path.item(i - 1)) { if (i == 1) { value = *attr.value_; return true; } else if (s_index != 0) { int new_match = finish_match(sl, s_index-1, path, i-2); if (new_match > best_match) { found_match = true; best_match = new_match; value = *attr.value_; } } } } if (found_match) { return true; } } } return false; } int StyleRep::finish_match( const StyleList& sl, long s_index, const UniqueStringList& path, long p_index ) { int matched = 0; long s_cur = s_index; long p_cur = p_index; while (p_cur >= 0 && s_cur >= 0) { StyleRep& s = *sl.item(s_cur)->rep_; int m = s.match_name(*path.item(p_cur)); if (m != 0) { --p_cur; matched += m; } --s_cur; } return matched; } /* * Short-hand */ bool Style::find_attribute(const char* name, String& value) const { return find_attribute(String(name), value); } bool Style::find_attribute(const String& name, long& value) const { String v; return find_attribute(name, v) && v.convert(value); } bool Style::find_attribute(const char* name, long& value) const { return find_attribute(String(name), value); } bool Style::find_attribute(const String& name, double& value) const { String v; return find_attribute(name, v) && v.convert(value); } bool Style::find_attribute(const char* name, double& value) const { return find_attribute(String(name), value); } bool Style::find_attribute(const String& name, Coord& value) const { String v; if (!find_attribute(name, v)) { return false; } String units(v); Coord pts = 1.0; const char* p = v.string(); const char* end = p + v.length(); if (p < end && (*p == '-' || *p == '+')) { ++p; } bool dot = false; for (; p < end; p++) { if (!dot && *p == '.') { dot = true; } else if (!isspace(*p) && !isdigit(*p)) { int i = p - v.string(); units.set_to_right(i); if (units == "mm") { pts = 72.0 / 25.4; } else if (units == "cm") { pts = 72.0 / 2.54; } else if (units == "in") { pts = 72.0; } else if (units != "pt") { return false; } v.set_to_left(i); break; } } if (v.convert(value)) { value *= pts; return true; } return false; } bool Style::find_attribute(const char* name, Coord& value) const { return find_attribute(String(name), value); } bool Style::value_is_on(const String& s) const { String v; if (!find_attribute(s, v)) { return false; } return v.case_insensitive_equal("on") || v.case_insensitive_equal("true"); } bool Style::value_is_on(const char* s) const { return value_is_on(String(s)); } neuron-7.6.3/src/lib/InterViews/superpose.cpp000077500000000000000000000043761340731477100212460ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Superpose - composite layout */ #include Superpose::Superpose( Layout* l0, Layout* l1, Layout* l2, Layout* l3, Layout* l4 ) : Layout() { Layout* arg[6]; arg[0] = l0; arg[1] = l1; arg[2] = l2; arg[3] = l3; arg[4] = l4; arg[5] = nil; for (count_ = 0; arg[count_] != nil; count_++) { } layout_ = new Layout* [count_]; for (long i = 0; i < count_; i++) { layout_[i] = arg[i]; } } Superpose::~Superpose() { for (long i = 0; i < count_; ++i) { delete layout_[i]; } delete [] layout_; layout_ = nil; } void Superpose::request( GlyphIndex count, const Requisition* request, Requisition& result ) { for (long i = 0; i < count_; ++i) { layout_[i]->request(count, request, result); } } void Superpose::allocate( const Allocation& given, GlyphIndex count, const Requisition* requisition, Allocation* result ) { for (long i = 0; i < count_; ++i) { layout_[i]->allocate(given, count, requisition, result); } } neuron-7.6.3/src/lib/InterViews/target.cpp000077500000000000000000000044471340731477100205060ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Target - hit sensitivity control */ #include #include Target::Target(Glyph* body, TargetSensitivity sensitivity) : MonoGlyph(body) { sensitivity_ = sensitivity; } Target::~Target() { } void Target::pick(Canvas* c, const Allocation& a, int depth, Hit& h) { Coord x, left, right; switch (sensitivity_) { case TargetBodyHit: MonoGlyph::pick(c, a, depth, h); break; case TargetNeverHit: break; case TargetAlwaysHit: h.target(depth, this, 0); break; case TargetPrimitiveHit: if (h.right() >= a.left() && h.left() < a.right() && h.top() >= a.bottom() && h.bottom() < a.top() ) { h.target(depth, this, 0); } break; case TargetCharacterHit: /* call to pick is dubious, but needed for now by doc */ MonoGlyph::pick(c, a, depth, h); x = h.left(); left = a.left(); right = a.right(); if (h.right() >= left && x < right) { h.target(depth, this, (x > ((left + right) * 0.5)) ? 1 : 0); } break; } } neuron-7.6.3/src/lib/InterViews/telltale.cpp000066400000000000000000000132501340731477100210130ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include #include /* class TelltaleState */ TelltaleState::TelltaleState(const TelltaleFlags flags) { flags_ = flags; group_ = nil; } TelltaleState::~TelltaleState() { leave_group(); } void TelltaleState::set(const TelltaleFlags flags, bool b) { TelltaleFlags newflags = b ? (flags_ | flags) : (flags_ & ~flags); if (newflags != flags_) { flags_ = newflags; notify(); if (group_ != nil) { group_->update(this); } } } bool TelltaleState::test(const TelltaleFlags flags) const { return (flags_ & flags) == flags; } void TelltaleState::join(TelltaleGroup* g) { if (g != group_) { Resource::ref(g); leave_group(); group_ = g; } } void TelltaleState::leave_group() { if (group_ != nil) { group_->remove(this); Resource::unref(group_); } } /* class Telltale */ Telltale::Telltale(Glyph* g, TelltaleState* s) : MonoGlyph(g) { state_ = s; Resource::ref(state_); state_->attach(this); } Telltale::~Telltale() { state_->detach(this); Resource::unref(state_); } void Telltale::state(TelltaleState* s) { Resource::ref(s); Resource::unref(state_); state_ = s; } TelltaleState* Telltale::state() const { return state_; } void Telltale::disconnect(Observable*) { state_ = nil; } /* class TelltaleGroup */ TelltaleGroup::TelltaleGroup() { current_ = nil; } TelltaleGroup::~TelltaleGroup() { } void TelltaleGroup::update(TelltaleState* s) { if (s != current_ && s->test(TelltaleState::is_chosen)) { if (current_ != nil) { current_->set(TelltaleState::is_chosen, false); } current_ = s; } } void TelltaleGroup::remove(TelltaleState* s) { if (current_ == s) { current_ = nil; } } /* class ChoiceItem */ ChoiceItem::ChoiceItem(TelltaleState* t) : Telltale(nil, t) { init(); } ChoiceItem::ChoiceItem( TelltaleState* t, Glyph* normal, Glyph* pressed ) : Telltale(nil, t) { init(); look(0, TelltaleState::is_active, normal); look(TelltaleState::is_enabled_active, 0, pressed); } ChoiceItem::ChoiceItem( TelltaleState* t, Glyph* disabled, Glyph* enabled, Glyph* visible, Glyph* visible_active, Glyph* active, Glyph* chosen, Glyph* visible_chosen, Glyph* active_chosen, Glyph* visible_active_chosen, Glyph* disabled_chosen ) : Telltale(nil, t) { init(); look(0, TelltaleState::is_enabled_chosen, disabled); look( TelltaleState::is_enabled, TelltaleState::is_visible_active_chosen, enabled ); look( TelltaleState::is_enabled_visible, TelltaleState::is_active_chosen, visible ); look( TelltaleState::is_enabled_visible_active, TelltaleState::is_chosen, visible_active ); look( TelltaleState::is_enabled_active, TelltaleState::is_visible_chosen, active ); look( TelltaleState::is_enabled_chosen, TelltaleState::is_visible_active, chosen ); look( TelltaleState::is_enabled_visible_chosen, TelltaleState::is_active, visible_chosen ); look( TelltaleState::is_enabled_active_chosen, TelltaleState::is_visible, active_chosen ); look( TelltaleState::is_enabled_visible_active_chosen, 0, visible_active_chosen ); look( TelltaleState::is_chosen, TelltaleState::is_enabled, disabled_chosen ); } ChoiceItem::~ChoiceItem() { } void ChoiceItem::init() { deck_ = new Deck; for (TelltaleFlags i = 0; i < TelltaleState::max_flags; i++) { index_[i] = -1; } state()->set(TelltaleState::is_enabled, true); body(new Target(deck_, TargetPrimitiveHit)); } void ChoiceItem::look( const TelltaleFlags include, const TelltaleFlags exclude, Glyph* g ) { GlyphIndex g_index = -1; TelltaleFlags flags = state()->flags(); for (TelltaleFlags s = 0; s < TelltaleState::max_flags; s++) { if ((s & include) == include && (s & exclude) == 0) { GlyphIndex& i = index_[s]; if (i == -1) { if (g_index == -1) { g_index = deck_->count(); deck_->append(g); } i = g_index; if (s == flags) { deck_->flip_to(g_index); } } else { deck_->replace(i, g); } } } } Glyph* ChoiceItem::look(const TelltaleFlags s) const { if (s < TelltaleState::max_flags && index_[s] != -1) { return deck_->component(index_[s]); } return nil; } void ChoiceItem::update(Observable*) { TelltaleFlags s = state()->flags(); if (s < TelltaleState::max_flags && index_[s] != -1) { deck_->flip_to(index_[s]); } } neuron-7.6.3/src/lib/InterViews/texcomp.cpp000066400000000000000000000177141340731477100206750ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include static const int TOLERANCE = 100; static const float BADGSR = 4.5; class BreakSet { public: BreakSet(BreakSet*); ~BreakSet(); void add_break(CompositorIndex index, int demerits); void no_break(Coord natural, Coord stretch, Coord shrink); int demerits_; Coord natural_; Coord stretch_; Coord shrink_; CompositorIndex* breaks_; CompositorIndex size_; CompositorIndex count_; BreakSet* next_; BreakSet* prev_; }; BreakSet::BreakSet(BreakSet* b) { natural_ = 0; stretch_ = 0; shrink_ = 0; if (b == nil) { size_ = 20; breaks_ = new CompositorIndex[size_]; demerits_ = 0; count_ = 0; next_ = this; prev_ = this; } else { demerits_ = b->demerits_; size_ = b->size_; breaks_ = new CompositorIndex[size_]; count_ = b->count_; for (CompositorIndex i = 0; i < count_; ++i) { breaks_[i] = b->breaks_[i]; } next_ = b->next_; prev_ = b; prev_->next_ = this; next_->prev_ = this; } } BreakSet::~BreakSet() { prev_->next_ = next_; next_->prev_ = prev_; delete [] breaks_; } void BreakSet::add_break(CompositorIndex index, int demerits) { if (count_ == size_) { CompositorIndex size = size_ + 20; CompositorIndex* breaks = new CompositorIndex[size]; for (CompositorIndex i = 0; i < count_; ++i) { breaks[i] = breaks_[i]; } delete [] breaks_; breaks_ = breaks; size_ = size; } breaks_[count_] = index; ++count_; natural_ = 0; stretch_ = 0; shrink_ = 0; demerits_ += demerits; } inline void BreakSet::no_break(Coord natural, Coord stretch, Coord shrink) { natural_ += natural; stretch_ += stretch; shrink_ += shrink; } inline int demerits(int badness, int penalty, int linepenalty) { int lb = linepenalty + (badness > 0 ? badness : -badness); if (penalty > 0) { return lb * lb + penalty * penalty; } else { return lb * lb - penalty * penalty; } } inline int badness(Coord size, Coord natural, Coord stretch, Coord shrink) { int r; Coord gsr; if (size >= natural) { if (stretch == 0) { return PenaltyBad; } else { gsr = (size - natural)/stretch; if (gsr > BADGSR) { return PenaltyBad; } else { r = int(100 * gsr * gsr * gsr); return Math::min(r, PenaltyBad); } } } else if (shrink == 0 || size < natural - shrink) { return -PenaltyBad; } else { gsr = (size - natural)/shrink; if (gsr < -BADGSR) { return -PenaltyBad; } else { r = int(100 * gsr * gsr * gsr); return Math::max(r, -PenaltyBad); } } } static void possible_break( CompositorIndex index, Coord* spans, CompositorIndex span_count, Coord natural, Coord stretch, Coord shrink, int penalty, int breakpenalty, BreakSet* breaks ) { BreakSet* best_break = nil; BreakSet* doomed; int least_demerits; BreakSet* b = breaks->next_; while (b != breaks) { Coord span = spans[Math::min(b->count_, long(span_count-1))]; b->no_break(natural, stretch, shrink); int break_badness = badness( span, b->natural_, b->stretch_, b->shrink_ ); bool only_break = b == breaks->next_ && b->next_ == breaks; if (penalty <= PenaltyGood) { int break_demerits = demerits( break_badness, penalty, breakpenalty ); if (best_break == nil) { b->add_break(index, break_demerits); best_break = b; least_demerits = b->demerits_; } else if (b->demerits_ + break_demerits < least_demerits) { delete best_break; b->add_break(index, break_demerits); best_break = b; least_demerits = b->demerits_; } else { if (!only_break) { doomed = b; b = b->prev_; delete doomed; } } } else if (break_badness < -TOLERANCE) { if (only_break) { int break_demerits = demerits( break_badness, penalty, breakpenalty ); b->add_break(index, break_demerits); best_break = b; least_demerits = b->demerits_; } else { doomed = b; b = b->prev_; delete doomed; } } else if (break_badness <= TOLERANCE) { int break_demerits = demerits( break_badness, penalty, breakpenalty ); if (best_break == nil) { new BreakSet(b); b = b->next_; b->add_break(index, break_demerits); best_break = b; least_demerits = b->demerits_; } else if (b->demerits_ + break_demerits < least_demerits) { delete best_break; new BreakSet(b); b = b->next_; b->add_break(index, break_demerits); best_break = b; least_demerits = b->demerits_; } } b = b->next_; } } TeXCompositor::TeXCompositor(int penalty) : Compositor() { penalty_ = penalty; } TeXCompositor::~TeXCompositor() { } CompositorIndex TeXCompositor::compose( Coord* natural, Coord* stretch, Coord* shrink, int* penalties, CompositorIndex component_count, Coord* spans, CompositorIndex span_count, CompositorIndex* breaks, CompositorIndex break_count ) { BreakSet* best_breaks = new BreakSet(nil); new BreakSet(best_breaks); Coord nat = 0; Coord str = 0; Coord shr = 0; int penalty; for (CompositorIndex i = 0; i < component_count; ++i) { nat += natural[i]; str += stretch[i]; shr += shrink[i]; if (i == component_count - 1) { penalty = PenaltyGood; } else { penalty = penalties[i]; } if (penalty < PenaltyBad) { possible_break( i, spans, span_count, nat, str, shr, penalty, penalty_, best_breaks ); nat = 0; str = 0; shr = 0; } } CompositorIndex count = Math::min(break_count, best_breaks->next_->count_); for (CompositorIndex j = 0; j < count; ++j) { breaks[j] = best_breaks->next_->breaks_[j]; } BreakSet* doomed = best_breaks->next_; delete doomed; delete best_breaks; return count; } neuron-7.6.3/src/lib/InterViews/tformsetter.cpp000077500000000000000000000125541340731477100215740ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TransformSetter */ #include #include #include #include #include TransformSetter::TransformSetter(Glyph* g) : MonoGlyph(g) { } TransformSetter::TransformSetter( Glyph* g, const Transformer& tx ) : MonoGlyph(g) { transformer_ = tx; } TransformSetter::~TransformSetter() { } const Transformer& TransformSetter::transformer() const { return transformer_; } Transformer& TransformSetter::transformer() { return transformer_; } void TransformSetter::transformer(const Transformer& tx) { transformer_ = tx; } static void compute_req(Requirement& r, Coord first, Coord last) { Coord natural = last - first; r.natural(natural); r.stretch(0.0); r.shrink(0.0); if (Math::equal(natural, float(0), float(1e-3))) { r.alignment(0.0); } else { r.alignment(-first / natural); } } void TransformSetter::request(Requisition& req) const { TransformSetter* t = (TransformSetter*)this; MonoGlyph::request(req); Allocation& a = t->natural_allocation_; Requirement& rx = req.x_requirement(); Allotment& ax = a.x_allotment(); ax.origin(0.0); ax.span(rx.natural()); ax.alignment(rx.alignment()); Requirement& ry = req.y_requirement(); Allotment& ay = a.y_allotment(); ay.origin(0.0); ay.span(ry.natural()); ay.alignment(ry.alignment()); const Transformer& tx = transformer_; Coord left = ax.begin(), bottom = ay.begin(); Coord right = ax.end(), top = ay.end(); Coord x1, y1, x2, y2, x3, y3, x4, y4; tx.transform(left, bottom, x1, y1); tx.transform(left, top, x2, y2); tx.transform(right, top, x3, y3); tx.transform(right, bottom, x4, y4); left = Math::min(x1, x2, x3, x4); bottom = Math::min(y1, y2, y3, y4); right = Math::max(x1, x2, x3, x4); top = Math::max(y1, y2, y3, y4); compute_req(rx, left, right); compute_req(ry, bottom, top); } void TransformSetter::allocate( Canvas* c, const Allocation& a, Extension& ext ) { /* * Shouldn't need to test for nil canvas, but some old * applications (notably doc) pass nil as a canvas * when doing certain kinds of allocation. */ if (c != nil) { push_transform(c, a, natural_allocation_); MonoGlyph::allocate(c, natural_allocation_, ext); c->pop_transform(); } } void TransformSetter::draw(Canvas* c, const Allocation& a) const { push_transform(c, a, natural_allocation_); MonoGlyph::draw(c, natural_allocation_); c->pop_transform(); } void TransformSetter::print(Printer* p, const Allocation& a) const { push_transform(p, a, natural_allocation_); MonoGlyph::print(p, natural_allocation_); p->pop_transform(); } void TransformSetter::pick(Canvas* c, const Allocation& a, int depth, Hit& h) { Transformer t(transformer_); transform(t, a, natural_allocation_); c->push_transform(); c->transform(t); h.push_transform(); h.transform(t); MonoGlyph::pick(c, natural_allocation_, depth, h); c->pop_transform(); h.pop_transform(); } void TransformSetter::push_transform( Canvas* c, const Allocation& a, const Allocation& natural ) const { Transformer t(transformer_); transform(t, a, natural); c->push_transform(); c->transform(t); } void TransformSetter::transform( Transformer& t, const Allocation& a, const Allocation& ) const { t.translate(a.x(), a.y()); } /* class TransformFitter */ TransformFitter::TransformFitter(Glyph* g) : TransformSetter(g) { } TransformFitter::~TransformFitter() { } void TransformFitter::transform( Transformer& t, const Allocation& a, const Allocation& natural ) const { const Allotment& natural_x = natural.x_allotment(); const Allotment& natural_y = natural.y_allotment(); if (!Math::equal(natural_x.span(), Coord(0), float(1e-2)) && !Math::equal(natural_y.span(), Coord(0), float(1e-2)) ) { const Allotment& ax = a.x_allotment(); const Allotment& ay = a.y_allotment(); t.scale( a.x_allotment().span() / natural_x.span(), a.y_allotment().span() / natural_y.span() ); } t.translate(a.x(), a.y()); } neuron-7.6.3/src/lib/InterViews/tiff.cpp000066400000000000000000000637751340731477100201560ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef MAC #include #include #include #include #include #define howmany(x, y) (((x)+((y)-1))/(y)) typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; typedef unsigned char RGBvalue; class TIFFRasterImpl; typedef void (TIFFRasterImpl::*tileContigRoutine)( u_long*, const u_char*, const RGBvalue*, u_long, u_long, int, int ); typedef void (TIFFRasterImpl::*tileSeparateRoutine)( u_long*, const u_char*, const u_char*, const u_char*, const RGBvalue*, u_long, u_long, int, int ); class TIFFRasterImpl { private: friend class TIFFRaster; TIFF* tif_; u_long* raster_; /* packed image data */ u_short bitspersample_; u_short samplesperpixel_; u_short photometric_; u_short orientation_; u_short* redcmap_; /* colormap for pallete images */ u_short* greencmap_; u_short* bluecmap_; u_long** BWmap_; /* B&W mapping table */ u_long** PALmap_; /* palette image mapping table */ TIFFRasterImpl(); ~TIFFRasterImpl(); Raster* load(const char* filename); bool gt(u_long w, u_long h); bool gtTileContig(const RGBvalue* Map, u_long h, u_long w); bool gtTileSeparate(const RGBvalue* Map, u_long h, u_long w); bool gtStripContig(const RGBvalue* Map, u_long h, u_long w); bool gtStripSeparate(const RGBvalue* Map, u_long h, u_long w); u_long setorientation(u_long h); bool makebwmap(RGBvalue* Map); bool makecmap( const u_short* rmap, const u_short* gmap, const u_short* bmap ); void put8bitcmaptile( u_long* dest, const u_char* src, const RGBvalue* Map, u_long w, u_long h, int fromskew, int toskew ); void put4bitcmaptile( u_long* dest, const u_char* src, const RGBvalue* Map, u_long w, u_long h, int fromskew, int toskew ); void put2bitcmaptile( u_long* dest, const u_char* src, const RGBvalue* Map, u_long w, u_long h, int fromskew, int toskew ); void put1bitcmaptile( u_long* dest, const u_char* src, const RGBvalue* Map, u_long w, u_long h, int fromskew, int toskew ); void put1bitbwtile( u_long* dest, const u_char* src, const RGBvalue* Map, u_long w, u_long h, int fromskew, int toskew ); void put2bitbwtile( u_long* dest, const u_char* src, const RGBvalue* Map, u_long w, u_long h, int fromskew, int toskew ); void put4bitbwtile( u_long* dest, const u_char* src, const RGBvalue* Map, u_long w, u_long h, int fromskew, int toskew ); void putRGBgreytile( u_long* dest, const u_char* src, const RGBvalue* Map, u_long w, u_long h, int fromskew, int toskew ); void putRGBcontig8bittile( u_long* dest, const u_char* src, const RGBvalue* Map, u_long w, u_long h, int fromskew, int toskew ); void putRGBcontig16bittile( u_long* dest, const u_char* src, const RGBvalue* Map, u_long w, u_long h, int fromskew, int toskew ); void putRGBseparate8bittile( u_long* dest, const u_char* red, const u_char* green, const u_char* blue, const RGBvalue* Map, u_long w, u_long h, int fromskew, int toskew ); void putRGBseparate16bittile( u_long* dest, const u_char* red, const u_char* green, const u_char* blue, const RGBvalue* Map, u_long w, u_long h, int fromskew, int toskew ); tileContigRoutine pickTileContigCase(const RGBvalue* Map); tileSeparateRoutine pickTileSeparateCase(const RGBvalue* Map); }; TIFFRasterImpl::TIFFRasterImpl() {} TIFFRasterImpl::~TIFFRasterImpl() {} Raster* TIFFRaster::load(const char* filename, bool) { TIFFRasterImpl impl; return impl.load(filename); } Raster* TIFFRasterImpl::load(const char* filename) { tif_ = TIFFOpen(filename, "r"); if (tif_ == nil) { return nil; } if (!TIFFGetField(tif_, TIFFTAG_BITSPERSAMPLE, &bitspersample_)) { bitspersample_ = 1; } switch (bitspersample_) { case 1: case 2: case 4: case 8: case 16: break; default: TIFFClose(tif_); return nil; } if (!TIFFGetField(tif_, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel_)) { samplesperpixel_ = 1; } switch (samplesperpixel_) { case 1: case 3: case 4: break; default: TIFFClose(tif_); return nil; } u_long width; TIFFGetField(tif_, TIFFTAG_IMAGEWIDTH, &width); u_long height; TIFFGetField(tif_, TIFFTAG_IMAGELENGTH, &height); if (!TIFFGetField(tif_, TIFFTAG_PHOTOMETRIC, &photometric_)) { switch (samplesperpixel_) { case 1: photometric_ = PHOTOMETRIC_MINISBLACK; break; case 3: case 4: photometric_ = PHOTOMETRIC_RGB; break; default: TIFFClose(tif_); return nil; } } Raster* r = nil; raster_ = new u_long[width * height]; BWmap_ = nil; PALmap_ = nil; if (raster_ != nil && gt(width, height)) { /* create raster_ from packed image data */ r = new Raster(width, height); for (long i = height - 1; i >= 0; i--) { u_char* c = (u_char*) (raster_ + i*width); /* should use a lookup table here */ for (long j = 0; j < width; j++) { r->poke( j, i, #ifdef LINUX ColorIntensity(float(c[0]) / float(0xff)), ColorIntensity(float(c[1]) / float(0xff)), ColorIntensity(float(c[2]) / float(0xff)), #else ColorIntensity(float(c[3]) / float(0xff)), ColorIntensity(float(c[2]) / float(0xff)), ColorIntensity(float(c[1]) / float(0xff)), #endif 1.0 ); c += sizeof (u_long); } } } TIFFClose(tif_); delete raster_; delete BWmap_; delete PALmap_; return r; } static int checkcmap( int n, const u_short* r, const u_short* g, const u_short* b ) { while (n-- > 0) { if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256) { return 16; } } return 8; } bool TIFFRasterImpl::gt(u_long w, u_long h) { u_short minsamplevalue; u_short maxsamplevalue; u_short planarconfig; RGBvalue* Map = nil; if (!TIFFGetField(tif_, TIFFTAG_MINSAMPLEVALUE, &minsamplevalue)) { minsamplevalue = 0; } if (!TIFFGetField(tif_, TIFFTAG_MAXSAMPLEVALUE, &maxsamplevalue)) { maxsamplevalue = (1< 0; i--) { #define CVT(x) (((x) * 255) / ((1L<<16)-1)) redcmap_[i] = (u_short) CVT(redcmap_[i]); greencmap_[i] = (u_short) CVT(greencmap_[i]); bluecmap_[i] = (u_short) CVT(bluecmap_[i]); } } if (bitspersample_ <= 8) { /* * Use mapping table and colormap to construct * unpacking tables for samples < 8 bits. */ if (!makecmap(redcmap_, greencmap_, bluecmap_)) { return false; } } break; } TIFFGetField(tif_, TIFFTAG_PLANARCONFIG, &planarconfig); bool e; if (planarconfig == PLANARCONFIG_SEPARATE && samplesperpixel_ > 1) { e = TIFFIsTiled(tif_) ? gtTileSeparate(Map, h, w) : gtStripSeparate(Map, h, w); } else { e = TIFFIsTiled(tif_) ? gtTileContig(Map, h, w) : gtStripContig(Map, h, w); } delete Map; return e; } u_long TIFFRasterImpl::setorientation(u_long h) { u_long y; if (!TIFFGetField(tif_, TIFFTAG_ORIENTATION, &orientation_)) { orientation_ = ORIENTATION_TOPLEFT; } switch (orientation_) { case ORIENTATION_BOTRIGHT: case ORIENTATION_RIGHTBOT: /* XXX */ case ORIENTATION_LEFTBOT: /* XXX */ TIFFWarning(TIFFFileName(tif_), "using bottom-left orientation"); orientation_ = ORIENTATION_BOTLEFT; /* fall thru... */ case ORIENTATION_BOTLEFT: y = 0; break; case ORIENTATION_TOPRIGHT: case ORIENTATION_RIGHTTOP: /* XXX */ case ORIENTATION_LEFTTOP: /* XXX */ default: TIFFWarning(TIFFFileName(tif_), "using top-left orientation"); orientation_ = ORIENTATION_TOPLEFT; /* fall thru... */ case ORIENTATION_TOPLEFT: y = h-1; break; } return y; } /* * Get an tile-organized image that has * PlanarConfiguration contiguous if SamplesPerPixel > 1 * or * SamplesPerPixel == 1 */ bool TIFFRasterImpl::gtTileContig(const RGBvalue* Map, u_long h, u_long w) { u_char* buf = new u_char[TIFFTileSize(tif_)]; if (buf == nil) { TIFFError(TIFFFileName(tif_), "No space for tile buffer"); return false; } tileContigRoutine put = pickTileContigCase(Map); u_long tw; TIFFGetField(tif_, TIFFTAG_TILEWIDTH, &tw); u_long th; TIFFGetField(tif_, TIFFTAG_TILELENGTH, &th); u_long y = setorientation(h); int toskew = (int)(orientation_ == ORIENTATION_TOPLEFT ? -tw+-w : -tw+w); for (u_long row = 0; row < h; row += th) { u_long nrow = (row + th > h ? h - row : th); for (u_long col = 0; col < w; col += tw) { if (TIFFReadTile(tif_, buf, col, row, 0, 0) < 0) { break; } if (col + tw > w) { /* * Tile is clipped horizontally. Calculate * visible portion and skewing factors. */ u_long npix = w - col; int fromskew = (int)(tw - npix); (this->*put)( raster_ + y*w + col, buf, Map, npix, nrow, fromskew, toskew + fromskew ); } else (this->*put)( raster_ + y*w + col, buf, Map, tw, nrow, 0, toskew ); } y += (orientation_ == ORIENTATION_TOPLEFT ? -nrow : nrow); } delete [] buf; return true; } /* * Get an tile-organized image that has * SamplesPerPixel > 1 * PlanarConfiguration separated * We assume that all such images are RGB. */ bool TIFFRasterImpl::gtTileSeparate( const RGBvalue* Map, u_long h, u_long w ) { u_long tilesize = TIFFTileSize(tif_); u_char* buf = new u_char[3*tilesize]; if (buf == nil) { TIFFError(TIFFFileName(tif_), "No space for tile buffer"); return false; } u_char* r = buf; u_char* g = r + tilesize; u_char* b = g + tilesize; tileSeparateRoutine put = pickTileSeparateCase(Map); u_long tw; TIFFGetField(tif_, TIFFTAG_TILEWIDTH, &tw); u_long th; TIFFGetField(tif_, TIFFTAG_TILELENGTH, &th); u_long y = setorientation(h); int toskew = (int)(orientation_ == ORIENTATION_TOPLEFT ? -tw+-w : -tw+w); for (u_long row = 0; row < h; row += th) { u_long nrow = (row + th > h ? h - row : th); for (u_long col = 0; col < w; col += tw) { if (TIFFReadTile(tif_, r, col, row, 0, 0) < 0) { break; } if (TIFFReadTile(tif_, g, col, row, 0, 1) < 0) { break; } if (TIFFReadTile(tif_, b, col, row, 0, 2) < 0) { break; } if (col + tw > w) { /* * Tile is clipped horizontally. Calculate * visible portion and skewing factors. */ u_long npix = w - col; int fromskew = (int)(tw - npix); (this->*put)( raster_ + y*w + col, r, g, b, Map, npix, nrow, fromskew, toskew + fromskew ); } else (this->*put)( raster_ + y*w + col, r, g, b, Map, tw, nrow, 0, toskew ); } y += (orientation_ == ORIENTATION_TOPLEFT ? -nrow : nrow); } delete [] buf; return true; } /* * Get a strip-organized image that has * PlanarConfiguration contiguous if SamplesPerPixel > 1 * or * SamplesPerPixel == 1 */ bool TIFFRasterImpl::gtStripContig( const RGBvalue* Map, u_long h, u_long w ) { u_char* buf = new u_char[TIFFStripSize(tif_)]; if (buf == nil) { TIFFError(TIFFFileName(tif_), "No space for strip buffer"); return (false); } tileContigRoutine put = pickTileContigCase(Map); u_long y = setorientation(h); int toskew = (int)(orientation_ == ORIENTATION_TOPLEFT ? -w + -w : -w + w); u_long rowsperstrip = (u_long) -1L; TIFFGetField(tif_, TIFFTAG_ROWSPERSTRIP, &rowsperstrip); u_long imagewidth; TIFFGetField(tif_, TIFFTAG_IMAGEWIDTH, &imagewidth); int scanline = TIFFScanlineSize(tif_); int fromskew = (int)(w < imagewidth ? imagewidth - w : 0); for (u_long row = 0; row < h; row += rowsperstrip) { u_int nrow = u_int(row + rowsperstrip > h ? h - row : rowsperstrip); if (TIFFReadEncodedStrip( tif_, TIFFComputeStrip(tif_, row, 0), buf, nrow*scanline) < 0 ) { break; } (this->*put)(raster_ + y*w, buf, Map, w, nrow, fromskew, toskew); y += (orientation_ == ORIENTATION_TOPLEFT ? -nrow : nrow); } delete [] buf; return true; } /* * Get a strip-organized image with * SamplesPerPixel > 1 * PlanarConfiguration separated * We assume that all such images are RGB. */ bool TIFFRasterImpl::gtStripSeparate( const RGBvalue* Map, u_long h, u_long w ) { u_long stripsize = TIFFStripSize(tif_); u_char* buf = new u_char[3*stripsize]; u_char* r = buf; u_char* g = r + stripsize; u_char* b = g + stripsize; tileSeparateRoutine put = pickTileSeparateCase(Map); u_long y = setorientation(h); int toskew = (int)(orientation_ == ORIENTATION_TOPLEFT ? -w + -w : -w + w); u_long rowsperstrip = (u_long) -1L; TIFFGetField(tif_, TIFFTAG_ROWSPERSTRIP, &rowsperstrip); u_long imagewidth; TIFFGetField(tif_, TIFFTAG_IMAGEWIDTH, &imagewidth); int scanline = TIFFScanlineSize(tif_); int fromskew = (int)(w < imagewidth ? imagewidth - w : 0); for (u_long row = 0; row < h; row += rowsperstrip) { u_int nrow = u_int(row + rowsperstrip > h ? h - row : rowsperstrip); if (TIFFReadEncodedStrip( tif_, TIFFComputeStrip(tif_, row, 0), r, nrow*scanline) < 0 ) { break; } if (TIFFReadEncodedStrip( tif_, TIFFComputeStrip(tif_, row, 1), g, nrow*scanline) < 0 ) { break; } if (TIFFReadEncodedStrip( tif_, TIFFComputeStrip(tif_, row, 2), b, nrow*scanline) < 0 ) { break; } (this->*put)(raster_ + y*w, r, g, b, Map, w, nrow, fromskew, toskew); y += (orientation_ == ORIENTATION_TOPLEFT ? -nrow : nrow); } delete [] buf; return true; } #define PACK(r,g,b) ((u_long)(r))|(((u_long)(g))<<8)|(((u_long)(b))<<16) /* * Greyscale images with less than 8 bits/sample are handled * with a table to avoid lots of shifts and masks. The table * is setup so that put*bwtile (below) can retrieve 8/bitspersample_ * pixel values simply by indexing into the table with one * number. */ bool TIFFRasterImpl::makebwmap(RGBvalue* Map) { register int i; int nsamples = 8 / bitspersample_; BWmap_ = (u_long **)malloc( 256*sizeof (u_long *)+(256*nsamples*sizeof(u_long)) ); if (BWmap_ == nil) { TIFFError(TIFFFileName(tif_), "No space for B&W mapping table"); return false; } register u_long* p = (u_long*)(BWmap_ + 256); for (i = 0; i < 256; i++) { BWmap_[i] = p; switch (bitspersample_) { register RGBvalue c; #define GREY(x) c = Map[x]; *p++ = PACK(c,c,c); case 1: GREY(i>>7); GREY((i>>6)&1); GREY((i>>5)&1); GREY((i>>4)&1); GREY((i>>3)&1); GREY((i>>2)&1); GREY((i>>1)&1); GREY(i&1); break; case 2: GREY(i>>6); GREY((i>>4)&3); GREY((i>>2)&3); GREY(i&3); break; case 4: GREY(i>>4); GREY(i&0xf); break; } #undef GREY } return true; } /* * Palette images with <= 8 bits/sample are handled * with a table to avoid lots of shifts and masks. The table * is setup so that put*cmaptile (below) can retrieve 8/bitspersample_ * pixel values simply by indexing into the table with one * number. */ bool TIFFRasterImpl::makecmap( const u_short* rmap, const u_short* gmap, const u_short* bmap ) { register int i; int nsamples = 8 / bitspersample_; register u_long *p; PALmap_ = (u_long **)malloc( 256*sizeof (u_long *)+(256*nsamples*sizeof(u_long)) ); if (PALmap_ == nil) { TIFFError(TIFFFileName(tif_), "No space for Palette mapping table"); return (false); } p = (u_long *)(PALmap_ + 256); for (i = 0; i < 256; i++) { PALmap_[i] = p; #define CMAP(x) \ c = x; *p++ = PACK(rmap[c]&0xff, gmap[c]&0xff, bmap[c]&0xff); switch (bitspersample_) { register RGBvalue c; case 1: CMAP(i>>7); CMAP((i>>6)&1); CMAP((i>>5)&1); CMAP((i>>4)&1); CMAP((i>>3)&1); CMAP((i>>2)&1); CMAP((i>>1)&1); CMAP(i&1); break; case 2: CMAP(i>>6); CMAP((i>>4)&3); CMAP((i>>2)&3); CMAP(i&3); break; case 4: CMAP(i>>4); CMAP(i&0xf); break; case 8: CMAP(i); break; } #undef CMAP } return (true); } /* * The following routines move decoded data returned * from the TIFF library into rasters that are suitable * for passing to lrecwrite. They do the necessary * conversions based on whether the drawing mode is RGB * colormap and whether or not there is a mapping table. * * The routines have been created according to the most * important cases and optimized. pickTileContigCase and * pickTileSeparateCase analyze the parameters and select * the appropriate "put" routine to use. */ #define REPEAT8(op) REPEAT4(op); REPEAT4(op) #define REPEAT4(op) REPEAT2(op); REPEAT2(op) #define REPEAT2(op) op; op #define CASE8(x,op) \ switch (x) { \ case 7: op; case 6: op; case 5: op; \ case 4: op; case 3: op; case 2: op; \ case 1: op; \ } #define CASE4(x,op) switch (x) { case 3: op; case 2: op; case 1: op; } #define UNROLL8(w, op1, op2) { \ u_long x; \ for (x = w; x >= 8; x -= 8) { \ op1; \ REPEAT8(op2); \ } \ if (x > 0) { \ op1; \ CASE8(x,op2); \ } \ } #define UNROLL4(w, op1, op2) { \ u_long x; \ for (x = w; x >= 4; x -= 4) { \ op1; \ REPEAT4(op2); \ } \ if (x > 0) { \ op1; \ CASE4(x,op2); \ } \ } #define UNROLL2(w, op1, op2) { \ u_long x; \ for (x = w; x >= 2; x -= 2) { \ op1; \ REPEAT2(op2); \ } \ if (x) { \ op1; \ op2; \ } \ } #define SKEW(r,g,b,skew) { r += skew; g += skew; b += skew; } /* * 8-bit palette => RGB */ void TIFFRasterImpl::put8bitcmaptile( u_long* cp, const u_char* pp, const RGBvalue*, u_long w, u_long h, int fromskew, int toskew ) { while (h-- > 0) { UNROLL8(w,, *cp++ = PALmap_[*pp++][0]); cp += toskew; pp += fromskew; } } /* * 4-bit palette => RGB */ void TIFFRasterImpl::put4bitcmaptile( u_long* cp, const u_char* pp, const RGBvalue*, u_long w, u_long h, int fromskew, int toskew ) { u_long *bw; fromskew /= 2; while (h-- > 0) { UNROLL2(w, bw = PALmap_[*pp++], *cp++ = *bw++); cp += toskew; pp += fromskew; } } /* * 2-bit palette => RGB */ void TIFFRasterImpl::put2bitcmaptile( u_long* cp, const u_char* pp, const RGBvalue*, u_long w, u_long h, int fromskew, int toskew ) { u_long *bw; fromskew /= 4; while (h-- > 0) { UNROLL4(w, bw = PALmap_[*pp++], *cp++ = *bw++); cp += toskew; pp += fromskew; } } /* * 1-bit palette => RGB */ void TIFFRasterImpl::put1bitcmaptile( u_long* cp, const u_char* pp, const RGBvalue*, u_long w, u_long h, int fromskew, int toskew ) { u_long *bw; fromskew /= 8; while (h-- > 0) { UNROLL8(w, bw = PALmap_[*pp++], *cp++ = *bw++); cp += toskew; pp += fromskew; } } /* * 1-bit bilevel => RGB */ void TIFFRasterImpl::put1bitbwtile( u_long* cp, const u_char* pp, const RGBvalue*, u_long w, u_long h, int fromskew, int toskew ) { u_long* bw; fromskew /= 8; while (h-- > 0) { UNROLL8(w, bw = BWmap_[*pp++], *cp++ = *bw++); cp += toskew; pp += fromskew; } } /* * 2-bit greyscale => RGB */ void TIFFRasterImpl::put2bitbwtile( u_long* cp, const u_char* pp, const RGBvalue*, u_long w, u_long h, int fromskew, int toskew ) { u_long* bw; fromskew /= 4; while (h-- > 0) { UNROLL4(w, bw = BWmap_[*pp++], *cp++ = *bw++); cp += toskew; pp += fromskew; } } /* * 4-bit greyscale => RGB */ void TIFFRasterImpl::put4bitbwtile( u_long* cp, const u_char* pp, const RGBvalue*, u_long w, u_long h, int fromskew, int toskew ) { u_long* bw; fromskew /= 2; while (h-- > 0) { UNROLL2(w, bw = BWmap_[*pp++], *cp++ = *bw++); cp += toskew; pp += fromskew; } } /* * 8-bit packed samples => RGB */ void TIFFRasterImpl::putRGBcontig8bittile( u_long* cp, const u_char* pp, const RGBvalue* Map, u_long w, u_long h, int fromskew, int toskew ) { fromskew *= samplesperpixel_; if (Map) { while (h-- > 0) { u_long x; for (x = w; x-- > 0;) { *cp++ = PACK(Map[pp[0]], Map[pp[1]], Map[pp[2]]); pp += samplesperpixel_; } pp += fromskew; cp += toskew; } } else { while (h-- > 0) { UNROLL8(w,, *cp++ = PACK(pp[0], pp[1], pp[2]); pp += samplesperpixel_); cp += toskew; pp += fromskew; } } } /* * 16-bit packed samples => RGB */ void TIFFRasterImpl::putRGBcontig16bittile( u_long* cp, const u_char* pp, const RGBvalue* Map, u_long w, u_long h, int fromskew, int toskew ) { u_long x; fromskew *= samplesperpixel_; if (Map) { while (h-- > 0) { for (x = w; x-- > 0;) { *cp++ = PACK(Map[pp[0]], Map[pp[1]], Map[pp[2]]); pp += samplesperpixel_; } cp += toskew; pp += fromskew; } } else { while (h-- > 0) { for (x = w; x-- > 0;) { *cp++ = PACK(pp[0], pp[1], pp[2]); pp += samplesperpixel_; } cp += toskew; pp += fromskew; } } } /* * 8-bit unpacked samples => RGB */ void TIFFRasterImpl::putRGBseparate8bittile( u_long* cp, const u_char* r, const u_char* g, const u_char* b, const RGBvalue* Map, u_long w, u_long h, int fromskew, int toskew ) { if (Map) { while (h-- > 0) { u_long x; for (x = w; x > 0; x--) *cp++ = PACK(Map[*r++], Map[*g++], Map[*b++]); SKEW(r, g, b, fromskew); cp += toskew; } } else { while (h-- > 0) { UNROLL8(w,, *cp++ = PACK(*r++, *g++, *b++)); SKEW(r, g, b, fromskew); cp += toskew; } } } /* * 16-bit unpacked samples => RGB */ void TIFFRasterImpl::putRGBseparate16bittile( u_long* cp, const u_char* r, const u_char* g, const u_char* b, const RGBvalue* Map, u_long w, u_long h, int fromskew, int toskew ) { u_long x; if (Map) { while (h-- > 0) { for (x = w; x > 0; x--) *cp++ = PACK(Map[*r++], Map[*g++], Map[*b++]); SKEW(r, g, b, fromskew); cp += toskew; } } else { while (h-- > 0) { for (x = 0; x < w; x++) *cp++ = PACK(*r++, *g++, *b++); SKEW(r, g, b, fromskew); cp += toskew; } } } /* * 8-bit greyscale => RGB */ void TIFFRasterImpl::putRGBgreytile( u_long* cp, const u_char* pp, const RGBvalue* Map, u_long w, u_long h, int fromskew, int toskew ) { while (h-- > 0) { u_long x; for (x = w; x-- > 0;) { RGBvalue c = Map[*pp++]; *cp++ = PACK(c,c,c); } cp += toskew; pp += fromskew; } } /* * Select the appropriate conversion routine for packed data. */ tileContigRoutine TIFFRasterImpl::pickTileContigCase(const RGBvalue*) { tileContigRoutine put = 0; switch (photometric_) { case PHOTOMETRIC_RGB: if (bitspersample_ == 8) { put = &TIFFRasterImpl::putRGBcontig8bittile; } else { put = &TIFFRasterImpl::putRGBcontig16bittile; } break; case PHOTOMETRIC_PALETTE: switch (bitspersample_) { case 8: put = &TIFFRasterImpl::put8bitcmaptile; break; case 4: put = &TIFFRasterImpl::put4bitcmaptile; break; case 2: put = &TIFFRasterImpl::put2bitcmaptile; break; case 1: put = &TIFFRasterImpl::put1bitcmaptile; break; } break; case PHOTOMETRIC_MINISWHITE: case PHOTOMETRIC_MINISBLACK: switch (bitspersample_) { case 8: put = &TIFFRasterImpl::putRGBgreytile; break; case 4: put = &TIFFRasterImpl::put4bitbwtile; break; case 2: put = &TIFFRasterImpl::put2bitbwtile; break; case 1: put = &TIFFRasterImpl::put1bitbwtile; break; } break; } return (put); } /* * Select the appropriate conversion routine for unpacked data. * * NB: we assume that unpacked single channel data is directed * to the "packed routines. */ tileSeparateRoutine TIFFRasterImpl::pickTileSeparateCase(const RGBvalue*) { if (bitspersample_ == 8) { return &TIFFRasterImpl::putRGBseparate8bittile; } return &TIFFRasterImpl::putRGBseparate16bittile; } #endif neuron-7.6.3/src/lib/InterViews/tile.cpp000066400000000000000000000306511340731477100201460ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include static void compute_tile_request( DimensionName d, float a, GlyphIndex count, const Requisition* request, Requisition& result ) { Coord natural = 0, min_size = 0, max_size = 0; for (GlyphIndex i = 0; i < count; i++) { const Requirement& r = request[i].requirement(d); if (r.defined()) { Coord n = r.natural(); natural += n; max_size += n + r.stretch(); min_size += n - r.shrink(); } } Requirement& nr = result.requirement(d); nr.natural(natural); nr.stretch(max_size - natural); nr.shrink(natural - min_size); nr.alignment(a); } Tile::Tile(DimensionName d) : Layout() { dimension_ = d; } Tile::~Tile() { } void Tile::request( GlyphIndex count, const Requisition* request, Requisition& result ) { compute_tile_request(dimension_, 0.0, count, request, result); requisition_ = result; } void Tile::allocate( const Allocation& given, GlyphIndex count, const Requisition* request, Allocation* result ) { const Allotment& g = given.allotment(dimension_); Requirement& r = requisition_.requirement(dimension_); Coord span = g.span(); if (r.alignment() == 0) { span = Coord(float(span) * (1 - g.alignment())); } else if (r.alignment() == 1) { span = Coord(float(span) * g.alignment()); } else { span = Coord( float(span) * Math::min( g.alignment()/r.alignment(), (1 - g.alignment())/(1 - r.alignment()) ) ); } Coord natural = r.natural(); bool growing = span > natural; bool shrinking = span < natural; float f; if (growing && r.stretch() > 0) { f = float(span - natural) / float(r.stretch()); } else if (shrinking && r.shrink() > 0) { f = float(natural - span) / float(r.shrink()); } else { f = 0; } Coord p = g.origin(); for (unsigned long index = 0; index < count; ++index) { const Requirement& r = request[index].requirement(dimension_); Allotment& a = result[index].allotment(dimension_); if (r.defined()) { Coord cspan = r.natural(); if (growing) { cspan += Coord(float(r.stretch()) * f); } else if (shrinking) { cspan -= Coord(float(r.shrink()) * f); } a.span(cspan); a.origin(p + Coord(r.alignment() * cspan)); a.alignment(r.alignment()); p += cspan; } else { a.span(0); a.origin(p); a.alignment(0); } } } TileReversed::TileReversed(DimensionName d) : Layout() { dimension_ = d; } TileReversed::~TileReversed() { } void TileReversed::request( GlyphIndex count, const Requisition* request, Requisition& result ) { compute_tile_request(dimension_, 1.0, count, request, result); requisition_ = result; } void TileReversed::allocate( const Allocation& given, GlyphIndex count, const Requisition* request, Allocation* result ) { const Allotment& g = given.allotment(dimension_); Requirement& r = requisition_.requirement(dimension_); Coord span = g.span(); if (r.alignment() == 0) { span = Coord(float(span) * (1 - g.alignment())); } else if (r.alignment() == 1) { span = Coord(float(span) * g.alignment()); } else { span = Coord( float(span) * Math::min( g.alignment()/r.alignment(), (1 - g.alignment())/(1 - r.alignment()) ) ); } Coord natural = r.natural(); bool growing = span > natural; bool shrinking = span < natural; float f; if (growing && r.stretch() > 0) { f = float(span - natural) / float(r.stretch()); } else if (shrinking && r.shrink() > 0) { f = float(natural - span) / float(r.shrink()); } else { f = 0; } Coord p = g.origin(); for (unsigned long index = 0; index < count; ++index) { const Requirement& r = request[index].requirement(dimension_); Allotment a; if (r.defined()) { Coord cspan = r.natural(); if (growing) { cspan += Coord(float(r.stretch()) * f); } else if (shrinking) { cspan -= Coord(float(r.shrink()) * f); } p -= cspan; a.span(cspan); a.origin(p + Coord(r.alignment() * cspan)); a.alignment(r.alignment()); } else { a.span(0); a.origin(p); a.alignment(0); } result[index].allot(dimension_, a); } } TileFirstAligned::TileFirstAligned(DimensionName dimension) : Layout() { dimension_ = dimension; } TileFirstAligned::~TileFirstAligned() { } void TileFirstAligned::request( GlyphIndex count, const Requisition* request, Requisition& result ) { Coord natural_lead = 0; Coord min_lead = 0; Coord max_lead = 0; Coord natural_trail = 0; Coord min_trail = 0; Coord max_trail = 0; for (unsigned long index = 0; index < count; ++index) { const Requirement& r = request[index].requirement(dimension_); if (r.defined()) { if (index == 0) { natural_lead = Coord(r.natural() * r.alignment()); max_lead = Coord((r.natural() + r.stretch()) * r.alignment()); min_lead = Coord((r.natural() - r.shrink()) * r.alignment()); natural_trail = Coord(r.natural() * (1 - r.alignment())); max_trail = Coord( (r.natural() + r.stretch()) * (1 - r.alignment()) ); min_trail = Coord( (r.natural() - r.shrink()) * (1 - r.alignment()) ); } else { natural_trail += r.natural(); max_trail += r.natural() + r.stretch(); min_trail += r.natural() - r.shrink(); } } } Requirement nr( natural_lead, max_lead, min_lead, natural_trail, max_trail, min_trail ); result.require(dimension_, nr); requisition_ = result; } void TileFirstAligned::allocate( const Allocation& given, GlyphIndex count, const Requisition* request, Allocation* result ) { const Allotment& g = given.allotment(dimension_); Requirement& r = requisition_.requirement(dimension_); Coord span = g.span(); if (r.alignment() == 0) { span = Coord(float(span) * (1 - g.alignment())); } else if (r.alignment() == 1) { span = Coord(float(span) * g.alignment()); } else { span = Coord( float(span) * Math::min( g.alignment()/r.alignment(), (1 - g.alignment())/(1 - r.alignment()) ) ); } Coord natural = r.natural(); bool growing = span > natural; bool shrinking = span < natural; float f; if (growing && r.stretch() > 0) { f = float(span - natural) / float(r.stretch()); } else if (shrinking && r.shrink() > 0) { f = float(natural - span) / float(r.shrink()); } else { f = 0; } Coord p = g.origin(); for (unsigned long index = 0; index < count; ++index) { const Requirement& r = request[index].requirement(dimension_); Allotment a; if (r.defined()) { Coord cspan = r.natural(); if (growing) { cspan += Coord(float(r.stretch()) * f); } else if (shrinking) { cspan -= Coord(float(r.shrink()) * f); } if (index == 0) { p -= Coord(r.alignment() * float(cspan)); } a.span(cspan); a.origin(p + Coord(r.alignment() * cspan)); a.alignment(r.alignment()); p += cspan; } else { a.span(0); a.origin(p); a.alignment(0); } result[index].allot(dimension_, a); } } TileReversedFirstAligned::TileReversedFirstAligned( DimensionName d ) : Layout() { dimension_ = d; } TileReversedFirstAligned::~TileReversedFirstAligned() { } void TileReversedFirstAligned::request( GlyphIndex count, const Requisition* request, Requisition& result ) { Coord natural_lead = 0; Coord min_lead = 0; Coord max_lead = 0; Coord natural_trail = 0; Coord min_trail = 0; Coord max_trail = 0; for (unsigned long index = 0; index < count; ++index) { const Requirement& r = request[index].requirement(dimension_); if (r.defined()) { if (index == 0) { natural_lead = Coord(r.natural() * r.alignment()); max_lead = Coord((r.natural() + r.stretch()) * r.alignment()); min_lead = Coord((r.natural() - r.shrink()) * r.alignment()); natural_trail = Coord(r.natural() * (1 - r.alignment())); max_trail = Coord( (r.natural() + r.stretch()) * (1 - r.alignment()) ); min_trail = Coord( (r.natural() - r.shrink()) * (1 - r.alignment()) ); } else { natural_lead += r.natural(); max_lead += r.natural() + r.stretch(); min_lead += r.natural() - r.shrink(); } } } Requirement nr( natural_lead, max_lead, min_lead, natural_trail, max_trail, min_trail ); result.require(dimension_, nr); requisition_ = result; } void TileReversedFirstAligned::allocate( const Allocation& given, GlyphIndex count, const Requisition* request, Allocation* result ) { const Allotment& g = given.allotment(dimension_); Requirement& r = requisition_.requirement(dimension_); Coord span = g.span(); if (r.alignment() == 0) { span = Coord(float(span) * (1 - g.alignment())); } else if (r.alignment() == 1) { span = Coord(float(span) * g.alignment()); } else { span = Coord( float(span) * Math::min( g.alignment()/r.alignment(), (1 - g.alignment())/(1 - r.alignment()) ) ); } Coord natural = r.natural(); bool growing = span > natural; bool shrinking = span < natural; float f; if (growing && r.stretch() > 0) { f = float(span - natural) / float(r.stretch()); } else if (shrinking && r.shrink() > 0) { f = float(natural - span) / float(r.shrink()); } else { f = 0; } Coord p = g.origin(); for (unsigned long index = 0; index < count; ++index) { const Requirement& r = request[index].requirement(dimension_); Allotment a; if (r.defined()) { Coord cspan = r.natural(); if (growing) { cspan += Coord(float(r.stretch()) * f); } else if (shrinking) { cspan -= Coord(float(r.shrink()) * f); } if (index == 0) { p += Coord((1 - r.alignment()) * float(cspan)); } p -= cspan; a.span(cspan); a.origin(p + Coord(r.alignment() * cspan)); a.alignment(r.alignment()); } else { a.span(0); a.origin(p); a.alignment(0); } result[index].allot(dimension_, a); } } neuron-7.6.3/src/lib/InterViews/transformer.cpp000066400000000000000000000136421340731477100215540ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Implementation of transformation matrix operations. */ #include #include #include #if (defined (WIN32) || defined (MAC) ) && !defined(M_PI) #define M_PI 3.14159265358979323846 #endif static const double RADPERDEG = M_PI/180.0; Transformer::Transformer() { identity_ = true; mat00 = mat11 = 1; mat01 = mat10 = mat20 = mat21 = 0; ref(); } Transformer::Transformer(const Transformer& t) { mat00 = t.mat00; mat01 = t.mat01; mat10 = t.mat10; mat11 = t.mat11; mat20 = t.mat20; mat21 = t.mat21; update(); ref(); } Transformer::Transformer( float a00, float a01, float a10, float a11, float a20, float a21 ) { mat00 = a00; mat01 = a01; mat10 = a10; mat11 = a11; mat20 = a20; mat21 = a21; update(); ref(); } Transformer::~Transformer() { } bool Transformer::operator ==(const Transformer& t) const { if (identity_) { return t.identity_; } if (t.identity_) { return false; } return ( mat00 == t.mat00 && mat01 == t.mat01 && mat10 == t.mat10 && mat11 == t.mat11 && mat20 == t.mat20 && mat21 == t.mat21 ); } bool Transformer::operator !=(const Transformer& t) const { if (identity_) { return !t.identity_; } if (t.identity_) { return true; } return ( mat00 != t.mat00 || mat01 != t.mat01 || mat10 != t.mat10 || mat11 != t.mat11 || mat20 != t.mat20 || mat21 != t.mat21 ); } Transformer& Transformer::operator =(const Transformer& t) { mat00 = t.mat00; mat01 = t.mat01; mat10 = t.mat10; mat11 = t.mat11; mat20 = t.mat20; mat21 = t.mat21; update(); return *this; } void Transformer::matrix( float& a00, float& a01, float& a10, float& a11, float& a20, float& a21 ) const { a00 = mat00; a01 = mat01; a10 = mat10; a11 = mat11; a20 = mat20; a21 = mat21; } void Transformer::update() { identity_ = ( mat00 == 1 && mat11 == 1 && mat01 == 0 && mat10 == 0 && mat20 == 0 && mat21 == 0 ); } void Transformer::translate(float dx, float dy) { mat20 += dx; mat21 += dy; update(); } void Transformer::scale(float sx, float sy) { mat00 *= sx; mat01 *= sy; mat10 *= sx; mat11 *= sy; mat20 *= sx; mat21 *= sy; update(); } void Transformer::skew(float sx, float sy) { mat01 += mat00*sy; mat10 += mat11*sx; update(); } void Transformer::rotate(float angle) { float tmp1, tmp2, m00, m01, m10, m11, m20, m21; angle *= RADPERDEG; tmp1 = cos(angle); tmp2 = sin(angle); m00 = mat00*tmp1; m01 = mat01*tmp2; m10 = mat10*tmp1; m11 = mat11*tmp2; m20 = mat20*tmp1; m21 = mat21*tmp2; mat01 = mat00*tmp2 + mat01*tmp1; mat11 = mat10*tmp2 + mat11*tmp1; mat21 = mat20*tmp2 + mat21*tmp1; mat00 = m00 - m01; mat10 = m10 - m11; mat20 = m20 - m21; update(); } void Transformer::premultiply(const Transformer& t) { float tmp1 = mat00; float tmp2 = mat10; mat00 = t.mat00*tmp1 + t.mat01*tmp2; mat10 = t.mat10*tmp1 + t.mat11*tmp2; mat20 += t.mat20*tmp1 + t.mat21*tmp2; tmp1 = mat01; tmp2 = mat11; mat01 = t.mat00*tmp1 + t.mat01*tmp2; mat11 = t.mat10*tmp1 + t.mat11*tmp2; mat21 += t.mat20*tmp1 + t.mat21*tmp2; update(); } void Transformer::postmultiply(const Transformer& t) { float tmp = mat00*t.mat01 + mat01*t.mat11; mat00 = mat00*t.mat00 + mat01*t.mat10; mat01 = tmp; tmp = mat10*t.mat01 + mat11*t.mat11; mat10 = mat10*t.mat00 + mat11*t.mat10; mat11 = tmp; tmp = mat20*t.mat01 + mat21*t.mat11; mat20 = mat20*t.mat00 + mat21*t.mat10; mat21 = tmp; mat20 += t.mat20; mat21 += t.mat21; update(); } void Transformer::invert() { float d = det(); float t00 = mat00; float t20 = mat20; mat20 = (mat10*mat21 - mat11*mat20)/d; mat21 = (mat01*t20 - mat00*mat21)/d; mat00 = mat11/d; mat11 = t00/d; mat10 = -mat10/d; mat01 = -mat01/d; update(); } void Transformer::transform(float& x, float& y) const { float tx = x; x = tx*mat00 + y*mat10 + mat20; y = tx*mat01 + y*mat11 + mat21; } void Transformer::transform(float x, float y, float& tx, float& ty) const { tx = x*mat00 + y*mat10 + mat20; ty = x*mat01 + y*mat11 + mat21; } void Transformer::inverse_transform(float& tx, float& ty) const { float d = det(); float a = (tx - mat20) / d; float b = (ty - mat21) / d; tx = a*mat11 - b*mat10; ty = b*mat00 - a*mat01; } void Transformer::inverse_transform( float tx, float ty, float& x, float& y ) const { float d = det(); float a = (tx - mat20) / d; float b = (ty - mat21) / d; x = a*mat11 - b*mat10; y = b*mat00 - a*mat01; } neuron-7.6.3/src/lib/InterViews/winbmp.cpp000077500000000000000000000114741340731477100205120ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif // ======================================================================= // // Windows BMP format raster loader. // // 1.1 // 1997/03/28 17:36:38 // // InterViews Port to the Windows 3.1/NT operating systems // Copyright (c) 1993 Tim Prinzing // // Permission to use, copy, modify, distribute, and sell this software and // its documentation for any purpose is hereby granted without fee, provided // that (i) the above copyright notice and this permission notice appear in // all copies of the software and related documentation, and (ii) the name of // Tim Prinzing may not be used in any advertising or publicity relating to // the software without the specific, prior written permission of Tim Prinzing. // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL Tim Prinzing BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // // ======================================================================= #include #include #include #include #include typedef long int dword; typedef int word; typedef short int byte; #define readChar(in,data) fread(data,1,1,in) == 1 #define readShort(in,data) fread(data,2,1,in) == 1 #define readLong(in,data) fread(data,4,1,in) == 1 Raster* BMPRaster::load(const char *filename) { char dummyChar; short dummyShort; long dummyLong; FILE *in = fopen(filename,"r"); // reading BITMAPFILEHEADER long fileSize; readShort(in,&dummyShort); readLong(in,&fileSize); readShort(in,&dummyShort); readShort(in,&dummyShort); readLong(in,&dummyLong); // reading BITMAPINFOHEADER long infoHeaderSize, width, height; short planes, bitCount; long compression, sizeImage, xres, yres, colorUsed, colorImp; readLong(in,&infoHeaderSize); readLong(in,&width); readLong(in,&height); readShort(in,&planes); readShort(in,&bitCount); readLong(in,&compression); readLong(in,&sizeImage); readLong(in,&xres); readLong(in,&yres); readLong(in,&colorUsed); readLong(in,&colorImp); // read in color table unsigned char red[256], green[256], blue[256]; int colorTable = (bitCount != 24) ? (1 << bitCount) : 0; for (int i=0; i=0; row--) { unsigned char data[32]; // scan lines must end on 4-byte boundaries int length = width * bitCount / 8; if (length % 4) length += 4 - (length % 4); for (int k=0; k> 4; } else if (bitCount == 1) { int whichByte = col / 8; int whichBit = col % 8; color = !!(data[whichByte] & (1 << (7 - whichBit))); } if (bitCount == 24 || bitCount == 4 || bitCount == 1) { // printf("%d %d: %d\n",row,col,color); int r = (bitCount == 24) ? (color >> 16) : red[color]; int g = (bitCount == 24) ? ((color >> 8) & 0xff) : green[color]; int b = (bitCount == 24) ? (color & 0xff) : blue[color]; // printf(" --> %d %d %d\n",r,g,b); res->poke(col,row, float(r)/255.0f, float(g)/255.0f, float(b)/255.0f, 1.0f); } } } fclose(in); // printf("file is of size %d\n",fileSize); // printf("width and height are %d %d\n",width,height); // printf("planes and bitCount are %d and %d\n",planes,bitCount); // printf("sizeImage is %d\n",sizeImage); // printf("colorUsed and colorImp are %d and %d\n",colorUsed,colorUsed); return res; } neuron-7.6.3/src/lib/InterViews/xymarker.cpp000077500000000000000000000126201340731477100210520ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include #include static const Coord th = 1; static const float e = 0.01; XYMarker::XYMarker( Glyph* body, const Color* overlay, const Color* underlay ) : MonoGlyph(body) { overlay_ = overlay; Resource::ref(overlay_); underlay_ = underlay; Resource::ref(underlay_); marked_ = false; canvas_ = nil; } XYMarker::~XYMarker() { Resource::unref(overlay_); overlay_ = nil; Resource::unref(underlay_); underlay_ = nil; } static void do_draw( Canvas* c, const Color* color, Coord left, Coord bottom, Coord right, Coord top ) { Coord l = Math::min(left, right); Coord b = Math::min(bottom, top); Coord r = Math::max(left, right); Coord t = Math::max(bottom, top); if ((r - l) < 2*th || (t - b) < 2*th) { c->fill_rect(l - th, b - th, r + th, t + th, color); } else { c->fill_rect(l - th, b + th, l + th, t + th, color); c->fill_rect(l + th, t + th, r + th, t - th, color); c->fill_rect(r + th, t - th, r - th, b - th, color); c->fill_rect(r - th, b - th, l - th, b + th, color); } } static void do_damage( Canvas* canvas, Coord left, Coord bottom, Coord right, Coord top ) { Coord l = Math::min(left, right); Coord b = Math::min(bottom, top); Coord r = Math::max(left, right); Coord t = Math::max(bottom, top); if ((r - l) < 2*th || (t - b) < 2*th) { canvas->damage(l - th, b - th, r + th, t + th); } else { canvas->damage(l - th, b + th, l + th, t + th); canvas->damage(l + th, t + th, r + th, t - th); canvas->damage(r + th, t - th, r - th, b - th); canvas->damage(r - th, b - th, l - th, b + th); } } void XYMarker::unmark() { if (marked_) { if (canvas_ != nil) { do_damage(canvas_, left_, bottom_, right_, top_); } marked_ = false; } } void XYMarker::mark(Coord left, Coord bottom, Coord right, Coord top) { if (canvas_ != nil) { if (!marked_) { do_damage(canvas_, left, bottom, right, top); } else if ( left > right_ || right < left_ || top < bottom_ || bottom > top_ ) { do_damage(canvas_, left, bottom, right, top); do_damage(canvas_, left_, bottom_, right_, top_); } else { if (!Math::equal(left_, left, e)) { do_damage(canvas_, left, bottom_, left_, top_); } if (!Math::equal(right_, right, e)) { do_damage(canvas_, right, bottom_, right_, top_); } if (!Math::equal(bottom_, bottom, e)) { do_damage(canvas_, left_, bottom, right_, bottom_); } if (!Math::equal(top_, top, e)) { do_damage(canvas_, left_, top, right_, top_); } if (!Math::equal(top_, top, e) && !Math::equal(left_, left, e)) { do_damage(canvas_, left, top, left_, top_); } if (!Math::equal(top_, top, e) && !Math::equal(right_, right, e)) { do_damage(canvas_, right, top, right_, top_); } if (!Math::equal(bottom_, bottom, e) && !Math::equal(left_, left, e) ) { do_damage(canvas_, left, bottom, left_, bottom_); } if (!Math::equal(bottom_, bottom, e) && !Math::equal(right_, right, e) ) { do_damage(canvas_, right, bottom, right_, bottom_); } } } left_ = left; bottom_ = bottom; right_ = right; top_ = top; marked_ = true; } void XYMarker::allocate(Canvas* c, const Allocation& a, Extension& ext) { MonoGlyph::allocate(c, a, ext); ext.merge_xy( c, a.left() - th, a.bottom() - th, a.right() + th, a.top() + th ); canvas_ = c; } void XYMarker::draw(Canvas* c, const Allocation& a) const { if (marked_ && underlay_ != nil) { do_draw(c, underlay_, left_, bottom_, right_, top_); } MonoGlyph::draw(c, a); if (marked_ && overlay_ != nil) { do_draw(c, overlay_, left_, bottom_, right_, top_); } } void XYMarker::undraw() { MonoGlyph::undraw(); canvas_ = nil; } neuron-7.6.3/src/lib/Makefile.in000066400000000000000000010514341340731477100164560ustar00rootroot00000000000000# Makefile.in generated automatically by automake 1.4a from Makefile.am # Well, it used to be generated by automake, but automake can't handle files # in subdirectories very well so I got rid of it. SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_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 = ../.. INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_FLAG = NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : @SET_MAKE@ CC = @CC@ CXX = @CXX@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ RANLIB = @RANLIB@ INCLUDES = -I../include $(X_CFLAGS) @CARBON_FALSE@@CYGWIN_FALSE@@MINGW_FALSE@KIT_DEFINES = -Dmotif_kit -Dsgi_motif_kit -Dopenlook_kit -Dbw_kit -Ddefault_kit=SMFKit @CYGWIN_TRUE@KIT_DEFINES = -Dmotif_kit -Dsgi_motif_kit @MINGW_TRUE@KIT_DEFINES = -Dmotif_kit -Dsgi_motif_kit @CARBON_TRUE@KIT_DEFINES = -Dmotif_kit -Dsgi_motif_kit -Dbw_kit -Ddefault_kit=SMFKit TIFF_DEFINES = -DCOLORIMETRY_SUPPORT -DJPEG_SUPPORT -DYCBCR_SUPPORT -DCMYK_SUPPORT -DHAVE_IEEEFP=1 -DUSE_VARARGS=0 -DUSE_PROTOTYPES=1 -DUSE_CONST=1 TIFF_INCLUDES = -I../include/TIFF # Rename the libraries to something unique so we don't accidently link with # a vanilla interviews distribution. libIV = libIVhines.la libUnidraw = libUnidrawhines.la @CARBON_FALSE@@CYGWIN_FALSE@@MINGW_FALSE@lib_LTLIBRARIES = $(libIV) $(libUnidraw) @CYGWIN_TRUE@lib_LTLIBRARIES = $(libIV) @MINGW_TRUE@lib_LTLIBRARIES = $(libIV) @CARBON_TRUE@lib_LTLIBRARIES = $(libIV) libIV_la_LDFLAGS = -version-info 3:3:0 $(X_LDFLAGS) libIV_la_LIBADD = $(X_LIBS) libUnidraw_la_LDFLAGS = -version-info 3:3:0 $(X_LDFLAGS) libUnidraw_la_LIBADD = $(X_LIBS) # # Lists of objects that go into the libraries: # dispatch = \ Dispatch/dispatcher.lo \ Dispatch/iohandler.lo iv26 = \ IV-2_6/adjuster2_6.lo \ IV-2_6/banner.lo \ IV-2_6/border2_6.lo \ IV-2_6/box2_6.lo \ IV-2_6/button2_6.lo \ IV-2_6/compeditor.lo \ IV-2_6/control.lo \ IV-2_6/deck2_6.lo \ IV-2_6/dialog2_6.lo \ IV-2_6/filebrowser.lo \ IV-2_6/filechooser.lo \ IV-2_6/frame.lo \ IV-2_6/glue2_6.lo \ IV-2_6/interactor.lo \ IV-2_6/matcheditor.lo \ IV-2_6/menu2_6.lo \ IV-2_6/message.lo \ IV-2_6/painter.lo \ IV-2_6/panner2_6.lo \ IV-2_6/perspective.lo \ IV-2_6/rubband.lo \ IV-2_6/rubcurve.lo \ IV-2_6/rubgroup.lo \ IV-2_6/rubline.lo \ IV-2_6/rubrect.lo \ IV-2_6/rubverts.lo \ IV-2_6/scene.lo \ IV-2_6/scrollbar2_6.lo \ IV-2_6/scroller2_6.lo \ IV-2_6/sensor.lo \ IV-2_6/shape.lo \ IV-2_6/strbrowser.lo \ IV-2_6/strchooser.lo \ IV-2_6/streditor.lo \ IV-2_6/subject.lo \ IV-2_6/textbuffer.lo \ IV-2_6/textdisplay.lo \ IV-2_6/texteditor.lo \ IV-2_6/tform2_6.lo \ IV-2_6/tray.lo \ IV-2_6/viewport.lo \ IV-2_6/world.lo \ IV-2_6/xbitmap2_6.lo \ IV-2_6/xevent2_6.lo \ IV-2_6/xinter.lo \ IV-2_6/xpainter.lo \ IV-2_6/xpattern.lo @MINGW_FALSE@interviews_extra = InterViews/ol_kit.lo InterViews/tiff.lo @MINGW_TRUE@interviews_extra = interviews = \ InterViews/dialogs.lo \ InterViews/action.lo \ InterViews/adjust.lo \ InterViews/aggr.lo \ InterViews/align.lo \ InterViews/alloctbl.lo \ InterViews/arrcomp.lo \ InterViews/background.lo \ InterViews/bevel.lo \ InterViews/border.lo \ InterViews/box.lo \ InterViews/browser.lo \ InterViews/button.lo \ InterViews/character.lo \ InterViews/compositor.lo \ InterViews/comption.lo \ InterViews/debug.lo \ InterViews/deck.lo \ InterViews/fbrowser.lo \ InterViews/fchooser.lo \ InterViews/field.lo \ InterViews/geometry.lo \ InterViews/glyph.lo \ InterViews/group.lo \ InterViews/handler.lo \ InterViews/hit.lo \ InterViews/image.lo \ InterViews/input.lo \ InterViews/kit.lo \ InterViews/label.lo \ InterViews/layout.lo \ InterViews/lrmarker.lo \ InterViews/menu.lo \ InterViews/mf_dialogs.lo \ InterViews/mf_kit.lo \ InterViews/mono_kit.lo \ InterViews/monoglyph.lo \ InterViews/observe.lo \ InterViews/ol_dialogs.lo \ InterViews/page.lo \ InterViews/patch.lo \ InterViews/place.lo \ InterViews/polyglyph.lo \ InterViews/printer.lo \ InterViews/psfont.lo \ InterViews/regexp.lo \ InterViews/resource.lo \ InterViews/rule.lo \ InterViews/scrbox.lo \ InterViews/shadow.lo \ InterViews/simpcomp.lo \ InterViews/slider.lo \ InterViews/smf_kit.lo \ InterViews/stencil.lo \ InterViews/stepper.lo \ InterViews/style.lo \ InterViews/superpose.lo \ InterViews/target.lo \ InterViews/telltale.lo \ InterViews/texcomp.lo \ InterViews/iv3text.lo \ InterViews/iv3textbuffer.lo \ InterViews/tformsetter.lo \ InterViews/tile.lo \ InterViews/transformer.lo \ InterViews/winbmp.lo \ InterViews/xymarker.lo \ $(interviews_extra) ivx11 = \ IV-X11/session.lo \ IV-X11/xbitmap.lo \ IV-X11/xbrush.lo \ IV-X11/xcanvas.lo \ IV-X11/xcolor.lo \ IV-X11/xcursor.lo \ IV-X11/xdrag.lo \ IV-X11/xevent.lo \ IV-X11/xfont.lo \ IV-X11/xraster.lo \ IV-X11/xreqerr.lo \ IV-X11/xselection.lo \ IV-X11/xwindow.lo os = \ OS/directory.lo \ OS/file.lo \ OS/host.lo \ OS/listimpl.lo \ OS/math.lo \ OS/memory.lo \ OS/string.lo \ OS/ustring.lo tiff = \ TIFF/tif_aux.lo \ TIFF/tif_ccittrle.lo \ TIFF/tif_close.lo \ TIFF/tif_cmprs.lo \ TIFF/tif_compat.lo \ TIFF/tif_dir.lo \ TIFF/tif_dirinfo.lo \ TIFF/tif_dirread.lo \ TIFF/tif_dirwrite.lo \ TIFF/tif_dumpmode.lo \ TIFF/tif_error.lo \ TIFF/tif_fax3.lo \ TIFF/tif_fax4.lo \ TIFF/tif_flush.lo \ TIFF/tif_getimage.lo \ TIFF/tif_jpeg.lo \ TIFF/tif_lzw.lo \ TIFF/tif_machdep.lo \ TIFF/tif_next.lo \ TIFF/tif_open.lo \ TIFF/tif_packbits.lo \ TIFF/tif_print.lo \ TIFF/tif_read.lo \ TIFF/tif_strip.lo \ TIFF/tif_swab.lo \ TIFF/tif_thunder.lo \ TIFF/tif_tile.lo \ TIFF/tif_version.lo \ TIFF/tif_warning.lo \ TIFF/tif_write.lo ivwin = \ IV-Win/bitmap.lo \ IV-Win/brush.lo \ IV-Win/canvas.lo \ IV-Win/canvas16.lo \ IV-Win/color.lo \ IV-Win/cursor.lo \ IV-Win/display.lo \ IV-Win/event.lo \ IV-Win/font.lo \ IV-Win/ivclean.lo \ IV-Win/mprinter.lo \ IV-Win/mwapp.lo \ IV-Win/mwlib.lo \ IV-Win/raster.lo \ IV-Win/session.lo \ IV-Win/window.lo ivmac = \ IV-Mac/bitmap.lo \ IV-Mac/brush.lo \ IV-Mac/canvas.lo \ IV-Mac/color.lo \ IV-Mac/cursor.lo \ IV-Mac/display.lo \ IV-Mac/event.lo \ IV-Mac/carbevent.lo \ IV-Mac/font.lo \ IV-Mac/mprinter.lo \ IV-Mac/raster.lo \ IV-Mac/session.lo \ IV-Mac/window.lo @CARBON_FALSE@@CYGWIN_FALSE@@MINGW_FALSE@libIV_la_OBJECTS = $(dispatch) $(iv26) $(ivx11) $(interviews) $(os) $(tiff) @CYGWIN_TRUE@libIV_la_OBJECTS = $(dispatch) $(ivwin) $(interviews) $(os) $(tiff) @MINGW_TRUE@libIV_la_OBJECTS = $(ivwin) $(interviews) $(os) @CARBON_TRUE@libIV_la_OBJECTS = $(dispatch) $(ivmac) $(interviews) $(os) libUnidraw_la_OBJECTS = \ Unidraw/align.lo \ Unidraw/brushcmd.lo \ Unidraw/catalog.lo \ Unidraw/catcmds.lo \ Unidraw/cglue.lo \ Unidraw/clipboard.lo \ Unidraw/colorcmd.lo \ Unidraw/command.lo \ Unidraw/component.lo \ Unidraw/compview.lo \ Unidraw/connect.lo \ Unidraw/connector.lo \ Unidraw/creator.lo \ Unidraw/csolver.lo \ Unidraw/ctrlinfo.lo \ Unidraw/damage.lo \ Unidraw/data.lo \ Unidraw/datas.lo \ Unidraw/dialogs.lo \ Unidraw/edit.lo \ Unidraw/editor.lo \ Unidraw/editorinfo.lo \ Unidraw/ellipse.lo \ Unidraw/ellipses.lo \ Unidraw/externview.lo \ Unidraw/font.lo \ Unidraw/geomobjs.lo \ Unidraw/globals.lo \ Unidraw/graphic.lo \ Unidraw/grblock.lo \ Unidraw/grcomp.lo \ Unidraw/grcomptool.lo \ Unidraw/grid.lo \ Unidraw/grview.lo \ Unidraw/gvupdater.lo \ Unidraw/import.lo \ Unidraw/iterator.lo \ Unidraw/keymap.lo \ Unidraw/kybd.lo \ Unidraw/line.lo \ Unidraw/lines.lo \ Unidraw/link.lo \ Unidraw/macro.lo \ Unidraw/magnify.lo \ Unidraw/manip.lo \ Unidraw/manips.lo \ Unidraw/move.lo \ Unidraw/nop.lo \ Unidraw/pad.lo \ Unidraw/patcmd.lo \ Unidraw/path.lo \ Unidraw/picture.lo \ Unidraw/pin.lo \ Unidraw/polygon.lo \ Unidraw/polygons.lo \ Unidraw/pspaint.lo \ Unidraw/psview.lo \ Unidraw/rastercomp.lo \ Unidraw/rasterrect.lo \ Unidraw/rect.lo \ Unidraw/reshape.lo \ Unidraw/rotate.lo \ Unidraw/scale.lo \ Unidraw/select.lo \ Unidraw/selection.lo \ Unidraw/slot.lo \ Unidraw/spline.lo \ Unidraw/splines.lo \ Unidraw/statevar.lo \ Unidraw/statevars.lo \ Unidraw/stateview.lo \ Unidraw/stateviews.lo \ Unidraw/stencilcomp.lo \ Unidraw/stretch.lo \ Unidraw/text.lo \ Unidraw/struct.lo \ Unidraw/tool.lo \ Unidraw/transfn.lo \ Unidraw/transfns.lo \ Unidraw/transforms.lo \ Unidraw/uarray.lo \ Unidraw/uctrl.lo \ Unidraw/uctrls.lo \ Unidraw/uhash.lo \ Unidraw/ulabel.lo \ Unidraw/ulist.lo \ Unidraw/umap.lo \ Unidraw/unidraw.lo \ Unidraw/upage.lo \ Unidraw/ustencil.lo \ Unidraw/vertices.lo \ Unidraw/verts.lo \ Unidraw/viewcmds.lo \ Unidraw/viewer.lo data_DATA = app-defaults/Doc app-defaults/InterViews app-defaults/Idemo subdir = src/lib mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = LTLIBRARIES = $(lib_LTLIBRARIES) MINGW_LIBS = @MINGW_LIBS@ DEFS = @DEFS@ -I. -I$(srcdir) CPPFLAGS = @CPPFLAGS@ @CARBON_FALSE@LDFLAGS = @LDFLAGS@ @CARBON_TRUE@LDFLAGS = @LDFLAGS@ -framework Carbon LIBS = @LIBS@ X_CFLAGS = @X_CFLAGS@ X_LIBS = @X_LIBS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ libIV_la_DEPENDENCIES = LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) LTCCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) CCOMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @CARBON_FALSE@CXXFLAGS = @CXXFLAGS@ @CARBON_TRUE@CXXFLAGS = @CXXFLAGS@ -DMAC=1 -Dcarbon=1 -DSYSV=1 CFLAGS = @CFLAGS@ CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ DIST_SOURCES = $(libIV_la_SOURCES) $(libUnidraw_la_SOURCES) DATA = $(data_DATA) PACKAGE = @PACKAGE@ VERSION = @VERSION@ all: $(lib_LTLIBRARIES) .SUFFIXES: .cpp .c .lo Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status clean: $(RM) *.la */*.o */*.lo */*.la TIFF/g3states.h TIFF/mkg3states rm -rf .libs */.libs distclean: clean rm -f Makefile install: $(mkinstalldirs) $(DESTDIR)$(libdir) @for p in $(lib_LTLIBRARIES); do \ echo "$(LIBTOOL) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$p"; \ $(LIBTOOL) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$p; \ done $(mkinstalldirs) $(DESTDIR)$(datadir)/app-defaults @for f in $(data_DATA); do \ echo "$(INSTALL) $$f $(DESTDIR)$(datadir)/$$f"; \ $(INSTALL_DATA) $$f $(DESTDIR)$(datadir)/$$f; \ done uninstall: @for p in $(lib_LTLIBRARIES); do \ echo "$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ done @for f in $(data_DATA); do \ echo "rm -f $(DESTDIR)$(datadir)/$$f"; \ rm -f $(DESTDIR)$(datadir)/$$f; \ done $(libIV): $(libIV_la_OBJECTS) $(libIV_la_DEPENDENCIES) $(CXXLINK) -rpath $(libdir) $(libIV_la_LDFLAGS) $(libIV_la_OBJECTS) $(libIV_la_LIBADD) $(MINGW_LIBS) $(LIBS) $(libUnidraw): $(libUnidraw_la_OBJECTS) $(libUnidraw_la_DEPENDENCIES) $(CXXLINK) -rpath $(libdir) $(libUnidraw_la_LDFLAGS) $(libUnidraw_la_OBJECTS) $(libUnidraw_la_LIBADD) $(LIBS) # Don't display the compilation command, because LIBTOOL displays it for us-- # twice, in fact. .cpp.lo: @$(LTCXXCOMPILE) -c -o $@ $< # # It turns out that all of the C files are actually from the TIFF directory, # so they all want the same flags: # .c.lo: @$(LTCCOMPILE) $(TIFF_DEFINES) $(TIFF_INCLUDES) -c -o $@ $< .PHONY: all clean distclean install uninstall # # Several of the files have special compilation options: # InterViews/dialogs.lo: InterViews/dialogs.cpp @$(LTCXXCOMPILE) $(KIT_DEFINES) -c -o $@ $< InterViews/kit.lo: InterViews/kit.cpp @$(LTCXXCOMPILE) $(KIT_DEFINES) -c -o $@ $< IV-X11/session.lo: IV-X11/session.cpp @$(LTCXXCOMPILE) -DIV_LIBALL='"$(datadir)"' -DX_LIBDIR='"$(X_LIBS)"' -c -o $@ $< TIFF/tif_fax3.lo: TIFF/g3states.h TIFF/g3states.h: TIFF/mkg3states TIFF/mkg3states > $@ TIFF/mkg3states: TIFF/mkg3states.c $(CCOMPILE) $(TIFF_DEFINES) $(TIFF_INCLUDES) TIFF/mkg3states.c -o $@ # 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: # Everything below this was generated by a dependency scanning program. Since # this library isn't being actively developed, I'm not interested in doing # dependency scanning automatically. ############################################################################### IV-Mac/bitmap.lo : ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/InterViews/coord.h ../include/OS/math.h ../include/InterViews/bitmap.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/IV-2_6/_enter.h ../include/InterViews/session.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/resource.h ../include/OS/memory.h ../include/InterViews/geometry.h ../include/InterViews/_leave.h IV-Mac/brush.lo : ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/InterViews/coord.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/brush.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/resource.h ../include/InterViews/_leave.h IV-Mac/canvas.lo : ../include/OS/list.h ../include/OS/_defines.h ../include/InterViews/raster.h ../include/InterViews/transformer.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/coord.h ../include/OS/math.h ../include/InterViews/canvas.h ../include/InterViews/bitmap.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/IV-2_6/_enter.h ../include/InterViews/brush.h ../include/InterViews/session.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/InterViews/_leave.h IV-Mac/color.lo : ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/InterViews/coord.h ../include/OS/enter-scope.h ../include/OS/table.h ../include/OS/math.h ../include/InterViews/bitmap.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/InterViews/color.h ../include/IV-2_6/_enter.h ../include/InterViews/session.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/resource.h ../include/OS/string.h ../include/InterViews/_leave.h IV-Mac/cursor.lo : ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/InterViews/coord.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/bitmap.h ../include/InterViews/cursor.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/IV-2_6/_enter.h ../include/InterViews/session.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/resource.h ../include/InterViews/_leave.h IV-Mac/display.lo : ../include/OS/list.h ../include/OS/_defines.h ../include/InterViews/style.h ../include/InterViews/_names.h ../include/OS/os.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/display.h ../include/OS/enter-scope.h ../include/InterViews/coord.h ../include/InterViews/window.h ../include/OS/math.h ../include/InterViews/canvas.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/IV-2_6/_enter.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/InterViews/_undefs.h ../include/IV-Mac/window.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/InterViews/_leave.h IV-Mac/event.lo : ../include/OS/list.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/coord.h ../include/OS/enter-scope.h ../include/InterViews/window.h ../include/InterViews/canvas.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/handler.h ../include/InterViews/iv.h ../include/IV-2_6/_enter.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/InterViews/_leave.h IV-Mac/font.lo : ../include/OS/list.h ../include/OS/_defines.h ../include/IV-Mac/session.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/InterViews/coord.h ../include/OS/enter-scope.h ../include/InterViews/font.h ../include/InterViews/window.h ../include/InterViews/canvas.h ../include/OS/math.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/IV-2_6/_enter.h ../include/IV-Mac/font.h ../include/InterViews/session.h ../include/InterViews/_undefs.h ../include/IV-Mac/window.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/resource.h ../include/OS/string.h ../include/InterViews/geometry.h ../include/InterViews/_leave.h IV-Mac/mprinter.lo : ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/InterViews/coord.h ../include/InterViews/canvas.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/IV-Mac/mprinter.h ../include/InterViews/iv.h ../include/IV-2_6/_enter.h ../include/InterViews/printer.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/IV-Mac/canvas.h ../include/InterViews/geometry.h ../include/InterViews/_leave.h IV-Mac/raster.lo : ../include/OS/_defines.h ../include/InterViews/raster.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/coord.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/IV-2_6/_enter.h ../include/InterViews/session.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/InterViews/_leave.h IV-Mac/session.lo : ../include/OS/_defines.h ../include/InterViews/style.h ../include/OS/file.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/InterViews/coord.h ../include/OS/enter-scope.h ../include/InterViews/window.h ../include/InterViews/canvas.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/cursor.h ../include/InterViews/iv.h ../include/IV-2_6/_enter.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/resource.h ../include/OS/string.h ../include/InterViews/_leave.h ../include/InterViews/geometry.h IV-Mac/window.lo : ../include/OS/list.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/InterViews/canvas.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/action.h ../include/InterViews/handler.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/InterViews/glyph.h ../include/IV-Mac/window.h ../include/InterViews/hit.h ../include/InterViews/resource.h ../include/OS/string.h ../include/IV-Mac/cursor.h ../include/IV-Mac/color.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-Mac/event.h ../include/IV-Mac/session.h ../include/InterViews/style.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/InterViews/coord.h ../include/InterViews/window.h ../include/OS/table.h ../include/OS/math.h ../include/InterViews/cursor.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/IV-Mac/canvas.h ../include/InterViews/_leave.h TIFF/mkg3states.lo : TIFF/t4.h TIFF/prototypes.h TIFF/mkspans.lo : TIFF/tiffcompat.h TIFF/tif_aux.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/prototypes.h TIFF/tif_ccittrle.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/tif_fax3.h TIFF/tif_close.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/tif_cmprs.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/tif_compat.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/tif_dir.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/prototypes.h TIFF/tif_dirinfo.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/prototypes.h TIFF/tif_dirread.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/prototypes.h TIFF/tif_dirwrite.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/prototypes.h TIFF/tif_dumpmode.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/tif_error.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/prototypes.h TIFF/tif_fax3.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/tif_fax3.h TIFF/t4.h TIFF/tif_fax4.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/tif_fax3.h TIFF/tif_flush.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/tif_getimage.lo : TIFF/tiffcompat.h TIFF/prototypes.h TIFF/tif_jpeg.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/tif_lzw.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/prototypes.h TIFF/tif_machdep.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/tif_next.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/tif_open.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/prototypes.h TIFF/tif_packbits.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/tif_print.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/tif_read.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/tif_strip.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/tif_swab.lo : TIFF/tif_thunder.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/tif_tile.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/tif_version.lo : TIFF/tiffcompat.h TIFF/tif_warning.lo : TIFF/tiffcompat.h TIFF/tiffioP.h TIFF/prototypes.h TIFF/tif_write.lo : TIFF/tiffcompat.h TIFF/tiffioP.h Dispatch/dispatcher.lo : ../include/Dispatch/dp.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/Dispatch/enter-scope.h ../include/Dispatch/dispatcher.h ../include/OS/_defines.h ../include/OS/os.h ../include/Dispatch/iohandler.h ../include/Dispatch/_defines.h ../include/OS/leave-scope.h ../include/OS/types.h ../include/OS/memory.h Dispatch/iohandler.lo : ../include/Dispatch/dp.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/Dispatch/enter-scope.h ../include/OS/_defines.h ../include/OS/os.h ../include/Dispatch/iohandler.h ../include/Dispatch/_defines.h ../include/OS/leave-scope.h ../include/OS/types.h Dispatch/iostreamb.lo : ../include/Dispatch/dp.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/Dispatch/enter-scope.h ../include/OS/_defines.h ../include/OS/os.h ../include/Dispatch/_defines.h ../include/OS/leave-scope.h ../include/Dispatch/iostreamb.h Dispatch/rpcbuf.lo : ../include/Dispatch/dp.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/Dispatch/enter-scope.h Dispatch/netinet_in.h ../include/OS/_defines.h ../include/OS/os.h ../include/Dispatch/_defines.h ../include/Dispatch/rpcbuf.h ../include/Dispatch/iostreamb.h ../include/OS/leave-scope.h ../include/OS/types.h ../include/OS/memory.h Dispatch/rpchdr.lo : ../include/Dispatch/dp.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/Dispatch/rpchdr.h ../include/Dispatch/enter-scope.h ../include/OS/_defines.h ../include/Dispatch/rpcstream.h ../include/OS/os.h ../include/Dispatch/_defines.h ../include/Dispatch/rpcbuf.h ../include/Dispatch/iostreamb.h ../include/OS/leave-scope.h Dispatch/rpcpeer.lo : ../include/Dispatch/dp.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/Dispatch/rpcregistry.h ../include/Dispatch/enter-scope.h ../include/Dispatch/dispatcher.h ../include/OS/_defines.h ../include/Dispatch/rpcpeer.h ../include/OS/os.h ../include/Dispatch/iohandler.h ../include/Dispatch/_defines.h ../include/Dispatch/rpcbuf.h ../include/Dispatch/iostreamb.h ../include/OS/leave-scope.h ../include/OS/types.h Dispatch/rpcreader.lo : ../include/Dispatch/dp.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/Dispatch/rpcreader.h ../include/Dispatch/rpchdr.h ../include/Dispatch/enter-scope.h ../include/Dispatch/dispatcher.h ../include/OS/_defines.h ../include/Dispatch/rpcstream.h ../include/OS/os.h ../include/Dispatch/iohandler.h ../include/Dispatch/_defines.h ../include/Dispatch/rpcbuf.h ../include/Dispatch/iostreamb.h ../include/OS/leave-scope.h ../include/OS/types.h Dispatch/rpcregistry.lo : ../include/OS/host.h ../include/Dispatch/dp.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/Dispatch/rpcregistry.h ../include/Dispatch/enter-scope.h ../include/OS/_defines.h ../include/OS/os.h ../include/Dispatch/_defines.h ../include/OS/leave-scope.h ../include/OS/types.h Dispatch/rpcservice.lo : ../include/Dispatch/dp.h ../include/Dispatch/rpcservice.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/Dispatch/rpcregistry.h ../include/Dispatch/enter-scope.h ../include/Dispatch/dispatcher.h ../include/OS/_defines.h ../include/OS/os.h ../include/Dispatch/iohandler.h ../include/Dispatch/_defines.h ../include/Dispatch/rpcbuf.h ../include/Dispatch/iostreamb.h ../include/OS/leave-scope.h ../include/OS/types.h Dispatch/rpcstream.lo : ../include/Dispatch/dp.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/Dispatch/enter-scope.h ../include/OS/_defines.h ../include/Dispatch/rpcstream.h ../include/OS/os.h ../include/Dispatch/_defines.h ../include/Dispatch/rpcbuf.h ../include/OS/leave-scope.h ../include/Dispatch/iostreamb.h Dispatch/rpcwriter.lo : ../include/Dispatch/dp.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/Dispatch/rpcregistry.h ../include/Dispatch/rpcwriter.h ../include/Dispatch/enter-scope.h ../include/OS/_defines.h ../include/Dispatch/rpcstream.h ../include/OS/os.h ../include/Dispatch/_defines.h ../include/Dispatch/rpcbuf.h ../include/Dispatch/iostreamb.h ../include/OS/leave-scope.h IV-2_6/adjuster2_6.lo : ../include/InterViews/Bitmaps/rmoverMask.bm ../include/InterViews/Bitmaps/umoverMask.bm ../include/InterViews/Bitmaps/reducer.bm ../include/IV-2_6/InterViews/shape.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/Bitmaps/reducerMask.bm ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/Bitmaps/enlarge.bm ../include/InterViews/glyph.h ../include/IV-2_6/InterViews/adjuster.h ../include/InterViews/resource.h ../include/InterViews/Bitmaps/umoverHit.bm ../include/IV-2_6/InterViews/minmax.h ../include/InterViews/geometry.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/InterViews/Bitmaps/enlargeMask.bm ../include/InterViews/Bitmaps/dmover.bm ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/Bitmaps/reducerHit.bm ../include/IV-2_6/InterViews/painter.h ../include/InterViews/coord.h ../include/InterViews/Bitmaps/dmoverHit.bm ../include/InterViews/Bitmaps/lmover.bm ../include/OS/math.h ../include/IV-2_6/InterViews/sensor.h ../include/IV-2_6/InterViews/interactor.h ../include/InterViews/bitmap.h ../include/InterViews/Bitmaps/dmoverMask.bm ../include/InterViews/Bitmaps/lmoverHit.bm ../include/IV-2_6/_enter.h ../include/InterViews/Bitmaps/rmover.bm ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/Bitmaps/umover.bm ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/InterViews/Bitmaps/rmoverHit.bm ../include/OS/leave-scope.h ../include/InterViews/Bitmaps/lmoverMask.bm ../include/InterViews/Bitmaps/enlargeHit.bm ../include/IV-2_6/InterViews/perspective.h ../include/InterViews/_leave.h IV-2_6/banner.lo : ../include/IV-2_6/InterViews/shape.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/InterViews/font.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/InterViews/geometry.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/InterViews/painter.h ../include/InterViews/coord.h ../include/IV-2_6/InterViews/banner.h ../include/OS/math.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h IV-2_6/border2_6.lo : ../include/IV-2_6/InterViews/shape.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/InterViews/geometry.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/InterViews/painter.h ../include/InterViews/coord.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/border.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h IV-2_6/box2_6.lo : ../include/IV-2_6/InterViews/shape.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/box.h ../include/InterViews/geometry.h ../include/IV-2_6/InterViews/minmax.h ../include/OS/_defines.h ../include/IV-2_6/_leave.h ../include/IV-2_6/InterViews/scene.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/OS/math.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h IV-2_6/button2_6.lo : ../include/IV-2_6/InterViews/shape.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/IV-2_6/InterViews/button.h ../include/InterViews/pattern.h ../include/InterViews/iv.h ../include/InterViews/Bitmaps/radioBoth.bm ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/InterViews/geometry.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/subject.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/Bitmaps/radio.bm ../include/InterViews/Bitmaps/radioChosen.bm ../include/IV-2_6/InterViews/painter.h ../include/InterViews/coord.h ../include/InterViews/Bitmaps/radioHit.bm ../include/OS/math.h ../include/IV-2_6/InterViews/sensor.h ../include/IV-2_6/InterViews/interactor.h ../include/InterViews/bitmap.h ../include/IV-2_6/_enter.h ../include/InterViews/Bitmaps/radioMask.bm ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h IV-2_6/compeditor.lo : ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/InterViews/session.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/IV-2_6/InterViews/minmax.h ../include/OS/_defines.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/IV-2_6/InterViews/compeditor.h ../include/OS/math.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/textbuffer.h ../include/IV-2_6/InterViews/alignment.h ../include/IV-2_6/InterViews/streditor.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/world.h ../include/InterViews/_leave.h IV-2_6/control.lo : ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/IV-2_6/InterViews/minmax.h ../include/OS/_defines.h ../include/IV-2_6/_leave.h ../include/IV-2_6/InterViews/scene.h ../include/IV-2_6/InterViews/subject.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/IV-2_6/InterViews/sensor.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/IV-2_6/InterViews/control.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/message.h ../include/InterViews/_leave.h IV-2_6/deck2_6.lo : ../include/IV-2_6/InterViews/glue.h ../include/IV-2_6/InterViews/shape.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/IV-2_6/InterViews/deck.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/IV-2_6/InterViews/minmax.h ../include/OS/_defines.h ../include/IV-2_6/_leave.h ../include/IV-2_6/InterViews/scene.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/OS/math.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/perspective.h ../include/InterViews/_leave.h IV-2_6/dialog2_6.lo : ../include/IV-2_6/InterViews/dialog.h ../include/IV-2_6/InterViews/shape.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/IV-2_6/InterViews/button.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/InterViews/geometry.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/scene.h ../include/IV-2_6/InterViews/subject.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/world.h ../include/InterViews/_leave.h IV-2_6/filebrowser.lo : ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/IV-2_6/InterViews/strbrowser.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/IV-2_6/InterViews/filebrowser.h ../include/OS/directory.h ../include/InterViews/resource.h ../include/OS/string.h ../include/InterViews/geometry.h ../include/IV-2_6/InterViews/minmax.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/OS/types.h ../include/OS/memory.h ../include/InterViews/regexp.h ../include/IV-2_6/InterViews/perspective.h ../include/InterViews/_leave.h IV-2_6/filechooser.lo : ../include/IV-2_6/InterViews/strchooser.h ../include/IV-2_6/InterViews/glue.h ../include/IV-2_6/InterViews/dialog.h ../include/IV-2_6/InterViews/shape.h ../include/IV-2_6/InterViews/filechooser.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/IV-2_6/InterViews/button.h ../include/IV-2_6/InterViews/strbrowser.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/IV-2_6/InterViews/adjuster.h ../include/IV-2_6/InterViews/scrollbar.h ../include/IV-2_6/InterViews/filebrowser.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/box.h ../include/IV-2_6/InterViews/minmax.h ../include/InterViews/geometry.h ../include/IV-2_6/InterViews/frame.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/scene.h ../include/IV-2_6/InterViews/subject.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/OS/math.h ../include/IV-2_6/InterViews/sensor.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/border.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/IV-2_6/InterViews/streditor.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/message.h ../include/InterViews/_leave.h IV-2_6/frame.lo : ../include/IV-2_6/InterViews/shape.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/canvas.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/pattern.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/box.h ../include/IV-2_6/InterViews/minmax.h ../include/InterViews/geometry.h ../include/IV-2_6/InterViews/frame.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/scene.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/InterViews/painter.h ../include/InterViews/coord.h ../include/IV-2_6/InterViews/banner.h ../include/IV-2_6/InterViews/sensor.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/border.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h IV-2_6/glue2_6.lo : ../include/IV-2_6/InterViews/glue.h ../include/IV-2_6/InterViews/shape.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/InterViews/geometry.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h IV-2_6/interactor.lo : ../include/IV-2_6/InterViews/shape.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/canvas.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/handler.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/OS/string.h ../include/IV-2_6/InterViews/minmax.h ../include/InterViews/geometry.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/scene.h ../include/InterViews/style.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/InterViews/painter.h ../include/InterViews/display.h ../include/InterViews/coord.h ../include/InterViews/window.h ../include/IV-2_6/InterViews/sensor.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/IV-2_6/InterViews/iwindow.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/ihandler.h ../include/IV-2_6/InterViews/world.h ../include/InterViews/_leave.h IV-2_6/matcheditor.lo : ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/InterViews/session.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/IV-2_6/InterViews/minmax.h ../include/OS/_defines.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/InterViews/matcheditor.h ../include/InterViews/coord.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/textbuffer.h ../include/IV-2_6/InterViews/alignment.h ../include/IV-2_6/InterViews/streditor.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/world.h ../include/InterViews/_leave.h IV-2_6/menu2_6.lo : ../include/IV-2_6/InterViews/glue.h ../include/IV-2_6/InterViews/shape.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/canvas.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/pattern.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/box.h ../include/IV-2_6/InterViews/minmax.h ../include/InterViews/geometry.h ../include/IV-2_6/InterViews/frame.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/scene.h ../include/IV-2_6/InterViews/subject.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/InterViews/painter.h ../include/IV-2_6/InterViews/menu.h ../include/InterViews/coord.h ../include/InterViews/window.h ../include/OS/math.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/IV-2_6/InterViews/control.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/message.h ../include/IV-2_6/InterViews/world.h ../include/InterViews/_leave.h IV-2_6/message.lo : ../include/IV-2_6/InterViews/shape.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/InterViews/font.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/InterViews/geometry.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/InterViews/painter.h ../include/InterViews/coord.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/message.h ../include/InterViews/_leave.h IV-2_6/painter.lo : ../include/InterViews/transformer.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/session.h ../include/InterViews/resource.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/InterViews/painter.h ../include/InterViews/coord.h ../include/OS/math.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/brush.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/world.h ../include/OS/memory.h ../include/InterViews/_leave.h IV-2_6/panner2_6.lo : ../include/IV-2_6/InterViews/glue.h ../include/IV-2_6/InterViews/shape.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/pattern.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/IV-2_6/InterViews/adjuster.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/box.h ../include/IV-2_6/InterViews/minmax.h ../include/InterViews/geometry.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/scene.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/InterViews/painter.h ../include/InterViews/coord.h ../include/IV-2_6/InterViews/rubrect.h ../include/OS/math.h ../include/IV-2_6/InterViews/sensor.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/rubband.h ../include/IV-2_6/InterViews/border.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/IV-2_6/InterViews/panner.h ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/perspective.h ../include/InterViews/_leave.h IV-2_6/perspective.lo : ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/IV-2_6/InterViews/minmax.h ../include/OS/_defines.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h ../include/IV-2_6/InterViews/perspective.h IV-2_6/rubband.lo : ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/InterViews/resource.h ../include/OS/_defines.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/InterViews/painter.h ../include/InterViews/coord.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/rubband.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h IV-2_6/rubcurve.lo : ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/InterViews/resource.h ../include/OS/_defines.h ../include/IV-2_6/_leave.h ../include/IV-2_6/InterViews/rubcurve.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/InterViews/painter.h ../include/InterViews/coord.h ../include/OS/math.h ../include/IV-2_6/InterViews/rubband.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/OS/memory.h IV-2_6/rubgroup.lo : ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/InterViews/resource.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/IV-2_6/InterViews/rubgroup.h ../include/IV-2_6/InterViews/rubband.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h IV-2_6/rubline.lo : ../include/IV-2_6/InterViews/rubline.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/InterViews/resource.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/InterViews/painter.h ../include/InterViews/coord.h ../include/OS/math.h ../include/IV-2_6/InterViews/rubband.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h IV-2_6/rubrect.lo : ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/InterViews/resource.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/InterViews/painter.h ../include/InterViews/coord.h ../include/IV-2_6/InterViews/rubrect.h ../include/OS/math.h ../include/IV-2_6/InterViews/rubband.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h IV-2_6/rubverts.lo : ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/InterViews/resource.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/InterViews/painter.h ../include/InterViews/coord.h ../include/OS/math.h ../include/IV-2_6/InterViews/rubverts.h ../include/IV-2_6/InterViews/rubband.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/OS/memory.h IV-2_6/scene.lo : ../include/IV-2_6/InterViews/shape.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/canvas.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/InterViews/session.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/InterViews/geometry.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/scene.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/InterViews/painter.h ../include/InterViews/coord.h ../include/InterViews/window.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/IV-2_6/InterViews/iwindow.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/world.h ../include/InterViews/_leave.h IV-2_6/scrollbar2_6.lo : ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/IV-2_6/InterViews/adjuster.h ../include/IV-2_6/InterViews/scrollbar.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/box.h ../include/IV-2_6/InterViews/minmax.h ../include/InterViews/geometry.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/scene.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/border.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/scroller.h ../include/InterViews/_leave.h IV-2_6/scroller2_6.lo : ../include/IV-2_6/InterViews/shape.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/pattern.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/InterViews/geometry.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/InterViews/painter.h ../include/InterViews/coord.h ../include/IV-2_6/InterViews/rubrect.h ../include/OS/math.h ../include/IV-2_6/InterViews/sensor.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/rubband.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/scroller.h ../include/IV-2_6/InterViews/perspective.h ../include/InterViews/_leave.h IV-2_6/sensor.lo : ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/resource.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/IV-2_6/InterViews/sensor.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h IV-2_6/shape.lo : ../include/IV-2_6/InterViews/shape.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/OS/_defines.h ../include/OS/os.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h IV-2_6/strbrowser.lo : ../include/InterViews/Bitmaps/handMask.bm ../include/IV-2_6/InterViews/shape.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/IV-2_6/InterViews/textdisplay.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/IV-2_6/InterViews/button.h ../include/IV-2_6/InterViews/strbrowser.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/Bitmaps/ufast.bm ../include/IV-2_6/InterViews/minmax.h ../include/InterViews/geometry.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/subject.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/InterViews/painter.h ../include/InterViews/Bitmaps/ufastMask.bm ../include/InterViews/coord.h ../include/InterViews/Bitmaps/dfast.bm ../include/OS/math.h ../include/IV-2_6/InterViews/sensor.h ../include/IV-2_6/InterViews/interactor.h ../include/InterViews/bitmap.h ../include/InterViews/cursor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/Bitmaps/hand.bm ../include/InterViews/Bitmaps/dfastMask.bm ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/OS/memory.h ../include/IV-2_6/InterViews/perspective.h ../include/InterViews/_leave.h IV-2_6/strchooser.lo : ../include/IV-2_6/InterViews/strchooser.h ../include/IV-2_6/InterViews/dialog.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/IV-2_6/InterViews/button.h ../include/IV-2_6/InterViews/strbrowser.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/InterViews/geometry.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/scene.h ../include/IV-2_6/InterViews/subject.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/IV-2_6/InterViews/sensor.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/IV-2_6/InterViews/streditor.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/world.h ../include/InterViews/_leave.h IV-2_6/streditor.lo : ../include/InterViews/Bitmaps/handMask.bm ../include/InterViews/Bitmaps/rfastMask.bm ../include/IV-2_6/InterViews/shape.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/IV-2_6/InterViews/textdisplay.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/IV-2_6/InterViews/button.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/InterViews/geometry.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/subject.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/InterViews/painter.h ../include/InterViews/coord.h ../include/OS/math.h ../include/IV-2_6/InterViews/sensor.h ../include/IV-2_6/InterViews/interactor.h ../include/InterViews/bitmap.h ../include/InterViews/cursor.h ../include/InterViews/Bitmaps/lfast.bm ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/textbuffer.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/Bitmaps/hand.bm ../include/IV-2_6/InterViews/streditor.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/InterViews/Bitmaps/rfast.bm ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/world.h ../include/InterViews/Bitmaps/lfastMask.bm ../include/InterViews/_leave.h IV-2_6/subject.lo : ../include/OS/list.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/IV-2_6/InterViews/minmax.h ../include/OS/_defines.h ../include/IV-2_6/_leave.h ../include/IV-2_6/InterViews/subject.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h IV-2_6/textbuffer.lo : ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/OS/_defines.h ../include/OS/os.h ../include/OS/math.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/textbuffer.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/OS/memory.h ../include/InterViews/regexp.h IV-2_6/textdisplay.lo : ../include/IV-2_6/InterViews/shape.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/InterViews/font.h ../include/IV-2_6/InterViews/textstyle.h ../include/IV-2_6/InterViews/textdisplay.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/IV-2_6/InterViews/minmax.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/InterViews/painter.h ../include/InterViews/coord.h ../include/OS/math.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/OS/memory.h ../include/InterViews/_leave.h IV-2_6/texteditor.lo : ../include/InterViews/Bitmaps/handMask.bm ../include/IV-2_6/InterViews/texteditor.h ../include/IV-2_6/InterViews/shape.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/IV-2_6/InterViews/textdisplay.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/Bitmaps/ufast.bm ../include/IV-2_6/InterViews/minmax.h ../include/InterViews/geometry.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/InterViews/painter.h ../include/InterViews/Bitmaps/ufastMask.bm ../include/InterViews/coord.h ../include/InterViews/Bitmaps/dfast.bm ../include/OS/math.h ../include/IV-2_6/InterViews/interactor.h ../include/InterViews/bitmap.h ../include/InterViews/cursor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/IV-2_6/InterViews/textbuffer.h ../include/InterViews/Bitmaps/hand.bm ../include/InterViews/Bitmaps/dfastMask.bm ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/perspective.h ../include/InterViews/_leave.h IV-2_6/tform2_6.lo : ../include/InterViews/transformer.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/InterViews/resource.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/OS/math.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h IV-2_6/tray.lo : ../include/IV-2_6/InterViews/shape.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/canvas.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/InterViews/geometry.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/scene.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/InterViews/painter.h ../include/InterViews/coord.h ../include/OS/math.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/IV-2_6/InterViews/tray.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h IV-2_6/viewport.lo : ../include/IV-2_6/InterViews/shape.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/canvas.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/pattern.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/InterViews/geometry.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/scene.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/InterViews/painter.h ../include/InterViews/coord.h ../include/OS/math.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/IV-2_6/InterViews/viewport.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/perspective.h ../include/InterViews/_leave.h IV-2_6/world.lo : ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/InterViews/resource.h ../include/OS/string.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/InterViews/style.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/InterViews/coord.h ../include/IV-2_6/InterViews/sensor.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/world.h ../include/InterViews/_leave.h IV-2_6/xbitmap2_6.lo : ../include/OS/list.h ../include/InterViews/transformer.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/InterViews/session.h ../include/IV-X11/xfont.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-X11/Xdefs.h ../include/IV-X11/Xundefs.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/InterViews/coord.h ../include/OS/math.h ../include/InterViews/bitmap.h ../include/IV-2_6/_enter.h ../include/IV-X11/xdisplay.h ../include/InterViews/_undefs.h ../include/IV-X11/Xlib.h ../include/InterViews/enter-scope.h ../include/IV-X11/xwindow.h ../include/OS/leave-scope.h ../include/IV-X11/xbitmap.h ../include/IV-X11/Xutil.h ../include/InterViews/_leave.h IV-2_6/xevent2_6.lo : ../include/OS/list.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-X11/xevent.h ../include/IV-X11/Xdefs.h ../include/IV-X11/Xundefs.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/InterViews/coord.h ../include/IV-2_6/InterViews/sensor.h ../include/IV-2_6/_enter.h ../include/IV-X11/xdisplay.h ../include/InterViews/_undefs.h ../include/IV-X11/Xlib.h ../include/InterViews/enter-scope.h ../include/IV-X11/xwindow.h ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/world.h ../include/IV-X11/Xutil.h ../include/InterViews/_leave.h IV-2_6/xinter.lo : ../include/OS/list.h ../include/IV-2_6/InterViews/shape.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/canvas.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/handler.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/InterViews/resource.h ../include/IV-X11/xcanvas.h ../include/IV-2_6/InterViews/minmax.h ../include/InterViews/geometry.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/IV-X11/xevent.h ../include/IV-2_6/InterViews/scene.h ../include/IV-X11/Xdefs.h ../include/InterViews/style.h ../include/InterViews/_names.h ../include/IV-X11/Xundefs.h ../include/OS/os.h ../include/IV-2_6/InterViews/painter.h ../include/InterViews/display.h ../include/InterViews/coord.h IV-X11/wtable.h ../include/InterViews/window.h ../include/OS/table.h ../include/OS/math.h ../include/IV-2_6/InterViews/sensor.h ../include/IV-2_6/InterViews/interactor.h ../include/InterViews/cursor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/IV-2_6/InterViews/iwindow.h ../include/IV-X11/xdisplay.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/IV-X11/Xlib.h ../include/IV-X11/xwindow.h ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/ihandler.h ../include/IV-2_6/InterViews/world.h ../include/IV-X11/xcursor.h ../include/IV-X11/Xutil.h ../include/InterViews/_leave.h IV-2_6/xpainter.lo : ../include/OS/list.h ../include/IV-X11/xbrush.h ../include/InterViews/transformer.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/canvas.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/IV-X11/xfont.h ../include/InterViews/resource.h ../include/OS/string.h ../include/IV-X11/xcanvas.h ../include/IV-X11/xpattern.h ../include/InterViews/geometry.h ../include/IV-X11/xcolor.h ../include/IV-2_6/_leave.h ../include/OS/_defines.h ../include/IV-X11/xevent.h ../include/IV-X11/Xdefs.h ../include/InterViews/style.h ../include/InterViews/raster.h ../include/InterViews/_names.h ../include/IV-X11/Xundefs.h ../include/OS/os.h ../include/IV-2_6/InterViews/painter.h ../include/InterViews/display.h ../include/InterViews/coord.h IV-X11/wtable.h ../include/InterViews/window.h ../include/OS/table.h ../include/OS/math.h ../include/InterViews/bitmap.h ../include/IV-X11/xraster.h ../include/IV-2_6/_enter.h ../include/IV-X11/xpainter.h ../include/IV-2_6/InterViews/iwindow.h ../include/IV-X11/xdisplay.h ../include/InterViews/brush.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/IV-X11/Xlib.h ../include/IV-X11/xwindow.h ../include/OS/leave-scope.h ../include/IV-X11/xbitmap.h ../include/OS/table2.h ../include/IV-X11/Xutil.h ../include/InterViews/_leave.h IV-2_6/xpattern.lo : ../include/OS/list.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/pattern.h ../include/InterViews/iv.h ../include/InterViews/session.h ../include/InterViews/resource.h ../include/IV-X11/xpattern.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-X11/Xdefs.h ../include/IV-X11/Xundefs.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/InterViews/coord.h ../include/IV-2_6/_enter.h ../include/IV-X11/xdisplay.h ../include/InterViews/_undefs.h ../include/IV-X11/Xlib.h ../include/InterViews/enter-scope.h ../include/IV-X11/xwindow.h ../include/OS/leave-scope.h ../include/IV-X11/Xutil.h ../include/InterViews/_leave.h IV-X11/glcontext.lo : ../include/OS/list.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/InterViews/session.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/IV-X11/xcanvas.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-X11/Xdefs.h ../include/InterViews/style.h ../include/InterViews/_names.h ../include/IV-X11/Xundefs.h ../include/OS/os.h ../include/InterViews/display.h ../include/InterViews/coord.h IV-X11/wtable.h ../include/InterViews/window.h ../include/InterViews/glcontext.h ../include/OS/table.h ../include/IV-2_6/_enter.h ../include/IV-X11/xdisplay.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/IV-X11/Xlib.h ../include/IV-X11/xwindow.h ../include/OS/leave-scope.h ../include/IV-X11/Xutil.h ../include/InterViews/_leave.h IV-X11/session.lo : ../include/OS/list.h ../include/OS/host.h ../include/OS/file.h ../include/Dispatch/dp.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/InterViews/canvas.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/Dispatch/enter-scope.h ../include/Dispatch/dispatcher.h ../include/InterViews/resource.h ../include/OS/string.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/InterViews/style.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/Dispatch/iohandler.h ../include/InterViews/coord.h ../include/InterViews/window.h ../include/Dispatch/_defines.h ../include/InterViews/cursor.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/OS/types.h ../include/InterViews/_leave.h IV-X11/xbitmap.lo : ../include/OS/list.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/InterViews/session.h ../include/IV-X11/xfont.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-X11/Xdefs.h ../include/IV-X11/Xundefs.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/InterViews/coord.h ../include/OS/math.h ../include/InterViews/bitmap.h ../include/IV-2_6/_enter.h ../include/IV-X11/xdisplay.h ../include/InterViews/_undefs.h ../include/IV-X11/Xlib.h ../include/InterViews/enter-scope.h ../include/IV-X11/xwindow.h ../include/OS/leave-scope.h ../include/IV-X11/xbitmap.h ../include/IV-X11/Xutil.h ../include/InterViews/_leave.h IV-X11/xbrush.lo : ../include/OS/list.h ../include/IV-X11/xbrush.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/InterViews/session.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/InterViews/coord.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/brush.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h IV-X11/xcanvas.lo : ../include/OS/list.h ../include/IV-X11/xbrush.h ../include/InterViews/transformer.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/canvas.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/IV-X11/xfont.h ../include/InterViews/resource.h ../include/IV-X11/xcanvas.h ../include/InterViews/geometry.h ../include/IV-X11/xcolor.h ../include/OS/_defines.h ../include/IV-X11/Xdefs.h ../include/InterViews/style.h ../include/InterViews/raster.h ../include/IV-X11/Xundefs.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/InterViews/coord.h ../include/InterViews/window.h ../include/OS/math.h ../include/InterViews/bitmap.h ../include/IV-X11/xraster.h ../include/IV-2_6/_enter.h ../include/IV-X11/xdisplay.h ../include/InterViews/brush.h ../include/InterViews/_undefs.h ../include/IV-X11/Xlib.h ../include/InterViews/enter-scope.h ../include/IV-X11/xwindow.h ../include/OS/leave-scope.h ../include/IV-X11/xbitmap.h ../include/OS/table2.h ../include/IV-X11/Xutil.h ../include/InterViews/_leave.h IV-X11/xcolor.lo : ../include/OS/list.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/InterViews/canvas.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/InterViews/color.h ../include/InterViews/session.h ../include/InterViews/resource.h ../include/OS/string.h ../include/InterViews/geometry.h ../include/IV-X11/xcolor.h ../include/OS/_defines.h ../include/IV-X11/Xdefs.h ../include/IV-X11/Xundefs.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/InterViews/coord.h ../include/InterViews/window.h ../include/OS/math.h ../include/OS/ustring.h ../include/IV-2_6/_enter.h ../include/IV-X11/xdisplay.h ../include/InterViews/_undefs.h ../include/IV-X11/Xlib.h ../include/InterViews/enter-scope.h ../include/IV-X11/xwindow.h ../include/OS/leave-scope.h ../include/OS/table2.h ../include/IV-X11/Xutil.h ../include/InterViews/_leave.h IV-X11/xcursor.lo : ../include/OS/list.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/IV-X11/xfont.h ../include/InterViews/resource.h ../include/OS/string.h ../include/InterViews/geometry.h ../include/IV-X11/xcolor.h ../include/OS/_defines.h ../include/IV-X11/Xdefs.h ../include/InterViews/style.h ../include/IV-X11/Xundefs.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/InterViews/coord.h ../include/InterViews/bitmap.h ../include/InterViews/cursor.h ../include/IV-2_6/_enter.h ../include/IV-X11/xdisplay.h ../include/InterViews/_undefs.h ../include/IV-X11/Xlib.h ../include/InterViews/enter-scope.h ../include/IV-X11/xwindow.h ../include/OS/leave-scope.h ../include/IV-X11/xbitmap.h ../include/IV-X11/Xutil.h ../include/IV-X11/xcursor.h ../include/InterViews/_leave.h IV-X11/xdrag.lo : ../include/OS/list.h ../include/OS/host.h ../include/InterViews/input.h ../include/IV-look/stepper.h ../include/InterViews/observe.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/IV-look/kit.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/action.h ../include/InterViews/drag.h ../include/InterViews/handler.h ../include/InterViews/iv.h ../include/InterViews/background.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/InterViews/resource.h ../include/InterViews/adjust.h ../include/IV-X11/xdrag.h ../include/InterViews/geometry.h ../include/IV-look/button.h ../include/OS/_defines.h ../include/IV-X11/xevent.h ../include/IV-X11/Xdefs.h ../include/InterViews/style.h ../include/IV-X11/Xundefs.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/InterViews/telltale.h ../include/InterViews/coord.h ../include/InterViews/window.h ../include/InterViews/cursor.h ../include/IV-2_6/_enter.h ../include/IV-X11/xdisplay.h ../include/InterViews/_undefs.h ../include/IV-X11/Xlib.h ../include/InterViews/enter-scope.h ../include/IV-X11/xwindow.h ../include/IV-look/menu.h ../include/OS/leave-scope.h ../include/OS/types.h ../include/IV-X11/Xutil.h ../include/IV-X11/xcursor.h ../include/InterViews/_leave.h IV-X11/xevent.lo : ../include/OS/list.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/canvas.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/handler.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/InterViews/resource.h ../include/IV-X11/xcanvas.h ../include/IV-X11/xdrag.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-X11/xevent.h ../include/IV-X11/Xdefs.h ../include/InterViews/_names.h ../include/IV-X11/Xundefs.h ../include/OS/os.h ../include/InterViews/display.h ../include/InterViews/coord.h IV-X11/wtable.h ../include/InterViews/window.h ../include/OS/table.h ../include/IV-2_6/_enter.h ../include/IV-X11/xdisplay.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/IV-X11/Xlib.h ../include/IV-X11/xwindow.h ../include/OS/leave-scope.h ../include/IV-X11/Xutil.h ../include/InterViews/_leave.h IV-X11/xfont.lo : ../include/OS/list.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/InterViews/session.h ../include/IV-X11/xfont.h ../include/InterViews/resource.h ../include/OS/string.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-X11/Xdefs.h ../include/IV-X11/Xundefs.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/InterViews/coord.h ../include/OS/table.h ../include/OS/math.h ../include/OS/ustring.h ../include/IV-2_6/_enter.h ../include/IV-X11/xdisplay.h ../include/InterViews/_undefs.h ../include/IV-X11/Xlib.h ../include/InterViews/enter-scope.h ../include/IV-X11/xwindow.h ../include/OS/leave-scope.h ../include/IV-X11/Xutil.h ../include/InterViews/_leave.h IV-X11/xraster.lo : ../include/OS/list.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/canvas.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/session.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-X11/Xdefs.h ../include/InterViews/raster.h ../include/IV-X11/Xundefs.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/InterViews/coord.h ../include/IV-X11/xraster.h ../include/IV-2_6/_enter.h ../include/IV-X11/xdisplay.h ../include/InterViews/_undefs.h ../include/IV-X11/Xlib.h ../include/InterViews/enter-scope.h ../include/IV-X11/xwindow.h ../include/OS/leave-scope.h ../include/IV-X11/Xutil.h ../include/InterViews/_leave.h IV-X11/xreqerr.lo : ../include/InterViews/reqerr.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/OS/_defines.h ../include/IV-X11/Xdefs.h ../include/IV-X11/Xundefs.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/IV-X11/Xlib.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/IV-X11/Xutil.h ../include/InterViews/_leave.h IV-X11/xselection.lo : ../include/OS/list.h ../include/InterViews/patch.h ../include/InterViews/transformer.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/selection.h ../include/InterViews/resource.h ../include/OS/string.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-X11/Xdefs.h ../include/InterViews/_names.h ../include/IV-X11/Xundefs.h ../include/IV-X11/xselection.h ../include/OS/os.h ../include/InterViews/display.h ../include/InterViews/coord.h IV-X11/wtable.h ../include/InterViews/window.h ../include/OS/table.h ../include/IV-2_6/_enter.h ../include/IV-X11/xdisplay.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/IV-X11/Xlib.h ../include/IV-X11/xwindow.h ../include/OS/leave-scope.h ../include/IV-X11/Xutil.h ../include/InterViews/_leave.h IV-X11/xwindow.lo : ../include/OS/list.h ../include/OS/host.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/canvas.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/handler.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/InterViews/selection.h ../include/InterViews/resource.h ../include/OS/string.h ../include/IV-X11/xcanvas.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-X11/xevent.h ../include/IV-X11/Xdefs.h ../include/InterViews/style.h ../include/InterViews/_names.h ../include/IV-X11/Xundefs.h ../include/IV-X11/xselection.h ../include/OS/os.h ../include/InterViews/display.h ../include/InterViews/coord.h IV-X11/wtable.h ../include/InterViews/window.h ../include/OS/table.h ../include/OS/math.h ../include/InterViews/bitmap.h ../include/InterViews/cursor.h ../include/IV-X11/Xext.h ../include/IV-2_6/_enter.h ../include/IV-X11/xdisplay.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/IV-X11/Xlib.h ../include/IV-X11/xwindow.h ../include/OS/leave-scope.h ../include/IV-X11/xbitmap.h ../include/IV-X11/xcursor.h ../include/IV-X11/Xutil.h ../include/InterViews/_leave.h InterViews/action.lo : ../include/OS/list.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/action.h ../include/InterViews/iv.h ../include/InterViews/resource.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h InterViews/adjust.lo : ../include/InterViews/observe.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/InterViews/adjust.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/OS/math.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h InterViews/aggr.lo : ../include/OS/list.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/canvas.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/InterViews/printer.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/IV-2_6/_enter.h ../include/InterViews/aggr.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h InterViews/align.lo : ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/deck.h ../include/InterViews/monoglyph.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/polyglyph.h ../include/InterViews/resource.h ../include/InterViews/adjust.h ../include/InterViews/align.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/InterViews/scrbox.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/OS/math.h ../include/InterViews/layout.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h InterViews/alloctbl.lo : ../include/OS/list.h ../include/InterViews/transformer.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/canvas.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/InterViews/alloctbl.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/OS/math.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h InterViews/arrcomp.lo : ../include/InterViews/compositor.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/InterViews/arraycomp.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/OS/math.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h InterViews/background.lo : ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/background.h ../include/InterViews/printer.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h InterViews/bevel.lo : ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/printer.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/window.h ../include/IV-look/bevel.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h InterViews/border.lo : ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/printer.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/border.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h InterViews/box.lo : ../include/OS/list.h ../include/InterViews/tile.h ../include/InterViews/transformer.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/InterViews/deck.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/InterViews/printer.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/InterViews/polyglyph.h ../include/InterViews/resource.h ../include/InterViews/box.h ../include/InterViews/adjust.h ../include/InterViews/align.h ../include/InterViews/geometry.h ../include/InterViews/alloctbl.h ../include/OS/_defines.h ../include/InterViews/scrbox.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/OS/math.h ../include/InterViews/layout.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/InterViews/superpose.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h InterViews/browser.lo : ../include/OS/list.h ../include/InterViews/input.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/observe.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/monoglyph.h ../include/InterViews/action.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/InterViews/style.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-look/browser.h ../include/InterViews/telltale.h ../include/InterViews/coord.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/IV-look/telltale.h ../include/InterViews/_leave.h InterViews/button.lo : ../include/InterViews/input.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/observe.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/monoglyph.h ../include/InterViews/action.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/IV-look/button.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/telltale.h ../include/InterViews/coord.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/IV-look/telltale.h ../include/InterViews/_leave.h InterViews/character.lo : ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/canvas.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/InterViews/character.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h InterViews/compositor.lo : ../include/InterViews/compositor.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h InterViews/comption.lo : ../include/OS/list.h ../include/InterViews/tile.h ../include/InterViews/compositor.h ../include/InterViews/patch.h ../include/InterViews/transformer.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/InterViews/deck.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/InterViews/polyglyph.h ../include/InterViews/resource.h ../include/InterViews/comption.h ../include/InterViews/box.h ../include/InterViews/adjust.h ../include/InterViews/align.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/InterViews/scrbox.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/OS/math.h ../include/InterViews/layout.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h InterViews/debug.lo : ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/InterViews/resource.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/debug.h ../include/InterViews/_leave.h InterViews/deck.lo : ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/InterViews/deck.h ../include/InterViews/monoglyph.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/InterViews/polyglyph.h ../include/InterViews/resource.h ../include/InterViews/adjust.h ../include/InterViews/align.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/InterViews/scrbox.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/layout.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/OS/leave-scope.h ../include/InterViews/_leave.h InterViews/dialogs.lo : ../include/OS/list.h ../include/IV-look/ol_dialogs.h ../include/InterViews/input.h ../include/InterViews/dialog.h ../include/IV-look/stepper.h ../include/IV-look/dialogs.h ../include/IV-look/field.h ../include/InterViews/observe.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/OS/enter-scope.h ../include/IV-look/kit.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/handler.h ../include/InterViews/action.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/InterViews/glyph.h ../include/IV-Mac/window.h ../include/InterViews/resource.h ../include/OS/string.h ../include/InterViews/adjust.h ../include/InterViews/geometry.h ../include/IV-look/button.h ../include/OS/_defines.h ../include/InterViews/style.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/InterViews/telltale.h ../include/InterViews/coord.h ../include/InterViews/window.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/IV-look/mf_dialogs.h ../include/IV-look/menu.h ../include/OS/leave-scope.h ../include/IV-look/fchooser.h ../include/InterViews/_leave.h InterViews/fbrowser.lo : ../include/InterViews/input.h ../include/IV-look/stepper.h ../include/Dispatch/dp.h ../include/InterViews/observe.h ../include/IV-2_6/_names.h ../include/OS/_undefs.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/IV-look/kit.h ../include/IV-look/fbrowser.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/action.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/Dispatch/iocallback.h ../include/Dispatch/enter-scope.h ../include/Dispatch/dispatcher.h ../include/InterViews/polyglyph.h ../include/InterViews/resource.h ../include/InterViews/adjust.h ../include/InterViews/geometry.h ../include/IV-look/button.h ../include/OS/_defines.h ../include/InterViews/style.h ../include/InterViews/scrbox.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-look/browser.h ../include/Dispatch/iohandler.h ../include/InterViews/telltale.h ../include/InterViews/coord.h ../include/InterViews/window.h ../include/Dispatch/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/IV-look/menu.h ../include/OS/leave-scope.h ../include/OS/types.h ../include/InterViews/_leave.h InterViews/fchooser.lo : ../include/InterViews/input.h ../include/InterViews/dialog.h ../include/IV-look/stepper.h ../include/IV-look/dialogs.h ../include/IV-look/field.h ../include/InterViews/observe.h ../include/OS/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/deck.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/IV-look/kit.h ../include/IV-look/fbrowser.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/monoglyph.h ../include/InterViews/action.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/OS/directory.h ../include/InterViews/polyglyph.h ../include/InterViews/resource.h ../include/OS/string.h ../include/InterViews/adjust.h ../include/InterViews/geometry.h ../include/IV-look/button.h ../include/OS/_defines.h ../include/InterViews/style.h ../include/InterViews/scrbox.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-look/browser.h ../include/InterViews/telltale.h ../include/InterViews/coord.h ../include/IV-look/choice.h ../include/InterViews/layout.h ../include/IV-2_6/_enter.h ../include/InterViews/_undefs.h ../include/InterViews/enter-scope.h ../include/IV-look/menu.h ../include/OS/leave-scope.h ../include/InterViews/target.h ../include/IV-look/fchooser.h ../include/InterViews/_leave.h InterViews/field.lo : ../include/InterViews/input.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/iv3text.h ../include/Dispatch/iocallback.h ../include/Dispatch/enter-scope.h ../include/OS/string.h ../include/InterViews/geometry.h ../include/IV-look/button.h ../include/OS/_defines.h ../include/InterViews/style.h ../include/IV-2_6/InterViews/subject.h ../include/IV-2_6/InterViews/painter.h ../include/InterViews/window.h ../include/OS/math.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/IV-look/menu.h ../include/OS/types.h ../include/InterViews/_leave.h ../include/OS/list.h ../include/InterViews/patch.h ../include/InterViews/transformer.h ../include/Dispatch/dp.h ../include/IV-look/stepper.h ../include/IV-look/field.h ../include/OS/_undefs.h ../include/InterViews/observe.h ../include/InterViews/deck.h ../include/IV-2_6/InterViews/textstyle.h ../include/IV-look/kit.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/IV-2_6/InterViews/textdisplay.h ../include/InterViews/action.h ../include/IV-2_6/InterViews/button.h ../include/InterViews/iv.h ../include/InterViews/background.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/InterViews/printer.h ../include/InterViews/hit.h ../include/InterViews/selection.h ../include/Dispatch/dispatcher.h ../include/InterViews/resource.h ../include/InterViews/polyglyph.h ../include/InterViews/adjust.h ../include/IV-2_6/InterViews/minmax.h ../include/IV-2_6/_leave.h ../include/InterViews/scrbox.h ../include/InterViews/_names.h ../include/OS/os.h ../include/Dispatch/iohandler.h ../include/InterViews/display.h ../include/InterViews/coord.h ../include/InterViews/telltale.h ../include/IV-2_6/InterViews/sensor.h ../include/Dispatch/_defines.h ../include/InterViews/layout.h ../include/IV-2_6/InterViews/streditor.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/geometry.lo : ../include/InterViews/compositor.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/OS/math.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/InterViews/transformer.h ../include/OS/_undefs.h ../include/InterViews/canvas.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/glyph.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/_undefs.h ../include/InterViews/canvas.h ../include/InterViews/iv.h ../include/InterViews/printer.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/InterViews/resource.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/group.lo : ../include/InterViews/group.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/aggr.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/list.h ../include/OS/_undefs.h ../include/InterViews/deck.h ../include/InterViews/monoglyph.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/polyglyph.h ../include/InterViews/resource.h ../include/InterViews/adjust.h ../include/InterViews/align.h ../include/InterViews/scrbox.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/layout.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/handler.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/_undefs.h ../include/InterViews/handler.h ../include/InterViews/iv.h ../include/InterViews/resource.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/hit.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/OS/math.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/list.h ../include/InterViews/transformer.h ../include/OS/_undefs.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/InterViews/resource.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/OS/memory.h InterViews/image.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/image.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/_undefs.h ../include/InterViews/canvas.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/raster.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/input.lo : ../include/InterViews/input.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/geometry.h ../include/InterViews/alloctbl.h ../include/OS/_defines.h ../include/InterViews/style.h ../include/InterViews/window.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/list.h ../include/InterViews/transformer.h ../include/OS/_undefs.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/handler.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/InterViews/resource.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/kit.lo : ../include/InterViews/Bitmaps/handMask.bm ../include/InterViews/input.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/OS/string.h ../include/InterViews/geometry.h ../include/IV-look/button.h ../include/OS/_defines.h ../include/InterViews/style.h ../include/IV-look/mono_kit.h ../include/IV-look/smf_kit.h ../include/IV-look/bevel.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/Bitmaps/rfast.bm ../include/IV-look/menu.h ../include/InterViews/_leave.h ../include/OS/list.h ../include/InterViews/Bitmaps/rfastMask.bm ../include/IV-look/ol_kit.h ../include/IV-look/stepper.h ../include/InterViews/Bitmaps/lufast.bm ../include/OS/_undefs.h ../include/InterViews/observe.h ../include/InterViews/deck.h ../include/IV-look/kit.h ../include/InterViews/Bitmaps/rufast.bm ../include/InterViews/canvas.h ../include/IV-look/mw_kit.h ../include/InterViews/monoglyph.h ../include/InterViews/action.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/background.h ../include/InterViews/Bitmaps/lufastMask.bm ../include/InterViews/Bitmaps/ldfast.bm ../include/InterViews/session.h ../include/InterViews/glyph.h ../include/InterViews/Bitmaps/rufastMask.bm ../include/InterViews/polyglyph.h ../include/InterViews/resource.h ../include/InterViews/Bitmaps/ufast.bm ../include/InterViews/Bitmaps/rdfast.bm ../include/InterViews/adjust.h ../include/InterViews/Bitmaps/ldfastMask.bm ../include/InterViews/scrbox.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/Bitmaps/ufastMask.bm ../include/InterViews/Bitmaps/rdfastMask.bm ../include/InterViews/display.h ../include/InterViews/telltale.h ../include/InterViews/coord.h ../include/InterViews/Bitmaps/dfast.bm ../include/InterViews/bitmap.h ../include/OS/ustring.h ../include/InterViews/layout.h ../include/InterViews/cursor.h ../include/InterViews/Bitmaps/lfast.bm ../include/InterViews/label.h ../include/InterViews/Bitmaps/hand.bm ../include/InterViews/Bitmaps/dfastMask.bm ../include/InterViews/_undefs.h ../include/IV-Win/MWlib.h ../include/OS/leave-scope.h ../include/IV-look/mf_kit.h ../include/InterViews/Bitmaps/lfastMask.bm InterViews/label.lo : ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/OS/string.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/_undefs.h ../include/InterViews/canvas.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/InterViews/resource.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/label.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/layout.lo : ../include/InterViews/glue.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/box.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/InterViews/tile.h ../include/OS/_undefs.h ../include/InterViews/deck.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/place.h ../include/InterViews/hit.h ../include/InterViews/polyglyph.h ../include/InterViews/resource.h ../include/InterViews/adjust.h ../include/InterViews/align.h ../include/InterViews/scrbox.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/layout.h ../include/InterViews/_undefs.h ../include/InterViews/superpose.h ../include/OS/leave-scope.h InterViews/lrmarker.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/OS/math.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/_undefs.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/iv.h ../include/InterViews/color.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/lrmarker.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/menu.lo : ../include/InterViews/input.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/InterViews/window.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/IV-look/menu.h ../include/InterViews/_leave.h ../include/OS/list.h ../include/InterViews/patch.h ../include/InterViews/transformer.h ../include/OS/_undefs.h ../include/InterViews/observe.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/action.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/InterViews/resource.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/telltale.h ../include/InterViews/coord.h ../include/InterViews/cursor.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/IV-look/telltale.h InterViews/mf_dialogs.lo : ../include/InterViews/input.h ../include/IV-look/dialogs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/OS/string.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/IV-look/mf_dialogs.h ../include/InterViews/_leave.h ../include/InterViews/dialog.h ../include/IV-look/field.h ../include/OS/_undefs.h ../include/InterViews/monoglyph.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/IV-look/fchooser.h InterViews/mf_kit.lo : ../include/InterViews/input.h ../include/IV-look/slider.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/OS/string.h ../include/InterViews/geometry.h ../include/IV-look/button.h ../include/OS/_defines.h ../include/InterViews/style.h ../include/IV-look/choice.h ../include/InterViews/border.h ../include/IV-look/bevel.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/IV-look/menu.h ../include/InterViews/_leave.h ../include/OS/list.h ../include/IV-look/stepper.h ../include/InterViews/observe.h ../include/OS/_undefs.h ../include/InterViews/deck.h ../include/IV-look/kit.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/action.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/background.h ../include/InterViews/session.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/InterViews/polyglyph.h ../include/InterViews/resource.h ../include/InterViews/adjust.h ../include/InterViews/scrbox.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/InterViews/telltale.h ../include/InterViews/coord.h ../include/InterViews/bitmap.h ../include/InterViews/layout.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/IV-look/mf_kit.h InterViews/mono_kit.lo : ../include/InterViews/input.h ../include/IV-look/slider.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/OS/string.h ../include/InterViews/geometry.h ../include/IV-look/button.h ../include/OS/_defines.h ../include/InterViews/style.h ../include/IV-look/mono_kit.h ../include/IV-look/choice.h ../include/InterViews/border.h ../include/IV-look/bevel.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/IV-look/menu.h ../include/InterViews/_leave.h ../include/OS/list.h ../include/IV-look/stepper.h ../include/InterViews/observe.h ../include/OS/_undefs.h ../include/InterViews/deck.h ../include/IV-look/kit.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/action.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/background.h ../include/InterViews/session.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/InterViews/polyglyph.h ../include/InterViews/resource.h ../include/InterViews/adjust.h ../include/InterViews/scrbox.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/InterViews/telltale.h ../include/InterViews/coord.h ../include/InterViews/bitmap.h ../include/InterViews/layout.h ../include/InterViews/label.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/monoglyph.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/_undefs.h ../include/InterViews/monoglyph.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/observe.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/list.h ../include/OS/_undefs.h ../include/InterViews/observe.h ../include/InterViews/iv.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/ol_dialogs.lo : ../include/IV-look/ol_dialogs.h ../include/InterViews/input.h ../include/IV-look/dialogs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/OS/string.h ../include/InterViews/geometry.h ../include/IV-look/button.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/IV-look/menu.h ../include/InterViews/_leave.h ../include/InterViews/dialog.h ../include/IV-look/ol_kit.h ../include/IV-look/stepper.h ../include/IV-look/field.h ../include/InterViews/observe.h ../include/OS/_undefs.h ../include/IV-look/kit.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/action.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/adjust.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/telltale.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/IV-look/fchooser.h InterViews/ol_kit.lo : ../include/InterViews/input.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Dispatch/iocallback.h ../include/Dispatch/enter-scope.h ../include/OS/string.h ../include/InterViews/geometry.h ../include/IV-look/button.h ../include/OS/_defines.h ../include/InterViews/style.h ../include/InterViews/window.h ../include/IV-look/bevel.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/IV-look/menu.h ../include/OS/types.h ../include/InterViews/_leave.h ../include/InterViews/patch.h ../include/InterViews/transformer.h ../include/IV-look/ol_kit.h ../include/IV-look/stepper.h ../include/Dispatch/dp.h ../include/InterViews/observe.h ../include/OS/_undefs.h ../include/InterViews/deck.h ../include/IV-look/kit.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/action.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/Dispatch/dispatcher.h ../include/InterViews/polyglyph.h ../include/InterViews/resource.h ../include/InterViews/adjust.h ../include/InterViews/scrbox.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/Dispatch/iohandler.h ../include/InterViews/telltale.h ../include/InterViews/coord.h ../include/Dispatch/_defines.h ../include/InterViews/layout.h ../include/InterViews/cursor.h ../include/InterViews/brush.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/page.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/list.h ../include/OS/_undefs.h ../include/InterViews/canvas.h ../include/InterViews/page.h ../include/InterViews/iv.h ../include/InterViews/printer.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/InterViews/resource.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/patch.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/InterViews/patch.h ../include/InterViews/transformer.h ../include/OS/_undefs.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/place.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/OS/math.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/_undefs.h ../include/InterViews/deck.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/iv.h ../include/InterViews/printer.h ../include/InterViews/glyph.h ../include/InterViews/place.h ../include/InterViews/polyglyph.h ../include/InterViews/resource.h ../include/InterViews/adjust.h ../include/InterViews/scrbox.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/layout.h ../include/InterViews/_undefs.h ../include/InterViews/superpose.h ../include/OS/leave-scope.h InterViews/polyglyph.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/list.h ../include/OS/_undefs.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/polyglyph.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/printer.lo : ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/OS/math.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/list.h ../include/InterViews/transformer.h ../include/OS/_undefs.h ../include/InterViews/canvas.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/printer.h ../include/InterViews/resource.h ../include/InterViews/raster.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/bitmap.h ../include/InterViews/brush.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/psfont.lo : ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/_undefs.h ../include/InterViews/iv.h ../include/InterViews/resource.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/psfont.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/regexp.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/OS/_undefs.h ../include/InterViews/iv.h ../include/OS/os.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/InterViews/regexp.h InterViews/resource.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/OS/list.h ../include/OS/_undefs.h ../include/InterViews/iv.h ../include/InterViews/resource.h ../include/OS/os.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/rule.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/rule.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/_undefs.h ../include/InterViews/canvas.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/scrbox.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/OS/math.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/list.h ../include/InterViews/transformer.h ../include/OS/_undefs.h ../include/InterViews/canvas.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/printer.h ../include/InterViews/hit.h ../include/InterViews/polyglyph.h ../include/InterViews/resource.h ../include/InterViews/adjust.h ../include/InterViews/scrbox.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/shadow.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/OS/math.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/shadow.h ../include/InterViews/_leave.h ../include/OS/_undefs.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/printer.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/simpcomp.lo : ../include/InterViews/compositor.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/OS/math.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/_undefs.h ../include/InterViews/simplecomp.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/slider.lo : ../include/InterViews/input.h ../include/IV-look/slider.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/geometry.h ../include/IV-look/button.h ../include/OS/_defines.h ../include/InterViews/style.h ../include/OS/math.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/InterViews/patch.h ../include/InterViews/transformer.h ../include/IV-look/stepper.h ../include/OS/_undefs.h ../include/InterViews/observe.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/InterViews/resource.h ../include/InterViews/adjust.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/InterViews/telltale.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/IV-look/telltale.h InterViews/smf_kit.lo : ../include/InterViews/input.h ../include/InterViews/stencil.h ../include/IV-look/slider.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/OS/string.h ../include/InterViews/geometry.h ../include/IV-look/button.h ../include/OS/_defines.h ../include/InterViews/style.h ../include/InterViews/window.h ../include/IV-look/smf_kit.h ../include/IV-look/bevel.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/shadow.h ../include/IV-look/menu.h ../include/InterViews/_leave.h ../include/OS/list.h ../include/IV-look/stepper.h ../include/InterViews/observe.h ../include/OS/_undefs.h ../include/InterViews/deck.h ../include/IV-look/kit.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/action.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/session.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/InterViews/polyglyph.h ../include/InterViews/resource.h ../include/InterViews/adjust.h ../include/InterViews/scrbox.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/telltale.h ../include/InterViews/coord.h ../include/InterViews/bitmap.h ../include/InterViews/layout.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/IV-look/mf_kit.h InterViews/stencil.lo : ../include/InterViews/stencil.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/_undefs.h ../include/InterViews/canvas.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/bitmap.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/stepper.lo : ../include/InterViews/input.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Dispatch/iocallback.h ../include/Dispatch/enter-scope.h ../include/InterViews/geometry.h ../include/IV-look/button.h ../include/OS/_defines.h ../include/InterViews/style.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/OS/types.h ../include/InterViews/_leave.h ../include/IV-look/stepper.h ../include/Dispatch/dp.h ../include/InterViews/observe.h ../include/OS/_undefs.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/Dispatch/dispatcher.h ../include/InterViews/resource.h ../include/InterViews/adjust.h ../include/InterViews/_names.h ../include/OS/os.h ../include/Dispatch/iohandler.h ../include/InterViews/coord.h ../include/Dispatch/_defines.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/InterViews/target.h InterViews/style.lo : ../include/OS/file.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/OS/string.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/InterViews/style.h ../include/OS/table.h ../include/OS/math.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/list.h ../include/OS/_undefs.h ../include/InterViews/action.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/session.h ../include/InterViews/resource.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/display.h ../include/InterViews/coord.h ../include/OS/ustring.h ../include/InterViews/brush.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/superpose.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/_undefs.h ../include/InterViews/deck.h ../include/InterViews/monoglyph.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/polyglyph.h ../include/InterViews/resource.h ../include/InterViews/adjust.h ../include/InterViews/scrbox.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/layout.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/InterViews/superpose.h InterViews/target.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/_undefs.h ../include/InterViews/monoglyph.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/InterViews/resource.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/InterViews/target.h InterViews/telltale.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-look/choice.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/InterViews/observe.h ../include/OS/_undefs.h ../include/InterViews/deck.h ../include/InterViews/monoglyph.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/polyglyph.h ../include/InterViews/resource.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/telltale.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/InterViews/target.h ../include/IV-look/telltale.h InterViews/texcomp.lo : ../include/InterViews/compositor.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/OS/math.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/_undefs.h ../include/InterViews/iv.h ../include/InterViews/texcomp.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/text.lo : ../include/InterViews/input.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/OS/string.h ../include/InterViews/box.h ../include/InterViews/geometry.h ../include/IV-look/button.h ../include/OS/_defines.h ../include/InterViews/style.h ../include/InterViews/window.h ../include/OS/math.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/IV-look/menu.h ../include/InterViews/_leave.h ../include/IV-look/stepper.h ../include/InterViews/observe.h ../include/OS/_undefs.h ../include/InterViews/deck.h ../include/IV-look/kit.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/handler.h ../include/InterViews/action.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/InterViews/polyglyph.h ../include/InterViews/resource.h ../include/InterViews/adjust.h ../include/InterViews/scrbox.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/telltale.h ../include/InterViews/coord.h ../include/InterViews/layout.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/OS/memory.h InterViews/textbuffer.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/OS/string.h ../include/OS/_defines.h ../include/OS/math.h ../include/InterViews/iv3textbuffer.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/OS/_undefs.h ../include/InterViews/iv.h ../include/OS/os.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/OS/memory.h ../include/InterViews/regexp.h InterViews/tformsetter.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/OS/math.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/InterViews/transformer.h ../include/OS/_undefs.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/iv.h ../include/InterViews/printer.h ../include/InterViews/glyph.h ../include/InterViews/hit.h ../include/InterViews/resource.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/tformsetter.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/tiff.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/tiff.h ../include/InterViews/_leave.h ../include/OS/_undefs.h ../include/TIFF/tiffio.h ../include/InterViews/iv.h ../include/InterViews/color.h ../include/InterViews/resource.h ../include/InterViews/raster.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/tile.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/OS/math.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/InterViews/tile.h ../include/OS/_undefs.h ../include/InterViews/deck.h ../include/InterViews/monoglyph.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/polyglyph.h ../include/InterViews/resource.h ../include/InterViews/adjust.h ../include/InterViews/scrbox.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/layout.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/transformer.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/OS/_defines.h ../include/OS/math.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/InterViews/transformer.h ../include/OS/_undefs.h ../include/InterViews/iv.h ../include/InterViews/resource.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/winbmp.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/winbmp.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/_undefs.h ../include/InterViews/iv.h ../include/InterViews/color.h ../include/InterViews/resource.h ../include/InterViews/raster.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h InterViews/xymarker.lo : ../include/InterViews/xymarker.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/OS/math.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/_undefs.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/InterViews/resource.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h OS/directory.lo : ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/OS/string.h ../include/OS/_defines.h ../include/OS/types.h ../include/InterViews/_leave.h ../include/OS/directory.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-Win/MWlib.h ../include/OS/memory.h OS/dirent.lo : OS/file.lo : ../include/OS/file.h ../include/OS/enter-scope.h ../include/OS/string.h ../include/OS/_defines.h ../include/OS/types.h ../include/OS/os.h OS/host.lo : ../include/OS/enter-scope.h ../include/OS/_defines.h ../include/OS/host.h ../include/OS/os.h OS/listimpl.lo : ../include/OS/enter-scope.h ../include/OS/_defines.h ../include/OS/list.h ../include/OS/os.h OS/math.lo : ../include/OS/enter-scope.h ../include/OS/_defines.h ../include/OS/math.h ../include/OS/os.h OS/memory.lo : ../include/OS/enter-scope.h ../include/OS/_defines.h ../include/OS/os.h ../include/OS/memory.h OS/string.lo : ../include/OS/enter-scope.h ../include/OS/string.h ../include/OS/_defines.h ../include/OS/os.h OS/ustring.lo : ../include/OS/enter-scope.h ../include/OS/string.h ../include/OS/_defines.h ../include/OS/table.h ../include/OS/os.h ../include/OS/ustring.h Unidraw/align.lo : ../include/Unidraw/_undefs.h ../include/Unidraw/grid.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/Commands/datas.h ../include/Unidraw/clipboard.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Commands/data.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/Unidraw/Commands/align.h ../include/Unidraw/Graphic/grblock.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/InterViews/transformer.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/Commands/transforms.h ../include/InterViews/monoglyph.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/unidraw.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/selection.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/InterViews/brush.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h Unidraw/brushcmd.lo : ../include/Unidraw/_undefs.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/statevars.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/statevar.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/monoglyph.h ../include/Unidraw/umap.h ../include/InterViews/iv.h ../include/Unidraw/Commands/brushcmd.h ../include/Unidraw/unidraw.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/uformat.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h Unidraw/catalog.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/clipboard.h ../include/Unidraw/ulist.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/statevars.h ../include/Unidraw/Components/compview.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/Unidraw/transfn.h ../include/OS/types.h ../include/Unidraw/ctrlinfo.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/InterViews/transformer.h ../include/Unidraw/statevar.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/Components/csolver.h ../include/Unidraw/editorinfo.h ../include/Unidraw/umap.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/session.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/uformat.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/raster.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/creator.h ../include/InterViews/bitmap.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/Unidraw/Tools/tool.h ../include/IV-2_6/InterViews/world.h ../include/Unidraw/Components/connector.h ../include/OS/memory.h Unidraw/catcmds.lo : ../include/Unidraw/_undefs.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/IV-look/dialogs.h ../include/IV-2_6/InterViews/filechooser.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/statevars.h ../include/OS/string.h ../include/Unidraw/Components/compview.h ../include/Unidraw/Commands/catcmds.h ../include/InterViews/geometry.h ../include/Unidraw/dialogs.h ../include/OS/_defines.h ../include/InterViews/style.h ../include/Unidraw/Components/grview.h ../include/InterViews/window.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/OS/types.h ../include/InterViews/_leave.h ../include/IV-2_6/InterViews/strchooser.h ../include/Unidraw/enter-scope.h ../include/InterViews/dialog.h ../include/Unidraw/Components/component.h ../include/IV-2_6/InterViews/dialog.h ../include/Unidraw/statevar.h ../include/Unidraw/iterator.h ../include/IV-look/field.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/canvas.h ../include/Unidraw/Components/psview.h ../include/InterViews/monoglyph.h ../include/Unidraw/umap.h ../include/InterViews/iv.h ../include/InterViews/session.h ../include/Unidraw/unidraw.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/uformat.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/Components/externview.h ../include/IV-2_6/InterViews/scene.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/IV-look/fchooser.h Unidraw/cglue.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/Unidraw/enter-scope.h ../include/IV-2_6/InterViews/shape.h ../include/OS/_undefs.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/Unidraw/Components/cglue.h ../include/OS/os.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h Unidraw/clipboard.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/Unidraw/clipboard.h ../include/Unidraw/ulist.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/Components/compview.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/selection.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h Unidraw/colorcmd.lo : ../include/Unidraw/_undefs.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/statevars.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/statevar.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/monoglyph.h ../include/Unidraw/umap.h ../include/Unidraw/Commands/colorcmd.h ../include/InterViews/iv.h ../include/Unidraw/unidraw.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/uformat.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h Unidraw/command.lo : ../include/Unidraw/_undefs.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/Unidraw/Commands/datas.h ../include/Unidraw/clipboard.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/Commands/data.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/grblock.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/Unidraw/ctrlinfo.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/monoglyph.h ../include/Unidraw/umap.h ../include/InterViews/iv.h ../include/Unidraw/unidraw.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/uformat.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/selection.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h Unidraw/component.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/Unidraw/ulist.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/Components/compview.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/umap.h ../include/InterViews/iv.h ../include/Unidraw/unidraw.h ../include/Unidraw/_defines.h ../include/Unidraw/uformat.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/creator.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h Unidraw/compview.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Components/compview.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h Unidraw/connect.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Tools/connect.h ../include/Unidraw/Graphic/grblock.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/selection.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/Unidraw/Tools/tool.h ../include/Unidraw/Components/connector.h Unidraw/connector.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/ulist.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/Commands/data.h ../include/Unidraw/statevars.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/Unidraw/Graphic/grblock.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/Unidraw/transfn.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/Unidraw/statevar.h ../include/OS/_undefs.h ../include/Unidraw/path.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/Components/csolver.h ../include/Unidraw/umap.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/Unidraw/unidraw.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/uformat.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/Unidraw/Components/cglue.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/Unidraw/Components/connector.h Unidraw/creator.lo : ../include/Unidraw/Components/ellipse.h ../include/Unidraw/_undefs.h ../include/Unidraw/Tools/reshape.h ../include/Unidraw/Tools/magnify.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/statevars.h ../include/Unidraw/Components/compview.h ../include/Unidraw/Commands/catcmds.h ../include/Unidraw/Components/rect.h ../include/Unidraw/Graphic/geomobjs.h ../include/Unidraw/Commands/viewcmds.h ../include/OS/_defines.h ../include/Unidraw/Tools/grcomptool.h ../include/IV-2_6/InterViews/rubcurve.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Tools/connect.h ../include/Unidraw/Components/pad.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/Unidraw/Commands/align.h ../include/Unidraw/Commands/nop.h ../include/Unidraw/Tools/rotate.h ../include/Unidraw/Commands/macro.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/InterViews/rubband.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/Unidraw/Components/vertices.h ../include/InterViews/enter-scope.h ../include/Unidraw/Components/pin.h ../include/Unidraw/Commands/import.h ../include/Unidraw/transfn.h ../include/Unidraw/Components/line.h ../include/Unidraw/Components/spline.h ../include/InterViews/_leave.h ../include/Unidraw/Components/link.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/Unidraw/statevar.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/transfns.h ../include/Unidraw/Commands/transforms.h ../include/Unidraw/Components/psview.h ../include/Unidraw/umap.h ../include/InterViews/pattern.h ../include/Unidraw/Commands/colorcmd.h ../include/Unidraw/Components/rastercomp.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/Components/stencilcomp.h ../include/Unidraw/Components/slot.h ../include/Unidraw/Commands/brushcmd.h ../include/Unidraw/Components/text.h ../include/Unidraw/Commands/patcmd.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/uformat.h ../include/Unidraw/Tools/select.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/Components/externview.h ../include/Unidraw/Commands/struct.h ../include/Unidraw/Commands/edit.h ../include/Unidraw/Tools/scale.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/creator.h ../include/Unidraw/uarray.h ../include/Unidraw/Tools/move.h ../include/Unidraw/Commands/font.h ../include/Unidraw/uhash.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h ../include/Unidraw/Tools/stretch.h ../include/Unidraw/Components/polygon.h ../include/Unidraw/Components/grcomp.h ../include/Unidraw/Tools/tool.h ../include/Unidraw/Components/connector.h ../include/Unidraw/Graphic/ulabel.h Unidraw/csolver.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/ulist.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/Components/compview.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/InterViews/transformer.h ../include/IV-2_6/InterViews/shape.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/Commands/transforms.h ../include/Unidraw/Components/csolver.h ../include/Unidraw/umap.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/unidraw.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/uformat.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/Unidraw/Components/cglue.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/Unidraw/Components/connector.h Unidraw/ctrlinfo.lo : ../include/Unidraw/_undefs.h ../include/Unidraw/uctrl.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/subject.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/IV-2_6/InterViews/control.h ../include/InterViews/enter-scope.h ../include/Unidraw/ctrlinfo.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/Components/psview.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/Components/text.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/Components/externview.h ../include/IV-2_6/InterViews/scene.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/Unidraw/Graphic/ulabel.h Unidraw/damage.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/ulist.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/painter.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/iterator.h ../include/Unidraw/Graphic/damage.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/canvas.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h Unidraw/data.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/Unidraw/Commands/data.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/Unidraw/enter-scope.h ../include/OS/_undefs.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/OS/os.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h Unidraw/datas.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/Commands/datas.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Commands/data.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/brush.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h Unidraw/dialogs.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/InterViews/glue.h ../include/IV-2_6/InterViews/filechooser.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/IV-2_6/InterViews/strbrowser.h ../include/IV-2_6/InterViews/adjuster.h ../include/InterViews/geometry.h ../include/IV-2_6/InterViews/frame.h ../include/Unidraw/dialogs.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/subject.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/border.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/IV-2_6/InterViews/message.h ../include/InterViews/_leave.h ../include/IV-2_6/InterViews/strchooser.h ../include/Unidraw/enter-scope.h ../include/IV-2_6/InterViews/dialog.h ../include/IV-2_6/InterViews/shape.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/IV-2_6/InterViews/button.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/IV-2_6/InterViews/filebrowser.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/box.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/IV-2_6/InterViews/scene.h ../include/InterViews/_names.h ../include/OS/os.h ../include/IV-2_6/InterViews/matcheditor.h ../include/InterViews/coord.h ../include/IV-2_6/InterViews/sensor.h ../include/IV-2_6/InterViews/streditor.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/scroller.h Unidraw/edit.lo : ../include/Unidraw/_undefs.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/IV-2_6/InterViews/filechooser.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/Commands/datas.h ../include/Unidraw/clipboard.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/Commands/data.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/Unidraw/dialogs.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/Unidraw/Graphic/grblock.h ../include/Unidraw/Commands/macro.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/IV-2_6/InterViews/strchooser.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/IV-2_6/InterViews/dialog.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/Commands/transforms.h ../include/InterViews/monoglyph.h ../include/Unidraw/umap.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/unidraw.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/uformat.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/selection.h ../include/IV-2_6/InterViews/scene.h ../include/Unidraw/Commands/edit.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/Unidraw/Components/connector.h Unidraw/editor.lo : ../include/Unidraw/_undefs.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/InterViews/style.h ../include/Unidraw/Components/grview.h ../include/InterViews/window.h ../include/Unidraw/Graphic/grblock.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/OS/list.h ../include/Unidraw/enter-scope.h ../include/Unidraw/keymap.h ../include/Unidraw/Components/component.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/Unidraw/umap.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/Unidraw/unidraw.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/uformat.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/selection.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h ../include/InterViews/target.h Unidraw/editorinfo.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/editorinfo.h ../include/Unidraw/umap.h ../include/InterViews/iv.h ../include/Unidraw/unidraw.h ../include/Unidraw/_defines.h ../include/Unidraw/uformat.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h Unidraw/ellipse.lo : ../include/Unidraw/Components/ellipse.h ../include/Unidraw/_undefs.h ../include/Unidraw/grid.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/Unidraw/manips.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/Graphic/ellipses.h ../include/Unidraw/clipboard.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/statevars.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/rubcurve.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/Unidraw/Commands/align.h ../include/Unidraw/Graphic/grblock.h ../include/Unidraw/Commands/macro.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/InterViews/rubband.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/InterViews/transformer.h ../include/Unidraw/statevar.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/Commands/transforms.h ../include/Unidraw/Components/psview.h ../include/InterViews/monoglyph.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/Unidraw/manip.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/Components/externview.h ../include/Unidraw/selection.h ../include/Unidraw/Commands/edit.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/InterViews/brush.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/Unidraw/Tools/tool.h Unidraw/ellipses.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/Graphic/ellipses.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/painter.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/InterViews/transformer.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/Unidraw/Graphic/util.h ../include/InterViews/coord.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/OS/memory.h Unidraw/externview.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Components/compview.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/Components/externview.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h Unidraw/font.lo : ../include/Unidraw/_undefs.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/statevars.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/statevar.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/monoglyph.h ../include/Unidraw/umap.h ../include/InterViews/iv.h ../include/Unidraw/unidraw.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/uformat.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/uarray.h ../include/Unidraw/Commands/font.h ../include/Unidraw/uhash.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h Unidraw/geomobjs.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/Unidraw/enter-scope.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/IV-2_6/InterViews/minmax.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/Unidraw/Graphic/util.h ../include/InterViews/coord.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/OS/memory.h Unidraw/globals.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h Unidraw/graphic.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/painter.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/InterViews/transformer.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/Unidraw/Graphic/util.h ../include/InterViews/coord.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/OS/memory.h Unidraw/grblock.lo : ../include/Unidraw/_undefs.h ../include/InterViews/input.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/font.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/geometry.h ../include/IV-look/button.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/painter.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/Unidraw/Graphic/grblock.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/IV-look/menu.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/IV-2_6/InterViews/shape.h ../include/IV-look/stepper.h ../include/InterViews/observe.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/IV-look/kit.h ../include/InterViews/canvas.h ../include/InterViews/monoglyph.h ../include/InterViews/action.h ../include/InterViews/pattern.h ../include/InterViews/iv.h ../include/InterViews/color.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/InterViews/adjust.h ../include/IV-2_6/InterViews/minmax.h ../include/IV-2_6/_leave.h ../include/IV-2_6/InterViews/scene.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/telltale.h ../include/InterViews/coord.h ../include/InterViews/bitmap.h ../include/InterViews/cursor.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/brush.h ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/perspective.h Unidraw/grcomp.lo : ../include/Unidraw/_undefs.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/Commands/datas.h ../include/Unidraw/clipboard.h ../include/Unidraw/ulist.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/Commands/data.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/Unidraw/Commands/align.h ../include/Unidraw/Graphic/grblock.h ../include/Unidraw/Commands/macro.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/InterViews/transformer.h ../include/Unidraw/Graphic/picture.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/Commands/transforms.h ../include/Unidraw/Components/csolver.h ../include/InterViews/monoglyph.h ../include/Unidraw/umap.h ../include/InterViews/pattern.h ../include/Unidraw/Commands/colorcmd.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/Commands/brushcmd.h ../include/Unidraw/Commands/patcmd.h ../include/Unidraw/unidraw.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/uformat.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/Commands/struct.h ../include/Unidraw/selection.h ../include/Unidraw/Commands/edit.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/creator.h ../include/Unidraw/viewer.h ../include/Unidraw/uarray.h ../include/Unidraw/Commands/font.h ../include/Unidraw/uhash.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/Unidraw/Components/connector.h Unidraw/grcomptool.lo : ../include/Unidraw/_undefs.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/Unidraw/Tools/grcomptool.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/grblock.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/monoglyph.h ../include/Unidraw/umap.h ../include/Unidraw/manip.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/Unidraw/unidraw.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/uformat.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/selection.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/Unidraw/Tools/tool.h Unidraw/grid.lo : ../include/Unidraw/_undefs.h ../include/Unidraw/grid.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/painter.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/OS/math.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/InterViews/transformer.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/canvas.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h Unidraw/grview.lo : ../include/Unidraw/_undefs.h ../include/Unidraw/grid.h ../include/Unidraw/manips.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/clipboard.h ../include/Unidraw/ulist.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/rubcurve.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/Unidraw/Commands/align.h ../include/IV-2_6/InterViews/rubrect.h ../include/Unidraw/Graphic/grblock.h ../include/Unidraw/Commands/macro.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/InterViews/rubband.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/InterViews/transformer.h ../include/Unidraw/Graphic/picture.h ../include/Unidraw/iterator.h ../include/Unidraw/Graphic/damage.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/Commands/transforms.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/Unidraw/manip.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/selection.h ../include/Unidraw/Components/gvupdater.h ../include/Unidraw/Commands/edit.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/InterViews/brush.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/Unidraw/Tools/tool.h ../include/Unidraw/Components/connector.h Unidraw/gvupdater.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/ulist.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Components/compview.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/InterViews/transformer.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/Components/gvupdater.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/uhash.h ../include/InterViews/brush.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h Unidraw/import.lo : ../include/Unidraw/_undefs.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/IV-look/dialogs.h ../include/Unidraw/Graphic/rasterrect.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/clipboard.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/Graphic/ustencil.h ../include/OS/string.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/InterViews/style.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/InterViews/window.h ../include/Unidraw/Graphic/grblock.h ../include/Unidraw/Commands/macro.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/Unidraw/Commands/import.h ../include/InterViews/tiff.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/InterViews/dialog.h ../include/Unidraw/Components/component.h ../include/IV-look/field.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/canvas.h ../include/Unidraw/Components/psview.h ../include/InterViews/monoglyph.h ../include/Unidraw/umap.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/Unidraw/Components/rastercomp.h ../include/InterViews/iv.h ../include/Unidraw/Components/stencilcomp.h ../include/TIFF/format.h ../include/InterViews/session.h ../include/Unidraw/unidraw.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/uformat.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/Components/externview.h ../include/InterViews/raster.h ../include/Unidraw/Commands/edit.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/InterViews/bitmap.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/IV-look/fchooser.h Unidraw/iterator.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h Unidraw/keymap.lo : ../include/Unidraw/_undefs.h ../include/Unidraw/uctrl.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/subject.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/IV-2_6/InterViews/control.h ../include/InterViews/enter-scope.h ../include/Unidraw/ctrlinfo.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/keymap.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/IV-2_6/_leave.h ../include/IV-2_6/InterViews/scene.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h Unidraw/kybd.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/Unidraw/enter-scope.h ../include/OS/_undefs.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/OS/os.h ../include/Unidraw/kybd.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h Unidraw/line.lo : ../include/Unidraw/_undefs.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/Unidraw/Graphic/lines.h ../include/Unidraw/manips.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/clipboard.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/statevars.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/rubcurve.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/Unidraw/Commands/align.h ../include/Unidraw/Graphic/grblock.h ../include/Unidraw/Commands/macro.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/InterViews/rubverts.h ../include/IV-2_6/InterViews/rubband.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/Unidraw/Components/vertices.h ../include/InterViews/enter-scope.h ../include/Unidraw/Components/line.h ../include/Unidraw/Graphic/verts.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/InterViews/transformer.h ../include/IV-2_6/InterViews/rubline.h ../include/Unidraw/statevar.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/Commands/transforms.h ../include/Unidraw/Components/psview.h ../include/InterViews/monoglyph.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/Unidraw/manip.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/Components/externview.h ../include/Unidraw/selection.h ../include/Unidraw/Commands/edit.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/InterViews/brush.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/Unidraw/Tools/tool.h Unidraw/lines.lo : ../include/Unidraw/_undefs.h ../include/Unidraw/Graphic/lines.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/painter.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/Unidraw/Graphic/verts.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/Unidraw/Graphic/util.h ../include/InterViews/coord.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/OS/memory.h Unidraw/link.lo : ../include/Unidraw/_undefs.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/Unidraw/Graphic/lines.h ../include/Unidraw/manips.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/clipboard.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/statevars.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/rubcurve.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/rubgroup.h ../include/Unidraw/Graphic/grblock.h ../include/Unidraw/Commands/macro.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/InterViews/rubband.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/Unidraw/Components/pin.h ../include/Unidraw/Graphic/verts.h ../include/InterViews/_leave.h ../include/Unidraw/Components/link.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/InterViews/transformer.h ../include/IV-2_6/InterViews/rubline.h ../include/Unidraw/Graphic/picture.h ../include/Unidraw/statevar.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/Commands/transforms.h ../include/Unidraw/Components/psview.h ../include/InterViews/monoglyph.h ../include/Unidraw/umap.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/Unidraw/manip.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/Unidraw/unidraw.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/uformat.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/Components/externview.h ../include/Unidraw/selection.h ../include/Unidraw/Commands/edit.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/Unidraw/Tools/tool.h ../include/Unidraw/Components/connector.h Unidraw/macro.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/Unidraw/ulist.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/OS/_defines.h ../include/Unidraw/Commands/macro.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/umap.h ../include/InterViews/iv.h ../include/Unidraw/unidraw.h ../include/Unidraw/_defines.h ../include/Unidraw/uformat.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h Unidraw/magnify.lo : ../include/Unidraw/_undefs.h ../include/Unidraw/manips.h ../include/Unidraw/Tools/magnify.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/rubrect.h ../include/Unidraw/Graphic/grblock.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/rubband.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/manip.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/Unidraw/Tools/tool.h ../include/IV-2_6/InterViews/perspective.h Unidraw/manip.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/OS/_undefs.h ../include/InterViews/iv.h ../include/Unidraw/manip.h ../include/Unidraw/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h Unidraw/manips.lo : ../include/Unidraw/_undefs.h ../include/Unidraw/manips.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/ulist.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/IV-2_6/InterViews/painter.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/Unidraw/Graphic/grblock.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/InterViews/rubverts.h ../include/IV-2_6/InterViews/rubband.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/textbuffer.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/InterViews/transformer.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/IV-2_6/InterViews/textdisplay.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/Unidraw/manip.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/selection.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/viewer.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/IV-2_6/InterViews/world.h ../include/Unidraw/Components/connector.h Unidraw/move.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/grblock.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/manip.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/selection.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/Unidraw/Tools/move.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/Unidraw/Tools/tool.h Unidraw/nop.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/OS/_defines.h ../include/Unidraw/Commands/nop.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/Unidraw/enter-scope.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h Unidraw/pad.lo : ../include/Unidraw/_undefs.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/Unidraw/manips.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/clipboard.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/statevars.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Components/pad.h ../include/IV-2_6/InterViews/painter.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/Unidraw/Commands/align.h ../include/IV-2_6/InterViews/rubgroup.h ../include/IV-2_6/InterViews/rubrect.h ../include/Unidraw/Graphic/grblock.h ../include/Unidraw/Commands/macro.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/InterViews/rubband.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/InterViews/transformer.h ../include/IV-2_6/InterViews/shape.h ../include/IV-2_6/InterViews/rubline.h ../include/Unidraw/statevar.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/Components/psview.h ../include/Unidraw/Components/csolver.h ../include/InterViews/monoglyph.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/Unidraw/manip.h ../include/InterViews/iv.h ../include/Unidraw/Components/slot.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/Unidraw/Components/cglue.h ../include/IV-2_6/_leave.h ../include/Unidraw/Components/externview.h ../include/Unidraw/selection.h ../include/Unidraw/Commands/edit.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/InterViews/brush.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/Unidraw/Tools/tool.h ../include/Unidraw/Components/connector.h Unidraw/patcmd.lo : ../include/Unidraw/_undefs.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/statevars.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/statevar.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/monoglyph.h ../include/Unidraw/umap.h ../include/InterViews/iv.h ../include/Unidraw/Commands/patcmd.h ../include/Unidraw/unidraw.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/uformat.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h Unidraw/path.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/Unidraw/ulist.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/OS/_undefs.h ../include/Unidraw/path.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/OS/memory.h Unidraw/picture.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/ulist.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/InterViews/transformer.h ../include/Unidraw/Graphic/picture.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h Unidraw/pin.lo : ../include/Unidraw/_undefs.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/Unidraw/Graphic/lines.h ../include/Unidraw/manips.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/clipboard.h ../include/Unidraw/ulist.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/statevars.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/rubcurve.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Components/pad.h ../include/IV-2_6/InterViews/painter.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/Unidraw/Commands/align.h ../include/IV-2_6/InterViews/rubgroup.h ../include/Unidraw/Graphic/grblock.h ../include/Unidraw/Commands/macro.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/InterViews/rubband.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/Unidraw/Components/pin.h ../include/Unidraw/Graphic/verts.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/InterViews/transformer.h ../include/IV-2_6/InterViews/shape.h ../include/IV-2_6/InterViews/rubline.h ../include/Unidraw/Graphic/picture.h ../include/Unidraw/statevar.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/Components/psview.h ../include/Unidraw/Components/csolver.h ../include/InterViews/monoglyph.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/Unidraw/manip.h ../include/InterViews/iv.h ../include/Unidraw/Components/slot.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/Unidraw/Components/cglue.h ../include/IV-2_6/_leave.h ../include/Unidraw/Components/externview.h ../include/Unidraw/selection.h ../include/Unidraw/Commands/edit.h ../include/InterViews/_names.h ../include/OS/os.h ../include/Unidraw/Graphic/util.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/InterViews/brush.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/Unidraw/Tools/tool.h ../include/Unidraw/Components/connector.h ../include/OS/memory.h Unidraw/polygon.lo : ../include/Unidraw/_undefs.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/Unidraw/manips.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/clipboard.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/statevars.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/Unidraw/Graphic/grblock.h ../include/Unidraw/Commands/macro.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/InterViews/rubverts.h ../include/IV-2_6/InterViews/rubband.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/Unidraw/Components/vertices.h ../include/InterViews/enter-scope.h ../include/Unidraw/Graphic/verts.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Graphic/polygons.h ../include/Unidraw/Components/component.h ../include/InterViews/transformer.h ../include/IV-2_6/InterViews/rubline.h ../include/Unidraw/statevar.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/Components/psview.h ../include/InterViews/monoglyph.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/Unidraw/manip.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/Components/externview.h ../include/Unidraw/Commands/edit.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/InterViews/brush.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/Unidraw/Components/polygon.h ../include/Unidraw/Tools/tool.h Unidraw/polygons.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/painter.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/Unidraw/Graphic/verts.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Graphic/polygons.h ../include/InterViews/transformer.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h Unidraw/pspaint.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/OS/_defines.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/session.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/world.h ../include/OS/memory.h Unidraw/psview.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/ulist.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Components/compview.h ../include/Unidraw/Components/psformat.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/InterViews/transformer.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/Components/psview.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/Components/externview.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/InterViews/brush.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h Unidraw/rastercomp.lo : ../include/Unidraw/_undefs.h ../include/Unidraw/Graphic/rasterrect.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/Components/compview.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/InterViews/transformer.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/Components/psview.h ../include/Unidraw/umap.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/Unidraw/Components/rastercomp.h ../include/InterViews/iv.h ../include/Unidraw/unidraw.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/uformat.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/Components/externview.h ../include/InterViews/raster.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h Unidraw/rasterrect.lo : ../include/Unidraw/_undefs.h ../include/Unidraw/Graphic/rasterrect.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/painter.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/InterViews/transformer.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/raster.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h Unidraw/rect.lo : ../include/Unidraw/_undefs.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/Unidraw/manips.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/clipboard.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/statevars.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/Unidraw/Components/rect.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/rubcurve.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/Unidraw/Commands/align.h ../include/IV-2_6/InterViews/rubgroup.h ../include/IV-2_6/InterViews/rubrect.h ../include/Unidraw/Graphic/grblock.h ../include/Unidraw/Commands/macro.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/InterViews/rubband.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/Unidraw/Components/vertices.h ../include/InterViews/enter-scope.h ../include/Unidraw/Graphic/verts.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Graphic/polygons.h ../include/Unidraw/Components/component.h ../include/InterViews/transformer.h ../include/IV-2_6/InterViews/rubline.h ../include/Unidraw/statevar.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/Commands/transforms.h ../include/Unidraw/Components/psview.h ../include/InterViews/monoglyph.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/Unidraw/manip.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/Components/externview.h ../include/Unidraw/selection.h ../include/Unidraw/Commands/edit.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/InterViews/brush.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/Unidraw/Components/polygon.h ../include/Unidraw/Tools/tool.h Unidraw/reshape.lo : ../include/Unidraw/_undefs.h ../include/Unidraw/Tools/reshape.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/grblock.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/manip.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/selection.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/Unidraw/Tools/tool.h Unidraw/rotate.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Tools/rotate.h ../include/Unidraw/Graphic/grblock.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/manip.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/selection.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/Unidraw/Tools/tool.h Unidraw/scale.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/grblock.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/manip.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/selection.h ../include/Unidraw/Tools/scale.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/Unidraw/Tools/tool.h Unidraw/select.lo : ../include/Unidraw/_undefs.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/Unidraw/manips.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/IV-2_6/InterViews/rubrect.h ../include/Unidraw/Graphic/grblock.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/rubband.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/monoglyph.h ../include/Unidraw/manip.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/Tools/select.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/selection.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/Unidraw/Tools/tool.h Unidraw/selection.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/ulist.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Components/compview.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/IV-2_6/InterViews/painter.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/InterViews/rubband.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Graphic/picture.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/selection.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h Unidraw/slot.lo : ../include/Unidraw/_undefs.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/Unidraw/Graphic/lines.h ../include/Unidraw/manips.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/clipboard.h ../include/Unidraw/ulist.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/statevars.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Components/pad.h ../include/IV-2_6/InterViews/painter.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/Unidraw/Commands/align.h ../include/IV-2_6/InterViews/rubgroup.h ../include/IV-2_6/InterViews/rubrect.h ../include/Unidraw/Graphic/grblock.h ../include/Unidraw/Commands/macro.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/InterViews/rubband.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/Unidraw/Graphic/verts.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/InterViews/transformer.h ../include/IV-2_6/InterViews/shape.h ../include/IV-2_6/InterViews/rubline.h ../include/Unidraw/statevar.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/Components/psview.h ../include/Unidraw/Components/csolver.h ../include/InterViews/monoglyph.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/Unidraw/manip.h ../include/InterViews/iv.h ../include/Unidraw/Components/slot.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/Unidraw/Components/cglue.h ../include/IV-2_6/_leave.h ../include/Unidraw/Components/externview.h ../include/Unidraw/selection.h ../include/Unidraw/Commands/edit.h ../include/InterViews/_names.h ../include/OS/os.h ../include/Unidraw/Graphic/util.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/InterViews/brush.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/Unidraw/Tools/tool.h ../include/Unidraw/Components/connector.h ../include/OS/memory.h Unidraw/spline.lo : ../include/Unidraw/_undefs.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/Unidraw/Graphic/lines.h ../include/Unidraw/manips.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/clipboard.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/statevars.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/rubcurve.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/Unidraw/Graphic/grblock.h ../include/Unidraw/Commands/macro.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/InterViews/rubverts.h ../include/IV-2_6/InterViews/rubband.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/Unidraw/Components/vertices.h ../include/InterViews/enter-scope.h ../include/Unidraw/Components/spline.h ../include/Unidraw/Graphic/verts.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/InterViews/transformer.h ../include/Unidraw/statevar.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/Components/psview.h ../include/InterViews/monoglyph.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/Unidraw/manip.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/Components/externview.h ../include/Unidraw/Commands/edit.h ../include/InterViews/_names.h ../include/OS/os.h ../include/Unidraw/Graphic/splines.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/InterViews/brush.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/Unidraw/Tools/tool.h Unidraw/splines.lo : ../include/Unidraw/_undefs.h ../include/Unidraw/Graphic/lines.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/painter.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/Unidraw/Graphic/verts.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/InterViews/transformer.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/Unidraw/Graphic/util.h ../include/Unidraw/Graphic/splines.h ../include/InterViews/coord.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/OS/memory.h Unidraw/statevar.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/Unidraw/ulist.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/Unidraw/stateview.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/statevar.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/umap.h ../include/InterViews/iv.h ../include/Unidraw/unidraw.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/uformat.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/IV-2_6/InterViews/scene.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h Unidraw/statevars.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/ulist.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/statevars.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/Unidraw/stateview.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/Unidraw/statevar.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/umap.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/unidraw.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/uformat.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/IV-2_6/InterViews/scene.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h Unidraw/stateview.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/Unidraw/stateview.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/statevar.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/IV-2_6/InterViews/scene.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h Unidraw/stateviews.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/statevars.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/painter.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/Unidraw/stateview.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/IV-2_6/InterViews/shape.h ../include/Unidraw/statevar.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/stateviews.h ../include/InterViews/canvas.h ../include/Unidraw/umap.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/unidraw.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/uformat.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/IV-2_6/InterViews/scene.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h Unidraw/stencilcomp.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/Graphic/ustencil.h ../include/Unidraw/Components/compview.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/InterViews/transformer.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/Components/psview.h ../include/Unidraw/umap.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/Components/stencilcomp.h ../include/Unidraw/unidraw.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/uformat.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/Components/externview.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/InterViews/bitmap.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h Unidraw/stretch.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/grblock.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/manip.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/selection.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/Unidraw/Tools/stretch.h ../include/Unidraw/Tools/tool.h Unidraw/struct.lo : ../include/Unidraw/_undefs.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/Commands/datas.h ../include/Unidraw/clipboard.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/Commands/data.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/Unidraw/Graphic/grblock.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/monoglyph.h ../include/Unidraw/umap.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/unidraw.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/uformat.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/Commands/struct.h ../include/Unidraw/selection.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h Unidraw/text.lo : ../include/Unidraw/_undefs.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/Unidraw/manips.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/Unidraw/Commands/datas.h ../include/Unidraw/clipboard.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Commands/data.h ../include/Unidraw/statevars.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/IV-2_6/InterViews/painter.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/Unidraw/Commands/align.h ../include/Unidraw/Graphic/grblock.h ../include/Unidraw/Commands/macro.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/textbuffer.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/InterViews/transformer.h ../include/Unidraw/Graphic/picture.h ../include/Unidraw/statevar.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/Components/psview.h ../include/InterViews/monoglyph.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/Unidraw/manip.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/Unidraw/Components/text.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/Components/externview.h ../include/Unidraw/selection.h ../include/Unidraw/Commands/edit.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/Unidraw/Commands/font.h ../include/InterViews/brush.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/Unidraw/Tools/tool.h ../include/Unidraw/Graphic/ulabel.h Unidraw/tool.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/Unidraw/ctrlinfo.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/umap.h ../include/InterViews/iv.h ../include/Unidraw/unidraw.h ../include/Unidraw/_defines.h ../include/Unidraw/uformat.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h ../include/Unidraw/Tools/tool.h Unidraw/transfn.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/Unidraw/transfn.h ../include/Unidraw/enter-scope.h ../include/Unidraw/statevar.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h Unidraw/transfns.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/Components/compview.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/Unidraw/transfn.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/Unidraw/statevar.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/transfns.h ../include/Unidraw/umap.h ../include/InterViews/iv.h ../include/Unidraw/unidraw.h ../include/Unidraw/_defines.h ../include/Unidraw/uformat.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/Unidraw/Components/connector.h Unidraw/transforms.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/Commands/transforms.h ../include/Unidraw/umap.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/Unidraw/uformat.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h Unidraw/uarray.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/OS/_defines.h ../include/OS/math.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/Unidraw/enter-scope.h ../include/OS/_undefs.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/OS/os.h ../include/Unidraw/uarray.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/OS/memory.h Unidraw/uctrl.lo : ../include/Unidraw/_undefs.h ../include/Unidraw/uctrl.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/subject.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/IV-2_6/InterViews/control.h ../include/InterViews/enter-scope.h ../include/Unidraw/ctrlinfo.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/Unidraw/Graphic/picture.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/IV-2_6/InterViews/button.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/IV-2_6/InterViews/scene.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/InterViews/brush.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h Unidraw/uctrls.lo : ../include/Unidraw/_undefs.h ../include/Unidraw/uctrl.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/subject.h ../include/IV-2_6/InterViews/painter.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/IV-2_6/InterViews/control.h ../include/InterViews/enter-scope.h ../include/Unidraw/Graphic/verts.h ../include/Unidraw/ctrlinfo.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Graphic/polygons.h ../include/IV-2_6/InterViews/shape.h ../include/Unidraw/Graphic/picture.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/InterViews/glyph.h ../include/Unidraw/uctrls.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/IV-2_6/InterViews/scene.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/IV-2_6/InterViews/sensor.h ../include/InterViews/brush.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/IV-2_6/InterViews/world.h ../include/Unidraw/Graphic/ulabel.h Unidraw/uhash.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/Unidraw/ulist.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/Unidraw/uhash.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/OS/memory.h Unidraw/ulabel.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/painter.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/InterViews/transformer.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/Unidraw/Graphic/ulabel.h Unidraw/ulist.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/Unidraw/ulist.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/OS/_undefs.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h Unidraw/umap.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_defines.h ../include/OS/_defines.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/Unidraw/enter-scope.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/umap.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/uarray.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h Unidraw/unidraw.lo : ../include/Unidraw/_undefs.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/Unidraw/ulist.h ../include/InterViews/_defines.h ../include/InterViews/_enter.h ../include/Unidraw/statevars.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/OS/_defines.h ../include/Unidraw/Components/grview.h ../include/InterViews/window.h ../include/Unidraw/Commands/macro.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/Unidraw/statevar.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/canvas.h ../include/Unidraw/Components/csolver.h ../include/InterViews/monoglyph.h ../include/Unidraw/umap.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/session.h ../include/Unidraw/unidraw.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/uformat.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/uarray.h ../include/Unidraw/uhash.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/Unidraw/catalog.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/IV-2_6/InterViews/world.h ../include/Unidraw/Components/connector.h Unidraw/upage.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/painter.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/Unidraw/upage.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h Unidraw/ustencil.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Graphic/ustencil.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/painter.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/InterViews/transformer.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/InterViews/bitmap.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h Unidraw/vertices.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/rubcurve.h ../include/Unidraw/Components/grview.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/Unidraw/Commands/align.h ../include/Unidraw/Graphic/grblock.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/InterViews/rubband.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/Unidraw/Components/vertices.h ../include/InterViews/enter-scope.h ../include/Unidraw/Graphic/verts.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/InterViews/transformer.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/Components/psview.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/Unidraw/Components/externview.h ../include/InterViews/_names.h ../include/OS/os.h ../include/Unidraw/Graphic/util.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/InterViews/brush.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/OS/memory.h Unidraw/verts.lo : ../include/Unidraw/_undefs.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/Unidraw/Graphic/verts.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/InterViews/iv.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/IV-2_6/InterViews/minmax.h ../include/IV-2_6/_leave.h ../include/InterViews/_names.h ../include/OS/os.h ../include/Unidraw/Graphic/util.h ../include/InterViews/coord.h ../include/InterViews/brush.h ../include/IV-2_6/InterViews/defs.h ../include/InterViews/_undefs.h ../include/OS/leave-scope.h ../include/OS/memory.h Unidraw/viewcmds.lo : ../include/Unidraw/_undefs.h ../include/Unidraw/grid.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/IV-2_6/InterViews/filechooser.h ../include/IV-2_6/_names.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/statevars.h ../include/Unidraw/Commands/catcmds.h ../include/InterViews/geometry.h ../include/Unidraw/Commands/viewcmds.h ../include/Unidraw/dialogs.h ../include/OS/_defines.h ../include/Unidraw/Graphic/grblock.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/InterViews/enter-scope.h ../include/InterViews/_leave.h ../include/IV-2_6/InterViews/strchooser.h ../include/Unidraw/enter-scope.h ../include/Unidraw/Components/component.h ../include/IV-2_6/InterViews/dialog.h ../include/Unidraw/statevar.h ../include/Unidraw/iterator.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/InterViews/monoglyph.h ../include/InterViews/iv.h ../include/Unidraw/unidraw.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/IV-2_6/InterViews/scene.h ../include/InterViews/_names.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/Unidraw/viewer.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h Unidraw/viewer.lo : ../include/Unidraw/_undefs.h ../include/Unidraw/grid.h ../include/InterViews/input.h ../include/Unidraw/editor.h ../include/Unidraw/manips.h ../include/Unidraw/uctrl.h ../include/IV-2_6/_names.h ../include/InterViews/font.h ../include/OS/enter-scope.h ../include/InterViews/_enter.h ../include/InterViews/_defines.h ../include/Unidraw/statevars.h ../include/Unidraw/Components/compview.h ../include/InterViews/geometry.h ../include/Unidraw/Graphic/geomobjs.h ../include/OS/_defines.h ../include/IV-2_6/InterViews/subject.h ../include/Unidraw/Components/grview.h ../include/IV-2_6/InterViews/painter.h ../include/Unidraw/Graphic/graphic.h ../include/Unidraw/Graphic/pspaint.h ../include/Unidraw/Graphic/grblock.h ../include/OS/math.h ../include/Unidraw/upage.h ../include/IV-2_6/InterViews/interactor.h ../include/IV-2_6/InterViews/paint.h ../include/IV-2_6/InterViews/rubband.h ../include/IV-2_6/_enter.h ../include/IV-2_6/InterViews/alignment.h ../include/IV-2_6/InterViews/control.h ../include/InterViews/enter-scope.h ../include/Unidraw/ctrlinfo.h ../include/InterViews/_leave.h ../include/Unidraw/enter-scope.h ../include/Unidraw/keymap.h ../include/Unidraw/Components/component.h ../include/InterViews/transformer.h ../include/IV-2_6/InterViews/shape.h ../include/Unidraw/Graphic/picture.h ../include/Unidraw/statevar.h ../include/Unidraw/iterator.h ../include/Unidraw/Graphic/damage.h ../include/OS/_undefs.h ../include/IV-2_6/InterViews/textstyle.h ../include/Unidraw/Commands/transforms.h ../include/IV-2_6/InterViews/textdisplay.h ../include/InterViews/monoglyph.h ../include/InterViews/pattern.h ../include/InterViews/color.h ../include/Unidraw/manip.h ../include/InterViews/iv.h ../include/InterViews/event.h ../include/InterViews/glyph.h ../include/Unidraw/_defines.h ../include/InterViews/resource.h ../include/Unidraw/Commands/command.h ../include/IV-2_6/InterViews/minmax.h ../include/Unidraw/globals.h ../include/IV-2_6/_leave.h ../include/IV-2_6/InterViews/scene.h ../include/Unidraw/selection.h ../include/InterViews/_names.h ../include/Unidraw/kybd.h ../include/OS/os.h ../include/InterViews/coord.h ../include/Unidraw/classes.h ../include/IV-2_6/InterViews/sensor.h ../include/Unidraw/viewer.h ../include/InterViews/brush.h ../include/InterViews/_undefs.h ../include/IV-2_6/InterViews/defs.h ../include/OS/leave-scope.h ../include/Unidraw/Components/grcomp.h ../include/Unidraw/Tools/tool.h ../include/IV-2_6/InterViews/perspective.h neuron-7.6.3/src/lib/OS/000077500000000000000000000000001340731477100147225ustar00rootroot00000000000000neuron-7.6.3/src/lib/OS/directory.cpp000066400000000000000000000511321340731477100174340ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #if carbon #undef MAC #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ // ======================================================================= // // 1.11 // 1999/08/11 19:13:36 // // Windows 3.1/NT InterViews Port // Copyright (c) 1993 Tim Prinzing // // Permission to use, copy, modify, distribute, and sell this software and // its documentation for any purpose is hereby granted without fee, provided // that (i) the above copyright notice and this permission notice appear in // all copies of the software and related documentation, and (ii) the name of // Tim Prinzing may not be used in any advertising or publicity relating to // the software without the specific, prior written permission of Tim Prinzing. // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL Tim Prinzing BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // // ======================================================================= /* 3/16/95 under borland 4.5 and win32s readdir, opendir work only on directories that contain files (opendir returns nil on a directory that contains only subdirectories and readdir returns only files (not subdirectories or ..) This is contrary to the borland documentation. Work around is to use WIN32_FIND_DATA */ #ifdef WIN32 #include // cygwin needs ctype to be included! #ifdef CYGWIN #include #endif #endif #include #include #include /* * BSD tends to have things in , System V uses . * So far as I can tell, POSIX went with . Ultrix * includes , which is silly because * needs . */ #if MAC #if !carbon #include #endif #include #endif #ifndef MAC #include #endif #ifdef HAVE_OSFCN_H #include #endif /* These lines copied out of the autoconfig documentation: */ #if HAVE_DIRENT_H # include # define NAMLEN(dirent) strlen((dirent)->d_name) #else # define dirent direct # define NAMLEN(dirent) (dirent)->d_namlen # if HAVE_SYS_NDIR_H # include # endif # if HAVE_SYS_DIR_H # include # endif # if HAVE_NDIR_H # include # endif #endif #if defined(WIN32) // cygwin has a real dirent -- no need to hack it! #ifdef CYGWIN #include #else #include #endif #include //#include "/nrn/src/winio/debug.h" #else #ifndef MAC #include #endif #endif /* WIN32 */ #if !defined (WIN32) && !defined(MAC) #include #endif #include #include #include #ifndef MAC #include #endif #if !defined (WIN32) && !defined (MAC) /* * These hide in mysterious places on various systems. * For now, it seems safest just to declare them explicitly. */ extern "C" { extern uid_t getuid(); extern void qsort( void*, size_t, size_t, int (*) (const void*, const void*) ); #ifdef __DECCXX extern struct passwd* getpwent(); extern struct passwd* getpwnam(const char*); extern struct passwd* getpwuid(uid_t); #endif } #endif /* WIN32 */ #ifndef S_ISDIR #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) #endif /* * Buffer size for internal path name computation. * The path stuff should really be reimplemented * with variable-length strings. */ static const int path_buffer_size = 1024 + 1; class DirectoryImpl; class DirectoryEntry { public: const String& name() const; void set_is_dir(DirectoryImpl*); bool is_dir() { return is_dir_;} private: friend class Directory; friend class DirectoryImpl; String* name_; bool is_dir_; }; inline const String& DirectoryEntry::name() const { return *name_; } class DirectoryImpl { private: friend class Directory; friend class DirectoryEntry; #ifdef MAC DirectoryImpl(String*); CInfoPBRec info_; #else #ifdef WIN32 DirectoryImpl(HANDLE, String*); HANDLE hwfd_; #else DirectoryImpl(DIR*, String*); DIR* dir_; #endif #endif ~DirectoryImpl(); String* name_; DirectoryEntry* entries_; int count_; int used_; bool filled_; static unsigned int overflows_; DirectoryImpl& filled(); void do_fill(); #if MAC static CopyString* mac_canonical(CopyString*); #endif static bool dot_slash(const char*); static bool dot_dot_slash(const char*); static const char* home(const char*); static const char* eliminate_dot(const char*); static bool collapsed_dot_dot_slash(char*, char*& start); static const char* eliminate_dot_dot(const char*); static const char* interpret_slash_slash(const char*); static const char* interpret_tilde(const char*); static const char* expand_tilde(const char*, int); static const char* real_path(const char*); static bool ifdir(const char*); }; unsigned int DirectoryImpl::overflows_ = 0; Directory::Directory() { impl_ = nil; } Directory::~Directory() { close(); delete impl_; } Directory* Directory::current() { return open("."); } Directory* Directory::open(const String& name) { #if MAC Directory* d = new Directory; CopyString* s1; if (name.length() == 0 || strcmp(name.string(), ".") == 0) { s1 = new CopyString(":"); }else{ if (name[name.length() - 1] == ':') { s1 = new CopyString(name); }else{ char buf[256]; sprintf(buf, "%s:", name.string()); s1 = new CopyString(buf); } } s1 = DirectoryImpl::mac_canonical(s1); d->impl_ = new DirectoryImpl(s1); CInfoPBRec& info = d->impl_->info_; char* c = (char*)&info; for (int i=0; i < sizeof(CInfoPBRec); ++i) { c[i] = 0; } info.dirInfo.ioCompletion = 0; info.dirInfo.ioFDirIndex = 0; info.dirInfo.ioVRefNum = 0; Str255 s; s[0] = strlen(d->impl_->name_->string()); strcpy((char*)&s[1], d->impl_->name_->string()); info.dirInfo.ioNamePtr = s; OSErr err = PBGetCatInfoSync(&info); if (err == noErr && (info.dirInfo.ioFlAttrib & 16 /*bit 4 */)) { return d; }else{ delete d; return nil; } #else String* s = canonical(name); int not_dir = 1; //DebugMessage("Directory::open name |%s|\n", name.string()); //DebugMessage("Directory::open s |%s|\n", s->string()); /* cast is to workaround bug in some opendir prototypes */ #ifdef WIN32 WIN32_FIND_DATA wfd; // HANDLE dir = FindFirstFile(s->string(), &wfd); HANDLE dir; dir = FindFirstFile(s->string(), &wfd); // WIN95 has trouble with the ./ directory if (dir == INVALID_HANDLE_VALUE) { // printf("couldn't open |%s|\n", s->string()); char buf[256]; sprintf(buf, "%s*", s->string()); dir = FindFirstFile(buf, &wfd); if (dir == INVALID_HANDLE_VALUE) { // printf("couldn't open |%s|\n", buf); }else{ not_dir = 0; // printf("successful |%s| %d |%s|\n", buf, // (wfd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)!=0, wfd.cFileName); } } if (dir == INVALID_HANDLE_VALUE) { // MessageBox(NULL, s->string(), "Directory::open failure", MB_OK); dir = 0; }else if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { FindClose(dir); dir = 0; } #else DIR* dir = opendir((char*)s->string()); #endif if (dir == nil && not_dir) { delete s; return nil; } Directory* d = new Directory; d->impl_ = new DirectoryImpl(dir, s); return d; #endif } void Directory::close() { DirectoryImpl& d = *impl_; #ifdef WIN32 if (d.hwfd_ != nil) { FindClose(d.hwfd_); d.hwfd_ = nil; } #endif #if defined(WIN32) || MAC if (d.entries_) { #else if (d.dir_ != nil) { closedir(d.dir_); d.dir_ = nil; #endif DirectoryEntry* end = &d.entries_[d.used_]; for (DirectoryEntry* e = &d.entries_[0]; e < end; e++) { delete e->name_; } delete [] d.entries_; d.entries_ = nil; } } const String* Directory::path() const { DirectoryImpl& d = *impl_; return d.name_; } int Directory::count() const { DirectoryImpl& d = impl_->filled(); return d.used_; } const String* Directory::name(int i) const { DirectoryImpl& d = impl_->filled(); if (i < 0 || i >= d.used_) { /* raise exception -- out of range */ return nil; } return d.entries_[i].name_; } int Directory::index(const String& name) const { NullTerminatedString ns(name); const char* s = ns.string(); DirectoryImpl& d = impl_->filled(); int i = 0, j = d.used_ - 1; while (i <= j) { int k = (i + j) / 2; int cmp = strcmp(s, d.entries_[k].name_->string()); if (cmp == 0) { return k; } if (cmp > 0) { i = k + 1; } else { j = k - 1; } } return -1; } bool Directory::is_directory(int i) const { DirectoryImpl& d = impl_->filled(); if (i < 0 || i >= d.used_) { /* raise exception -- out of range */ return false; } DirectoryEntry& e = d.entries_[i]; return e.is_dir_; } void DirectoryEntry::set_is_dir(DirectoryImpl* d) { #if MAC #else struct stat* s = new (struct stat); char* tmp = new char[d->name_->length() + name_->length() + 2]; #ifdef WIN32 sprintf(tmp, "%s%s", d->name_->string(), name_->string()); #else sprintf(tmp, "%s/%s", d->name_->string(), name_->string()); #endif int i = stat(tmp, s); delete [] tmp; if (i != 0) { is_dir_ = false; }else{ is_dir_ = S_ISDIR(s->st_mode); } delete s; #endif } inline bool DirectoryImpl::dot_slash(const char* path) { return path[0] == '.' && (path[1] == '/' || path[1] == '\0'); } inline bool DirectoryImpl::dot_dot_slash(const char* path) { return (path[0] == '.' && path[1] == '.' && (path[2] == '/' || path[2] == '\0') ); } String* Directory::canonical(const String& name) { #ifdef MAC return new CopyString(name); #else NullTerminatedString ns(name); const char* path = ns.string(); #ifdef WIN32 { char* cp; for (cp = (char*)path; *cp; ++cp) { if (*cp == '\\') { *cp = '/'; } } } #endif static char newpath[path_buffer_size]; const char* s = DirectoryImpl::interpret_slash_slash(path); s = DirectoryImpl::eliminate_dot(s); s = DirectoryImpl::eliminate_dot_dot(s); s = DirectoryImpl::interpret_tilde(s); if (s[0] == '\0' || strcmp(s, ".") == 0) { sprintf(newpath, "./"); #ifndef WIN32 } else if (!DirectoryImpl::dot_slash(s) && !DirectoryImpl::dot_dot_slash(s) && s[0] != '/' ) { sprintf(newpath, "./%s", s); #endif } else if ((DirectoryImpl::ifdir(s) && s[strlen(s) - 1] != '/') || s[strlen(s) -1] == ':' ) { sprintf(newpath, "%s/", s); } else { sprintf(newpath, "%s", s); } return new CopyString(newpath); #endif } #if MAC CopyString* DirectoryImpl::mac_canonical(CopyString* name) { //replace :name:: with : // just enough to work most of the time, ie at end CopyString* s = name; CopyString& nm = *name; int n = name->length(); if (n > 3 && nm[--n] == ':' && nm[--n] == ':' && nm[--n] != ':') { while (--n >= 0 && nm[n] != ':') { ; } if (n >= 0) { s = new CopyString(nm.left(n+1)); }else{ s = new CopyString(":"); } delete name; } return s; } #endif static bool s_eq_p(const char* s, const char* p) { #if defined(WIN32) || MAC return toupper(*s) == toupper(*p); #else return *s == *p; #endif } bool Directory::match(const String& name, const String& pattern) { const char* s = name.string(); const char* end_s = s + name.length(); const char* p = pattern.string(); const char* end_p = p + pattern.length(); #if 0 for (; p < end_p; p++, s++) { if (*p == '*') { const char* pp = p + 1; if (pp == end_p) { return true; } for (; s < end_s && *s != *pp; s++); p = pp; } else if (s >= end_s || *p != *s) { return false; } } return s == end_s; #else // ro2m: re-written so that it actually works.. const char* prev_p = NULL; const char* prev_s = NULL; while((p < end_p) && (s < end_s)) { if (*p == '*') { const char* pp = p + 1; if (pp == end_p) /* if last one is a star, must be ok! */ return true; while((s < end_s) && (!s_eq_p(s, pp))) s++; /* skip to matching s */ if(s == end_s) return false; /* didn't get it */ p = pp; prev_p = p; /* if we get stuck, go back here */ prev_s = s + 1; } if(!s_eq_p(p, s)) { if(prev_p == NULL) return false; p = prev_p; s = prev_s; while((s < end_s) && (!s_eq_p(s, p))) s++; /* skip to matching s */ if(s == end_s) return false; /* didn't get it */ prev_s = s + 1; } p++; s++; if(s == end_s) { if((p == end_p) || (*p == '*')) return true; return false; } } return false; #endif } /** class DirectoryImpl **/ #if MAC DirectoryImpl::DirectoryImpl(String* name) { #else #ifdef WIN32 DirectoryImpl::DirectoryImpl(HANDLE d, String* name) { hwfd_ = d; #else DirectoryImpl::DirectoryImpl(DIR* d, String* name) { dir_ = d; #endif #endif entries_ = nil; count_ = 50*overflows_; entries_ = new DirectoryEntry[count_]; used_ = 0; filled_ = false; name_ = name; } DirectoryImpl::~DirectoryImpl() { delete name_; } DirectoryImpl& DirectoryImpl::filled() { if (!filled_) { do_fill(); filled_ = true; } return *this; } // directories in alpha order then files static int compare_entries(const void* k1, const void* k2) { DirectoryEntry* e1 = (DirectoryEntry*)k1; DirectoryEntry* e2 = (DirectoryEntry*)k2; if (e1->is_dir() != e2->is_dir()) { return e1->is_dir() ? -1 : 1; } return strcmp(e1->name().string(), e2->name().string()); } #if MAC void DirectoryImpl::do_fill() { int i; DirInfo& dibase = info_.dirInfo; CInfoPBRec info; char* c = (char*)&info; for (int i=0; i < sizeof(CInfoPBRec); ++i) { c[i] = 0; } DirInfo& di = info.dirInfo; int cnt = dibase.ioDrNmFls; int dirid = dibase.ioDrDirID; int volid = dibase.ioVRefNum; Str255 s; di.ioNamePtr = s; for (i=0; i <= cnt; ++i) { if (i == 0) { if (1) { s[0] = 1; s[1] = ':'; }else{ continue; } }else{ di.ioDrDirID = dirid; di.ioVRefNum = volid; di.ioFDirIndex = i; di.ioACUser = 0; OSErr err = PBGetCatInfoSync(&info); if (err != noErr) { printf("error in DirectoryImpl::do_fill\n"); } } s[s[0] + 1] = '\0'; if (used_ >= count_) { ++overflows_; int new_count = count_ + 50*overflows_; DirectoryEntry* new_entries = new DirectoryEntry[new_count]; Memory::copy( entries_, new_entries, count_ * sizeof(DirectoryEntry) ); delete [] entries_; entries_ = new_entries; count_ = new_count; } DirectoryEntry& e = entries_[used_]; e.name_ = new CopyString((char*)&s[1]); //printf("%d %s\n", di.ioFDirIndex, e.name_->string()); if (i == 0){ // the parent directory e.is_dir_ = true; }else{ e.is_dir_ = (di.ioFlAttrib & 16) != 0; } ++used_; } qsort(entries_, used_, sizeof(DirectoryEntry), &compare_entries); } #else #ifdef WIN32 void DirectoryImpl::do_fill() { WIN32_FIND_DATA fd; HANDLE h; char * buf = new char[strlen(name_->string()) + 3]; sprintf(buf, "%s%s", name_->string(), "*"); for (h = FindFirstFile(buf, &fd); FindNextFile(h, &fd);) { if (used_ >= count_) { ++overflows_; int new_count = count_ + 50*overflows_; DirectoryEntry* new_entries = new DirectoryEntry[new_count]; Memory::copy( entries_, new_entries, count_ * sizeof(DirectoryEntry) ); delete [] entries_; entries_ = new_entries; count_ = new_count; } DirectoryEntry& e = entries_[used_]; e.name_ = new CopyString(fd.cFileName); e.set_is_dir(this); ++used_; } delete [] buf; FindClose(h); qsort(entries_, used_, sizeof(DirectoryEntry), &compare_entries); } #else void DirectoryImpl::do_fill() { //#ifdef apollo // Not needed any more because on apollo we do #define dirent direct. // for (struct direct* d = readdir(dir_); d != nil; d = readdir(dir_)) { //#else for (struct dirent* d = readdir(dir_); d != nil; d = readdir(dir_)) { //#endif if (used_ >= count_) { ++overflows_; int new_count = count_ + 50*overflows_; DirectoryEntry* new_entries = new DirectoryEntry[new_count]; Memory::copy( entries_, new_entries, count_ * sizeof(DirectoryEntry) ); delete [] entries_; entries_ = new_entries; count_ = new_count; } DirectoryEntry& e = entries_[used_]; e.name_ = new CopyString(d->d_name); e.set_is_dir(this); ++used_; } qsort(entries_, used_, sizeof(DirectoryEntry), &compare_entries); } #endif #endif const char* DirectoryImpl::home(const char* name) { #if defined(WIN32) || MAC return nil; #else struct passwd* pw; if (name == nil) { pw = getpwuid(getuid()); } else { pw = getpwnam(name); } return (pw == nil) ? nil : pw->pw_dir; #endif } const char* DirectoryImpl::eliminate_dot(const char* path) { static char newpath[path_buffer_size]; const char* src; char* dest = newpath; const char* end = &path[strlen(path)]; for (src = path; src < end; src++) { if (dot_slash(src) && dest > newpath && *(dest - 1) == '/') { src++; } else { *dest++ = *src; } } *dest = '\0'; return newpath; } bool DirectoryImpl::collapsed_dot_dot_slash(char* path, char*& start) { if (path == start || *(start - 1) != '/') { return false; } if (path == start - 1 && *path == '/') { return true; } if (path == start - 2) { /* doesn't handle double-slash correctly */ start = path; return *start != '.'; } if (path < start - 2 && !dot_dot_slash(start - 3)) { for (start -= 2; path <= start; --start) { if (*start == '/') { ++start; return true; } } start = path; return true; } return false; } const char* DirectoryImpl::eliminate_dot_dot(const char* path) { static char newpath[path_buffer_size]; const char* src; char* dest = newpath; const char* end = &path[strlen(path)]; for (src = path; src < end; src++) { if (dot_dot_slash(src) && collapsed_dot_dot_slash(newpath, dest)) { src += 2; } else { *dest++ = *src; } } *dest = '\0'; return newpath; } const char* DirectoryImpl::interpret_slash_slash(const char* path) { for (int i = strlen(path) - 1; i > 0; --i) { if (path[i] == '/' && path[i - 1] == '/') { return &path[i]; } } return path; } const char* DirectoryImpl::interpret_tilde(const char* path) { static char realpath[path_buffer_size]; const char* beg = strrchr(path, '~'); bool valid = (beg != nil && (beg == path || *(beg - 1) == '/')); if (valid) { const char* end = strchr(beg, '/'); int length = (end == nil) ? strlen(beg) : (end - beg); const char* expanded = expand_tilde(beg, length); if (expanded == nil) { valid = false; } else { strcpy(realpath, expanded); if (end != nil) { strcat(realpath, end); } } } return valid ? realpath : path; } const char* DirectoryImpl::expand_tilde(const char* tilde, int length) { const char* name = nil; if (length > 1) { static char buf[path_buffer_size]; strncpy(buf, tilde + 1, length - 1); buf[length - 1] = '\0'; name = buf; } return home(name); } const char* DirectoryImpl::real_path(const char* path) { const char* realpath; if (*path == '\0') { realpath = "./"; } else { realpath = interpret_tilde(interpret_slash_slash(path)); } return realpath; } bool DirectoryImpl::ifdir(const char* path) { #if MAC Directory* dir = Directory::open(path); if (dir) { delete dir; return true; } return false; #else struct stat st; return stat((char*) path, &st) == 0 && S_ISDIR(st.st_mode); #endif } neuron-7.6.3/src/lib/OS/dirent.cpp000077500000000000000000000114151340731477100167200ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif // ===================================================================== // dirent.c // // An implementation of the BSD directory routines for MS-Windows NT. // With the alternative filesystems available under NT, filenames can // be up to 256 character long. The berkeley routines have similar // counterparts in the WIN32 library. // // // 1.1 // 1997/03/28 22:04:30 // // Windows 3.1/NT InterViews Port // Copyright (c) 1993 Tim Prinzing // // Permission to use, copy, modify, distribute, and sell this software and // its documentation for any purpose is hereby granted without fee, provided // that (i) the above copyright notice and this permission notice appear in // all copies of the software and related documentation, and (ii) the name of // Tim Prinzing may not be used in any advertising or publicity relating to // the software without the specific, prior written permission of Tim Prinzing. // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL Tim Prinzing BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // // ================================================================== */ #include #include #include // ------------------------------------------------------------------------ // open the directory named by name, and associate a directory stream with // it. Opendir returns a pointer to be used to identify the directory // stream in subsequent operations. The pointer NULL is returned if "name" // cannot be accessed, is not a directory, or store cannot be allocated. // ------------------------------------------------------------------------ DIR* opendir(const char* name) { char buff[1024]; DIR* retval = (DIR*) malloc(sizeof(DIR)); sprintf(buff,"%s/*", name); if (retval) { retval->offs = 0; retval->srchHandle = findfirst(buff, &(retval->data), 0); if (retval->srchHandle == -1) { free(retval); return 0; } return retval; } return 0; } // ------------------------------------------------------------------------ // Closes the directory stream, and frees the DIR structure. // ------------------------------------------------------------------------ void closedir(DIR* dirp) { if (dirp) { // findclose(dirp->srchHandle); free(dirp); } } // ------------------------------------------------------------------------ // returns a pointer to the next active entry. NULL is returned upon // reaching the end of the directory, or upon detecting an invalid entry. // // The lifetime of the returned pointer should not be counted upon. This // is different from typical unix implementations, so applications that // made assumptions about the implementation will break!!! // ------------------------------------------------------------------------ struct dirent* readdir(DIR* dirp) { if (dirp) { if (dirp->offs != 0) { // The first entry was already fetched when an attempt was // made to open the directory. In this case we simply return // it, otherwise we need to try and fetch the next entry. #if defined(WIN32) && defined (__MWERKS__) if (findnext(dirp->srchHandle, &(dirp->data)) == -1) #else if (findnext(&(dirp->data)) == -1) #endif return 0; } dirp->offs += 1; dirp->conversion.d_namlen = strlen(dirp->data.ff_name); strcpy(dirp->conversion.d_name, dirp->data.ff_name); return &(dirp->conversion); } return 0; } // ------------------------------------------------------------------------ // Sets the position of the next readdir() operation on the directory // stream. The new position reverts to the one associated with the value // returned by a telldir() operation when fed to this routine (ie this is // a random access function used to revisit a previous location). // // Since the NT functions only move forward using an existing handle, we // have to close the existing and restart the operation. // ------------------------------------------------------------------------ void seekdir(DIR* dirp, long off) { // fprintf(stderr,"seekdir() - TBD\n"); printf("seekdir() - TBD\n"); } // ------------------------------------------------------------------------ // report the current relative position from the start of the directory. // ------------------------------------------------------------------------ long telldir(DIR* dirp) { if (dirp) return dirp->offs; else return 0; } neuron-7.6.3/src/lib/OS/file.cpp000077500000000000000000000163001340731477100163500ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #if carbon #undef MAC #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ // ======================================================================= // // 1.5 // 1999/07/05 15:34:58 // // Windows 3.1/NT InterViews Port // Copyright (c) 1993 Tim Prinzing // // Permission to use, copy, modify, distribute, and sell this software and // its documentation for any purpose is hereby granted without fee, provided // that (i) the above copyright notice and this permission notice appear in // all copies of the software and related documentation, and (ii) the name of // Tim Prinzing may not be used in any advertising or publicity relating to // the software without the specific, prior written permission of Tim Prinzing. // // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. // // IN NO EVENT SHALL Tim Prinzing BE LIABLE FOR ANY SPECIAL, INCIDENTAL, // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // // ======================================================================= #if defined(CYGWIN) #include static int myclose(int fd) { return close(fd); } static ssize_t myread(int fd, void* buf, size_t count) { return read(fd, buf, count); } #endif #include #include #include #include #include #include #ifndef MAC #include #endif #ifdef HAVE_SYS_MMAN_H extern "C" { #include } #endif #ifdef WIN16 #define WIN32 #endif #ifdef WIN32 #include #endif #if !defined(__GNUC__) || !defined (WIN32) && !defined (MAC) /* no standard place for these */ // Yes there is. Posix says read and close are in unistd.h. #ifdef HAVE_UNISTD_H #include #else extern "C" { // These are the POSIX definitions. Hopefully they won't conflict. extern int close(int); extern int read(int, void*, unsigned int); } #endif //#if defined(SGI) //#endif //#if defined(sun) && !defined(__SYSENT_H) // extern int read(int, void*, unsigned int); //#endif //#if defined(AIXV3) // extern int read(int, char*, unsigned int); //#endif //#if defined(apollo) // extern long read(int, void*, unsigned int); //#endif //#if defined(__DECCXX) // extern int read(int, void*, unsigned int); //#endif //} #endif /* WIN32 */ class FileInfo { #ifndef MAC public: CopyString* name_; int fd_; char* map_; struct stat info_; off_t pos_; char* buf_; unsigned int limit_; FileInfo(CopyString*, int fd); #endif }; #ifndef MAC FileInfo::FileInfo(CopyString* s, int fd) { name_ = s; fd_ = fd; pos_ = 0; limit_ = 0; map_ = nil; buf_ = nil; } #endif File::File(FileInfo* i) { assert(i != nil); rep_ = i; } File::~File() { close(); #ifndef MAC delete rep_->name_; delete rep_; #endif } const String* File::name() const { #ifndef MAC return rep_->name_; #else return nil; #endif } long File::length() const { #ifndef MAC return rep_->info_.st_size; #else return 0; #endif } void File::close() { #ifndef MAC FileInfo* i = rep_; if (i->fd_ >= 0) { if (i->map_ != nil) { #ifdef HAVE_SYS_MMAN_H // #if defined(SGI) || defined(__alpha) munmap(i->map_, int(i->info_.st_size)); #endif } if (i->buf_ != nil) { delete [] i->buf_; } #if defined(CYGWIN) myclose(i->fd_); #elif defined(WIN32) _close(i->fd_); #else ::close(i->fd_); #endif i->fd_ = -1; } #endif } void File::limit(unsigned int buffersize) { #ifndef MAC rep_->limit_ = buffersize; #endif } FileInfo* File::rep() const { #ifndef MAC return rep_; #else return nil; #endif } /* class InputFile */ InputFile::InputFile(FileInfo* i) : File(i) { } InputFile::~InputFile() { } InputFile* InputFile::open(const String& name) { CopyString* s = new CopyString(name); #ifndef MAC #if defined(WIN32) && !defined(__MWERKS__) && !defined(CYGWIN) int fd = _open((char*)s->string(), O_RDONLY); #else /* cast to workaround DEC C++ prototype bug */ int fd = ::open((char*)s->string(), O_RDONLY); #endif if (fd < 0) { delete s; return nil; } FileInfo* i = new FileInfo(s, fd); if (fstat(fd, &i->info_) < 0) { delete s; delete i; return nil; } return new InputFile(i); #else return nil; #endif } int InputFile::read(const char*& start) { #ifndef MAC FileInfo* i = rep(); int len = (int)(i->info_.st_size); if (i->pos_ >= len) { return 0; } if (i->limit_ != 0 && len > i->limit_) { len = (int)(i->limit_); } #if HAVE_SYS_MMAN_H // #if defined(SGI) || defined(__alpha) i->map_ = (char*)mmap(0, len, PROT_READ, MAP_PRIVATE, i->fd_, i->pos_); if ((long)(i->map_) == -1) { return -1; } start = i->map_; #else if (i->buf_ == nil) { i->buf_ = new char[len]; } start = i->buf_; #if defined(CYGWIN) len = myread(i->fd_, i->buf_, len); #elif defined(WIN32) len = _read(i->fd_, i->buf_, len); #else len = ::read(i->fd_, i->buf_, len); #endif /* WIN32 */ #endif i->pos_ += len; return len; #else return 0; #endif } /* class StdInput */ #if !MAC StdInput::StdInput() : InputFile(new FileInfo(new CopyString("-stdin"), 0)) { } #endif StdInput::~StdInput() { } long StdInput::length() const { return -1; } int StdInput::read(const char*& start) { #ifndef MAC FileInfo* i = rep(); if (i->buf_ == nil) { if (i->limit_ == 0) { i->limit_ = BUFSIZ; } i->buf_ = new char[i->limit_]; } #if defined(CYGWIN) int nbytes = myread(i->fd_, (char*)i->buf_, i->limit_); #elif defined(WIN32) int nbytes = _read(i->fd_, (char*)i->buf_, i->limit_); #else int nbytes = ::read(i->fd_, (char*)i->buf_, i->limit_); #endif /* WIN32 */ if (nbytes > 0) { start = (const char*)(i->buf_); } return nbytes; #else return 0; #endif } neuron-7.6.3/src/lib/OS/host.cpp000077500000000000000000000026731340731477100164160ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include char Host::name_[100]; const char* Host::name() { if (name_[0] == '\0') { // gethostname(name_, sizeof(name_)); } return name_; } neuron-7.6.3/src/lib/OS/listimpl.cpp000077500000000000000000000042241340731477100172700ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Support routines for lists. */ #include #include #include implementList(__AnyPtrList,__AnyPtr) static long ListImpl_best_new_sizes[] = { 48, 112, 240, 496, 1008, 2032, 4080, 8176, 16368, 32752, 65520, 131056, 262128, 524272, 1048560, 2097136, 4194288, 8388592, 16777200, 33554416, 67108848, 134217712, 268435440, 536870896, 1073741808, 2147483632 }; long ListImpl_best_new_count(long count, unsigned int size, unsigned int m) { for (int i = 0; i < sizeof(ListImpl_best_new_sizes)/sizeof(long); i++) { if (count * size < ListImpl_best_new_sizes[i]) { return ListImpl_best_new_sizes[i] / size; } } return count*m; } void ListImpl_range_error(long i) { #if defined(WIN32) || MAC printf("internal error: list index %d out of range\n", i); #else fprintf(stderr, "internal error: list index %ld out of range\n", i); #endif abort(); } neuron-7.6.3/src/lib/OS/math.cpp000077500000000000000000000032051340731477100163620ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include /* would that these lived in a standard place ... */ #if defined(IVOS_FABS) #define myfabs IVOS_FABS #else extern "C" { extern int abs(int); extern double fabs(double); } #define myfabs ::fabs #endif int Math::abs(int x) { return ::abs(x); } long Math::abs(long x) { return x >= 0 ? x : -x; } double Math::abs(double x) { return myfabs(x); } neuron-7.6.3/src/lib/OS/memory.cpp000077500000000000000000000036141340731477100167450ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #if defined(WIN32) || MAC #define STDC_HEADERS 1 #else #include #endif #include void Memory::copy(const void* from, void* to, unsigned int nbytes) { #if MAC BlockMove(from, to, nbytes); #elif defined(STDC_HEADERS) // ANSI C memmove and memset: memmove(to, from, size_t(nbytes)); #elif defined(HAVE_BCOPY) bcopy(from, to, nbytes); #else #error "Neither bcopy nor mmove is defined." #endif } int Memory::compare(const void* b1, const void* b2, unsigned int nbytes) { return memcmp(b1, b2, nbytes) != 0; } void Memory::zero(void* b, unsigned int nbytes) { memset(b, 0, size_t(nbytes)); } neuron-7.6.3/src/lib/OS/string.cpp000066400000000000000000000223471340731477100167440ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include #include /* * Just to be sure ... */ /* fails on mac osx extern "C" { #if !MAC #ifndef tolower extern int tolower(int); #endif #ifndef toupper extern int toupper(int); #endif #endif extern long int strtol(const char*, char**, int); extern double strtod(const char*, char**); } */ String::String() { data_ = nil; length_ = 0; } String::String(const char* s) { data_ = s; length_ = strlen(s); } String::String(const char* s, int n) { data_ = s; length_ = n; } String::String(const String& s) { data_ = s.data_; length_ = s.length_; } String::~String() { } unsigned long String::hash() const { const char* p; unsigned long v = 0; if (length_ == -1) { for (p = data_; *p != '\0'; p++) { v = (v << 1) ^ (*p); } String* s = (String*)this; s->length_ = p - data_; } else { const char* q = &data_[length_]; for (p = data_; p < q; p++) { v = (v << 1) ^ (*p); } } unsigned long t = v >> 10; t ^= (t >> 10); return v ^ t; } String& String::operator =(const String& s) { data_ = s.data_; length_ = s.length_; return *this; } String& String::operator =(const char* s) { data_ = s; length_ = strlen(s); return *this; } bool String::operator ==(const String& s) const { return (length_ == s.length_) && (strncmp(data_, s.data_, length_) == 0); } bool String::operator ==(const char* s) const { return (strncmp(data_, s, length_) == 0) && (s[length_] == '\0'); } bool String::operator !=(const String& s) const { return (length_ != s.length_) || (strncmp(data_, s.data_, length_) != 0); } bool String::operator !=(const char* s) const { return (strncmp(data_, s, length_) != 0) || (s[length_] != '\0'); } bool String::operator >(const String& s) const { return strncmp(data_, s.data_, length_) > 0; } bool String::operator >(const char* s) const { return strncmp(data_, s, length_) > 0; } bool String::operator >=(const String& s) const { return strncmp(data_, s.data_, length_) >= 0; } bool String::operator >=(const char* s) const { return strncmp(data_, s, length_) >= 0; } bool String::operator <(const String& s) const { return strncmp(data_, s.data_, length_) < 0; } bool String::operator <(const char* s) const { return strncmp(data_, s, length_) < 0; } bool String::operator <=(const String& s) const { return strncmp(data_, s.data_, length_) <= 0; } bool String::operator <=(const char* s) const { return strncmp(data_, s, length_) <= 0; } bool String::case_insensitive_equal(const String& s) const { if (length() != s.length()) { return false; } const char* p = string(); const char* p2 = s.string(); const char* q = p + length(); for (; p < q; p++, p2++) { int c1 = *p; int c2 = *p2; if (c1 != c2 && tolower(c1) != tolower(c2)) { return false; } } return true; } bool String::case_insensitive_equal(const char* s) const { return case_insensitive_equal(String(s)); } /* * A negative value for start initializes the position at the end * of the string before indexing. Any negative length makes * the substring extend to the end of the string. */ String String::substr(int start, int length) const { if (start >= length_ || start < -length_) { /* should raise exception */ return String(""); } int pos = (start >= 0) ? start : (length_ + start); if (pos + length > length_) { /* should raise exception */ return String(""); } int len = (length >= 0) ? length : (length_ - pos); return String(data_ + pos, len); } void String::set_to_substr(int start, int length) { if (start > length_ || start < -length_) { /* should raise exception */ return; } int pos = (start >= 0) ? start : (length_ + start); if (pos + length > length_) { /* should raise exception */ return; } int len = (length >= 0) ? length : (length_ - pos); data_ += pos; length_ = len; } bool String::null_terminated() const { return false; } void String::set_value(const char* s) { data_ = s; length_ = strlen(s); } void String::set_value(const char* s, int len) { data_ = s; length_ = len; } /* * A negative value for start initializes the position to the end * of the string before indexing and searches right-to-left. */ int String::search(int start, u_char c) const { if (start >= length_ || start < -length_) { /* should raise exception */ return -1; } if (start >= 0) { const char* end = data_ + length_; for (const char* p = data_ + start; p < end; p++) { if (*p == c) { return p - data_; } } } else { for (const char* p = data_ + length_ + start; p >= data_; p--) { if (*p == c) { return p - data_; } } } return -1; } /* * Convert a string to binary value. */ bool String::convert(int& value) const { NullTerminatedString s(*this); const char* str = s.string(); char* ptr; value = (int)strtol(str, &ptr, 0); return ptr != str; } bool String::convert(long& value) const { NullTerminatedString s(*this); const char* str = s.string(); char* ptr; value = strtol(str, &ptr, 0); return ptr != str; } bool String::convert(float& value) const { NullTerminatedString s(*this); const char* str = s.string(); char* ptr; value = (float)strtod(str, &ptr); return ptr != str; } bool String::convert(double& value) const { NullTerminatedString s(*this); const char* str = s.string(); char* ptr; value = strtod(str, &ptr); return ptr != str; } /* class CopyString */ CopyString::CopyString() : String() { } CopyString::CopyString(const char* s) : String() { set_value(s); } CopyString::CopyString(const char* s, int length) : String() { set_value(s, length); } CopyString::CopyString(const String& s) : String() { set_value(s.string(), s.length()); } CopyString::CopyString(const CopyString& s) : String() { set_value(s.string(), s.length()); } CopyString::~CopyString() { strfree(); } String& CopyString::operator =(const CopyString& s) { strfree(); set_value(s.string(), s.length()); return *this; } String& CopyString::operator =(const String& s) { strfree(); set_value(s.string(), s.length()); return *this; } String& CopyString::operator =(const char* s) { strfree(); set_value(s); return *this; } bool CopyString::null_terminated() const { return true; } void CopyString::set_value(const char* s) { set_value(s, strlen(s)); } /* * Guarantee null-terminated string for compatibility with printf et al. */ void CopyString::set_value(const char* s, int len) { char* ns = new char[len + 1]; ns[len] = '\0'; String::set_value(strncpy(ns, s, len), len); } void CopyString::strfree() { char* s = (char*)(string()); delete [] s; } /* * class NullTerminatedString */ NullTerminatedString::NullTerminatedString() : String() { allocated_ = false; } NullTerminatedString::NullTerminatedString(const String& s) : String() { assign(s); } NullTerminatedString::NullTerminatedString( const NullTerminatedString& s ) : String() { allocated_ = false; String::set_value(s.string(), s.length()); } NullTerminatedString::~NullTerminatedString() { strfree(); } String& NullTerminatedString::operator =(const String& s) { strfree(); assign(s); return *this; } String& NullTerminatedString::operator =(const char* s) { strfree(); allocated_ = false; String::set_value(s, strlen(s)); return *this; } bool NullTerminatedString::null_terminated() const { return true; } void NullTerminatedString::assign(const String& s) { if (s.null_terminated()) { allocated_ = false; String::set_value(s.string(), s.length()); } else { allocated_ = true; int len = s.length(); char* ns = new char[len + 1]; ns[len] = '\0'; String::set_value(strncpy(ns, s.string(), len), len); } } void NullTerminatedString::strfree() { if (allocated_) { char* s = (char*)(string()); delete [] s; allocated_ = false; } } neuron-7.6.3/src/lib/OS/ustring.cpp000066400000000000000000000105661340731477100171310ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Stanford and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Stanford and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include /* * UniqueString uses a table for matching strings and a string pool * for storing the string data. A pool is presumably more efficient * than malloc/new, but individual strings cannot be deallocated. */ inline unsigned long key_to_hash(String& s) { return s.hash(); } declareTable(UniqueStringTable,String,String) implementTable(UniqueStringTable,String,String) static const unsigned strpoolsize = 800; class UniqueStringPool { public: UniqueStringPool(unsigned poolsize = strpoolsize); ~UniqueStringPool(); char* add(const char*, unsigned); private: char* data; unsigned size; unsigned cur; UniqueStringPool* prev; }; UniqueStringTable* UniqueString::table_; UniqueStringPool* UniqueString::pool_; UniqueString::UniqueString() : String() { } UniqueString::UniqueString(const char* s) : String() { init(String(s)); } UniqueString::UniqueString(const char* s, int n) : String() { init(String(s, n)); } UniqueString::UniqueString(const String& s) : String() { init(s); } UniqueString::UniqueString(const UniqueString& s) : String(s) { } UniqueString::~UniqueString() { } void UniqueString::init(const String& s) { if (table_ == nil) { table_ = new UniqueStringTable(256); } if (!table_->find(*this, s)) { if (pool_ == nil) { pool_ = new UniqueStringPool; } int n = s.length(); set_value(pool_->add(s.string(), n), n); table_->insert(*this, *this); } } /* * UniqueString's have a unique data pointer, so we can just use * that for a hash value. */ unsigned long UniqueString::hash() const { return key_to_hash(string()); } bool UniqueString::operator ==(const String& s) const { return string() == s.string() && length() == s.length(); } bool UniqueString::operator ==(const char* s) const { return String::operator ==(s); } bool UniqueString::null_terminated() const { return false; } /* * UniqueStringPool implementation. */ UniqueStringPool::UniqueStringPool(unsigned poolsize) { data = new char[poolsize]; size = poolsize; cur = 0; prev = nil; } /* * Tail-recursive deletion to walk the list back to the head * of the pool. */ UniqueStringPool::~UniqueStringPool() { delete [] data; delete prev; } /* * Add a string of a given length to the pool. If it won't fit, * create a copy of the current pool and allocate space for a new one. * * No null-padding is implied, so if you want that you must include * the null in the length. */ char* UniqueStringPool::add(const char* str, unsigned len) { if (len > strpoolsize) { UniqueStringPool* s = new UniqueStringPool(len); strncpy(s->data, str, len); s->cur = len; s->prev = prev; prev = s; return s->data; } unsigned index = cur; unsigned newcur = index + len; if (newcur > size) { UniqueStringPool* s = new UniqueStringPool; char* newdata = s->data; s->data = data; s->size = size; s->cur = cur; s->prev = prev; data = newdata; prev = s; index = 0; newcur = len; } char* r = &data[index]; strncpy(r, str, len); cur = newcur; return r; } neuron-7.6.3/src/lib/TIFF/000077500000000000000000000000001340731477100151315ustar00rootroot00000000000000neuron-7.6.3/src/lib/TIFF/Copyright000077500000000000000000000022161340731477100170300ustar00rootroot00000000000000Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler Copyright (c) 1991, 1992 Silicon Graphics, Inc. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that (i) the above copyright notices and this permission notice appear in all copies of the software and related documentation, and (ii) the names of Sam Leffler and Silicon Graphics may not be used in any advertising or publicity relating to the software without the specific, prior written permission of Sam Leffler and Silicon Graphics. THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. neuron-7.6.3/src/lib/TIFF/HOWTO000077500000000000000000000014431340731477100157610ustar00rootroot00000000000000/local/src/master/iv/src/lib/TIFF/HOWTO,v 1.2 1997/03/26 15:06:56 hines Exp How To Obtain This Software (in case all you get is this file) The software is available for public ftp on sgi.com graphics/tiff/v3.0.tar.Z (192.48.153.1) ucbvax.berkeley.edu pub/tiff/v3.0.tar.Z (128.32.130.12) For example, ftp -n sgi.com .... user anonymous ... cd graphics/tiff binary get v3.0.tar.Z The software comes in a compressed tar file. To extract the information: zcat v3.0.tar.Z | tar xf - (uncompress and extract individual files in current directory). There is also a companion compressed tar file, v3.0pics.tar.Z that has sample TIFF image files. These are mostly useful in testing the software if/when you port it to an unsupported system. neuron-7.6.3/src/lib/TIFF/README000077500000000000000000000510441340731477100160200ustar00rootroot00000000000000/local/src/master/iv/src/lib/TIFF/README,v 1.2 1997/03/26 15:06:57 hines Exp NOTE: The file CHANGES-v3.0 has a list of changes between v2.4.2 and this software. TIFF Software "Release" 3.00 ---------------------------- This is Version 3.00 of my public domain TIFF support software. Included is a library, libtiff, for reading and writing TIFF files. The library, along with associated tool programs, should handle most of your needs for reading and writing files that follow the 5.0 TIFF spec for Classes B, G, P, and R. There is also considerable support for proposed additions that are to appear in the 6.0 TIFF spec. o core requirements both "MM" and "II" byte orders are handled multiple subfiles can be read and written editing is NOT supported in that related subfiles (e.g. a reduced resolution version of an image) are not automatically updated Tags handled: NewSubfileType, ImageWidth, ImageLength, Rowsperstrip, StripOffsets, StripByteCounts, XResolution, YResolution, ResolutionUnit. o Class B for bilevel images SamplesPerPixel = 1 BitsPerSample = 1 Compression = 1 (none), 2 (CCITT 1D), or 32773 (PackBits) PhotometricInterpretation = 0 (Min-is-White), 1 (Min-is-Black) o Class G for grayscale images SamplesPerPixel = 1 BitsPerSample = 4, 8 Compression = 1 (none) 5 (LZW) PhotometricInterpretation = 0 (Min-is-White), 1 (Min-is-Black) o Class P for palette color images SamplesPerPixel = 1 BitsPerSample = 1-8 Compression = 1 (none) 5 (LZW) PhotometricInterpretation = 3 (Palette RGB) ColorMap o Class R for RGB full color images SamplesPerPixel = 3 BitsPerSample = <8,8,8> PlanarConfiguration = 1, 2 Compression = 1 (none) 5 (LZW) PhotometricInterpretation = 2 (RGB) o Class F for facsimile (proposed appendix to 5.0 spec) (Class B tags plus...) Compression = 3 (CCITT Group 3), 4 (CCITT Group 4) FillOrder = 1 (MSB), 2 (LSB) Group3Options = 1 (2d encoding), 4 (zero fill), 5 (2d+fill) ImageWidth = 1728, 2048, 2482 NewSubFileType = 2 ResolutionUnit = 2 (Inch), 3 (Centimeter) PageNumber, XResolution, YResolution, Software, BadFaxLines, CleanFaxData, ConsecutiveBadFaxLines, DateTime, DocumentName, ImageDescription, Orientation o Class S for separated images (Appendix K to appear in 6.0) SamplesPerPixel = 4 PlanarConfiguration = 1, 2 Compression = 1 (none), 5 (LZW) PhotometricInterpretation = 5 (Separated) InkSet = 1 (CMYK) DotRange, InkNames, DotRange, TargetPrinter o Class Y for JPEG images (Appendix O to appear in 6.0) SamplesPerPixel = 3 BitsPerSample = <8,8,8> PlanarConfiguration = 1, 2 Compression = 1 (none), 5 (LZW), 32865 (JPEG) PhotometricInterpretation = 6 (YCbCr) YCbCrCoefficients, YCbCrSubsampling, YCbCrPositioning (colorimetry info from Appendix H; see below) o Class "JPEG" for JPEG images (Appendix P to appear in 6.0) PhotometricInterpretation = 1 (grayscale), 2 (RGB), 5 (CMYK), 6 (YCbCr) (Class Y tags if YCbCr) (Class S tags if CMYK) Compression = 6 (JPEG) JPEGProc = 0 (baseline) JPEGQTables = ... (offsets to per-channel Q matrices) JPEGDCTables = .... (offsets to per-channel DC tables) JPEGACTables = .... (offsets to per-channel AC tables) JPEGRestartInterval o Tiled Images (Appendix L to appear in 6.0) TileWidth TileLength TileOffsets TileByteCounts o Image Colorimetry Information (Appendix H to appear in 6.0) WhitePoint PrimaryChromaticities TransferFunction ReferenceBlackWhite In addition, the library supports some optional compression algorithms that are, in some cases, of dubious value. Compression = 32766 NeXT 2-bit encoding Compression = 32809 ThunderScan 4-bit encoding [JPEG compression should fit into this library simply by replacing the existing stub JPEG compression module. That is, all YCbCr and JPEG-related tags are supported in this version of the library.] The following tags are recognized and handled by the library (as described in the table). If no use is indicated, then the library reads and writes the tag, but does not use it internally. Tag Name Value R/W Library's Use ----------------------------------------------------- NewSubFileType 254 R/W (called SubFileType) SubFileType 255 R/W (called OSubFileType) ImageWidth 256 R/W lots ImageLength 257 R/W lots BitsPerSample 258 R/W lots Compression 259 R/W choosing compression routines PhotometricInterpretation 262 R/W Group 3 and JPEG code Thresholding 263 R/W CellWidth 264 parsed but ignored CellLength 265 parsed but ignored FillOrder 266 R/W control bit order DocumentName 269 R/W ImageDescription 270 R/W Make 271 R/W Model 272 R/W StripOffsets 273 R/W data i/o Orientation 274 R/W SamplesPerPixel 277 R/W lots RowsPerStrip 278 R/W data i/o StripByteCounts 279 R/W data i/o MinSampleValue 280 R/W MaxSampleValue 281 R/W XResolution 282 R/W YResolution 283 R/W used by Group 3 2d encoding PlanarConfiguration 284 R/W data i/o PageName 285 R/W XPosition 286 R/W YPosition 286 R/W FreeOffsets 288 parsed but ignored FreeByteCounts 289 parsed but ignored GrayResponseUnit 290 parsed but ignored GrayResponseCurve 291 parsed but ignored Group3Options 292 R/W used by Group 3 code Group4Options 293 R/W ResolutionUnit 296 R/W PageNumber 297 R/W ColorResponseUnit 300 parsed but ignored TransferFunction 301 R/W Software 305 R/W DateTime 306 R/W Artist 315 R/W HostComputer 316 R/W Predictor 317 R/W used by LZW code WhitePoint 318 R/W PrimaryChromacities 319 R/W ColorMap 320 R/W TileWidth 322 R/W data i/o TileLength 323 R/W data i/o TileOffsets 324 R/W data i/o TileByteCounts 324 R/W data i/o BadFaxLines 326 R/W CleanFaxData 327 R/W ConsecutiveBadFaxLines 328 R/W InkSet 332 R/W InkNames 333 R/W DotRange 336 R/W TargetPrinter 337 R/W ExtraSamples 338 R/W SampleFormat 339 R/W JPEGProc 512 R/W JPEG code JPEGQRestartInterval 515 R/W JPEG code JPEGQTables 519 R/W JPEG code JPEGDCTables 520 R/W JPEG code JPEGACTables 521 R/W JPEG code YCbCrCoefficients 529 R/W used by TIFFReadRGBAImage YCbCrSubsampling 530 R/W tile/strip size calculations YCbCrPositioning 531 R/W ReferenceBlackWhite 532 R/W Matteing 32995 R DataType 32996 R ImageDepth 32997 R/W tile/strip calculations TileDepth 32998 R/W tile/strip calculations The Matteing and DataType tags have been obsoleted by the 6.0 ExtraSamples and SampleFormat tags. Note that the ExtraSamples tag is only supported as needed to store Associated Alpha data. Consult the documentation on the ExtraSamples tag and Associated Alpha for elaboration. Note however that if you use Associated Alpha, you are expected to save data that is pre-multipled by Alpha. If this means nothing to you, check out Porter & Duff's paper in the '84 SIGGRAPH proceedings: "Compositing Digital Images". The ImageDepth tag is a non-standard, but registered tag that specifies the Z-dimension of volumetric data. The combination of ImageWidth, ImageLength, and ImageDepth, defines a 3D volume of pixels that are further specified by BitsPerSample and SamplesPerPixel. The TileDepth tag (also non-standard, but registered) can be used to specified a subvolume "tiling" of a volume of data. The JPEG, Colorimetry, and CMYK tags are planned additions for TIFF 6.0. Consult the appropriate TIFF appendices for the descriptions of these tags. LIBTIFF ------- Libtiff is the software library that you can use to read and write TIFF files (most all the tools use it to do their work). The library provides two interfaces, one for strip-based images and one for tile-based images. The normal interface is through a simple scanline-based interface that works with images comprised of strips. For example, to read the contents of a file, the following might be used: #include "tiffio.h" TIFF *tif; unsigned long imagelength; char *buf; long row; tif = TIFFOpen("myfile.tif", "r"); TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &imagelength); buf = malloc(TIFFScanlineSize(tif)); for (row = 0; row < imagelength; row++) TIFFReadScanline(tif, buf, row); (this example assumes samples are packed contiguously.) Similarly, to write a file, something like the following can be used: tif = TIFFOpen("myfile.tif", "w"); TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, imagewidth); TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_LZW); ... row = 0; while (...more scanlines to write...) TIFFWriteScanline(tif, buf, row); TIFFClose(tif); (once again, we assume samples are packed contiguously.) A 2D tile-based interface is also provided as an alternative to the scanline-orientated interfaces. With this interface, an image is broken up into a set of rectangular areas called tiles. All the tiles in an image have the same size, and the tile width and length must each be a multiple of 16 pixels. Tiles are ordered left-to-right and top-to-bottom in an image. As for scanlines, samples can be packed contiguously or separately. When separated, all the tiles for a sample are colocated in the file. That is, all the tiles for sample 0 appear before the tiles for sample 1, etc. Tiles and strips may also be extended in a z dimension to form volumes. Data volumes are organized as "slices". That is, all the data for a slice is colocated. Volumes whose data is organized in tiles can also have a tile depth so that data can be organized in cubes. The interface for tiles is similar to scanlines. To read a tiled image, code of the following sort might be used: unsigned long imageWidth, imageLength; unsigned long tileWidth, tileLength; unsigned long x, y; char *buf; tif = TIFFOpen("myfile.tif", "r"); TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &imageWidth); TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &imageLength); TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tileWidth); TIFFGetField(tif, TIFFTAG_TILELENGTH, &tileLength); buf = malloc(TIFFTileSize(tif)); for (y = 0; y < imageLength; y += tileLength) for (x = 0; x < imageWidth; x += tileWidth) TIFFReadTile(tif, buf, x, y, 0); (once again, we assume samples are packed contiguously.) Note that unlike the stdio library, libtiff only supports reading OR writing of a file. There is also an append mode, but this has not really been tested. TOOLS ----- There are two device-dependent programs: o tiffgt is used to display the contents of a TIFF file on a framebuffer. The version included in this release was written for the Silicon Graphics Graphics Library (GL), although it should be a simple matter to tailor it for other systems. o tiffsv is used to save all or part of a framebuffer in a TIFF file. Once again, the version of tiffsv included here was written for the GL, but should be tailorable to other devices. (Note, tiffsv uses the readdisplay routine that was introduced in IRIX 4.0.) The remaining programs should be device-independent: o tiffinfo formats information about one or more TIFF files o tiffdump displays the verbatim contents of the TIFF directory in a file (it's very useful for debugging bogus files that you may get from someone that claims they support TIFF). o tiffcp is used to copy, concatenate, and convert TIFF images (e.g. switching from Compression=5 to Compression=1). o tiff2ps is a program that converts a TIFF image to PostScript. o tiffcmp can be used to compare the contents of two TIFF files (it does not check all the directory information, but does check all the data). o tiff2bw is a simple program to convert a color image to grayscale. o ras2tiff is a quick hack that converts Sun rasterfile format images to TIFF -- it's less than complete. o rgb2ycbcr converts an RGB, grayscale, or bilevel TIFF image to a YCbCr TIFF image. o gif2tiff is a quick hack that converts GIF 87a format images to TIFF. o ppm2tiff is a quick hack that converts PPM format images to TIFF. o fax2tiff converts raw Group 3 facsimile data to TIFF. o pal2rgb converts a Palette color image to a full color RGB image by applying the colormap. o tiffdither dithers a b&w image into a bilevel image (suitable for use in creating fax files) o tiffsplit creates one or more single-image files from a (possibly) multi-image file o Finally, tiffmedian is a version of Paul Heckbert's median cut program that reads an RGB TIFF image, and creates a TIFF palette file as a result. It's useful for converting full-color RGB images to 8-bit color for your friends that have cheapo 8-bit framebuffers. There is also: o sgi2tiff, a program to convert SGI image files to TIFF. This program is only useful on SGI machines as it uses -limage. Check out the manual pages for details about the above programs. CONTRIBUTED STUFF: ----------------- The directory contrib has contributed software: contrib/dbs an X-based TIFF viewer from Dan & Chris Sears contrib/ras two programs by Patrick Naughton for converting between Sun rasterfile format and TIFF (these require libpixrect.a, as opposed to the one in tools that doesn't) contrib/fax2ps a program that converts TIFF/F images to an encoded form of PostScript that is faster to print than just dumping a full raster contrib/vms scripts and files from Karsten Spang for building the library and tools under VMS contrib/xv patches to XV version 2.00 to make it support TIFF (XV is an X-based viewer from John Bradley) Don't send me mail asking about these programs. Send questions and/or bug reports directly to the authors. DOCUMENTATION: ------------- A copy of the 5.0 spec is included in the doc directory. This document was obtained by Bill Johnston of LBL who retrieved it from simtel20. Beware that the document has been modified slightly from the original version to enhance printability. We've tried to be very careful in making any changes, but there's always the possibility of mistakes being introduced. Another document describes a proposed addition to TIFF 6.0 for Associated Alpha data (i.e. what is now the Matteing tag). TEST IMAGES: ----------- Test images are available for most formats supported by the library. The images are kept in a separate archive that should be located along with this software. If the archive that you retrieve was v3.0.tar.Z, then the images should be in the same directory in an archive named v3.0pics.tar.Z. BUILDING THE SOFTWARE --------------------- The software, as distributed, is setup for building the software on an SGI machine (release 4.0.1 if you care). To configure things for your machine, check for Makefiles in the libtiff and tools directories for your machine: Makefile.aix Makefile for an IBM RS/6000 running AIX Makefile.apollo Makefile for an Apollo Makefile.hpux Makefile for HP machines running HP-UX Makefile.mips Makefile for a MIPS running MIPS OS 2.? Makefile.next Makefile for a NeXT Makefile.sgi Makefile for a VGX, GT, GTX, or Personal Iris Makefile.sun Makefile for a Sun-3 or Sun-4 running SunOS 3.5+ Makefile.tahoe Makefile for a TAHOE running 4.3BSD Makefile.vax Makefile for a VAX running 4.3BSD If your machine is not represented, you'll have to make up a Makefile that is right for you. In libtiff the important things to setup are AR=/usr/bin/ar whatever your library archiver is called RANLIB=/usr/bin/ranlib if you need to ranlib a library IPATH=-I. -I/usr/include/bsd list of directories to search includes CONF=.... configuring optional support To build the library, just cd libtiff; make In the tools directory, you'll want to setup the MACHALL macro, MACHALL=ras2tiff tiffgt tiffsv and add definitions for how to build tiffgt and tiffsv for your machine (if appropriate). Note also that for building the fax2tiff program, the CONF_LIBRARY macro in the Makefile MUST agree with the definition in the Makefile in the libtiff directory! If this is not true, then fax2tiff will not work. To build the tools library, just cd ../tools; make CHECKING OUT THE SOFTWARE ------------------------- Assuming you have working versions of tiffgt and tiffsv, you can just use them to view any of the sample images (the list is given below). Otherwise, you can check out the operation of the library with tiffcp and tiffcmp. For example, tiffcp -lzw cramps.tif x.tif tiffcmp cramps.tif x.tif (tiffcmp should be silent if the files compare correctly). BUGS AND SUCH.... ----------------- This software is free. The only thing that I ask in return is that you tell me when you find a problem or fix a bug. I also gladly accept software contributions, although I hesitate to include such software in my regular stuff if I am personally unable to test it. There is a mailing list associated with the software, tiff@ucbvax.berkeley.edu, that you can join by sending a message to tiff-request@ucbvax.berkeley.edu. You can also reach me directly at sam@sgi.com. ACKNOWLEDGEMENTS ---------------- The LZW algorithm is derived from the compress program (the proper attribution is included in the source code). The Group 3 fax stuff originated as code from Jef Poskanzer, but has since been rewritten several times. The latest version uses an algorithm from Michael Marking -- consult libtiff/mkg3states.c for further information. Many other people have, by now, helped with bug fixes and code. WARNING ------- It appears that Unisys is actively pursuing copyright control on the LZW compression algorithm. In particular, users of the LZW compression within the TIFF framework. For this reason the TIFF 6.0 spec will state that LZW compression is not recommended. It is unclear at this time what compression algorithm will be used in place of it. I have no idea what this means to you or to this library. I make no warranty or guarantees with regard to the LZW support in this library. FILE CONTENTS ------------- At least the following files are included in the distribution: libtiff/prototypes.h stuff for ANSI function prototypes libtiff/tiff.h TIFF spec definitions libtiff/tiffio.h public TIFF library definitions libtiff/tiffioP.h private TIFF library definitions libtiff/tiffcompat.h UNIX-compatibility definitions libtiff/t4.h CCITT Group 3 1d code tables+definitions libtiff/tif_fax3.h CCITT Group 3-related definitions libtiff/tif_aux.c auxilary directory-related functions libtiff/tif_ccittrle.c CCITT 1d Huffman compression libtiff/tif_compat.c OS-related compatibility stuff libtiff/tif_compress.c list of supported compression algorithms libtiff/tif_dir.c directory tag interface code libtiff/tif_dirinfo.c directory known tag support code libtiff/tif_dirread.c directory reading code libtiff/tif_dirwrite.c directory writing code libtiff/tif_dumpmode.c "no" compression algorithm libtiff/tif_fax3.c CCITT Group 3 fax compression libtiff/tif_fax4.c CCITT Group 4 fax compression libtiff/tif_getimage.c code to read an entire image into an RGBA raster libtiff/tif_jpeg.c JPEG compression placeholder libtiff/tif_lzw.c LZW encoding and decoding libtiff/tif_next.c NeXT 2-bit decoding algorithm (no encoding) libtiff/tif_machdep.c machine/architecture-specific code libtiff/tif_open.c open and simply query code libtiff/tif_packbits.c Packbits encoding and decoding libtiff/tif_print.c directory printing support libtiff/tif_swab.c byte and bit swapping support libtiff/tif_strip.c some strip-related code libtiff/tif_thunder.c Thunderscan decoding (no encoding) libtiff/tif_tile.c some tile-related code libtiff/mkg3states.c program to generate G3 decoding state tables libtiff/mkspans.c program to generate black-white span tables tools/getopt.c public domain getopt from Berkeley used by tools tools/fax2tiff.c convert raw facsimile data to TIFF tools/gif2tiff.c convert GIF87 file to TIFF tools/pal2rgb.c convert TIFF Palette image to TIFF RGB tools/ppm2tiff.c convert PPM image file to TIFF tools/ras2tiff.c convert Sun rasterfile format to TIFF (limited) tools/rgb2ybcr.c convert TIFF to YCbCr TIFF tools/sgi2tiff.c convert SGI image file to TIFF tools/sgigt.c TIFF picture get for SGI framebuffer (uses GL) tools/sgisv.c save image on SGI framebuffer in TIFF file tools/tiff2bw.c convert color TIFF file to B&W tools/tiff2ps.c convert TIFF to PostScript tools/tiffcmp.c compare two TIFF files tools/tiffcp.c copy/convert TIFF files (used to change compression) tools/tiffdither.c dither grayscale to bilevel tools/tiffdump.c dump TIFF header and directory tags w/o library tools/tiffinfo.c print info about TIFF file(s) tools/tiffmedian.c median cut RGB -> palette conversion program tools/tiffsplit.c split a multi-page TIFF into single-page TIFFs tools/ycbcr.c RGB->YCbCr->RGB test program doc/5.0spec raw text version of TIFF 5.0 spec doc/ClassF.txt raw text version of current Class F (fax) document doc/alpha.ps PostScript version of proposed TIFF 6.0 appendix doc/extra.ps PostScript version of proposed TIFF 6.0 tag doc/TIFF6.ps PostScript version of 1st draft of TIFF 6.0 spec man/man1 UNIX manual pages for tools man/man3 UNIX manual pages for libtiff functions neuron-7.6.3/src/lib/TIFF/VERSION000077500000000000000000000000051340731477100161770ustar00rootroot000000000000003.00 neuron-7.6.3/src/lib/TIFF/g3states.h000066400000000000000000026204571340731477100170570ustar00rootroot00000000000000/* DO NOT EDIT THIS FILE, IT WAS AUTOMATICALLY CREATED BY mkg3state */ #define ACT_INCOMP 0 /* incompletely decoded code */ #define ACT_INVALID 1 /* invalide code */ #define ACT_WRUNT 2 /* terminating white run code */ #define ACT_WRUN 65 /* non-terminating white run code */ #define ACT_BRUNT 106 /* terminating black run code */ #define ACT_BRUN 169 /* non-terminating black run code */ #define ACT_EOL 210 /* end-of-line code */ /* modes that the decoder can be in */ #define MODE_NULL 0 #define MODE_PASS 1 #define MODE_HORIZ 2 #define MODE_VERT_V0 6 #define MODE_VERT_VR1 7 #define MODE_VERT_VR2 8 #define MODE_VERT_VR3 9 #define MODE_VERT_VL1 5 #define MODE_VERT_VL2 4 #define MODE_VERT_VL3 3 #define MODE_UNCOMP 10 #define MODE_ERROR 11 #define MODE_ERROR_1 12 #define RUNLENGTH(ix) (TIFFFaxWhiteCodes[ix].runlen) #define UNCOMP_INCOMP 0 /* runs of [0]*1 */ #define UNCOMP_RUN0 1 #define UNCOMP_RUN1 2 #define UNCOMP_RUN2 3 #define UNCOMP_RUN3 4 #define UNCOMP_RUN4 5 #define UNCOMP_RUN5 6 #define UNCOMP_RUN6 7 /* runs of [0]* w/ terminating color */ #define UNCOMP_TRUN0 8 #define UNCOMP_TRUN1 9 #define UNCOMP_TRUN2 10 #define UNCOMP_TRUN3 11 #define UNCOMP_TRUN4 12 /* special code for unexpected EOF */ #define UNCOMP_EOF 13 /* invalid code encountered */ #define UNCOMP_INVALID 14 /* codes >= terminate uncompress mode */ #define UNCOMP_EXIT UNCOMP_TRUN0 #ifdef G3STATES u_char TIFFFax2DMode[20][256] = { /* prefix 0 */ { 12,12,11, 0, 3, 3, 9, 9, 4, 4, 4, 4, 8, 8, 8, 8, /* 0- 15 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 16- 31 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 32- 47 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 48- 63 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 64- 79 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 80- 95 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 96-111 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 112-127 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 128-143 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 144-159 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 160-175 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 176-191 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 192-207 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 208-223 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 224-239 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 240-255 */ }, /* prefix 1 */ { 12, 0, 3, 9, 4, 4, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 15 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 16- 31 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 32- 47 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 48- 63 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 64- 79 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 80- 95 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 96-111 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 112-127 */ 12, 0, 3, 9, 4, 4, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, /* 128-143 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 144-159 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 160-175 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 176-191 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 192-207 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 208-223 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 224-239 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 240-255 */ }, /* prefix 2 */ { 0, 0, 4, 8, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 15 */ 5, 5, 5, 5, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, /* 16- 31 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 32- 47 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 48- 63 */ 0, 0, 4, 8, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, /* 64- 79 */ 5, 5, 5, 5, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, /* 80- 95 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 96-111 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 112-127 */ 0, 0, 4, 8, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, /* 128-143 */ 5, 5, 5, 5, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, /* 144-159 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 160-175 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 176-191 */ 0, 0, 4, 8, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, /* 192-207 */ 5, 5, 5, 5, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, /* 208-223 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 224-239 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 240-255 */ }, /* prefix 3 */ { 0, 0, 1, 1, 2, 2, 2, 2, 5, 5, 5, 5, 7, 7, 7, 7, /* 0- 15 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 16- 31 */ 0, 0, 1, 1, 2, 2, 2, 2, 5, 5, 5, 5, 7, 7, 7, 7, /* 32- 47 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 48- 63 */ 0, 0, 1, 1, 2, 2, 2, 2, 5, 5, 5, 5, 7, 7, 7, 7, /* 64- 79 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 80- 95 */ 0, 0, 1, 1, 2, 2, 2, 2, 5, 5, 5, 5, 7, 7, 7, 7, /* 96-111 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 112-127 */ 0, 0, 1, 1, 2, 2, 2, 2, 5, 5, 5, 5, 7, 7, 7, 7, /* 128-143 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 144-159 */ 0, 0, 1, 1, 2, 2, 2, 2, 5, 5, 5, 5, 7, 7, 7, 7, /* 160-175 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 176-191 */ 0, 0, 1, 1, 2, 2, 2, 2, 5, 5, 5, 5, 7, 7, 7, 7, /* 192-207 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 208-223 */ 0, 0, 1, 1, 2, 2, 2, 2, 5, 5, 5, 5, 7, 7, 7, 7, /* 224-239 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 240-255 */ }, /* prefix 4 */ { 0, 1, 2, 2, 5, 5, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, /* 0- 15 */ 0, 1, 2, 2, 5, 5, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, /* 16- 31 */ 0, 1, 2, 2, 5, 5, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, /* 32- 47 */ 0, 1, 2, 2, 5, 5, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, /* 48- 63 */ 0, 1, 2, 2, 5, 5, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, /* 64- 79 */ 0, 1, 2, 2, 5, 5, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, /* 80- 95 */ 0, 1, 2, 2, 5, 5, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, /* 96-111 */ 0, 1, 2, 2, 5, 5, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, /* 112-127 */ 0, 1, 2, 2, 5, 5, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, /* 128-143 */ 0, 1, 2, 2, 5, 5, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, /* 144-159 */ 0, 1, 2, 2, 5, 5, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, /* 160-175 */ 0, 1, 2, 2, 5, 5, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, /* 176-191 */ 0, 1, 2, 2, 5, 5, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, /* 192-207 */ 0, 1, 2, 2, 5, 5, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, /* 208-223 */ 0, 1, 2, 2, 5, 5, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, /* 224-239 */ 0, 1, 2, 2, 5, 5, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, /* 240-255 */ }, /* prefix 5 */ { 0, 2, 5, 7, 6, 6, 6, 6, 0, 2, 5, 7, 6, 6, 6, 6, /* 0- 15 */ 0, 2, 5, 7, 6, 6, 6, 6, 0, 2, 5, 7, 6, 6, 6, 6, /* 16- 31 */ 0, 2, 5, 7, 6, 6, 6, 6, 0, 2, 5, 7, 6, 6, 6, 6, /* 32- 47 */ 0, 2, 5, 7, 6, 6, 6, 6, 0, 2, 5, 7, 6, 6, 6, 6, /* 48- 63 */ 0, 2, 5, 7, 6, 6, 6, 6, 0, 2, 5, 7, 6, 6, 6, 6, /* 64- 79 */ 0, 2, 5, 7, 6, 6, 6, 6, 0, 2, 5, 7, 6, 6, 6, 6, /* 80- 95 */ 0, 2, 5, 7, 6, 6, 6, 6, 0, 2, 5, 7, 6, 6, 6, 6, /* 96-111 */ 0, 2, 5, 7, 6, 6, 6, 6, 0, 2, 5, 7, 6, 6, 6, 6, /* 112-127 */ 0, 2, 5, 7, 6, 6, 6, 6, 0, 2, 5, 7, 6, 6, 6, 6, /* 128-143 */ 0, 2, 5, 7, 6, 6, 6, 6, 0, 2, 5, 7, 6, 6, 6, 6, /* 144-159 */ 0, 2, 5, 7, 6, 6, 6, 6, 0, 2, 5, 7, 6, 6, 6, 6, /* 160-175 */ 0, 2, 5, 7, 6, 6, 6, 6, 0, 2, 5, 7, 6, 6, 6, 6, /* 176-191 */ 0, 2, 5, 7, 6, 6, 6, 6, 0, 2, 5, 7, 6, 6, 6, 6, /* 192-207 */ 0, 2, 5, 7, 6, 6, 6, 6, 0, 2, 5, 7, 6, 6, 6, 6, /* 208-223 */ 0, 2, 5, 7, 6, 6, 6, 6, 0, 2, 5, 7, 6, 6, 6, 6, /* 224-239 */ 0, 2, 5, 7, 6, 6, 6, 6, 0, 2, 5, 7, 6, 6, 6, 6, /* 240-255 */ }, /* prefix 6 */ { 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, /* 0- 15 */ 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, /* 16- 31 */ 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, /* 32- 47 */ 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, /* 48- 63 */ 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, /* 64- 79 */ 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, /* 80- 95 */ 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, /* 96-111 */ 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, /* 112-127 */ 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, /* 128-143 */ 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, /* 144-159 */ 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, /* 160-175 */ 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, /* 176-191 */ 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, /* 192-207 */ 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, /* 208-223 */ 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, /* 224-239 */ 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, 0, 0, 6, 6, /* 240-255 */ }, /* prefix 7 */ { 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, /* 0- 15 */ 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, /* 16- 31 */ 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, /* 32- 47 */ 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, /* 48- 63 */ 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, /* 64- 79 */ 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, /* 80- 95 */ 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, /* 96-111 */ 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, /* 112-127 */ 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, /* 128-143 */ 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, /* 144-159 */ 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, /* 160-175 */ 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, /* 176-191 */ 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, /* 192-207 */ 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, /* 208-223 */ 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, /* 224-239 */ 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, /* 240-255 */ }, /* prefix 8 */ { 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 0- 15 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 16- 31 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 32- 47 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 48- 63 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 64- 79 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 80- 95 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 96-111 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 112-127 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 128-143 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 144-159 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 160-175 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 176-191 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 192-207 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 208-223 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 224-239 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 240-255 */ }, /* prefix 9 */ { 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 0- 15 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 16- 31 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 32- 47 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 48- 63 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 64- 79 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 80- 95 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 96-111 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 112-127 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 128-143 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 144-159 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 160-175 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 176-191 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 192-207 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 208-223 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 224-239 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 240-255 */ }, /* prefix 10 */ { 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 0- 15 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 16- 31 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 32- 47 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 48- 63 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 64- 79 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 80- 95 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 96-111 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 112-127 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 128-143 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 144-159 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 160-175 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 176-191 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 192-207 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 208-223 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 224-239 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 240-255 */ }, /* prefix 11 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 15 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 16- 31 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 32- 47 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 48- 63 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 64- 79 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 80- 95 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 96-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-127 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 128-143 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 144-159 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 160-175 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 176-191 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 192-207 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 208-223 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 224-239 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 240-255 */ }, /* prefix 12 */ { 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 0- 15 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 16- 31 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 32- 47 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 48- 63 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 64- 79 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 80- 95 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 96-111 */ 11,11,11,11,11,11,11,11,10,10,10,10,10,10,10,10, /* 112-127 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 128-143 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 144-159 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 160-175 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 176-191 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 192-207 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 208-223 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 224-239 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 240-255 */ }, /* prefix 13 */ { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 0- 15 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 16- 31 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 32- 47 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 48- 63 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 64- 79 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 80- 95 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 96-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-127 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 128-143 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 144-159 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 160-175 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 176-191 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 192-207 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 208-223 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 224-239 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 240-255 */ }, /* prefix 14 */ { 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 0- 15 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 16- 31 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 32- 47 */ 11,11,11,11,11,11,11,11,11,11,11,11,10,10,10,10, /* 48- 63 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 64- 79 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 80- 95 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 96-111 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 112-127 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 128-143 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 144-159 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 160-175 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 176-191 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 192-207 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 208-223 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 224-239 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 240-255 */ }, /* prefix 15 */ { 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 0- 15 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,10, /* 16- 31 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 32- 47 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 48- 63 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 64- 79 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 80- 95 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 96-111 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 112-127 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 128-143 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 144-159 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 160-175 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 176-191 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 192-207 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 208-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-239 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 240-255 */ }, /* prefix 16 */ { 12,12,12,12,12,12,12,12,11,11,11,11,11,11,11,10, /* 0- 15 */ 3, 3, 3, 3, 3, 3, 3, 3, 9, 9, 9, 9, 9, 9, 9, 9, /* 16- 31 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 32- 47 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 48- 63 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 64- 79 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 80- 95 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 96-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-127 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 128-143 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 144-159 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 160-175 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 176-191 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 192-207 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 208-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-239 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 240-255 */ }, /* prefix 17 */ { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 0- 15 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 16- 31 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 32- 47 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 48- 63 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 64- 79 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 80- 95 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 96-111 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 112-127 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 128-143 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 144-159 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 160-175 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 176-191 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 192-207 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 208-223 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 224-239 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 240-255 */ }, /* prefix 18 */ { 12,12,12,12,11,11,11, 0, 3, 3, 3, 3, 9, 9, 9, 9, /* 0- 15 */ 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, /* 16- 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 32- 47 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 48- 63 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 64- 79 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 80- 95 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 96-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-127 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 128-143 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 144-159 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 160-175 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 176-191 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 192-207 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 208-223 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 224-239 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 240-255 */ }, /* prefix 19 */ { 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 0- 15 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 16- 31 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 32- 47 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 48- 63 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 64- 79 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 80- 95 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 96-111 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 112-127 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 128-143 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 144-159 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 160-175 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 176-191 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 192-207 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 208-223 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 224-239 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 240-255 */ } }; u_char TIFFFax2DNextState[20][256] = { /* prefix 0 */ { 7, 7, 0, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, /* 0- 15 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 16- 31 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 32- 47 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 48- 63 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 64- 79 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 80- 95 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 96-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-127 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 128-143 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 144-159 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 160-175 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 176-191 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 192-207 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 208-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-239 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 240-255 */ }, /* prefix 1 */ { 0, 9, 0, 0, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, /* 0- 15 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 16- 31 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 32- 47 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 48- 63 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 64- 79 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 80- 95 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 96-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-127 */ 0, 9, 0, 0, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, /* 128-143 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 144-159 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 160-175 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 176-191 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 192-207 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 208-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-239 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 240-255 */ }, /* prefix 2 */ { 10,11, 0, 0, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 0- 15 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 16- 31 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 32- 47 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 48- 63 */ 10,11, 0, 0, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 64- 79 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 80- 95 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 96-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-127 */ 10,11, 0, 0, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 128-143 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 144-159 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 160-175 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 176-191 */ 10,11, 0, 0, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 192-207 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 208-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-239 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 240-255 */ }, /* prefix 3 */ { 12,13, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 0- 15 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 16- 31 */ 12,13, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 32- 47 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 48- 63 */ 12,13, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 64- 79 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 80- 95 */ 12,13, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 96-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-127 */ 12,13, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 128-143 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 144-159 */ 12,13, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 160-175 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 176-191 */ 12,13, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 192-207 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 208-223 */ 12,13, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 224-239 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 240-255 */ }, /* prefix 4 */ { 14, 0, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, /* 0- 15 */ 14, 0, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, /* 16- 31 */ 14, 0, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, /* 32- 47 */ 14, 0, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, /* 48- 63 */ 14, 0, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, /* 64- 79 */ 14, 0, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, /* 80- 95 */ 14, 0, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, /* 96-111 */ 14, 0, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, /* 112-127 */ 14, 0, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, /* 128-143 */ 14, 0, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, /* 144-159 */ 14, 0, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, /* 160-175 */ 14, 0, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, /* 176-191 */ 14, 0, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, /* 192-207 */ 14, 0, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, /* 208-223 */ 14, 0, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, /* 224-239 */ 14, 0, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, /* 240-255 */ }, /* prefix 5 */ { 15, 0, 0, 0, 6, 6, 6, 6,15, 0, 0, 0, 6, 6, 6, 6, /* 0- 15 */ 15, 0, 0, 0, 6, 6, 6, 6,15, 0, 0, 0, 6, 6, 6, 6, /* 16- 31 */ 15, 0, 0, 0, 6, 6, 6, 6,15, 0, 0, 0, 6, 6, 6, 6, /* 32- 47 */ 15, 0, 0, 0, 6, 6, 6, 6,15, 0, 0, 0, 6, 6, 6, 6, /* 48- 63 */ 15, 0, 0, 0, 6, 6, 6, 6,15, 0, 0, 0, 6, 6, 6, 6, /* 64- 79 */ 15, 0, 0, 0, 6, 6, 6, 6,15, 0, 0, 0, 6, 6, 6, 6, /* 80- 95 */ 15, 0, 0, 0, 6, 6, 6, 6,15, 0, 0, 0, 6, 6, 6, 6, /* 96-111 */ 15, 0, 0, 0, 6, 6, 6, 6,15, 0, 0, 0, 6, 6, 6, 6, /* 112-127 */ 15, 0, 0, 0, 6, 6, 6, 6,15, 0, 0, 0, 6, 6, 6, 6, /* 128-143 */ 15, 0, 0, 0, 6, 6, 6, 6,15, 0, 0, 0, 6, 6, 6, 6, /* 144-159 */ 15, 0, 0, 0, 6, 6, 6, 6,15, 0, 0, 0, 6, 6, 6, 6, /* 160-175 */ 15, 0, 0, 0, 6, 6, 6, 6,15, 0, 0, 0, 6, 6, 6, 6, /* 176-191 */ 15, 0, 0, 0, 6, 6, 6, 6,15, 0, 0, 0, 6, 6, 6, 6, /* 192-207 */ 15, 0, 0, 0, 6, 6, 6, 6,15, 0, 0, 0, 6, 6, 6, 6, /* 208-223 */ 15, 0, 0, 0, 6, 6, 6, 6,15, 0, 0, 0, 6, 6, 6, 6, /* 224-239 */ 15, 0, 0, 0, 6, 6, 6, 6,15, 0, 0, 0, 6, 6, 6, 6, /* 240-255 */ }, /* prefix 6 */ { 16,17, 7, 7,16,17, 7, 7,16,17, 7, 7,16,17, 7, 7, /* 0- 15 */ 16,17, 7, 7,16,17, 7, 7,16,17, 7, 7,16,17, 7, 7, /* 16- 31 */ 16,17, 7, 7,16,17, 7, 7,16,17, 7, 7,16,17, 7, 7, /* 32- 47 */ 16,17, 7, 7,16,17, 7, 7,16,17, 7, 7,16,17, 7, 7, /* 48- 63 */ 16,17, 7, 7,16,17, 7, 7,16,17, 7, 7,16,17, 7, 7, /* 64- 79 */ 16,17, 7, 7,16,17, 7, 7,16,17, 7, 7,16,17, 7, 7, /* 80- 95 */ 16,17, 7, 7,16,17, 7, 7,16,17, 7, 7,16,17, 7, 7, /* 96-111 */ 16,17, 7, 7,16,17, 7, 7,16,17, 7, 7,16,17, 7, 7, /* 112-127 */ 16,17, 7, 7,16,17, 7, 7,16,17, 7, 7,16,17, 7, 7, /* 128-143 */ 16,17, 7, 7,16,17, 7, 7,16,17, 7, 7,16,17, 7, 7, /* 144-159 */ 16,17, 7, 7,16,17, 7, 7,16,17, 7, 7,16,17, 7, 7, /* 160-175 */ 16,17, 7, 7,16,17, 7, 7,16,17, 7, 7,16,17, 7, 7, /* 176-191 */ 16,17, 7, 7,16,17, 7, 7,16,17, 7, 7,16,17, 7, 7, /* 192-207 */ 16,17, 7, 7,16,17, 7, 7,16,17, 7, 7,16,17, 7, 7, /* 208-223 */ 16,17, 7, 7,16,17, 7, 7,16,17, 7, 7,16,17, 7, 7, /* 224-239 */ 16,17, 7, 7,16,17, 7, 7,16,17, 7, 7,16,17, 7, 7, /* 240-255 */ }, /* prefix 7 */ { 18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0, /* 0- 15 */ 18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0, /* 16- 31 */ 18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0, /* 32- 47 */ 18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0, /* 48- 63 */ 18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0, /* 64- 79 */ 18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0, /* 80- 95 */ 18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0, /* 96-111 */ 18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0, /* 112-127 */ 18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0, /* 128-143 */ 18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0, /* 144-159 */ 18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0, /* 160-175 */ 18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0, /* 176-191 */ 18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0, /* 192-207 */ 18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0, /* 208-223 */ 18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0, /* 224-239 */ 18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0,18, 0, /* 240-255 */ }, /* prefix 8 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 15 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 16- 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 32- 47 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 48- 63 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 64- 79 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 80- 95 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 96-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-127 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 128-143 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 144-159 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 160-175 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 176-191 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 192-207 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 208-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-239 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 240-255 */ }, /* prefix 9 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 15 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 16- 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 32- 47 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 48- 63 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 64- 79 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 80- 95 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 96-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-127 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 128-143 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 144-159 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 160-175 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 176-191 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 192-207 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 208-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-239 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 240-255 */ }, /* prefix 10 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 15 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 16- 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 32- 47 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 48- 63 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 64- 79 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 80- 95 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 96-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-127 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 128-143 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 144-159 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 160-175 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 176-191 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 192-207 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 208-223 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 224-239 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 240-255 */ }, /* prefix 11 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 15 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 16- 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 32- 47 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 48- 63 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 64- 79 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 80- 95 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 96-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-127 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 128-143 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 144-159 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 160-175 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 176-191 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 192-207 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 208-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-239 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 240-255 */ }, /* prefix 12 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 15 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 16- 31 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 32- 47 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 48- 63 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 64- 79 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 80- 95 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 96-111 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 112-127 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 128-143 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 144-159 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 160-175 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 176-191 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 192-207 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 208-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-239 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 240-255 */ }, /* prefix 13 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 15 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 16- 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 32- 47 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 48- 63 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 64- 79 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 80- 95 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 96-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-127 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 128-143 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 144-159 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 160-175 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 176-191 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 192-207 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 208-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-239 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 240-255 */ }, /* prefix 14 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 15 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 16- 31 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 32- 47 */ 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, /* 48- 63 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 64- 79 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 80- 95 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 96-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-127 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 128-143 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 144-159 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 160-175 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 176-191 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 192-207 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 208-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-239 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 240-255 */ }, /* prefix 15 */ { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 0- 15 */ 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, /* 16- 31 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 32- 47 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 48- 63 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 64- 79 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 80- 95 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 96-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-127 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 128-143 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 144-159 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 160-175 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 176-191 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 192-207 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 208-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-239 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 240-255 */ }, /* prefix 16 */ { 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 0, 0, /* 0- 15 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 16- 31 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 32- 47 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 48- 63 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 64- 79 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 80- 95 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 96-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-127 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 128-143 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 144-159 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 160-175 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 176-191 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 192-207 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 208-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-239 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 240-255 */ }, /* prefix 17 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 15 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 16- 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 32- 47 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 48- 63 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 64- 79 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 80- 95 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 96-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-127 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 128-143 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 144-159 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 160-175 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 176-191 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 192-207 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 208-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-239 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 240-255 */ }, /* prefix 18 */ { 6, 6, 6, 6, 7, 7, 0,19, 6, 6, 6, 6, 6, 6, 6, 6, /* 0- 15 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 16- 31 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 32- 47 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 48- 63 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 64- 79 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 80- 95 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 96-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-127 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 128-143 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 144-159 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 160-175 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 176-191 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 192-207 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 208-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-239 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 240-255 */ }, /* prefix 19 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 15 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 16- 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 32- 47 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 48- 63 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 64- 79 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 80- 95 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 96-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-127 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 128-143 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 144-159 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 160-175 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 176-191 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 192-207 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 208-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-239 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 240-255 */ } }; u_char TIFFFaxUncompAction[20][256] = { /* prefix 0 */ { 0, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, /* 0- 15 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 16- 31 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 32- 47 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 48- 63 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 64- 79 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 80- 95 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 96-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-127 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 128-143 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 144-159 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 160-175 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 176-191 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 192-207 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 208-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-239 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 240-255 */ }, /* prefix 1 */ { 0, 8, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 0- 15 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 16- 31 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 32- 47 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 48- 63 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 64- 79 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 80- 95 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 96-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-127 */ 0, 8, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 128-143 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 144-159 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 160-175 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 176-191 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 192-207 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 208-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-239 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 240-255 */ }, /* prefix 2 */ { 0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, /* 0- 15 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 16- 31 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 32- 47 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 48- 63 */ 0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, /* 64- 79 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 80- 95 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 96-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-127 */ 0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, /* 128-143 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 144-159 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 160-175 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 176-191 */ 0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, /* 192-207 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 208-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-239 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 240-255 */ }, /* prefix 3 */ { 0, 6, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 15 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 16- 31 */ 0, 6, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, /* 32- 47 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 48- 63 */ 0, 6, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, /* 64- 79 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 80- 95 */ 0, 6, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, /* 96-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-127 */ 0, 6, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, /* 128-143 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 144-159 */ 0, 6, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, /* 160-175 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 176-191 */ 0, 6, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, /* 192-207 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 208-223 */ 0, 6, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-239 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 240-255 */ }, /* prefix 4 */ { 0, 5, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 15 */ 0, 5, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, /* 16- 31 */ 0, 5, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, /* 32- 47 */ 0, 5, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, /* 48- 63 */ 0, 5, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, /* 64- 79 */ 0, 5, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, /* 80- 95 */ 0, 5, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, /* 96-111 */ 0, 5, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-127 */ 0, 5, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, /* 128-143 */ 0, 5, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, /* 144-159 */ 0, 5, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, /* 160-175 */ 0, 5, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, /* 176-191 */ 0, 5, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, /* 192-207 */ 0, 5, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, /* 208-223 */ 0, 5, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-239 */ 0, 5, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, /* 240-255 */ }, /* prefix 5 */ { 0, 4, 3, 3, 2, 2, 2, 2, 0, 4, 3, 3, 2, 2, 2, 2, /* 0- 15 */ 0, 4, 3, 3, 2, 2, 2, 2, 0, 4, 3, 3, 2, 2, 2, 2, /* 16- 31 */ 0, 4, 3, 3, 2, 2, 2, 2, 0, 4, 3, 3, 2, 2, 2, 2, /* 32- 47 */ 0, 4, 3, 3, 2, 2, 2, 2, 0, 4, 3, 3, 2, 2, 2, 2, /* 48- 63 */ 0, 4, 3, 3, 2, 2, 2, 2, 0, 4, 3, 3, 2, 2, 2, 2, /* 64- 79 */ 0, 4, 3, 3, 2, 2, 2, 2, 0, 4, 3, 3, 2, 2, 2, 2, /* 80- 95 */ 0, 4, 3, 3, 2, 2, 2, 2, 0, 4, 3, 3, 2, 2, 2, 2, /* 96-111 */ 0, 4, 3, 3, 2, 2, 2, 2, 0, 4, 3, 3, 2, 2, 2, 2, /* 112-127 */ 0, 4, 3, 3, 2, 2, 2, 2, 0, 4, 3, 3, 2, 2, 2, 2, /* 128-143 */ 0, 4, 3, 3, 2, 2, 2, 2, 0, 4, 3, 3, 2, 2, 2, 2, /* 144-159 */ 0, 4, 3, 3, 2, 2, 2, 2, 0, 4, 3, 3, 2, 2, 2, 2, /* 160-175 */ 0, 4, 3, 3, 2, 2, 2, 2, 0, 4, 3, 3, 2, 2, 2, 2, /* 176-191 */ 0, 4, 3, 3, 2, 2, 2, 2, 0, 4, 3, 3, 2, 2, 2, 2, /* 192-207 */ 0, 4, 3, 3, 2, 2, 2, 2, 0, 4, 3, 3, 2, 2, 2, 2, /* 208-223 */ 0, 4, 3, 3, 2, 2, 2, 2, 0, 4, 3, 3, 2, 2, 2, 2, /* 224-239 */ 0, 4, 3, 3, 2, 2, 2, 2, 0, 4, 3, 3, 2, 2, 2, 2, /* 240-255 */ }, /* prefix 6 */ { 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, /* 0- 15 */ 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, /* 16- 31 */ 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, /* 32- 47 */ 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, /* 48- 63 */ 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, /* 64- 79 */ 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, /* 80- 95 */ 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, /* 96-111 */ 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, /* 112-127 */ 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, /* 128-143 */ 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, /* 144-159 */ 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, /* 160-175 */ 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, /* 176-191 */ 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, /* 192-207 */ 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, /* 208-223 */ 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, /* 224-239 */ 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, 0, 3, 2, 2, /* 240-255 */ }, /* prefix 7 */ { 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, /* 0- 15 */ 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, /* 16- 31 */ 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, /* 32- 47 */ 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, /* 48- 63 */ 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, /* 64- 79 */ 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, /* 80- 95 */ 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, /* 96-111 */ 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, /* 112-127 */ 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, /* 128-143 */ 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, /* 144-159 */ 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, /* 160-175 */ 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, /* 176-191 */ 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, /* 192-207 */ 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, /* 208-223 */ 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, /* 224-239 */ 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, /* 240-255 */ }, /* prefix 8 */ { 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, /* 0- 15 */ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, /* 16- 31 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 32- 47 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 48- 63 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 64- 79 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 80- 95 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 96-111 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 112-127 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 128-143 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 144-159 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 160-175 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 176-191 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 192-207 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 208-223 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 224-239 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 240-255 */ }, /* prefix 9 */ { 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, /* 0- 15 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 16- 31 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 32- 47 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 48- 63 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 64- 79 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 80- 95 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 96-111 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 112-127 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 128-143 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 144-159 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 160-175 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 176-191 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 192-207 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 208-223 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 224-239 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 240-255 */ }, /* prefix 10 */ { 14,14,14,14,14,14,14,14,12,12,12,12,12,12,12,12, /* 0- 15 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 16- 31 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 32- 47 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 48- 63 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 64- 79 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 80- 95 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 96-111 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 112-127 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 128-143 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 144-159 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 160-175 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 176-191 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 192-207 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 208-223 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 224-239 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 240-255 */ }, /* prefix 11 */ { 14,14,14,14,12,12,12,12,11,11,11,11,11,11,11,11, /* 0- 15 */ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /* 16- 31 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 32- 47 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 48- 63 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 64- 79 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 80- 95 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 96-111 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 112-127 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 128-143 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 144-159 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 160-175 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 176-191 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 192-207 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 208-223 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 224-239 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 240-255 */ }, /* prefix 12 */ { 14,14,12,12,11,11,11,11,10,10,10,10,10,10,10,10, /* 0- 15 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 16- 31 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 32- 47 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 48- 63 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 64- 79 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 80- 95 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 96-111 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 112-127 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 128-143 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 144-159 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 160-175 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 176-191 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 192-207 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 208-223 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 224-239 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 240-255 */ }, /* prefix 13 */ { 14,12,11,11,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, /* 0- 15 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 16- 31 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 32- 47 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 48- 63 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 64- 79 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 80- 95 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 96-111 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 112-127 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 128-143 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 144-159 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 160-175 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 176-191 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 192-207 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 208-223 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 224-239 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 240-255 */ }, /* prefix 14 */ { 0,11,10,10, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, /* 0- 15 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 16- 31 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 32- 47 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 48- 63 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 64- 79 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 80- 95 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 96-111 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 112-127 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 128-143 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 144-159 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 160-175 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 176-191 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 192-207 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 208-223 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 224-239 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 240-255 */ }, /* prefix 15 */ { 0,10, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, /* 0- 15 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 16- 31 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 32- 47 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 48- 63 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 64- 79 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 80- 95 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 96-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-127 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 128-143 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 144-159 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 160-175 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 176-191 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 192-207 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 208-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-239 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 240-255 */ }, /* prefix 16 */ { 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, /* 0- 15 */ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, /* 16- 31 */ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, /* 32- 47 */ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, /* 48- 63 */ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, /* 64- 79 */ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, /* 80- 95 */ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, /* 96-111 */ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, /* 112-127 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 128-143 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 144-159 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 160-175 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 176-191 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 192-207 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 208-223 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 224-239 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 240-255 */ }, /* prefix 17 */ { 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, /* 0- 15 */ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, /* 16- 31 */ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, /* 32- 47 */ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, /* 48- 63 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 64- 79 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 80- 95 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 96-111 */ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, /* 112-127 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 128-143 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 144-159 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 160-175 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 176-191 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 192-207 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 208-223 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 224-239 */ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, /* 240-255 */ }, /* prefix 18 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0- 15 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 16- 31 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 32- 47 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 48- 63 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 64- 79 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 80- 95 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 96-111 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 112-127 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 128-143 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 144-159 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 160-175 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 176-191 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 192-207 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 208-223 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 224-239 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 240-255 */ }, /* prefix 19 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0- 15 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 16- 31 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 32- 47 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 48- 63 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 64- 79 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 80- 95 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 96-111 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 112-127 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 128-143 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 144-159 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 160-175 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 176-191 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 192-207 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 208-223 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 224-239 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 240-255 */ } }; u_char TIFFFaxUncompNextState[20][256] = { /* prefix 0 */ { 8, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 0- 15 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 16- 31 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 32- 47 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 48- 63 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 64- 79 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 80- 95 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 96-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-127 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 128-143 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 144-159 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 160-175 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 176-191 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 192-207 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 208-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-239 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 240-255 */ }, /* prefix 1 */ { 9, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 0- 15 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 16- 31 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 32- 47 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 48- 63 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 64- 79 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 80- 95 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 96-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-127 */ 9, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 128-143 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 144-159 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 160-175 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 176-191 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 192-207 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 208-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-239 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 240-255 */ }, /* prefix 2 */ { 10, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 0- 15 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 16- 31 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 32- 47 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 48- 63 */ 10, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 64- 79 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 80- 95 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 96-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-127 */ 10, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 128-143 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 144-159 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 160-175 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 176-191 */ 10, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 192-207 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 208-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-239 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 240-255 */ }, /* prefix 3 */ { 11, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 0- 15 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 16- 31 */ 11, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 32- 47 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 48- 63 */ 11, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 64- 79 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 80- 95 */ 11, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 96-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-127 */ 11, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 128-143 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 144-159 */ 11, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 160-175 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 176-191 */ 11, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 192-207 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 208-223 */ 11, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 224-239 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 240-255 */ }, /* prefix 4 */ { 12, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 0- 15 */ 12, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 16- 31 */ 12, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 32- 47 */ 12, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 48- 63 */ 12, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 64- 79 */ 12, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 80- 95 */ 12, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 96-111 */ 12, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 112-127 */ 12, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 128-143 */ 12, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 144-159 */ 12, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 160-175 */ 12, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 176-191 */ 12, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 192-207 */ 12, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 208-223 */ 12, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 224-239 */ 12, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 240-255 */ }, /* prefix 5 */ { 13, 0, 7, 7, 6, 6, 6, 6,13, 0, 7, 7, 6, 6, 6, 6, /* 0- 15 */ 13, 0, 7, 7, 6, 6, 6, 6,13, 0, 7, 7, 6, 6, 6, 6, /* 16- 31 */ 13, 0, 7, 7, 6, 6, 6, 6,13, 0, 7, 7, 6, 6, 6, 6, /* 32- 47 */ 13, 0, 7, 7, 6, 6, 6, 6,13, 0, 7, 7, 6, 6, 6, 6, /* 48- 63 */ 13, 0, 7, 7, 6, 6, 6, 6,13, 0, 7, 7, 6, 6, 6, 6, /* 64- 79 */ 13, 0, 7, 7, 6, 6, 6, 6,13, 0, 7, 7, 6, 6, 6, 6, /* 80- 95 */ 13, 0, 7, 7, 6, 6, 6, 6,13, 0, 7, 7, 6, 6, 6, 6, /* 96-111 */ 13, 0, 7, 7, 6, 6, 6, 6,13, 0, 7, 7, 6, 6, 6, 6, /* 112-127 */ 13, 0, 7, 7, 6, 6, 6, 6,13, 0, 7, 7, 6, 6, 6, 6, /* 128-143 */ 13, 0, 7, 7, 6, 6, 6, 6,13, 0, 7, 7, 6, 6, 6, 6, /* 144-159 */ 13, 0, 7, 7, 6, 6, 6, 6,13, 0, 7, 7, 6, 6, 6, 6, /* 160-175 */ 13, 0, 7, 7, 6, 6, 6, 6,13, 0, 7, 7, 6, 6, 6, 6, /* 176-191 */ 13, 0, 7, 7, 6, 6, 6, 6,13, 0, 7, 7, 6, 6, 6, 6, /* 192-207 */ 13, 0, 7, 7, 6, 6, 6, 6,13, 0, 7, 7, 6, 6, 6, 6, /* 208-223 */ 13, 0, 7, 7, 6, 6, 6, 6,13, 0, 7, 7, 6, 6, 6, 6, /* 224-239 */ 13, 0, 7, 7, 6, 6, 6, 6,13, 0, 7, 7, 6, 6, 6, 6, /* 240-255 */ }, /* prefix 6 */ { 14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7, /* 0- 15 */ 14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7, /* 16- 31 */ 14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7, /* 32- 47 */ 14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7, /* 48- 63 */ 14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7, /* 64- 79 */ 14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7, /* 80- 95 */ 14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7, /* 96-111 */ 14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7, /* 112-127 */ 14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7, /* 128-143 */ 14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7, /* 144-159 */ 14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7, /* 160-175 */ 14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7, /* 176-191 */ 14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7, /* 192-207 */ 14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7, /* 208-223 */ 14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7, /* 224-239 */ 14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7,14, 0, 7, 7, /* 240-255 */ }, /* prefix 7 */ { 15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0, /* 0- 15 */ 15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0, /* 16- 31 */ 15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0, /* 32- 47 */ 15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0, /* 48- 63 */ 15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0, /* 64- 79 */ 15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0, /* 80- 95 */ 15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0, /* 96-111 */ 15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0, /* 112-127 */ 15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0, /* 128-143 */ 15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0, /* 144-159 */ 15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0, /* 160-175 */ 15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0, /* 176-191 */ 15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0, /* 192-207 */ 15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0, /* 208-223 */ 15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0, /* 224-239 */ 15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0,15, 0, /* 240-255 */ }, /* prefix 8 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 15 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 16- 31 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 32- 47 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 48- 63 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 64- 79 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 80- 95 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 96-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-127 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 128-143 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 144-159 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 160-175 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 176-191 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 192-207 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 208-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-239 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 240-255 */ }, /* prefix 9 */ { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 0- 15 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 16- 31 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 32- 47 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 48- 63 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 64- 79 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 80- 95 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 96-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-127 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 128-143 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 144-159 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 160-175 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 176-191 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 192-207 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 208-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-239 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 240-255 */ }, /* prefix 10 */ { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 0- 15 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 16- 31 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 32- 47 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 48- 63 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 64- 79 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 80- 95 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 96-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-127 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 128-143 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 144-159 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 160-175 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 176-191 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 192-207 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 208-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-239 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 240-255 */ }, /* prefix 11 */ { 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 0- 15 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 16- 31 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 32- 47 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 48- 63 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 64- 79 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 80- 95 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 96-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-127 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 128-143 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 144-159 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 160-175 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 176-191 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 192-207 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 208-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-239 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 240-255 */ }, /* prefix 12 */ { 7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 0- 15 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 16- 31 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 32- 47 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 48- 63 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 64- 79 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 80- 95 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 96-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-127 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 128-143 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 144-159 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 160-175 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 176-191 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 192-207 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 208-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-239 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 240-255 */ }, /* prefix 13 */ { 0, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 0- 15 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 16- 31 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 32- 47 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 48- 63 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 64- 79 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 80- 95 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 96-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-127 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 128-143 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 144-159 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 160-175 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 176-191 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 192-207 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 208-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-239 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 240-255 */ }, /* prefix 14 */ { 16, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 0- 15 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 16- 31 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 32- 47 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 48- 63 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 64- 79 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 80- 95 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 96-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-127 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 128-143 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 144-159 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 160-175 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 176-191 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 192-207 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 208-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-239 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 240-255 */ }, /* prefix 15 */ { 17, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 0- 15 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 16- 31 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 32- 47 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 48- 63 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 64- 79 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 80- 95 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 96-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-127 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 128-143 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 144-159 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 160-175 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 176-191 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 192-207 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 208-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-239 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 240-255 */ }, /* prefix 16 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 15 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 16- 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 32- 47 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 48- 63 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 64- 79 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 80- 95 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 96-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-127 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 128-143 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 144-159 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 160-175 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 176-191 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 192-207 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 208-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-239 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 240-255 */ }, /* prefix 17 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 15 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 16- 31 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 32- 47 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 48- 63 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 64- 79 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 80- 95 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 96-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-127 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 128-143 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 144-159 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 160-175 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 176-191 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 192-207 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 208-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-239 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 240-255 */ }, /* prefix 18 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0- 15 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 16- 31 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 32- 47 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 48- 63 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 64- 79 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 80- 95 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 96-111 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 112-127 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 128-143 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 144-159 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 160-175 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 176-191 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 192-207 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 208-223 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 224-239 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 240-255 */ }, /* prefix 19 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0- 15 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 16- 31 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 32- 47 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 48- 63 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 64- 79 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 80- 95 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 96-111 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 112-127 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 128-143 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 144-159 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 160-175 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 176-191 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 192-207 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 208-223 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 224-239 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 240-255 */ } }; u_char TIFFFax1DAction[230][256] = { /* prefix 0 */ { 0, 0, 31, 32, 47, 48, 24, 24, 25, 25, 49, 50, 15, 15, /* 0- 13 */ 15, 15, 22, 22, 35, 36, 37, 38, 39, 40, 21, 21, 33, 34, /* 14- 27 */ 3, 3, 3, 3, 14, 14, 14, 14, 55, 56, 28, 28, 41, 42, /* 28- 41 */ 43, 44, 45, 46, 23, 23, 30, 30, 63, 64, 65, 2, 70, 71, /* 42- 55 */ 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, /* 56- 69 */ 13, 13, 29, 29, 61, 62, 0, 0, 20, 20, 26, 26, 51, 52, /* 70- 83 */ 53, 54, 27, 27, 57, 58, 59, 60, 68, 68, 68, 68, 91, 91, /* 84- 97 */ 91, 91, 72, 73, 0, 75, 74, 0, 0, 0, 0, 0, 69, 69, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 126-139 */ 5, 5, 5, 5, 67, 67, 67, 67, 67, 67, 67, 67, 10, 10, /* 140-153 */ 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, /* 154-167 */ 18, 18, 18, 18, 19, 19, 19, 19, 6, 6, 6, 6, 6, 6, /* 168-181 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, /* 182-195 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 16, 16, /* 196-209 */ 16, 16, 17, 17, 17, 17, 66, 66, 66, 66, 66, 66, 66, 66, /* 210-223 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 224-237 */ 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 238-251 */ 9, 9, 9, 9 }, /* prefix 1 */ { 0, 0, 0, 24, 25, 0, 15, 15, 22, 0, 0, 0, 21, 0, /* 0- 13 */ 3, 3, 14, 14, 0, 28, 0, 0, 0, 23, 30, 0, 0, 0, /* 14- 27 */ 12, 12, 12, 12, 13, 13, 13, 13, 29, 0, 0, 20, 26, 0, /* 28- 41 */ 0, 27, 0, 0, 68, 68, 91, 91, 0, 0, 0, 0, 0, 69, /* 42- 55 */ 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, /* 56- 69 */ 5, 5, 67, 67, 67, 67, 10, 10, 10, 10, 11, 11, 11, 11, /* 70- 83 */ 18, 18, 19, 19, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, /* 84- 97 */ 7, 7, 7, 7, 7, 7, 16, 16, 17, 17, 66, 66, 66, 66, /* 98-111 */ 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, /* 112-125 */ 9, 9, 0, 0, 0, 24, 25, 0, 15, 15, 22, 0, 0, 0, /* 126-139 */ 21, 0, 3, 3, 14, 14, 0, 28, 0, 0, 0, 23, 30, 0, /* 140-153 */ 0, 0, 12, 12, 12, 12, 13, 13, 13, 13, 29, 0, 0, 20, /* 154-167 */ 26, 0, 0, 27, 0, 0, 68, 68, 91, 91, 0, 0, 0, 0, /* 168-181 */ 0, 69, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, /* 182-195 */ 5, 5, 5, 5, 67, 67, 67, 67, 10, 10, 10, 10, 11, 11, /* 196-209 */ 11, 11, 18, 18, 19, 19, 6, 6, 6, 6, 6, 6, 6, 6, /* 210-223 */ 7, 7, 7, 7, 7, 7, 7, 7, 16, 16, 17, 17, 66, 66, /* 224-237 */ 66, 66, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, /* 238-251 */ 9, 9, 9, 9 }, /* prefix 2 */ { 0, 0, 0, 15, 0, 0, 0, 3, 14, 0, 0, 0, 0, 0, /* 0- 13 */ 12, 12, 13, 13, 0, 0, 0, 0, 0, 68, 91, 0, 0, 0, /* 14- 27 */ 4, 4, 4, 4, 5, 5, 5, 5, 67, 67, 10, 10, 11, 11, /* 28- 41 */ 18, 19, 6, 6, 6, 6, 7, 7, 7, 7, 16, 17, 66, 66, /* 42- 55 */ 8, 8, 8, 8, 9, 9, 9, 9, 0, 0, 0, 15, 0, 0, /* 56- 69 */ 0, 3, 14, 0, 0, 0, 0, 0, 12, 12, 13, 13, 0, 0, /* 70- 83 */ 0, 0, 0, 68, 91, 0, 0, 0, 4, 4, 4, 4, 5, 5, /* 84- 97 */ 5, 5, 67, 67, 10, 10, 11, 11, 18, 19, 6, 6, 6, 6, /* 98-111 */ 7, 7, 7, 7, 16, 17, 66, 66, 8, 8, 8, 8, 9, 9, /* 112-125 */ 9, 9, 0, 0, 0, 15, 0, 0, 0, 3, 14, 0, 0, 0, /* 126-139 */ 0, 0, 12, 12, 13, 13, 0, 0, 0, 0, 0, 68, 91, 0, /* 140-153 */ 0, 0, 4, 4, 4, 4, 5, 5, 5, 5, 67, 67, 10, 10, /* 154-167 */ 11, 11, 18, 19, 6, 6, 6, 6, 7, 7, 7, 7, 16, 17, /* 168-181 */ 66, 66, 8, 8, 8, 8, 9, 9, 9, 9, 0, 0, 0, 15, /* 182-195 */ 0, 0, 0, 3, 14, 0, 0, 0, 0, 0, 12, 12, 13, 13, /* 196-209 */ 0, 0, 0, 0, 0, 68, 91, 0, 0, 0, 4, 4, 4, 4, /* 210-223 */ 5, 5, 5, 5, 67, 67, 10, 10, 11, 11, 18, 19, 6, 6, /* 224-237 */ 6, 6, 7, 7, 7, 7, 16, 17, 66, 66, 8, 8, 8, 8, /* 238-251 */ 9, 9, 9, 9 }, /* prefix 3 */ { 0, 0, 0, 0, 0, 0, 0, 12, 13, 0, 0, 0, 0, 0, /* 0- 13 */ 4, 4, 5, 5, 67, 10, 11, 0, 6, 6, 7, 7, 0, 66, /* 14- 27 */ 8, 8, 9, 9, 0, 0, 0, 0, 0, 0, 0, 12, 13, 0, /* 28- 41 */ 0, 0, 0, 0, 4, 4, 5, 5, 67, 10, 11, 0, 6, 6, /* 42- 55 */ 7, 7, 0, 66, 8, 8, 9, 9, 0, 0, 0, 0, 0, 0, /* 56- 69 */ 0, 12, 13, 0, 0, 0, 0, 0, 4, 4, 5, 5, 67, 10, /* 70- 83 */ 11, 0, 6, 6, 7, 7, 0, 66, 8, 8, 9, 9, 0, 0, /* 84- 97 */ 0, 0, 0, 0, 0, 12, 13, 0, 0, 0, 0, 0, 4, 4, /* 98-111 */ 5, 5, 67, 10, 11, 0, 6, 6, 7, 7, 0, 66, 8, 8, /* 112-125 */ 9, 9, 0, 0, 0, 0, 0, 0, 0, 12, 13, 0, 0, 0, /* 126-139 */ 0, 0, 4, 4, 5, 5, 67, 10, 11, 0, 6, 6, 7, 7, /* 140-153 */ 0, 66, 8, 8, 9, 9, 0, 0, 0, 0, 0, 0, 0, 12, /* 154-167 */ 13, 0, 0, 0, 0, 0, 4, 4, 5, 5, 67, 10, 11, 0, /* 168-181 */ 6, 6, 7, 7, 0, 66, 8, 8, 9, 9, 0, 0, 0, 0, /* 182-195 */ 0, 0, 0, 12, 13, 0, 0, 0, 0, 0, 4, 4, 5, 5, /* 196-209 */ 67, 10, 11, 0, 6, 6, 7, 7, 0, 66, 8, 8, 9, 9, /* 210-223 */ 0, 0, 0, 0, 0, 0, 0, 12, 13, 0, 0, 0, 0, 0, /* 224-237 */ 4, 4, 5, 5, 67, 10, 11, 0, 6, 6, 7, 7, 0, 66, /* 238-251 */ 8, 8, 9, 9 }, /* prefix 4 */ { 0, 0, 0, 0, 0, 0, 0, 4, 5, 0, 0, 6, 7, 0, /* 0- 13 */ 8, 9, 0, 0, 0, 0, 0, 0, 0, 4, 5, 0, 0, 6, /* 14- 27 */ 7, 0, 8, 9, 0, 0, 0, 0, 0, 0, 0, 4, 5, 0, /* 28- 41 */ 0, 6, 7, 0, 8, 9, 0, 0, 0, 0, 0, 0, 0, 4, /* 42- 55 */ 5, 0, 0, 6, 7, 0, 8, 9, 0, 0, 0, 0, 0, 0, /* 56- 69 */ 0, 4, 5, 0, 0, 6, 7, 0, 8, 9, 0, 0, 0, 0, /* 70- 83 */ 0, 0, 0, 4, 5, 0, 0, 6, 7, 0, 8, 9, 0, 0, /* 84- 97 */ 0, 0, 0, 0, 0, 4, 5, 0, 0, 6, 7, 0, 8, 9, /* 98-111 */ 0, 0, 0, 0, 0, 0, 0, 4, 5, 0, 0, 6, 7, 0, /* 112-125 */ 8, 9, 0, 0, 0, 0, 0, 0, 0, 4, 5, 0, 0, 6, /* 126-139 */ 7, 0, 8, 9, 0, 0, 0, 0, 0, 0, 0, 4, 5, 0, /* 140-153 */ 0, 6, 7, 0, 8, 9, 0, 0, 0, 0, 0, 0, 0, 4, /* 154-167 */ 5, 0, 0, 6, 7, 0, 8, 9, 0, 0, 0, 0, 0, 0, /* 168-181 */ 0, 4, 5, 0, 0, 6, 7, 0, 8, 9, 0, 0, 0, 0, /* 182-195 */ 0, 0, 0, 4, 5, 0, 0, 6, 7, 0, 8, 9, 0, 0, /* 196-209 */ 0, 0, 0, 0, 0, 4, 5, 0, 0, 6, 7, 0, 8, 9, /* 210-223 */ 0, 0, 0, 0, 0, 0, 0, 4, 5, 0, 0, 6, 7, 0, /* 224-237 */ 8, 9, 0, 0, 0, 0, 0, 0, 0, 4, 5, 0, 0, 6, /* 238-251 */ 7, 0, 8, 9 }, /* prefix 5 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0- 13 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 14- 27 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 28- 41 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 42- 55 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 56- 69 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 70- 83 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 84- 97 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 98-111 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 112-125 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 126-139 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 140-153 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 154-167 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 168-181 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 182-195 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 196-209 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 210-223 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 224-237 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 238-251 */ 0, 0, 0, 0 }, /* prefix 6 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0- 13 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 14- 27 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 28- 41 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 42- 55 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 56- 69 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 70- 83 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 84- 97 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 98-111 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 112-125 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 126-139 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 140-153 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 154-167 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 168-181 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 182-195 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 196-209 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 210-223 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 224-237 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 238-251 */ 0, 0, 0, 0 }, /* prefix 7 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0- 13 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 14- 27 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 28- 41 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 42- 55 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 56- 69 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 70- 83 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 84- 97 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 98-111 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 112-125 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 126-139 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 140-153 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 154-167 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 168-181 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 182-195 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 196-209 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 210-223 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 224-237 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 238-251 */ 0, 0, 0, 0 }, /* prefix 8 */ { 0, 0, 0, 0,119, 0, 0,120,116,116,117,117, 0, 0, /* 0- 13 */ 118,118,115,115,115,115,114,114,114,114,113,113,113,113, /* 14- 27 */ 113,113,113,113,112,112,112,112,112,112,112,112,112,112, /* 28- 41 */ 112,112,112,112,112,112,111,111,111,111,111,111,111,111, /* 42- 55 */ 111,111,111,111,111,111,111,111,107,107,107,107,107,107, /* 56- 69 */ 107,107,107,107,107,107,107,107,107,107,107,107,107,107, /* 70- 83 */ 107,107,107,107,107,107,107,107,107,107,107,107,110,110, /* 84- 97 */ 110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* 98-111 */ 110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* 112-125 */ 110,110,109,109,109,109,109,109,109,109,109,109,109,109, /* 126-139 */ 109,109,109,109,109,109,109,109,109,109,109,109,109,109, /* 140-153 */ 109,109,109,109,109,109,109,109,109,109,109,109,109,109, /* 154-167 */ 109,109,109,109,109,109,109,109,109,109,109,109,109,109, /* 168-181 */ 109,109,109,109,109,109,109,109,109,109,108,108,108,108, /* 182-195 */ 108,108,108,108,108,108,108,108,108,108,108,108,108,108, /* 196-209 */ 108,108,108,108,108,108,108,108,108,108,108,108,108,108, /* 210-223 */ 108,108,108,108,108,108,108,108,108,108,108,108,108,108, /* 224-237 */ 108,108,108,108,108,108,108,108,108,108,108,108,108,108, /* 238-251 */ 108,108,108,108 }, /* prefix 9 */ { 0, 0, 0, 0,116,117, 0,118,115,115,114,114,113,113, /* 0- 13 */ 113,113,112,112,112,112,112,112,112,112,111,111,111,111, /* 14- 27 */ 111,111,111,111,107,107,107,107,107,107,107,107,107,107, /* 28- 41 */ 107,107,107,107,107,107,110,110,110,110,110,110,110,110, /* 42- 55 */ 110,110,110,110,110,110,110,110,109,109,109,109,109,109, /* 56- 69 */ 109,109,109,109,109,109,109,109,109,109,109,109,109,109, /* 70- 83 */ 109,109,109,109,109,109,109,109,109,109,109,109,108,108, /* 84- 97 */ 108,108,108,108,108,108,108,108,108,108,108,108,108,108, /* 98-111 */ 108,108,108,108,108,108,108,108,108,108,108,108,108,108, /* 112-125 */ 108,108, 0, 0, 0, 0,116,117, 0,118,115,115,114,114, /* 126-139 */ 113,113,113,113,112,112,112,112,112,112,112,112,111,111, /* 140-153 */ 111,111,111,111,111,111,107,107,107,107,107,107,107,107, /* 154-167 */ 107,107,107,107,107,107,107,107,110,110,110,110,110,110, /* 168-181 */ 110,110,110,110,110,110,110,110,110,110,109,109,109,109, /* 182-195 */ 109,109,109,109,109,109,109,109,109,109,109,109,109,109, /* 196-209 */ 109,109,109,109,109,109,109,109,109,109,109,109,109,109, /* 210-223 */ 108,108,108,108,108,108,108,108,108,108,108,108,108,108, /* 224-237 */ 108,108,108,108,108,108,108,108,108,108,108,108,108,108, /* 238-251 */ 108,108,108,108 }, /* prefix 10 */ { 0, 0, 0, 0,115,114,113,113,112,112,112,112,111,111, /* 0- 13 */ 111,111,107,107,107,107,107,107,107,107,110,110,110,110, /* 14- 27 */ 110,110,110,110,109,109,109,109,109,109,109,109,109,109, /* 28- 41 */ 109,109,109,109,109,109,108,108,108,108,108,108,108,108, /* 42- 55 */ 108,108,108,108,108,108,108,108, 0, 0, 0, 0,115,114, /* 56- 69 */ 113,113,112,112,112,112,111,111,111,111,107,107,107,107, /* 70- 83 */ 107,107,107,107,110,110,110,110,110,110,110,110,109,109, /* 84- 97 */ 109,109,109,109,109,109,109,109,109,109,109,109,109,109, /* 98-111 */ 108,108,108,108,108,108,108,108,108,108,108,108,108,108, /* 112-125 */ 108,108, 0, 0, 0, 0,115,114,113,113,112,112,112,112, /* 126-139 */ 111,111,111,111,107,107,107,107,107,107,107,107,110,110, /* 140-153 */ 110,110,110,110,110,110,109,109,109,109,109,109,109,109, /* 154-167 */ 109,109,109,109,109,109,109,109,108,108,108,108,108,108, /* 168-181 */ 108,108,108,108,108,108,108,108,108,108, 0, 0, 0, 0, /* 182-195 */ 115,114,113,113,112,112,112,112,111,111,111,111,107,107, /* 196-209 */ 107,107,107,107,107,107,110,110,110,110,110,110,110,110, /* 210-223 */ 109,109,109,109,109,109,109,109,109,109,109,109,109,109, /* 224-237 */ 109,109,108,108,108,108,108,108,108,108,108,108,108,108, /* 238-251 */ 108,108,108,108 }, /* prefix 11 */ { 0, 0, 0,113,112,112,111,111,107,107,107,107,110,110, /* 0- 13 */ 110,110,109,109,109,109,109,109,109,109,108,108,108,108, /* 14- 27 */ 108,108,108,108, 0, 0, 0,113,112,112,111,111,107,107, /* 28- 41 */ 107,107,110,110,110,110,109,109,109,109,109,109,109,109, /* 42- 55 */ 108,108,108,108,108,108,108,108, 0, 0, 0,113,112,112, /* 56- 69 */ 111,111,107,107,107,107,110,110,110,110,109,109,109,109, /* 70- 83 */ 109,109,109,109,108,108,108,108,108,108,108,108, 0, 0, /* 84- 97 */ 0,113,112,112,111,111,107,107,107,107,110,110,110,110, /* 98-111 */ 109,109,109,109,109,109,109,109,108,108,108,108,108,108, /* 112-125 */ 108,108, 0, 0, 0,113,112,112,111,111,107,107,107,107, /* 126-139 */ 110,110,110,110,109,109,109,109,109,109,109,109,108,108, /* 140-153 */ 108,108,108,108,108,108, 0, 0, 0,113,112,112,111,111, /* 154-167 */ 107,107,107,107,110,110,110,110,109,109,109,109,109,109, /* 168-181 */ 109,109,108,108,108,108,108,108,108,108, 0, 0, 0,113, /* 182-195 */ 112,112,111,111,107,107,107,107,110,110,110,110,109,109, /* 196-209 */ 109,109,109,109,109,109,108,108,108,108,108,108,108,108, /* 210-223 */ 0, 0, 0,113,112,112,111,111,107,107,107,107,110,110, /* 224-237 */ 110,110,109,109,109,109,109,109,109,109,108,108,108,108, /* 238-251 */ 108,108,108,108 }, /* prefix 12 */ { 0, 0,112,111,107,107,110,110,109,109,109,109,108,108, /* 0- 13 */ 108,108, 0, 0,112,111,107,107,110,110,109,109,109,109, /* 14- 27 */ 108,108,108,108, 0, 0,112,111,107,107,110,110,109,109, /* 28- 41 */ 109,109,108,108,108,108, 0, 0,112,111,107,107,110,110, /* 42- 55 */ 109,109,109,109,108,108,108,108, 0, 0,112,111,107,107, /* 56- 69 */ 110,110,109,109,109,109,108,108,108,108, 0, 0,112,111, /* 70- 83 */ 107,107,110,110,109,109,109,109,108,108,108,108, 0, 0, /* 84- 97 */ 112,111,107,107,110,110,109,109,109,109,108,108,108,108, /* 98-111 */ 0, 0,112,111,107,107,110,110,109,109,109,109,108,108, /* 112-125 */ 108,108, 0, 0,112,111,107,107,110,110,109,109,109,109, /* 126-139 */ 108,108,108,108, 0, 0,112,111,107,107,110,110,109,109, /* 140-153 */ 109,109,108,108,108,108, 0, 0,112,111,107,107,110,110, /* 154-167 */ 109,109,109,109,108,108,108,108, 0, 0,112,111,107,107, /* 168-181 */ 110,110,109,109,109,109,108,108,108,108, 0, 0,112,111, /* 182-195 */ 107,107,110,110,109,109,109,109,108,108,108,108, 0, 0, /* 196-209 */ 112,111,107,107,110,110,109,109,109,109,108,108,108,108, /* 210-223 */ 0, 0,112,111,107,107,110,110,109,109,109,109,108,108, /* 224-237 */ 108,108, 0, 0,112,111,107,107,110,110,109,109,109,109, /* 238-251 */ 108,108,108,108 }, /* prefix 13 */ { 0, 0,107,110,109,109,108,108, 0, 0,107,110,109,109, /* 0- 13 */ 108,108, 0, 0,107,110,109,109,108,108, 0, 0,107,110, /* 14- 27 */ 109,109,108,108, 0, 0,107,110,109,109,108,108, 0, 0, /* 28- 41 */ 107,110,109,109,108,108, 0, 0,107,110,109,109,108,108, /* 42- 55 */ 0, 0,107,110,109,109,108,108, 0, 0,107,110,109,109, /* 56- 69 */ 108,108, 0, 0,107,110,109,109,108,108, 0, 0,107,110, /* 70- 83 */ 109,109,108,108, 0, 0,107,110,109,109,108,108, 0, 0, /* 84- 97 */ 107,110,109,109,108,108, 0, 0,107,110,109,109,108,108, /* 98-111 */ 0, 0,107,110,109,109,108,108, 0, 0,107,110,109,109, /* 112-125 */ 108,108, 0, 0,107,110,109,109,108,108, 0, 0,107,110, /* 126-139 */ 109,109,108,108, 0, 0,107,110,109,109,108,108, 0, 0, /* 140-153 */ 107,110,109,109,108,108, 0, 0,107,110,109,109,108,108, /* 154-167 */ 0, 0,107,110,109,109,108,108, 0, 0,107,110,109,109, /* 168-181 */ 108,108, 0, 0,107,110,109,109,108,108, 0, 0,107,110, /* 182-195 */ 109,109,108,108, 0, 0,107,110,109,109,108,108, 0, 0, /* 196-209 */ 107,110,109,109,108,108, 0, 0,107,110,109,109,108,108, /* 210-223 */ 0, 0,107,110,109,109,108,108, 0, 0,107,110,109,109, /* 224-237 */ 108,108, 0, 0,107,110,109,109,108,108, 0, 0,107,110, /* 238-251 */ 109,109,108,108 }, /* prefix 14 */ { 0, 0,109,108, 0, 0,109,108, 0, 0,109,108, 0, 0, /* 0- 13 */ 109,108, 0, 0,109,108, 0, 0,109,108, 0, 0,109,108, /* 14- 27 */ 0, 0,109,108, 0, 0,109,108, 0, 0,109,108, 0, 0, /* 28- 41 */ 109,108, 0, 0,109,108, 0, 0,109,108, 0, 0,109,108, /* 42- 55 */ 0, 0,109,108, 0, 0,109,108, 0, 0,109,108, 0, 0, /* 56- 69 */ 109,108, 0, 0,109,108, 0, 0,109,108, 0, 0,109,108, /* 70- 83 */ 0, 0,109,108, 0, 0,109,108, 0, 0,109,108, 0, 0, /* 84- 97 */ 109,108, 0, 0,109,108, 0, 0,109,108, 0, 0,109,108, /* 98-111 */ 0, 0,109,108, 0, 0,109,108, 0, 0,109,108, 0, 0, /* 112-125 */ 109,108, 0, 0,109,108, 0, 0,109,108, 0, 0,109,108, /* 126-139 */ 0, 0,109,108, 0, 0,109,108, 0, 0,109,108, 0, 0, /* 140-153 */ 109,108, 0, 0,109,108, 0, 0,109,108, 0, 0,109,108, /* 154-167 */ 0, 0,109,108, 0, 0,109,108, 0, 0,109,108, 0, 0, /* 168-181 */ 109,108, 0, 0,109,108, 0, 0,109,108, 0, 0,109,108, /* 182-195 */ 0, 0,109,108, 0, 0,109,108, 0, 0,109,108, 0, 0, /* 196-209 */ 109,108, 0, 0,109,108, 0, 0,109,108, 0, 0,109,108, /* 210-223 */ 0, 0,109,108, 0, 0,109,108, 0, 0,109,108, 0, 0, /* 224-237 */ 109,108, 0, 0,109,108, 0, 0,109,108, 0, 0,109,108, /* 238-251 */ 0, 0,109,108 }, /* prefix 15 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0- 13 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 14- 27 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 28- 41 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 42- 55 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 56- 69 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 70- 83 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 84- 97 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 98-111 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 112-125 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 126-139 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 140-153 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 154-167 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 168-181 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 182-195 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 196-209 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 210-223 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 224-237 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 238-251 */ 0, 0, 0, 0 }, /* prefix 16 */ { 0,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 0- 13 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 14- 27 */ 210,210,210,210, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 17 */ { 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, /* 0- 13 */ 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, /* 14- 27 */ 93, 93, 93, 93, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* 28- 41 */ 96, 96, 96, 96, 96, 96, 97, 97, 97, 97, 97, 97, 97, 97, /* 42- 55 */ 97, 97, 97, 97, 97, 97, 97, 97, 98, 98, 98, 98, 98, 98, /* 56- 69 */ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 99, 99, 99, 99, /* 70- 83 */ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,100,100, /* 84- 97 */ 100,100,100,100,100,100,100,100,100,100,100,100,100,100, /* 98-111 */ 101,101,101,101,101,101,101,101,101,101,101,101,101,101, /* 112-125 */ 101,101, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, /* 126-139 */ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, /* 140-153 */ 94, 94, 94, 94, 94, 94, 95, 95, 95, 95, 95, 95, 95, 95, /* 154-167 */ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* 168-181 */ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,102,102,102,102, /* 182-195 */ 102,102,102,102,102,102,102,102,102,102,102,102,103,103, /* 196-209 */ 103,103,103,103,103,103,103,103,103,103,103,103,103,103, /* 210-223 */ 104,104,104,104,104,104,104,104,104,104,104,104,104,104, /* 224-237 */ 104,104,105,105,105,105,105,105,105,105,105,105,105,105, /* 238-251 */ 105,105,105,105 }, /* prefix 18 */ { 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, /* 0- 13 */ 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, /* 14- 27 */ 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, /* 28- 41 */ 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, /* 42- 55 */ 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, /* 56- 69 */ 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, /* 70- 83 */ 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, /* 84- 97 */ 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, /* 98-111 */ 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, /* 112-125 */ 88, 88, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, /* 126-139 */ 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, /* 140-153 */ 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, /* 154-167 */ 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, /* 168-181 */ 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, /* 182-195 */ 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, /* 196-209 */ 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, /* 210-223 */ 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, /* 224-237 */ 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, /* 238-251 */ 89, 89, 89, 89 }, /* prefix 19 */ { 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, /* 0- 13 */ 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, /* 14- 27 */ 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, /* 28- 41 */ 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, /* 42- 55 */ 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, /* 56- 69 */ 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, /* 70- 83 */ 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, /* 84- 97 */ 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, /* 98-111 */ 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, /* 112-125 */ 90, 90, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* 126-139 */ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* 140-153 */ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* 154-167 */ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* 168-181 */ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* 182-195 */ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* 196-209 */ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* 210-223 */ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* 224-237 */ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* 238-251 */ 92, 92, 92, 92 }, /* prefix 20 */ { 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, /* 0- 13 */ 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, /* 14- 27 */ 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, /* 28- 41 */ 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, /* 42- 55 */ 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, /* 56- 69 */ 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, /* 70- 83 */ 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, /* 84- 97 */ 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, /* 98-111 */ 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, /* 112-125 */ 76, 76, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, /* 126-139 */ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, /* 140-153 */ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, /* 154-167 */ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, /* 168-181 */ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, /* 182-195 */ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, /* 196-209 */ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, /* 210-223 */ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, /* 224-237 */ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, /* 238-251 */ 77, 77, 77, 77 }, /* prefix 21 */ { 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, /* 0- 13 */ 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, /* 14- 27 */ 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, /* 28- 41 */ 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, /* 42- 55 */ 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, /* 56- 69 */ 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, /* 70- 83 */ 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, /* 84- 97 */ 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, /* 98-111 */ 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, /* 112-125 */ 78, 78, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* 126-139 */ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* 140-153 */ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* 154-167 */ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* 168-181 */ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* 182-195 */ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* 196-209 */ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* 210-223 */ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* 224-237 */ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* 238-251 */ 79, 79, 79, 79 }, /* prefix 22 */ { 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, /* 0- 13 */ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, /* 14- 27 */ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, /* 28- 41 */ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, /* 42- 55 */ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, /* 56- 69 */ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, /* 70- 83 */ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, /* 84- 97 */ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, /* 98-111 */ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, /* 112-125 */ 80, 80, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, /* 126-139 */ 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, /* 140-153 */ 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, /* 154-167 */ 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, /* 168-181 */ 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, /* 182-195 */ 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, /* 196-209 */ 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, /* 210-223 */ 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, /* 224-237 */ 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, /* 238-251 */ 81, 81, 81, 81 }, /* prefix 23 */ { 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, /* 0- 13 */ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, /* 14- 27 */ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, /* 28- 41 */ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, /* 42- 55 */ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, /* 56- 69 */ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, /* 70- 83 */ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, /* 84- 97 */ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, /* 98-111 */ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, /* 112-125 */ 82, 82, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, /* 126-139 */ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, /* 140-153 */ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, /* 154-167 */ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, /* 168-181 */ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, /* 182-195 */ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, /* 196-209 */ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, /* 210-223 */ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, /* 224-237 */ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, /* 238-251 */ 83, 83, 83, 83 }, /* prefix 24 */ { 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, /* 0- 13 */ 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, /* 14- 27 */ 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, /* 28- 41 */ 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, /* 42- 55 */ 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, /* 56- 69 */ 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, /* 70- 83 */ 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, /* 84- 97 */ 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, /* 98-111 */ 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, /* 112-125 */ 84, 84, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, /* 126-139 */ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, /* 140-153 */ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, /* 154-167 */ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, /* 168-181 */ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, /* 182-195 */ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, /* 196-209 */ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, /* 210-223 */ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, /* 224-237 */ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, /* 238-251 */ 85, 85, 85, 85 }, /* prefix 25 */ { 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, /* 0- 13 */ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, /* 14- 27 */ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, /* 28- 41 */ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, /* 42- 55 */ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, /* 56- 69 */ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, /* 70- 83 */ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, /* 84- 97 */ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, /* 98-111 */ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, /* 112-125 */ 86, 86, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, /* 126-139 */ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, /* 140-153 */ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, /* 154-167 */ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, /* 168-181 */ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, /* 182-195 */ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, /* 196-209 */ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, /* 210-223 */ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, /* 224-237 */ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, /* 238-251 */ 87, 87, 87, 87 }, /* prefix 26 */ { 0,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 0- 13 */ 210,210, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, /* 126-139 */ 93, 93, 93, 93, 96, 96, 96, 96, 96, 96, 96, 96, 97, 97, /* 140-153 */ 97, 97, 97, 97, 97, 97, 98, 98, 98, 98, 98, 98, 98, 98, /* 154-167 */ 99, 99, 99, 99, 99, 99, 99, 99,100,100,100,100,100,100, /* 168-181 */ 100,100,101,101,101,101,101,101,101,101, 94, 94, 94, 94, /* 182-195 */ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 95, 95, /* 196-209 */ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* 210-223 */ 102,102,102,102,102,102,102,102,103,103,103,103,103,103, /* 224-237 */ 103,103,104,104,104,104,104,104,104,104,105,105,105,105, /* 238-251 */ 105,105,105,105 }, /* prefix 27 */ { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, /* 0- 13 */ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, /* 14- 27 */ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, /* 28- 41 */ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, /* 42- 55 */ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, /* 56- 69 */ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, /* 70- 83 */ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, /* 84- 97 */ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, /* 98-111 */ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, /* 112-125 */ 31, 31, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 126-139 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 140-153 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 154-167 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 168-181 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 182-195 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 196-209 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 210-223 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 224-237 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 238-251 */ 32, 32, 32, 32 }, /* prefix 28 */ { 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, /* 0- 13 */ 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, /* 14- 27 */ 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, /* 28- 41 */ 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, /* 42- 55 */ 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, /* 56- 69 */ 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, /* 70- 83 */ 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, /* 84- 97 */ 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, /* 98-111 */ 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, /* 112-125 */ 47, 47, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, /* 126-139 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, /* 140-153 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, /* 154-167 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, /* 168-181 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, /* 182-195 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, /* 196-209 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, /* 210-223 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, /* 224-237 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, /* 238-251 */ 48, 48, 48, 48 }, /* prefix 29 */ { 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, /* 0- 13 */ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, /* 14- 27 */ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, /* 28- 41 */ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, /* 42- 55 */ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, /* 56- 69 */ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, /* 70- 83 */ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, /* 84- 97 */ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, /* 98-111 */ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, /* 112-125 */ 49, 49, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, /* 126-139 */ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, /* 140-153 */ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, /* 154-167 */ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, /* 168-181 */ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, /* 182-195 */ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, /* 196-209 */ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, /* 210-223 */ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, /* 224-237 */ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, /* 238-251 */ 50, 50, 50, 50 }, /* prefix 30 */ { 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, /* 0- 13 */ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, /* 14- 27 */ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, /* 28- 41 */ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, /* 42- 55 */ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, /* 56- 69 */ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, /* 70- 83 */ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, /* 84- 97 */ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, /* 98-111 */ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, /* 112-125 */ 35, 35, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, /* 126-139 */ 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, /* 140-153 */ 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, /* 154-167 */ 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, /* 168-181 */ 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, /* 182-195 */ 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, /* 196-209 */ 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, /* 210-223 */ 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, /* 224-237 */ 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, /* 238-251 */ 36, 36, 36, 36 }, /* prefix 31 */ { 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, /* 0- 13 */ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, /* 14- 27 */ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, /* 28- 41 */ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, /* 42- 55 */ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, /* 56- 69 */ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, /* 70- 83 */ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, /* 84- 97 */ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, /* 98-111 */ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, /* 112-125 */ 37, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, /* 126-139 */ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, /* 140-153 */ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, /* 154-167 */ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, /* 168-181 */ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, /* 182-195 */ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, /* 196-209 */ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, /* 210-223 */ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, /* 224-237 */ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, /* 238-251 */ 38, 38, 38, 38 }, /* prefix 32 */ { 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, /* 0- 13 */ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, /* 14- 27 */ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, /* 28- 41 */ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, /* 42- 55 */ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, /* 56- 69 */ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, /* 70- 83 */ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, /* 84- 97 */ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, /* 98-111 */ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, /* 112-125 */ 39, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, /* 126-139 */ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, /* 140-153 */ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, /* 154-167 */ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, /* 168-181 */ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, /* 182-195 */ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, /* 196-209 */ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, /* 210-223 */ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, /* 224-237 */ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, /* 238-251 */ 40, 40, 40, 40 }, /* prefix 33 */ { 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, /* 0- 13 */ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, /* 14- 27 */ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, /* 28- 41 */ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, /* 42- 55 */ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, /* 56- 69 */ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, /* 70- 83 */ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, /* 84- 97 */ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, /* 98-111 */ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, /* 112-125 */ 33, 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, /* 126-139 */ 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, /* 140-153 */ 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, /* 154-167 */ 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, /* 168-181 */ 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, /* 182-195 */ 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, /* 196-209 */ 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, /* 210-223 */ 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, /* 224-237 */ 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, /* 238-251 */ 34, 34, 34, 34 }, /* prefix 34 */ { 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, /* 0- 13 */ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, /* 14- 27 */ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, /* 28- 41 */ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, /* 42- 55 */ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, /* 56- 69 */ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, /* 70- 83 */ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, /* 84- 97 */ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, /* 98-111 */ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, /* 112-125 */ 55, 55, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, /* 126-139 */ 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, /* 140-153 */ 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, /* 154-167 */ 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, /* 168-181 */ 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, /* 182-195 */ 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, /* 196-209 */ 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, /* 210-223 */ 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, /* 224-237 */ 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, /* 238-251 */ 56, 56, 56, 56 }, /* prefix 35 */ { 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, /* 0- 13 */ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, /* 14- 27 */ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, /* 28- 41 */ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, /* 42- 55 */ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, /* 56- 69 */ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, /* 70- 83 */ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, /* 84- 97 */ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, /* 98-111 */ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, /* 112-125 */ 41, 41, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, /* 126-139 */ 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, /* 140-153 */ 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, /* 154-167 */ 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, /* 168-181 */ 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, /* 182-195 */ 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, /* 196-209 */ 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, /* 210-223 */ 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, /* 224-237 */ 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, /* 238-251 */ 42, 42, 42, 42 }, /* prefix 36 */ { 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, /* 0- 13 */ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, /* 14- 27 */ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, /* 28- 41 */ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, /* 42- 55 */ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, /* 56- 69 */ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, /* 70- 83 */ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, /* 84- 97 */ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, /* 98-111 */ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, /* 112-125 */ 43, 43, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, /* 126-139 */ 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, /* 140-153 */ 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, /* 154-167 */ 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, /* 168-181 */ 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, /* 182-195 */ 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, /* 196-209 */ 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, /* 210-223 */ 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, /* 224-237 */ 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, /* 238-251 */ 44, 44, 44, 44 }, /* prefix 37 */ { 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, /* 0- 13 */ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, /* 14- 27 */ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, /* 28- 41 */ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, /* 42- 55 */ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, /* 56- 69 */ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, /* 70- 83 */ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, /* 84- 97 */ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, /* 98-111 */ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, /* 112-125 */ 45, 45, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, /* 126-139 */ 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, /* 140-153 */ 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, /* 154-167 */ 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, /* 168-181 */ 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, /* 182-195 */ 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, /* 196-209 */ 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, /* 210-223 */ 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, /* 224-237 */ 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, /* 238-251 */ 46, 46, 46, 46 }, /* prefix 38 */ { 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, /* 0- 13 */ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, /* 14- 27 */ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, /* 28- 41 */ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, /* 42- 55 */ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, /* 56- 69 */ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, /* 70- 83 */ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, /* 84- 97 */ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, /* 98-111 */ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, /* 112-125 */ 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, /* 126-139 */ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, /* 140-153 */ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, /* 154-167 */ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, /* 168-181 */ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, /* 182-195 */ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, /* 196-209 */ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, /* 210-223 */ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, /* 224-237 */ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, /* 238-251 */ 64, 64, 64, 64 }, /* prefix 39 */ { 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, /* 0- 13 */ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, /* 14- 27 */ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, /* 28- 41 */ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, /* 42- 55 */ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, /* 56- 69 */ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, /* 70- 83 */ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, /* 84- 97 */ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, /* 98-111 */ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, /* 112-125 */ 65, 65, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 40 */ { 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, /* 0- 13 */ 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, /* 14- 27 */ 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, /* 28- 41 */ 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, /* 42- 55 */ 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, /* 56- 69 */ 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, /* 70- 83 */ 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, /* 84- 97 */ 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, /* 98-111 */ 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, /* 112-125 */ 70, 70, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, /* 126-139 */ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, /* 140-153 */ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, /* 154-167 */ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, /* 168-181 */ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, /* 182-195 */ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, /* 196-209 */ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, /* 210-223 */ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, /* 224-237 */ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, /* 238-251 */ 71, 71, 71, 71 }, /* prefix 41 */ { 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, /* 0- 13 */ 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, /* 14- 27 */ 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, /* 28- 41 */ 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, /* 42- 55 */ 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, /* 56- 69 */ 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, /* 70- 83 */ 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, /* 84- 97 */ 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, /* 98-111 */ 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, /* 112-125 */ 61, 61, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, /* 126-139 */ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, /* 140-153 */ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, /* 154-167 */ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, /* 168-181 */ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, /* 182-195 */ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, /* 196-209 */ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, /* 210-223 */ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, /* 224-237 */ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, /* 238-251 */ 62, 62, 62, 62 }, /* prefix 42 */ { 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, /* 0- 13 */ 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, /* 14- 27 */ 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, /* 28- 41 */ 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, /* 42- 55 */ 88, 88, 88, 88, 88, 88, 88, 88, 89, 89, 89, 89, 89, 89, /* 56- 69 */ 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, /* 70- 83 */ 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, /* 84- 97 */ 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, /* 98-111 */ 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, /* 112-125 */ 89, 89, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, /* 126-139 */ 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, /* 140-153 */ 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, /* 154-167 */ 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, /* 168-181 */ 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 92, 92, 92, 92, /* 182-195 */ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* 196-209 */ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* 210-223 */ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* 224-237 */ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* 238-251 */ 92, 92, 92, 92 }, /* prefix 43 */ { 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, /* 0- 13 */ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, /* 14- 27 */ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, /* 28- 41 */ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, /* 42- 55 */ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, /* 56- 69 */ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, /* 70- 83 */ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, /* 84- 97 */ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, /* 98-111 */ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, /* 112-125 */ 51, 51, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, /* 126-139 */ 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, /* 140-153 */ 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, /* 154-167 */ 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, /* 168-181 */ 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, /* 182-195 */ 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, /* 196-209 */ 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, /* 210-223 */ 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, /* 224-237 */ 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, /* 238-251 */ 52, 52, 52, 52 }, /* prefix 44 */ { 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, /* 0- 13 */ 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, /* 14- 27 */ 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, /* 28- 41 */ 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, /* 42- 55 */ 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, /* 56- 69 */ 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, /* 70- 83 */ 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, /* 84- 97 */ 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, /* 98-111 */ 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, /* 112-125 */ 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, /* 126-139 */ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, /* 140-153 */ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, /* 154-167 */ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, /* 168-181 */ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, /* 182-195 */ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, /* 196-209 */ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, /* 210-223 */ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, /* 224-237 */ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, /* 238-251 */ 54, 54, 54, 54 }, /* prefix 45 */ { 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, /* 0- 13 */ 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, /* 14- 27 */ 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, /* 28- 41 */ 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, /* 42- 55 */ 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, /* 56- 69 */ 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, /* 70- 83 */ 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, /* 84- 97 */ 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, /* 98-111 */ 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, /* 112-125 */ 57, 57, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, /* 126-139 */ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, /* 140-153 */ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, /* 154-167 */ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, /* 168-181 */ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, /* 182-195 */ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, /* 196-209 */ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, /* 210-223 */ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, /* 224-237 */ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, /* 238-251 */ 58, 58, 58, 58 }, /* prefix 46 */ { 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, /* 0- 13 */ 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, /* 14- 27 */ 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, /* 28- 41 */ 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, /* 42- 55 */ 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, /* 56- 69 */ 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, /* 70- 83 */ 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, /* 84- 97 */ 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, /* 98-111 */ 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, /* 112-125 */ 59, 59, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, /* 126-139 */ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, /* 140-153 */ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, /* 154-167 */ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, /* 168-181 */ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, /* 182-195 */ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, /* 196-209 */ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, /* 210-223 */ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, /* 224-237 */ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, /* 238-251 */ 60, 60, 60, 60 }, /* prefix 47 */ { 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, /* 0- 13 */ 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, /* 14- 27 */ 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, /* 28- 41 */ 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, /* 42- 55 */ 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, /* 56- 69 */ 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, /* 70- 83 */ 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, /* 84- 97 */ 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, /* 98-111 */ 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, /* 112-125 */ 72, 72, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, /* 126-139 */ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, /* 140-153 */ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, /* 154-167 */ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, /* 168-181 */ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, /* 182-195 */ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, /* 196-209 */ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, /* 210-223 */ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, /* 224-237 */ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, /* 238-251 */ 73, 73, 73, 73 }, /* prefix 48 */ { 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, /* 0- 13 */ 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, /* 14- 27 */ 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, /* 28- 41 */ 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, /* 42- 55 */ 76, 76, 76, 76, 76, 76, 76, 76, 77, 77, 77, 77, 77, 77, /* 56- 69 */ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, /* 70- 83 */ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, /* 84- 97 */ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, /* 98-111 */ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, /* 112-125 */ 77, 77, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, /* 126-139 */ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, /* 140-153 */ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, /* 154-167 */ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, /* 168-181 */ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, /* 182-195 */ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, /* 196-209 */ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, /* 210-223 */ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, /* 224-237 */ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, /* 238-251 */ 75, 75, 75, 75 }, /* prefix 49 */ { 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, /* 0- 13 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, /* 14- 27 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, /* 28- 41 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, /* 42- 55 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, /* 56- 69 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, /* 70- 83 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, /* 84- 97 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, /* 98-111 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, /* 112-125 */ 74, 74, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, /* 126-139 */ 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, /* 140-153 */ 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, /* 154-167 */ 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, /* 168-181 */ 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 79, 79, 79, 79, /* 182-195 */ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* 196-209 */ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* 210-223 */ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* 224-237 */ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* 238-251 */ 79, 79, 79, 79 }, /* prefix 50 */ { 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, /* 0- 13 */ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, /* 14- 27 */ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, /* 28- 41 */ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, /* 42- 55 */ 80, 80, 80, 80, 80, 80, 80, 80, 81, 81, 81, 81, 81, 81, /* 56- 69 */ 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, /* 70- 83 */ 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, /* 84- 97 */ 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, /* 98-111 */ 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, /* 112-125 */ 81, 81, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, /* 126-139 */ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, /* 140-153 */ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, /* 154-167 */ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, /* 168-181 */ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 83, 83, 83, 83, /* 182-195 */ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, /* 196-209 */ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, /* 210-223 */ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, /* 224-237 */ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, /* 238-251 */ 83, 83, 83, 83 }, /* prefix 51 */ { 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, /* 0- 13 */ 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, /* 14- 27 */ 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, /* 28- 41 */ 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, /* 42- 55 */ 84, 84, 84, 84, 84, 84, 84, 84, 85, 85, 85, 85, 85, 85, /* 56- 69 */ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, /* 70- 83 */ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, /* 84- 97 */ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, /* 98-111 */ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, /* 112-125 */ 85, 85, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, /* 126-139 */ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, /* 140-153 */ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, /* 154-167 */ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, /* 168-181 */ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 87, 87, 87, 87, /* 182-195 */ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, /* 196-209 */ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, /* 210-223 */ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, /* 224-237 */ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, /* 238-251 */ 87, 87, 87, 87 }, /* prefix 52 */ { 0,210,210,210,210,210,210,210, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 93, 93, 93, 93, 93, 93, /* 56- 69 */ 93, 93, 96, 96, 96, 96, 97, 97, 97, 97, 98, 98, 98, 98, /* 70- 83 */ 99, 99, 99, 99,100,100,100,100,101,101,101,101, 94, 94, /* 84- 97 */ 94, 94, 94, 94, 94, 94, 95, 95, 95, 95, 95, 95, 95, 95, /* 98-111 */ 102,102,102,102,103,103,103,103,104,104,104,104,105,105, /* 112-125 */ 105,105, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, /* 126-139 */ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, /* 140-153 */ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, /* 154-167 */ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, /* 168-181 */ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, /* 182-195 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 196-209 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 210-223 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 224-237 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 238-251 */ 32, 32, 32, 32 }, /* prefix 53 */ { 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, /* 0- 13 */ 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, /* 14- 27 */ 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, /* 28- 41 */ 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, /* 42- 55 */ 47, 47, 47, 47, 47, 47, 47, 47, 48, 48, 48, 48, 48, 48, /* 56- 69 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, /* 70- 83 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, /* 84- 97 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, /* 98-111 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, /* 112-125 */ 48, 48, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, /* 126-139 */ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, /* 140-153 */ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, /* 154-167 */ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, /* 168-181 */ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, /* 182-195 */ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, /* 196-209 */ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, /* 210-223 */ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, /* 224-237 */ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, /* 238-251 */ 24, 24, 24, 24 }, /* prefix 54 */ { 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, /* 0- 13 */ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, /* 14- 27 */ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, /* 28- 41 */ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, /* 42- 55 */ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, /* 56- 69 */ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, /* 70- 83 */ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, /* 84- 97 */ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, /* 98-111 */ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, /* 112-125 */ 25, 25, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, /* 126-139 */ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, /* 140-153 */ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, /* 154-167 */ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, /* 168-181 */ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 50, 50, 50, 50, /* 182-195 */ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, /* 196-209 */ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, /* 210-223 */ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, /* 224-237 */ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, /* 238-251 */ 50, 50, 50, 50 }, /* prefix 55 */ { 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, /* 0- 13 */ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, /* 14- 27 */ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, /* 28- 41 */ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, /* 42- 55 */ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, /* 56- 69 */ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, /* 70- 83 */ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, /* 84- 97 */ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, /* 98-111 */ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, /* 112-125 */ 22, 22, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, /* 126-139 */ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, /* 140-153 */ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, /* 154-167 */ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, /* 168-181 */ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 36, 36, 36, 36, /* 182-195 */ 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, /* 196-209 */ 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, /* 210-223 */ 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, /* 224-237 */ 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, /* 238-251 */ 36, 36, 36, 36 }, /* prefix 56 */ { 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, /* 0- 13 */ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, /* 14- 27 */ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, /* 28- 41 */ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, /* 42- 55 */ 37, 37, 37, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 38, /* 56- 69 */ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, /* 70- 83 */ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, /* 84- 97 */ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, /* 98-111 */ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, /* 112-125 */ 38, 38, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, /* 126-139 */ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, /* 140-153 */ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, /* 154-167 */ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, /* 168-181 */ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 40, 40, 40, 40, /* 182-195 */ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, /* 196-209 */ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, /* 210-223 */ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, /* 224-237 */ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, /* 238-251 */ 40, 40, 40, 40 }, /* prefix 57 */ { 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, /* 0- 13 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, /* 14- 27 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, /* 28- 41 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, /* 42- 55 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, /* 56- 69 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, /* 70- 83 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, /* 84- 97 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, /* 98-111 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, /* 112-125 */ 21, 21, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, /* 126-139 */ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, /* 140-153 */ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, /* 154-167 */ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, /* 168-181 */ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, /* 182-195 */ 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, /* 196-209 */ 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, /* 210-223 */ 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, /* 224-237 */ 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, /* 238-251 */ 34, 34, 34, 34 }, /* prefix 58 */ { 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, /* 0- 13 */ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, /* 14- 27 */ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, /* 28- 41 */ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, /* 42- 55 */ 55, 55, 55, 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 56, /* 56- 69 */ 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, /* 70- 83 */ 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, /* 84- 97 */ 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, /* 98-111 */ 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, /* 112-125 */ 56, 56, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, /* 126-139 */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, /* 140-153 */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, /* 154-167 */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, /* 168-181 */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, /* 182-195 */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, /* 196-209 */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, /* 210-223 */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, /* 224-237 */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, /* 238-251 */ 28, 28, 28, 28 }, /* prefix 59 */ { 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, /* 0- 13 */ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, /* 14- 27 */ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, /* 28- 41 */ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, /* 42- 55 */ 41, 41, 41, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42, 42, /* 56- 69 */ 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, /* 70- 83 */ 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, /* 84- 97 */ 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, /* 98-111 */ 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, /* 112-125 */ 42, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, /* 126-139 */ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, /* 140-153 */ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, /* 154-167 */ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, /* 168-181 */ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 44, 44, 44, 44, /* 182-195 */ 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, /* 196-209 */ 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, /* 210-223 */ 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, /* 224-237 */ 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, /* 238-251 */ 44, 44, 44, 44 }, /* prefix 60 */ { 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, /* 0- 13 */ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, /* 14- 27 */ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, /* 28- 41 */ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, /* 42- 55 */ 45, 45, 45, 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, 46, /* 56- 69 */ 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, /* 70- 83 */ 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, /* 84- 97 */ 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, /* 98-111 */ 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, /* 112-125 */ 46, 46, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, /* 126-139 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, /* 140-153 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, /* 154-167 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, /* 168-181 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, /* 182-195 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, /* 196-209 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, /* 210-223 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, /* 224-237 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, /* 238-251 */ 23, 23, 23, 23 }, /* prefix 61 */ { 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, /* 0- 13 */ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, /* 14- 27 */ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, /* 28- 41 */ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, /* 42- 55 */ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, /* 56- 69 */ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, /* 70- 83 */ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, /* 84- 97 */ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, /* 98-111 */ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, /* 112-125 */ 30, 30, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, /* 126-139 */ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, /* 140-153 */ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, /* 154-167 */ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, /* 168-181 */ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, /* 182-195 */ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, /* 196-209 */ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, /* 210-223 */ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, /* 224-237 */ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, /* 238-251 */ 64, 64, 64, 64 }, /* prefix 62 */ { 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, /* 0- 13 */ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, /* 14- 27 */ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, /* 28- 41 */ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, /* 42- 55 */ 65, 65, 65, 65, 65, 65, 65, 65, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, /* 126-139 */ 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, /* 140-153 */ 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, /* 154-167 */ 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, /* 168-181 */ 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 71, 71, 71, 71, /* 182-195 */ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, /* 196-209 */ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, /* 210-223 */ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, /* 224-237 */ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, /* 238-251 */ 71, 71, 71, 71 }, /* prefix 63 */ { 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, /* 0- 13 */ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, /* 14- 27 */ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, /* 28- 41 */ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, /* 42- 55 */ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, /* 56- 69 */ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, /* 70- 83 */ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, /* 84- 97 */ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, /* 98-111 */ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, /* 112-125 */ 29, 29, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, /* 126-139 */ 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, /* 140-153 */ 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, /* 154-167 */ 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, /* 168-181 */ 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 62, 62, 62, 62, /* 182-195 */ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, /* 196-209 */ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, /* 210-223 */ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, /* 224-237 */ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, /* 238-251 */ 62, 62, 62, 62 }, /* prefix 64 */ { 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, /* 0- 13 */ 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, /* 14- 27 */ 88, 88, 88, 88, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, /* 28- 41 */ 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, /* 42- 55 */ 89, 89, 89, 89, 89, 89, 89, 89, 90, 90, 90, 90, 90, 90, /* 56- 69 */ 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, /* 70- 83 */ 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 92, 92, /* 84- 97 */ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* 98-111 */ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, /* 112-125 */ 92, 92, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, /* 126-139 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, /* 140-153 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, /* 154-167 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, /* 168-181 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, /* 182-195 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, /* 196-209 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, /* 210-223 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, /* 224-237 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, /* 238-251 */ 20, 20, 20, 20 }, /* prefix 65 */ { 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, /* 0- 13 */ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, /* 14- 27 */ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, /* 28- 41 */ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, /* 42- 55 */ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, /* 56- 69 */ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, /* 70- 83 */ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, /* 84- 97 */ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, /* 98-111 */ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, /* 112-125 */ 26, 26, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, /* 126-139 */ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, /* 140-153 */ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, /* 154-167 */ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, /* 168-181 */ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 52, 52, 52, 52, /* 182-195 */ 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, /* 196-209 */ 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, /* 210-223 */ 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, /* 224-237 */ 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, /* 238-251 */ 52, 52, 52, 52 }, /* prefix 66 */ { 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, /* 0- 13 */ 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, /* 14- 27 */ 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, /* 28- 41 */ 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, /* 42- 55 */ 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, /* 56- 69 */ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, /* 70- 83 */ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, /* 84- 97 */ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, /* 98-111 */ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, /* 112-125 */ 54, 54, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, /* 126-139 */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, /* 140-153 */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, /* 154-167 */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, /* 168-181 */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, /* 182-195 */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, /* 196-209 */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, /* 210-223 */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, /* 224-237 */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, /* 238-251 */ 27, 27, 27, 27 }, /* prefix 67 */ { 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, /* 0- 13 */ 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, /* 14- 27 */ 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, /* 28- 41 */ 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, /* 42- 55 */ 57, 57, 57, 57, 57, 57, 57, 57, 58, 58, 58, 58, 58, 58, /* 56- 69 */ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, /* 70- 83 */ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, /* 84- 97 */ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, /* 98-111 */ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, /* 112-125 */ 58, 58, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, /* 126-139 */ 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, /* 140-153 */ 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, /* 154-167 */ 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, /* 168-181 */ 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, /* 182-195 */ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, /* 196-209 */ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, /* 210-223 */ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, /* 224-237 */ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, /* 238-251 */ 60, 60, 60, 60 }, /* prefix 68 */ { 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, /* 0- 13 */ 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, /* 14- 27 */ 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, /* 28- 41 */ 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, /* 42- 55 */ 72, 72, 72, 72, 72, 72, 72, 72, 73, 73, 73, 73, 73, 73, /* 56- 69 */ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, /* 70- 83 */ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, /* 84- 97 */ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, /* 98-111 */ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, /* 112-125 */ 73, 73, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, /* 126-139 */ 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, /* 140-153 */ 76, 76, 76, 76, 76, 76, 77, 77, 77, 77, 77, 77, 77, 77, /* 154-167 */ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, /* 168-181 */ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 75, 75, 75, 75, /* 182-195 */ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, /* 196-209 */ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, /* 210-223 */ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, /* 224-237 */ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, /* 238-251 */ 75, 75, 75, 75 }, /* prefix 69 */ { 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, /* 0- 13 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, /* 14- 27 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, /* 28- 41 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, /* 42- 55 */ 74, 74, 74, 74, 74, 74, 74, 74, 78, 78, 78, 78, 78, 78, /* 56- 69 */ 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, /* 70- 83 */ 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 79, 79, /* 84- 97 */ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* 98-111 */ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* 112-125 */ 79, 79, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, /* 126-139 */ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, /* 140-153 */ 80, 80, 80, 80, 80, 80, 81, 81, 81, 81, 81, 81, 81, 81, /* 154-167 */ 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, /* 168-181 */ 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 82, 82, 82, 82, /* 182-195 */ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, /* 196-209 */ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, /* 210-223 */ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, /* 224-237 */ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, /* 238-251 */ 83, 83, 83, 83 }, /* prefix 70 */ { 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, /* 0- 13 */ 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, /* 14- 27 */ 84, 84, 84, 84, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, /* 28- 41 */ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, /* 42- 55 */ 85, 85, 85, 85, 85, 85, 85, 85, 86, 86, 86, 86, 86, 86, /* 56- 69 */ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, /* 70- 83 */ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 87, 87, /* 84- 97 */ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, /* 98-111 */ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, /* 112-125 */ 87, 87, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, /* 126-139 */ 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, /* 140-153 */ 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, /* 154-167 */ 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, /* 168-181 */ 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, /* 182-195 */ 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, /* 196-209 */ 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, /* 210-223 */ 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, /* 224-237 */ 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, /* 238-251 */ 69, 69, 69, 69 }, /* prefix 71 */ { 0,210,210,210, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 93, 93, 93, 93, 96, 96, 97, 97, 98, 98, /* 28- 41 */ 99, 99,100,100,101,101, 94, 94, 94, 94, 95, 95, 95, 95, /* 42- 55 */ 102,102,103,103,104,104,105,105, 31, 31, 31, 31, 31, 31, /* 56- 69 */ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, /* 70- 83 */ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 32, 32, /* 84- 97 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 98-111 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 112-125 */ 32, 32, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, /* 126-139 */ 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, /* 140-153 */ 47, 47, 47, 47, 47, 47, 48, 48, 48, 48, 48, 48, 48, 48, /* 154-167 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, /* 168-181 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 24, 24, 24, 24, /* 182-195 */ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, /* 196-209 */ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, /* 210-223 */ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, /* 224-237 */ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, /* 238-251 */ 24, 24, 24, 24 }, /* prefix 72 */ { 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, /* 0- 13 */ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, /* 14- 27 */ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, /* 28- 41 */ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, /* 42- 55 */ 25, 25, 25, 25, 25, 25, 25, 25, 49, 49, 49, 49, 49, 49, /* 56- 69 */ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, /* 70- 83 */ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 50, 50, /* 84- 97 */ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, /* 98-111 */ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, /* 112-125 */ 50, 50, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, /* 126-139 */ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, /* 140-153 */ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, /* 154-167 */ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, /* 168-181 */ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, /* 182-195 */ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, /* 196-209 */ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, /* 210-223 */ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, /* 224-237 */ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, /* 238-251 */ 15, 15, 15, 15 }, /* prefix 73 */ { 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, /* 0- 13 */ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, /* 14- 27 */ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, /* 28- 41 */ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, /* 42- 55 */ 22, 22, 22, 22, 22, 22, 22, 22, 35, 35, 35, 35, 35, 35, /* 56- 69 */ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, /* 70- 83 */ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 36, 36, /* 84- 97 */ 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, /* 98-111 */ 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, /* 112-125 */ 36, 36, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, /* 126-139 */ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, /* 140-153 */ 37, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 38, 38, 38, /* 154-167 */ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, /* 168-181 */ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, /* 182-195 */ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, /* 196-209 */ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, /* 210-223 */ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, /* 224-237 */ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, /* 238-251 */ 40, 40, 40, 40 }, /* prefix 74 */ { 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, /* 0- 13 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, /* 14- 27 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, /* 28- 41 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, /* 42- 55 */ 21, 21, 21, 21, 21, 21, 21, 21, 33, 33, 33, 33, 33, 33, /* 56- 69 */ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, /* 70- 83 */ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 34, 34, /* 84- 97 */ 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, /* 98-111 */ 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, /* 112-125 */ 34, 34, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 182-195 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 196-209 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 75 */ { 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, /* 0- 13 */ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, /* 14- 27 */ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, /* 28- 41 */ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, /* 42- 55 */ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, /* 56- 69 */ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, /* 70- 83 */ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, /* 84- 97 */ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, /* 98-111 */ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, /* 112-125 */ 14, 14, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, /* 126-139 */ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, /* 140-153 */ 55, 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 56, 56, 56, /* 154-167 */ 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, /* 168-181 */ 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 28, 28, 28, 28, /* 182-195 */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, /* 196-209 */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, /* 210-223 */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, /* 224-237 */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, /* 238-251 */ 28, 28, 28, 28 }, /* prefix 76 */ { 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, /* 0- 13 */ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, /* 14- 27 */ 41, 41, 41, 41, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, /* 28- 41 */ 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, /* 42- 55 */ 42, 42, 42, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, /* 56- 69 */ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, /* 70- 83 */ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 44, 44, /* 84- 97 */ 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, /* 98-111 */ 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, /* 112-125 */ 44, 44, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, /* 126-139 */ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, /* 140-153 */ 45, 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, 46, 46, 46, /* 154-167 */ 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, /* 168-181 */ 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 23, 23, 23, 23, /* 182-195 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, /* 196-209 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, /* 210-223 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, /* 224-237 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, /* 238-251 */ 23, 23, 23, 23 }, /* prefix 77 */ { 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, /* 0- 13 */ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, /* 14- 27 */ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, /* 28- 41 */ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, /* 42- 55 */ 30, 30, 30, 30, 30, 30, 30, 30, 63, 63, 63, 63, 63, 63, /* 56- 69 */ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, /* 70- 83 */ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, /* 84- 97 */ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, /* 98-111 */ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, /* 112-125 */ 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, /* 126-139 */ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, /* 140-153 */ 65, 65, 65, 65, 65, 65, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 70, 70, 70, 70, /* 182-195 */ 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, /* 196-209 */ 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, /* 210-223 */ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, /* 224-237 */ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, /* 238-251 */ 71, 71, 71, 71 }, /* prefix 78 */ { 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, /* 0- 13 */ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, /* 14- 27 */ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, /* 28- 41 */ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, /* 42- 55 */ 29, 29, 29, 29, 29, 29, 29, 29, 61, 61, 61, 61, 61, 61, /* 56- 69 */ 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, /* 70- 83 */ 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 62, 62, /* 84- 97 */ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, /* 98-111 */ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, /* 112-125 */ 62, 62, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, /* 126-139 */ 88, 88, 88, 88, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, /* 140-153 */ 89, 89, 89, 89, 89, 89, 90, 90, 90, 90, 90, 90, 90, 90, /* 154-167 */ 90, 90, 90, 90, 90, 90, 90, 90, 92, 92, 92, 92, 92, 92, /* 168-181 */ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 20, 20, 20, 20, /* 182-195 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, /* 196-209 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, /* 210-223 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, /* 224-237 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, /* 238-251 */ 20, 20, 20, 20 }, /* prefix 79 */ { 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, /* 0- 13 */ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, /* 14- 27 */ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, /* 28- 41 */ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, /* 42- 55 */ 26, 26, 26, 26, 26, 26, 26, 26, 51, 51, 51, 51, 51, 51, /* 56- 69 */ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, /* 70- 83 */ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 52, 52, /* 84- 97 */ 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, /* 98-111 */ 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, /* 112-125 */ 52, 52, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, /* 126-139 */ 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, /* 140-153 */ 53, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, /* 154-167 */ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, /* 168-181 */ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 27, 27, 27, 27, /* 182-195 */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, /* 196-209 */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, /* 210-223 */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, /* 224-237 */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, /* 238-251 */ 27, 27, 27, 27 }, /* prefix 80 */ { 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, /* 0- 13 */ 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, /* 14- 27 */ 57, 57, 57, 57, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, /* 28- 41 */ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, /* 42- 55 */ 58, 58, 58, 58, 58, 58, 58, 58, 59, 59, 59, 59, 59, 59, /* 56- 69 */ 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, /* 70- 83 */ 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 60, 60, /* 84- 97 */ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, /* 98-111 */ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, /* 112-125 */ 60, 60, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, /* 126-139 */ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, /* 140-153 */ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, /* 154-167 */ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, /* 168-181 */ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, /* 182-195 */ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, /* 196-209 */ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, /* 210-223 */ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, /* 224-237 */ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, /* 238-251 */ 68, 68, 68, 68 }, /* prefix 81 */ { 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, /* 0- 13 */ 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, /* 14- 27 */ 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, /* 28- 41 */ 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, /* 42- 55 */ 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, /* 56- 69 */ 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, /* 70- 83 */ 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, /* 84- 97 */ 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, /* 98-111 */ 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, /* 112-125 */ 91, 91, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, /* 126-139 */ 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, /* 140-153 */ 72, 72, 72, 72, 72, 72, 73, 73, 73, 73, 73, 73, 73, 73, /* 154-167 */ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, /* 168-181 */ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 76, 76, 76, 76, /* 182-195 */ 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 77, 77, /* 196-209 */ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, /* 210-223 */ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, /* 224-237 */ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, /* 238-251 */ 75, 75, 75, 75 }, /* prefix 82 */ { 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, /* 0- 13 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, /* 14- 27 */ 74, 74, 74, 74, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, /* 28- 41 */ 78, 78, 78, 78, 78, 78, 79, 79, 79, 79, 79, 79, 79, 79, /* 42- 55 */ 79, 79, 79, 79, 79, 79, 79, 79, 80, 80, 80, 80, 80, 80, /* 56- 69 */ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 81, 81, 81, 81, /* 70- 83 */ 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 82, 82, /* 84- 97 */ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, /* 98-111 */ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, /* 112-125 */ 83, 83, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, /* 126-139 */ 84, 84, 84, 84, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, /* 140-153 */ 85, 85, 85, 85, 85, 85, 86, 86, 86, 86, 86, 86, 86, 86, /* 154-167 */ 86, 86, 86, 86, 86, 86, 86, 86, 87, 87, 87, 87, 87, 87, /* 168-181 */ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 69, 69, 69, 69, /* 182-195 */ 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, /* 196-209 */ 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, /* 210-223 */ 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, /* 224-237 */ 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, /* 238-251 */ 69, 69, 69, 69 }, /* prefix 83 */ { 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, /* 0- 13 */ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, /* 14- 27 */ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, /* 28- 41 */ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, /* 42- 55 */ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, /* 56- 69 */ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, /* 70- 83 */ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, /* 84- 97 */ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, /* 98-111 */ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, /* 112-125 */ 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, /* 126-139 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, /* 140-153 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, /* 154-167 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, /* 168-181 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, /* 182-195 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, /* 196-209 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, /* 210-223 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, /* 224-237 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, /* 238-251 */ 19, 19, 19, 19 }, /* prefix 84 */ { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* 0- 13 */ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* 14- 27 */ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* 28- 41 */ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* 42- 55 */ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* 56- 69 */ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* 70- 83 */ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* 84- 97 */ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* 98-111 */ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* 112-125 */ 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, /* 126-139 */ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, /* 140-153 */ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, /* 154-167 */ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, /* 168-181 */ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, /* 182-195 */ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, /* 196-209 */ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, /* 210-223 */ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, /* 224-237 */ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, /* 238-251 */ 17, 17, 17, 17 }, /* prefix 85 */ { 0,210, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 93, 93, 96, 97, 98, 99,100,101, 94, 94, 95, 95, /* 14- 27 */ 102,103,104,105, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, /* 28- 41 */ 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 32, 32, /* 42- 55 */ 32, 32, 32, 32, 32, 32, 32, 32, 47, 47, 47, 47, 47, 47, /* 56- 69 */ 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 48, 48, 48, 48, /* 70- 83 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 24, 24, /* 84- 97 */ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, /* 98-111 */ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, /* 112-125 */ 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, /* 126-139 */ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, /* 140-153 */ 25, 25, 25, 25, 25, 25, 49, 49, 49, 49, 49, 49, 49, 49, /* 154-167 */ 49, 49, 49, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50, 50, /* 168-181 */ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 15, 15, 15, 15, /* 182-195 */ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, /* 196-209 */ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, /* 210-223 */ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, /* 224-237 */ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, /* 238-251 */ 15, 15, 15, 15 }, /* prefix 86 */ { 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, /* 0- 13 */ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, /* 14- 27 */ 22, 22, 22, 22, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, /* 28- 41 */ 35, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 36, 36, 36, /* 42- 55 */ 36, 36, 36, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 37, /* 56- 69 */ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 38, 38, 38, 38, /* 70- 83 */ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 39, 39, /* 84- 97 */ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, /* 98-111 */ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, /* 112-125 */ 40, 40, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, /* 126-139 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, /* 140-153 */ 21, 21, 21, 21, 21, 21, 33, 33, 33, 33, 33, 33, 33, 33, /* 154-167 */ 33, 33, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 34, /* 168-181 */ 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 3, 3, 3, 3, /* 182-195 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 196-209 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 87 */ { 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, /* 0- 13 */ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, /* 14- 27 */ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, /* 28- 41 */ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, /* 42- 55 */ 14, 14, 14, 14, 14, 14, 14, 14, 55, 55, 55, 55, 55, 55, /* 56- 69 */ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 56, 56, 56, 56, /* 70- 83 */ 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 28, 28, /* 84- 97 */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, /* 98-111 */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, /* 112-125 */ 28, 28, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, /* 126-139 */ 41, 41, 41, 41, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, /* 140-153 */ 42, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, 43, 43, /* 154-167 */ 43, 43, 43, 43, 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, /* 168-181 */ 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 45, 45, 45, 45, /* 182-195 */ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 46, 46, /* 196-209 */ 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, /* 210-223 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, /* 224-237 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, /* 238-251 */ 23, 23, 23, 23 }, /* prefix 88 */ { 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, /* 0- 13 */ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, /* 14- 27 */ 30, 30, 30, 30, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, /* 28- 41 */ 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, /* 42- 55 */ 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, /* 56- 69 */ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 70, 70, /* 84- 97 */ 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, /* 98-111 */ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, /* 112-125 */ 71, 71, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, /* 126-139 */ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, /* 140-153 */ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, /* 154-167 */ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, /* 168-181 */ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, /* 182-195 */ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, /* 196-209 */ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, /* 210-223 */ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, /* 224-237 */ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, /* 238-251 */ 12, 12, 12, 12 }, /* prefix 89 */ { 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, /* 0- 13 */ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, /* 14- 27 */ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, /* 28- 41 */ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, /* 42- 55 */ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, /* 56- 69 */ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, /* 70- 83 */ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, /* 84- 97 */ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, /* 98-111 */ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, /* 112-125 */ 13, 13, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, /* 126-139 */ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, /* 140-153 */ 29, 29, 29, 29, 29, 29, 61, 61, 61, 61, 61, 61, 61, 61, /* 154-167 */ 61, 61, 61, 61, 61, 61, 61, 61, 62, 62, 62, 62, 62, 62, /* 168-181 */ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 88, 88, 88, 88, /* 182-195 */ 88, 88, 88, 88, 89, 89, 89, 89, 89, 89, 89, 89, 90, 90, /* 196-209 */ 90, 90, 90, 90, 90, 90, 92, 92, 92, 92, 92, 92, 92, 92, /* 210-223 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, /* 224-237 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, /* 238-251 */ 20, 20, 20, 20 }, /* prefix 90 */ { 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, /* 0- 13 */ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, /* 14- 27 */ 26, 26, 26, 26, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, /* 28- 41 */ 51, 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 52, 52, 52, /* 42- 55 */ 52, 52, 52, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 53, /* 56- 69 */ 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54, 54, /* 70- 83 */ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 27, 27, /* 84- 97 */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, /* 98-111 */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, /* 112-125 */ 27, 27, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, /* 126-139 */ 57, 57, 57, 57, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, /* 140-153 */ 58, 58, 58, 58, 58, 58, 59, 59, 59, 59, 59, 59, 59, 59, /* 154-167 */ 59, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 60, /* 168-181 */ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 68, 68, 68, 68, /* 182-195 */ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, /* 196-209 */ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, /* 210-223 */ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, /* 224-237 */ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, /* 238-251 */ 68, 68, 68, 68 }, /* prefix 91 */ { 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, /* 0- 13 */ 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, /* 14- 27 */ 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, /* 28- 41 */ 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, /* 42- 55 */ 91, 91, 91, 91, 91, 91, 91, 91, 72, 72, 72, 72, 72, 72, /* 56- 69 */ 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 73, 73, 73, 73, /* 70- 83 */ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 76, 76, /* 84- 97 */ 76, 76, 76, 76, 76, 76, 77, 77, 77, 77, 77, 77, 77, 77, /* 98-111 */ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, /* 112-125 */ 75, 75, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, /* 126-139 */ 74, 74, 74, 74, 78, 78, 78, 78, 78, 78, 78, 78, 79, 79, /* 140-153 */ 79, 79, 79, 79, 79, 79, 80, 80, 80, 80, 80, 80, 80, 80, /* 154-167 */ 81, 81, 81, 81, 81, 81, 81, 81, 82, 82, 82, 82, 82, 82, /* 168-181 */ 82, 82, 83, 83, 83, 83, 83, 83, 83, 83, 84, 84, 84, 84, /* 182-195 */ 84, 84, 84, 84, 85, 85, 85, 85, 85, 85, 85, 85, 86, 86, /* 196-209 */ 86, 86, 86, 86, 86, 86, 87, 87, 87, 87, 87, 87, 87, 87, /* 210-223 */ 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, /* 224-237 */ 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, /* 238-251 */ 69, 69, 69, 69 }, /* prefix 92 */ { 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, /* 0- 13 */ 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, /* 14- 27 */ 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, /* 28- 41 */ 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, /* 42- 55 */ 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, /* 56- 69 */ 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, /* 70- 83 */ 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, /* 84- 97 */ 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, /* 98-111 */ 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, /* 112-125 */ 67, 67, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, /* 126-139 */ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, /* 140-153 */ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, /* 154-167 */ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, /* 168-181 */ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, /* 182-195 */ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, /* 196-209 */ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, /* 210-223 */ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, /* 224-237 */ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, /* 238-251 */ 10, 10, 10, 10 }, /* prefix 93 */ { 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, /* 0- 13 */ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, /* 14- 27 */ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, /* 28- 41 */ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, /* 42- 55 */ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, /* 56- 69 */ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, /* 70- 83 */ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, /* 84- 97 */ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, /* 98-111 */ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, /* 112-125 */ 11, 11, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, /* 126-139 */ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, /* 140-153 */ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, /* 154-167 */ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, /* 168-181 */ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, /* 182-195 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, /* 196-209 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, /* 210-223 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, /* 224-237 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, /* 238-251 */ 19, 19, 19, 19 }, /* prefix 94 */ { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* 0- 13 */ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* 14- 27 */ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* 28- 41 */ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* 42- 55 */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, /* 56- 69 */ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, /* 70- 83 */ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, /* 84- 97 */ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, /* 98-111 */ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, /* 112-125 */ 17, 17, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, /* 126-139 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, /* 140-153 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, /* 154-167 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, /* 168-181 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, /* 182-195 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, /* 196-209 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, /* 210-223 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, /* 224-237 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, /* 238-251 */ 66, 66, 66, 66 }, /* prefix 95 */ { 0, 1, 1, 1, 1, 1, 1, 1, 93, 0, 0, 0, 94, 95, /* 0- 13 */ 0, 0, 31, 31, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, /* 14- 27 */ 32, 32, 32, 32, 47, 47, 47, 47, 47, 47, 47, 47, 48, 48, /* 28- 41 */ 48, 48, 48, 48, 48, 48, 24, 24, 24, 24, 24, 24, 24, 24, /* 42- 55 */ 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, /* 56- 69 */ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 49, 49, 49, 49, /* 70- 83 */ 49, 49, 49, 49, 50, 50, 50, 50, 50, 50, 50, 50, 15, 15, /* 84- 97 */ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, /* 98-111 */ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, /* 112-125 */ 15, 15, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, /* 126-139 */ 22, 22, 22, 22, 35, 35, 35, 35, 35, 35, 35, 35, 36, 36, /* 140-153 */ 36, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 37, 37, 37, /* 154-167 */ 38, 38, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, /* 168-181 */ 39, 39, 40, 40, 40, 40, 40, 40, 40, 40, 21, 21, 21, 21, /* 182-195 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 33, 33, /* 196-209 */ 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 34, 34, 34, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 96 */ { 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, /* 0- 13 */ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, /* 14- 27 */ 14, 14, 14, 14, 55, 55, 55, 55, 55, 55, 55, 55, 56, 56, /* 28- 41 */ 56, 56, 56, 56, 56, 56, 28, 28, 28, 28, 28, 28, 28, 28, /* 42- 55 */ 28, 28, 28, 28, 28, 28, 28, 28, 41, 41, 41, 41, 41, 41, /* 56- 69 */ 41, 41, 42, 42, 42, 42, 42, 42, 42, 42, 43, 43, 43, 43, /* 70- 83 */ 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, 44, 44, 45, 45, /* 84- 97 */ 45, 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, 46, 46, 46, /* 98-111 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, /* 112-125 */ 23, 23, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, /* 126-139 */ 30, 30, 30, 30, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, /* 140-153 */ 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 70, 70, 70, 70, 70, 70, /* 168-181 */ 70, 70, 71, 71, 71, 71, 71, 71, 71, 71, 12, 12, 12, 12, /* 182-195 */ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, /* 196-209 */ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, /* 210-223 */ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, /* 224-237 */ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, /* 238-251 */ 12, 12, 12, 12 }, /* prefix 97 */ { 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, /* 0- 13 */ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, /* 14- 27 */ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, /* 28- 41 */ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, /* 42- 55 */ 13, 13, 13, 13, 13, 13, 13, 13, 29, 29, 29, 29, 29, 29, /* 56- 69 */ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 61, 61, 61, 61, /* 70- 83 */ 61, 61, 61, 61, 62, 62, 62, 62, 62, 62, 62, 62, 88, 88, /* 84- 97 */ 88, 88, 89, 89, 89, 89, 90, 90, 90, 90, 92, 92, 92, 92, /* 98-111 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, /* 112-125 */ 20, 20, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, /* 126-139 */ 26, 26, 26, 26, 51, 51, 51, 51, 51, 51, 51, 51, 52, 52, /* 140-153 */ 52, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 53, 53, 53, /* 154-167 */ 54, 54, 54, 54, 54, 54, 54, 54, 27, 27, 27, 27, 27, 27, /* 168-181 */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 57, 57, 57, 57, /* 182-195 */ 57, 57, 57, 57, 58, 58, 58, 58, 58, 58, 58, 58, 59, 59, /* 196-209 */ 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 60, /* 210-223 */ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, /* 224-237 */ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, /* 238-251 */ 68, 68, 68, 68 }, /* prefix 98 */ { 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, /* 0- 13 */ 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, /* 14- 27 */ 91, 91, 91, 91, 72, 72, 72, 72, 72, 72, 72, 72, 73, 73, /* 28- 41 */ 73, 73, 73, 73, 73, 73, 76, 76, 76, 76, 77, 77, 77, 77, /* 42- 55 */ 75, 75, 75, 75, 75, 75, 75, 75, 74, 74, 74, 74, 74, 74, /* 56- 69 */ 74, 74, 78, 78, 78, 78, 79, 79, 79, 79, 80, 80, 80, 80, /* 70- 83 */ 81, 81, 81, 81, 82, 82, 82, 82, 83, 83, 83, 83, 84, 84, /* 84- 97 */ 84, 84, 85, 85, 85, 85, 86, 86, 86, 86, 87, 87, 87, 87, /* 98-111 */ 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, /* 112-125 */ 69, 69, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 140-153 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 154-167 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 168-181 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 182-195 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 196-209 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 210-223 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 224-237 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 238-251 */ 4, 4, 4, 4 }, /* prefix 99 */ { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 0- 13 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 14- 27 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 28- 41 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 42- 55 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 56- 69 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 70- 83 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 84- 97 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 98-111 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 112-125 */ 5, 5, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, /* 126-139 */ 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, /* 140-153 */ 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, /* 154-167 */ 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, /* 168-181 */ 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 10, 10, 10, 10, /* 182-195 */ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, /* 196-209 */ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, /* 210-223 */ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, /* 224-237 */ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, /* 238-251 */ 10, 10, 10, 10 }, /* prefix 100 */ { 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, /* 0- 13 */ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, /* 14- 27 */ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, /* 28- 41 */ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, /* 42- 55 */ 11, 11, 11, 11, 11, 11, 11, 11, 18, 18, 18, 18, 18, 18, /* 56- 69 */ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, /* 70- 83 */ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, /* 84- 97 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, /* 98-111 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, /* 112-125 */ 19, 19, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 126-139 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 140-153 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 154-167 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 168-181 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 182-195 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 196-209 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 210-223 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 224-237 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 238-251 */ 6, 6, 6, 6 }, /* prefix 101 */ { 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 0- 13 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 14- 27 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 28- 41 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 42- 55 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 56- 69 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 70- 83 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 84- 97 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 98-111 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 112-125 */ 7, 7, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* 126-139 */ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* 140-153 */ 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, /* 154-167 */ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, /* 168-181 */ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 66, 66, 66, 66, /* 182-195 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, /* 196-209 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, /* 210-223 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, /* 224-237 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, /* 238-251 */ 66, 66, 66, 66 }, /* prefix 102 */ { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 0- 13 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 14- 27 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 28- 41 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 42- 55 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 56- 69 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 70- 83 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 84- 97 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 98-111 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 112-125 */ 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 126-139 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 140-153 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 154-167 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 168-181 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 182-195 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 196-209 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 210-223 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 224-237 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 238-251 */ 9, 9, 9, 9 }, /* prefix 103 */ { 0, 1, 1, 1, 0, 0, 0, 0, 31, 31, 31, 31, 32, 32, /* 0- 13 */ 32, 32, 47, 47, 47, 47, 48, 48, 48, 48, 24, 24, 24, 24, /* 14- 27 */ 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 49, 49, /* 28- 41 */ 49, 49, 50, 50, 50, 50, 15, 15, 15, 15, 15, 15, 15, 15, /* 42- 55 */ 15, 15, 15, 15, 15, 15, 15, 15, 22, 22, 22, 22, 22, 22, /* 56- 69 */ 22, 22, 35, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, /* 70- 83 */ 38, 38, 38, 38, 39, 39, 39, 39, 40, 40, 40, 40, 21, 21, /* 84- 97 */ 21, 21, 21, 21, 21, 21, 33, 33, 33, 33, 34, 34, 34, 34, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, /* 126-139 */ 14, 14, 14, 14, 55, 55, 55, 55, 56, 56, 56, 56, 28, 28, /* 140-153 */ 28, 28, 28, 28, 28, 28, 41, 41, 41, 41, 42, 42, 42, 42, /* 154-167 */ 43, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, /* 168-181 */ 46, 46, 23, 23, 23, 23, 23, 23, 23, 23, 30, 30, 30, 30, /* 182-195 */ 30, 30, 30, 30, 63, 63, 63, 63, 64, 64, 64, 64, 65, 65, /* 196-209 */ 65, 65, 2, 2, 2, 2, 70, 70, 70, 70, 71, 71, 71, 71, /* 210-223 */ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, /* 224-237 */ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, /* 238-251 */ 12, 12, 12, 12 }, /* prefix 104 */ { 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, /* 0- 13 */ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, /* 14- 27 */ 13, 13, 13, 13, 29, 29, 29, 29, 29, 29, 29, 29, 61, 61, /* 28- 41 */ 61, 61, 62, 62, 62, 62, 88, 88, 89, 89, 90, 90, 92, 92, /* 42- 55 */ 20, 20, 20, 20, 20, 20, 20, 20, 26, 26, 26, 26, 26, 26, /* 56- 69 */ 26, 26, 51, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 53, /* 70- 83 */ 54, 54, 54, 54, 27, 27, 27, 27, 27, 27, 27, 27, 57, 57, /* 84- 97 */ 57, 57, 58, 58, 58, 58, 59, 59, 59, 59, 60, 60, 60, 60, /* 98-111 */ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, /* 112-125 */ 68, 68, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, /* 126-139 */ 91, 91, 91, 91, 72, 72, 72, 72, 73, 73, 73, 73, 76, 76, /* 140-153 */ 77, 77, 75, 75, 75, 75, 74, 74, 74, 74, 78, 78, 79, 79, /* 154-167 */ 80, 80, 81, 81, 82, 82, 83, 83, 84, 84, 85, 85, 86, 86, /* 168-181 */ 87, 87, 69, 69, 69, 69, 69, 69, 69, 69, 4, 4, 4, 4, /* 182-195 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 196-209 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 210-223 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 224-237 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 238-251 */ 4, 4, 4, 4 }, /* prefix 105 */ { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 0- 13 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 14- 27 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 28- 41 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 42- 55 */ 5, 5, 5, 5, 5, 5, 5, 5, 67, 67, 67, 67, 67, 67, /* 56- 69 */ 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, /* 70- 83 */ 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 10, 10, /* 84- 97 */ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, /* 98-111 */ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, /* 112-125 */ 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, /* 126-139 */ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, /* 140-153 */ 11, 11, 11, 11, 11, 11, 18, 18, 18, 18, 18, 18, 18, 18, /* 154-167 */ 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, /* 168-181 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 6, 6, 6, 6, /* 182-195 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 196-209 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 210-223 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 224-237 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 238-251 */ 6, 6, 6, 6 }, /* prefix 106 */ { 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 0- 13 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 14- 27 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 28- 41 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 42- 55 */ 7, 7, 7, 7, 7, 7, 7, 7, 16, 16, 16, 16, 16, 16, /* 56- 69 */ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, /* 70- 83 */ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 66, 66, /* 84- 97 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, /* 98-111 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, /* 112-125 */ 66, 66, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 126-139 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 140-153 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 154-167 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 168-181 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, /* 182-195 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 196-209 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 210-223 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 224-237 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 238-251 */ 9, 9, 9, 9 }, /* prefix 107 */ { 0, 1, 0, 0, 31, 31, 32, 32, 47, 47, 48, 48, 24, 24, /* 0- 13 */ 24, 24, 25, 25, 25, 25, 49, 49, 50, 50, 15, 15, 15, 15, /* 14- 27 */ 15, 15, 15, 15, 22, 22, 22, 22, 35, 35, 36, 36, 37, 37, /* 28- 41 */ 38, 38, 39, 39, 40, 40, 21, 21, 21, 21, 33, 33, 34, 34, /* 42- 55 */ 3, 3, 3, 3, 3, 3, 3, 3, 14, 14, 14, 14, 14, 14, /* 56- 69 */ 14, 14, 55, 55, 56, 56, 28, 28, 28, 28, 41, 41, 42, 42, /* 70- 83 */ 43, 43, 44, 44, 45, 45, 46, 46, 23, 23, 23, 23, 30, 30, /* 84- 97 */ 30, 30, 63, 63, 64, 64, 65, 65, 2, 2, 70, 70, 71, 71, /* 98-111 */ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, /* 112-125 */ 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, /* 126-139 */ 13, 13, 13, 13, 29, 29, 29, 29, 61, 61, 62, 62, 88, 89, /* 140-153 */ 90, 92, 20, 20, 20, 20, 26, 26, 26, 26, 51, 51, 52, 52, /* 154-167 */ 53, 53, 54, 54, 27, 27, 27, 27, 57, 57, 58, 58, 59, 59, /* 168-181 */ 60, 60, 68, 68, 68, 68, 68, 68, 68, 68, 91, 91, 91, 91, /* 182-195 */ 91, 91, 91, 91, 72, 72, 73, 73, 76, 77, 75, 75, 74, 74, /* 196-209 */ 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 69, 69, 69, 69, /* 210-223 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 224-237 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 238-251 */ 4, 4, 4, 4 }, /* prefix 108 */ { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 0- 13 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 14- 27 */ 5, 5, 5, 5, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, /* 28- 41 */ 67, 67, 67, 67, 67, 67, 10, 10, 10, 10, 10, 10, 10, 10, /* 42- 55 */ 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, /* 56- 69 */ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 18, 18, 18, 18, /* 70- 83 */ 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 6, 6, /* 84- 97 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 98-111 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 112-125 */ 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 126-139 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 140-153 */ 7, 7, 7, 7, 7, 7, 16, 16, 16, 16, 16, 16, 16, 16, /* 154-167 */ 17, 17, 17, 17, 17, 17, 17, 17, 66, 66, 66, 66, 66, 66, /* 168-181 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 8, 8, 8, 8, /* 182-195 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 196-209 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 210-223 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 224-237 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 238-251 */ 9, 9, 9, 9 }, /* prefix 109 */ { 0,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 0- 13 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 14- 27 */ 210,210,210,210, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 110 */ { 197,197,197,197,197,197,197,197,197,197,197,197,197,197, /* 0- 13 */ 197,197,197,197,197,197,197,197,197,197,197,197,197,197, /* 14- 27 */ 197,197,197,197,200,200,200,200,200,200,200,200,200,200, /* 28- 41 */ 200,200,200,200,200,200,201,201,201,201,201,201,201,201, /* 42- 55 */ 201,201,201,201,201,201,201,201,202,202,202,202,202,202, /* 56- 69 */ 202,202,202,202,202,202,202,202,202,202,203,203,203,203, /* 70- 83 */ 203,203,203,203,203,203,203,203,203,203,203,203,204,204, /* 84- 97 */ 204,204,204,204,204,204,204,204,204,204,204,204,204,204, /* 98-111 */ 205,205,205,205,205,205,205,205,205,205,205,205,205,205, /* 112-125 */ 205,205,198,198,198,198,198,198,198,198,198,198,198,198, /* 126-139 */ 198,198,198,198,198,198,198,198,198,198,198,198,198,198, /* 140-153 */ 198,198,198,198,198,198,199,199,199,199,199,199,199,199, /* 154-167 */ 199,199,199,199,199,199,199,199,199,199,199,199,199,199, /* 168-181 */ 199,199,199,199,199,199,199,199,199,199,206,206,206,206, /* 182-195 */ 206,206,206,206,206,206,206,206,206,206,206,206,207,207, /* 196-209 */ 207,207,207,207,207,207,207,207,207,207,207,207,207,207, /* 210-223 */ 208,208,208,208,208,208,208,208,208,208,208,208,208,208, /* 224-237 */ 208,208,209,209,209,209,209,209,209,209,209,209,209,209, /* 238-251 */ 209,209,209,209 }, /* prefix 111 */ { 124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* 0- 13 */ 124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* 14- 27 */ 124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* 28- 41 */ 124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* 42- 55 */ 124,124,124,124,124,124,124,124,158,158,158,158,158,158, /* 56- 69 */ 158,158,158,158,158,158,158,158,158,158,179,179,179,179, /* 70- 83 */ 179,179,179,179,180,180,180,180,180,180,180,180,181,181, /* 84- 97 */ 181,181,181,181,181,181,182,182,182,182,182,182,182,182, /* 98-111 */ 161,161,161,161,161,161,161,161,161,161,161,161,161,161, /* 112-125 */ 161,161,162,162,162,162,162,162,162,162,162,162,162,162, /* 126-139 */ 162,162,162,162,189,189,189,189,189,189,189,189,190,190, /* 140-153 */ 190,190,190,190,190,190,191,191,191,191,191,191,191,191, /* 154-167 */ 192,192,192,192,192,192,192,192,165,165,165,165,165,165, /* 168-181 */ 165,165,165,165,165,165,165,165,165,165,166,166,166,166, /* 182-195 */ 166,166,166,166,166,166,166,166,166,166,166,166,193,193, /* 196-209 */ 193,193,193,193,193,193,194,194,194,194,194,194,194,194, /* 210-223 */ 130,130,130,130,130,130,130,130,130,130,130,130,130,130, /* 224-237 */ 130,130,130,130,130,130,130,130,130,130,130,130,130,130, /* 238-251 */ 130,130,130,130 }, /* prefix 112 */ { 131,131,131,131,131,131,131,131,131,131,131,131,131,131, /* 0- 13 */ 131,131,131,131,131,131,131,131,131,131,131,131,131,131, /* 14- 27 */ 131,131,131,131,195,195,195,195,195,195,195,195,196,196, /* 28- 41 */ 196,196,196,196,196,196,174,174,174,174,174,174,174,174, /* 42- 55 */ 174,174,174,174,174,174,174,174,175,175,175,175,175,175, /* 56- 69 */ 175,175,175,175,175,175,175,175,175,175,176,176,176,176, /* 70- 83 */ 176,176,176,176,176,176,176,176,176,176,176,176,177,177, /* 84- 97 */ 177,177,177,177,177,177,178,178,178,178,178,178,178,178, /* 98-111 */ 159,159,159,159,159,159,159,159,159,159,159,159,159,159, /* 112-125 */ 159,159,160,160,160,160,160,160,160,160,160,160,160,160, /* 126-139 */ 160,160,160,160,183,183,183,183,183,183,183,183,184,184, /* 140-153 */ 184,184,184,184,184,184,185,185,185,185,185,185,185,185, /* 154-167 */ 186,186,186,186,186,186,186,186,187,187,187,187,187,187, /* 168-181 */ 187,187,188,188,188,188,188,188,188,188,170,170,170,170, /* 182-195 */ 170,170,170,170,170,170,170,170,170,170,170,170,170,170, /* 196-209 */ 170,170,170,170,170,170,170,170,170,170,170,170,170,170, /* 210-223 */ 170,170,170,170,170,170,170,170,170,170,170,170,170,170, /* 224-237 */ 170,170,170,170,170,170,170,170,170,170,170,170,170,170, /* 238-251 */ 170,170,170,170 }, /* prefix 113 */ { 129,129,129,129,129,129,129,129,129,129,129,129,129,129, /* 0- 13 */ 129,129,129,129,129,129,129,129,129,129,129,129,129,129, /* 14- 27 */ 129,129,129,129,156,156,156,156,156,156,156,156,156,156, /* 28- 41 */ 156,156,156,156,156,156,157,157,157,157,157,157,157,157, /* 42- 55 */ 157,157,157,157,157,157,157,157,150,150,150,150,150,150, /* 56- 69 */ 150,150,150,150,150,150,150,150,150,150,151,151,151,151, /* 70- 83 */ 151,151,151,151,151,151,151,151,151,151,151,151,152,152, /* 84- 97 */ 152,152,152,152,152,152,152,152,152,152,152,152,152,152, /* 98-111 */ 153,153,153,153,153,153,153,153,153,153,153,153,153,153, /* 112-125 */ 153,153,163,163,163,163,163,163,163,163,163,163,163,163, /* 126-139 */ 163,163,163,163,164,164,164,164,164,164,164,164,164,164, /* 140-153 */ 164,164,164,164,164,164,167,167,167,167,167,167,167,167, /* 154-167 */ 167,167,167,167,167,167,167,167,173,173,173,173,173,173, /* 168-181 */ 173,173,173,173,173,173,173,173,173,173,122,122,122,122, /* 182-195 */ 122,122,122,122,122,122,122,122,122,122,122,122,122,122, /* 196-209 */ 122,122,122,122,122,122,122,122,122,122,122,122,122,122, /* 210-223 */ 122,122,122,122,122,122,122,122,122,122,122,122,122,122, /* 224-237 */ 122,122,122,122,122,122,122,122,122,122,122,122,122,122, /* 238-251 */ 122,122,122,122 }, /* prefix 114 */ { 123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* 0- 13 */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* 14- 27 */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* 28- 41 */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* 42- 55 */ 123,123,123,123,123,123,123,123,154,154,154,154,154,154, /* 56- 69 */ 154,154,154,154,154,154,154,154,154,154,155,155,155,155, /* 70- 83 */ 155,155,155,155,155,155,155,155,155,155,155,155,168,168, /* 84- 97 */ 168,168,168,168,168,168,168,168,168,168,168,168,168,168, /* 98-111 */ 169,169,169,169,169,169,169,169,169,169,169,169,169,169, /* 112-125 */ 169,169,136,136,136,136,136,136,136,136,136,136,136,136, /* 126-139 */ 136,136,136,136,137,137,137,137,137,137,137,137,137,137, /* 140-153 */ 137,137,137,137,137,137,138,138,138,138,138,138,138,138, /* 154-167 */ 138,138,138,138,138,138,138,138,139,139,139,139,139,139, /* 168-181 */ 139,139,139,139,139,139,139,139,139,139,146,146,146,146, /* 182-195 */ 146,146,146,146,146,146,146,146,146,146,146,146,147,147, /* 196-209 */ 147,147,147,147,147,147,147,147,147,147,147,147,147,147, /* 210-223 */ 128,128,128,128,128,128,128,128,128,128,128,128,128,128, /* 224-237 */ 128,128,128,128,128,128,128,128,128,128,128,128,128,128, /* 238-251 */ 128,128,128,128 }, /* prefix 115 */ { 121,121,121,121,121,121,121,121,121,121,121,121,121,121, /* 0- 13 */ 121,121,121,121,121,121,121,121,121,121,121,121,121,121, /* 14- 27 */ 121,121,121,121,121,121,121,121,121,121,121,121,121,121, /* 28- 41 */ 121,121,121,121,121,121,121,121,121,121,121,121,121,121, /* 42- 55 */ 121,121,121,121,121,121,121,121,121,121,121,121,121,121, /* 56- 69 */ 121,121,121,121,121,121,121,121,121,121,121,121,121,121, /* 70- 83 */ 121,121,121,121,121,121,121,121,121,121,121,121,121,121, /* 84- 97 */ 121,121,121,121,121,121,121,121,121,121,121,121,121,121, /* 98-111 */ 121,121,121,121,121,121,121,121,121,121,121,121,121,121, /* 112-125 */ 121,121,171,171,171,171,171,171,171,171,171,171,171,171, /* 126-139 */ 171,171,171,171,172,172,172,172,172,172,172,172,172,172, /* 140-153 */ 172,172,172,172,172,172,132,132,132,132,132,132,132,132, /* 154-167 */ 132,132,132,132,132,132,132,132,133,133,133,133,133,133, /* 168-181 */ 133,133,133,133,133,133,133,133,133,133,134,134,134,134, /* 182-195 */ 134,134,134,134,134,134,134,134,134,134,134,134,135,135, /* 196-209 */ 135,135,135,135,135,135,135,135,135,135,135,135,135,135, /* 210-223 */ 125,125,125,125,125,125,125,125,125,125,125,125,125,125, /* 224-237 */ 125,125,125,125,125,125,125,125,125,125,125,125,125,125, /* 238-251 */ 125,125,125,125 }, /* prefix 116 */ { 126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* 0- 13 */ 126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* 14- 27 */ 126,126,126,126,140,140,140,140,140,140,140,140,140,140, /* 28- 41 */ 140,140,140,140,140,140,141,141,141,141,141,141,141,141, /* 42- 55 */ 141,141,141,141,141,141,141,141,142,142,142,142,142,142, /* 56- 69 */ 142,142,142,142,142,142,142,142,142,142,143,143,143,143, /* 70- 83 */ 143,143,143,143,143,143,143,143,143,143,143,143,144,144, /* 84- 97 */ 144,144,144,144,144,144,144,144,144,144,144,144,144,144, /* 98-111 */ 145,145,145,145,145,145,145,145,145,145,145,145,145,145, /* 112-125 */ 145,145,127,127,127,127,127,127,127,127,127,127,127,127, /* 126-139 */ 127,127,127,127,127,127,127,127,127,127,127,127,127,127, /* 140-153 */ 127,127,127,127,127,127,148,148,148,148,148,148,148,148, /* 154-167 */ 148,148,148,148,148,148,148,148,149,149,149,149,149,149, /* 168-181 */ 149,149,149,149,149,149,149,149,149,149,106,106,106,106, /* 182-195 */ 106,106,106,106,106,106,106,106,106,106,106,106,106,106, /* 196-209 */ 106,106,106,106,106,106,106,106,106,106,106,106,106,106, /* 210-223 */ 106,106,106,106,106,106,106,106,106,106,106,106,106,106, /* 224-237 */ 106,106,106,106,106,106,106,106,106,106,106,106,106,106, /* 238-251 */ 106,106,106,106 }, /* prefix 117 */ { 0,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 0- 13 */ 210,210, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1,197,197,197,197,197,197,197,197,197,197,197,197, /* 126-139 */ 197,197,197,197,200,200,200,200,200,200,200,200,201,201, /* 140-153 */ 201,201,201,201,201,201,202,202,202,202,202,202,202,202, /* 154-167 */ 203,203,203,203,203,203,203,203,204,204,204,204,204,204, /* 168-181 */ 204,204,205,205,205,205,205,205,205,205,198,198,198,198, /* 182-195 */ 198,198,198,198,198,198,198,198,198,198,198,198,199,199, /* 196-209 */ 199,199,199,199,199,199,199,199,199,199,199,199,199,199, /* 210-223 */ 206,206,206,206,206,206,206,206,207,207,207,207,207,207, /* 224-237 */ 207,207,208,208,208,208,208,208,208,208,209,209,209,209, /* 238-251 */ 209,209,209,209 }, /* prefix 118 */ { 124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* 0- 13 */ 124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* 14- 27 */ 124,124,124,124,158,158,158,158,158,158,158,158,179,179, /* 28- 41 */ 179,179,180,180,180,180,181,181,181,181,182,182,182,182, /* 42- 55 */ 161,161,161,161,161,161,161,161,162,162,162,162,162,162, /* 56- 69 */ 162,162,189,189,189,189,190,190,190,190,191,191,191,191, /* 70- 83 */ 192,192,192,192,165,165,165,165,165,165,165,165,166,166, /* 84- 97 */ 166,166,166,166,166,166,193,193,193,193,194,194,194,194, /* 98-111 */ 130,130,130,130,130,130,130,130,130,130,130,130,130,130, /* 112-125 */ 130,130,131,131,131,131,131,131,131,131,131,131,131,131, /* 126-139 */ 131,131,131,131,195,195,195,195,196,196,196,196,174,174, /* 140-153 */ 174,174,174,174,174,174,175,175,175,175,175,175,175,175, /* 154-167 */ 176,176,176,176,176,176,176,176,177,177,177,177,178,178, /* 168-181 */ 178,178,159,159,159,159,159,159,159,159,160,160,160,160, /* 182-195 */ 160,160,160,160,183,183,183,183,184,184,184,184,185,185, /* 196-209 */ 185,185,186,186,186,186,187,187,187,187,188,188,188,188, /* 210-223 */ 170,170,170,170,170,170,170,170,170,170,170,170,170,170, /* 224-237 */ 170,170,170,170,170,170,170,170,170,170,170,170,170,170, /* 238-251 */ 170,170,170,170 }, /* prefix 119 */ { 119,119,119,119,119,119,119,119,119,119,119,119,119,119, /* 0- 13 */ 119,119,119,119,119,119,119,119,119,119,119,119,119,119, /* 14- 27 */ 119,119,119,119,119,119,119,119,119,119,119,119,119,119, /* 28- 41 */ 119,119,119,119,119,119,119,119,119,119,119,119,119,119, /* 42- 55 */ 119,119,119,119,119,119,119,119,119,119,119,119,119,119, /* 56- 69 */ 119,119,119,119,119,119,119,119,119,119,119,119,119,119, /* 70- 83 */ 119,119,119,119,119,119,119,119,119,119,119,119,119,119, /* 84- 97 */ 119,119,119,119,119,119,119,119,119,119,119,119,119,119, /* 98-111 */ 119,119,119,119,119,119,119,119,119,119,119,119,119,119, /* 112-125 */ 119,119,129,129,129,129,129,129,129,129,129,129,129,129, /* 126-139 */ 129,129,129,129,156,156,156,156,156,156,156,156,157,157, /* 140-153 */ 157,157,157,157,157,157,150,150,150,150,150,150,150,150, /* 154-167 */ 151,151,151,151,151,151,151,151,152,152,152,152,152,152, /* 168-181 */ 152,152,153,153,153,153,153,153,153,153,163,163,163,163, /* 182-195 */ 163,163,163,163,164,164,164,164,164,164,164,164,167,167, /* 196-209 */ 167,167,167,167,167,167,173,173,173,173,173,173,173,173, /* 210-223 */ 122,122,122,122,122,122,122,122,122,122,122,122,122,122, /* 224-237 */ 122,122,122,122,122,122,122,122,122,122,122,122,122,122, /* 238-251 */ 122,122,122,122 }, /* prefix 120 */ { 123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* 0- 13 */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* 14- 27 */ 123,123,123,123,154,154,154,154,154,154,154,154,155,155, /* 28- 41 */ 155,155,155,155,155,155,168,168,168,168,168,168,168,168, /* 42- 55 */ 169,169,169,169,169,169,169,169,136,136,136,136,136,136, /* 56- 69 */ 136,136,137,137,137,137,137,137,137,137,138,138,138,138, /* 70- 83 */ 138,138,138,138,139,139,139,139,139,139,139,139,146,146, /* 84- 97 */ 146,146,146,146,146,146,147,147,147,147,147,147,147,147, /* 98-111 */ 128,128,128,128,128,128,128,128,128,128,128,128,128,128, /* 112-125 */ 128,128,120,120,120,120,120,120,120,120,120,120,120,120, /* 126-139 */ 120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* 140-153 */ 120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* 154-167 */ 120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* 168-181 */ 120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* 182-195 */ 120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* 196-209 */ 120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* 210-223 */ 120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* 224-237 */ 120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* 238-251 */ 120,120,120,120 }, /* prefix 121 */ { 121,121,121,121,121,121,121,121,121,121,121,121,121,121, /* 0- 13 */ 121,121,121,121,121,121,121,121,121,121,121,121,121,121, /* 14- 27 */ 121,121,121,121,121,121,121,121,121,121,121,121,121,121, /* 28- 41 */ 121,121,121,121,121,121,121,121,121,121,121,121,121,121, /* 42- 55 */ 121,121,121,121,121,121,121,121,171,171,171,171,171,171, /* 56- 69 */ 171,171,172,172,172,172,172,172,172,172,132,132,132,132, /* 70- 83 */ 132,132,132,132,133,133,133,133,133,133,133,133,134,134, /* 84- 97 */ 134,134,134,134,134,134,135,135,135,135,135,135,135,135, /* 98-111 */ 125,125,125,125,125,125,125,125,125,125,125,125,125,125, /* 112-125 */ 125,125,126,126,126,126,126,126,126,126,126,126,126,126, /* 126-139 */ 126,126,126,126,140,140,140,140,140,140,140,140,141,141, /* 140-153 */ 141,141,141,141,141,141,142,142,142,142,142,142,142,142, /* 154-167 */ 143,143,143,143,143,143,143,143,144,144,144,144,144,144, /* 168-181 */ 144,144,145,145,145,145,145,145,145,145,127,127,127,127, /* 182-195 */ 127,127,127,127,127,127,127,127,127,127,127,127,148,148, /* 196-209 */ 148,148,148,148,148,148,149,149,149,149,149,149,149,149, /* 210-223 */ 106,106,106,106,106,106,106,106,106,106,106,106,106,106, /* 224-237 */ 106,106,106,106,106,106,106,106,106,106,106,106,106,106, /* 238-251 */ 106,106,106,106 }, /* prefix 122 */ { 0,210,210,210,210,210,210,210, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1,197,197,197,197,197,197, /* 56- 69 */ 197,197,200,200,200,200,201,201,201,201,202,202,202,202, /* 70- 83 */ 203,203,203,203,204,204,204,204,205,205,205,205,198,198, /* 84- 97 */ 198,198,198,198,198,198,199,199,199,199,199,199,199,199, /* 98-111 */ 206,206,206,206,207,207,207,207,208,208,208,208,209,209, /* 112-125 */ 209,209,124,124,124,124,124,124,124,124,124,124,124,124, /* 126-139 */ 124,124,124,124,158,158,158,158,179,179,180,180,181,181, /* 140-153 */ 182,182,161,161,161,161,162,162,162,162,189,189,190,190, /* 154-167 */ 191,191,192,192,165,165,165,165,166,166,166,166,193,193, /* 168-181 */ 194,194,130,130,130,130,130,130,130,130,131,131,131,131, /* 182-195 */ 131,131,131,131,195,195,196,196,174,174,174,174,175,175, /* 196-209 */ 175,175,176,176,176,176,177,177,178,178,159,159,159,159, /* 210-223 */ 160,160,160,160,183,183,184,184,185,185,186,186,187,187, /* 224-237 */ 188,188,170,170,170,170,170,170,170,170,170,170,170,170, /* 238-251 */ 170,170,170,170 }, /* prefix 123 */ { 119,119,119,119,119,119,119,119,119,119,119,119,119,119, /* 0- 13 */ 119,119,119,119,119,119,119,119,119,119,119,119,119,119, /* 14- 27 */ 119,119,119,119,119,119,119,119,119,119,119,119,119,119, /* 28- 41 */ 119,119,119,119,119,119,119,119,119,119,119,119,119,119, /* 42- 55 */ 119,119,119,119,119,119,119,119,129,129,129,129,129,129, /* 56- 69 */ 129,129,156,156,156,156,157,157,157,157,150,150,150,150, /* 70- 83 */ 151,151,151,151,152,152,152,152,153,153,153,153,163,163, /* 84- 97 */ 163,163,164,164,164,164,167,167,167,167,173,173,173,173, /* 98-111 */ 122,122,122,122,122,122,122,122,122,122,122,122,122,122, /* 112-125 */ 122,122,123,123,123,123,123,123,123,123,123,123,123,123, /* 126-139 */ 123,123,123,123,154,154,154,154,155,155,155,155,168,168, /* 140-153 */ 168,168,169,169,169,169,136,136,136,136,137,137,137,137, /* 154-167 */ 138,138,138,138,139,139,139,139,146,146,146,146,147,147, /* 168-181 */ 147,147,128,128,128,128,128,128,128,128,120,120,120,120, /* 182-195 */ 120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* 196-209 */ 120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* 210-223 */ 120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* 224-237 */ 120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* 238-251 */ 120,120,120,120 }, /* prefix 124 */ { 116,116,116,116,116,116,116,116,116,116,116,116,116,116, /* 0- 13 */ 116,116,116,116,116,116,116,116,116,116,116,116,116,116, /* 14- 27 */ 116,116,116,116,116,116,116,116,116,116,116,116,116,116, /* 28- 41 */ 116,116,116,116,116,116,116,116,116,116,116,116,116,116, /* 42- 55 */ 116,116,116,116,116,116,116,116,116,116,116,116,116,116, /* 56- 69 */ 116,116,116,116,116,116,116,116,116,116,116,116,116,116, /* 70- 83 */ 116,116,116,116,116,116,116,116,116,116,116,116,116,116, /* 84- 97 */ 116,116,116,116,116,116,116,116,116,116,116,116,116,116, /* 98-111 */ 116,116,116,116,116,116,116,116,116,116,116,116,116,116, /* 112-125 */ 116,116,117,117,117,117,117,117,117,117,117,117,117,117, /* 126-139 */ 117,117,117,117,117,117,117,117,117,117,117,117,117,117, /* 140-153 */ 117,117,117,117,117,117,117,117,117,117,117,117,117,117, /* 154-167 */ 117,117,117,117,117,117,117,117,117,117,117,117,117,117, /* 168-181 */ 117,117,117,117,117,117,117,117,117,117,117,117,117,117, /* 182-195 */ 117,117,117,117,117,117,117,117,117,117,117,117,117,117, /* 196-209 */ 117,117,117,117,117,117,117,117,117,117,117,117,117,117, /* 210-223 */ 117,117,117,117,117,117,117,117,117,117,117,117,117,117, /* 224-237 */ 117,117,117,117,117,117,117,117,117,117,117,117,117,117, /* 238-251 */ 117,117,117,117 }, /* prefix 125 */ { 121,121,121,121,121,121,121,121,121,121,121,121,121,121, /* 0- 13 */ 121,121,121,121,121,121,121,121,121,121,121,121,121,121, /* 14- 27 */ 121,121,121,121,171,171,171,171,172,172,172,172,132,132, /* 28- 41 */ 132,132,133,133,133,133,134,134,134,134,135,135,135,135, /* 42- 55 */ 125,125,125,125,125,125,125,125,126,126,126,126,126,126, /* 56- 69 */ 126,126,140,140,140,140,141,141,141,141,142,142,142,142, /* 70- 83 */ 143,143,143,143,144,144,144,144,145,145,145,145,127,127, /* 84- 97 */ 127,127,127,127,127,127,148,148,148,148,149,149,149,149, /* 98-111 */ 106,106,106,106,106,106,106,106,106,106,106,106,106,106, /* 112-125 */ 106,106,118,118,118,118,118,118,118,118,118,118,118,118, /* 126-139 */ 118,118,118,118,118,118,118,118,118,118,118,118,118,118, /* 140-153 */ 118,118,118,118,118,118,118,118,118,118,118,118,118,118, /* 154-167 */ 118,118,118,118,118,118,118,118,118,118,118,118,118,118, /* 168-181 */ 118,118,118,118,118,118,118,118,118,118,118,118,118,118, /* 182-195 */ 118,118,118,118,118,118,118,118,118,118,118,118,118,118, /* 196-209 */ 118,118,118,118,118,118,118,118,118,118,118,118,118,118, /* 210-223 */ 118,118,118,118,118,118,118,118,118,118,118,118,118,118, /* 224-237 */ 118,118,118,118,118,118,118,118,118,118,118,118,118,118, /* 238-251 */ 118,118,118,118 }, /* prefix 126 */ { 0,210,210,210, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1,197,197,197,197,200,200,201,201,202,202, /* 28- 41 */ 203,203,204,204,205,205,198,198,198,198,199,199,199,199, /* 42- 55 */ 206,206,207,207,208,208,209,209,124,124,124,124,124,124, /* 56- 69 */ 124,124,158,158,179,180,181,182,161,161,162,162,189,190, /* 70- 83 */ 191,192,165,165,166,166,193,194,130,130,130,130,131,131, /* 84- 97 */ 131,131,195,196,174,174,175,175,176,176,177,178,159,159, /* 98-111 */ 160,160,183,184,185,186,187,188,170,170,170,170,170,170, /* 112-125 */ 170,170,119,119,119,119,119,119,119,119,119,119,119,119, /* 126-139 */ 119,119,119,119,119,119,119,119,119,119,119,119,119,119, /* 140-153 */ 119,119,119,119,119,119,129,129,129,129,156,156,157,157, /* 154-167 */ 150,150,151,151,152,152,153,153,163,163,164,164,167,167, /* 168-181 */ 173,173,122,122,122,122,122,122,122,122,123,123,123,123, /* 182-195 */ 123,123,123,123,154,154,155,155,168,168,169,169,136,136, /* 196-209 */ 137,137,138,138,139,139,146,146,147,147,128,128,128,128, /* 210-223 */ 120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* 224-237 */ 120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* 238-251 */ 120,120,120,120 }, /* prefix 127 */ { 116,116,116,116,116,116,116,116,116,116,116,116,116,116, /* 0- 13 */ 116,116,116,116,116,116,116,116,116,116,116,116,116,116, /* 14- 27 */ 116,116,116,116,116,116,116,116,116,116,116,116,116,116, /* 28- 41 */ 116,116,116,116,116,116,116,116,116,116,116,116,116,116, /* 42- 55 */ 116,116,116,116,116,116,116,116,117,117,117,117,117,117, /* 56- 69 */ 117,117,117,117,117,117,117,117,117,117,117,117,117,117, /* 70- 83 */ 117,117,117,117,117,117,117,117,117,117,117,117,117,117, /* 84- 97 */ 117,117,117,117,117,117,117,117,117,117,117,117,117,117, /* 98-111 */ 117,117,117,117,117,117,117,117,117,117,117,117,117,117, /* 112-125 */ 117,117,121,121,121,121,121,121,121,121,121,121,121,121, /* 126-139 */ 121,121,121,121,171,171,172,172,132,132,133,133,134,134, /* 140-153 */ 135,135,125,125,125,125,126,126,126,126,140,140,141,141, /* 154-167 */ 142,142,143,143,144,144,145,145,127,127,127,127,148,148, /* 168-181 */ 149,149,106,106,106,106,106,106,106,106,118,118,118,118, /* 182-195 */ 118,118,118,118,118,118,118,118,118,118,118,118,118,118, /* 196-209 */ 118,118,118,118,118,118,118,118,118,118,118,118,118,118, /* 210-223 */ 118,118,118,118,118,118,118,118,118,118,118,118,118,118, /* 224-237 */ 118,118,118,118,118,118,118,118,118,118,118,118,118,118, /* 238-251 */ 118,118,118,118 }, /* prefix 128 */ { 115,115,115,115,115,115,115,115,115,115,115,115,115,115, /* 0- 13 */ 115,115,115,115,115,115,115,115,115,115,115,115,115,115, /* 14- 27 */ 115,115,115,115,115,115,115,115,115,115,115,115,115,115, /* 28- 41 */ 115,115,115,115,115,115,115,115,115,115,115,115,115,115, /* 42- 55 */ 115,115,115,115,115,115,115,115,115,115,115,115,115,115, /* 56- 69 */ 115,115,115,115,115,115,115,115,115,115,115,115,115,115, /* 70- 83 */ 115,115,115,115,115,115,115,115,115,115,115,115,115,115, /* 84- 97 */ 115,115,115,115,115,115,115,115,115,115,115,115,115,115, /* 98-111 */ 115,115,115,115,115,115,115,115,115,115,115,115,115,115, /* 112-125 */ 115,115,114,114,114,114,114,114,114,114,114,114,114,114, /* 126-139 */ 114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* 140-153 */ 114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* 154-167 */ 114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* 168-181 */ 114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* 182-195 */ 114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* 196-209 */ 114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* 210-223 */ 114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* 224-237 */ 114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* 238-251 */ 114,114,114,114 }, /* prefix 129 */ { 0,210, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1,197,197,200,201,202,203,204,205,198,198,199,199, /* 14- 27 */ 206,207,208,209,124,124,124,124,158, 0, 0,161,162, 0, /* 28- 41 */ 0,165,166, 0,130,130,131,131, 0,174,175,176, 0,159, /* 42- 55 */ 160, 0, 0, 0,170,170,170,170,119,119,119,119,119,119, /* 56- 69 */ 119,119,119,119,119,119,119,119,119,119,129,129,156,157, /* 70- 83 */ 150,151,152,153,163,164,167,173,122,122,122,122,123,123, /* 84- 97 */ 123,123,154,155,168,169,136,137,138,139,146,147,128,128, /* 98-111 */ 120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* 112-125 */ 120,120,116,116,116,116,116,116,116,116,116,116,116,116, /* 126-139 */ 116,116,116,116,116,116,116,116,116,116,116,116,116,116, /* 140-153 */ 116,116,116,116,116,116,117,117,117,117,117,117,117,117, /* 154-167 */ 117,117,117,117,117,117,117,117,117,117,117,117,117,117, /* 168-181 */ 117,117,117,117,117,117,117,117,117,117,121,121,121,121, /* 182-195 */ 121,121,121,121,171,172,132,133,134,135,125,125,126,126, /* 196-209 */ 140,141,142,143,144,145,127,127,148,149,106,106,106,106, /* 210-223 */ 118,118,118,118,118,118,118,118,118,118,118,118,118,118, /* 224-237 */ 118,118,118,118,118,118,118,118,118,118,118,118,118,118, /* 238-251 */ 118,118,118,118 }, /* prefix 130 */ { 115,115,115,115,115,115,115,115,115,115,115,115,115,115, /* 0- 13 */ 115,115,115,115,115,115,115,115,115,115,115,115,115,115, /* 14- 27 */ 115,115,115,115,115,115,115,115,115,115,115,115,115,115, /* 28- 41 */ 115,115,115,115,115,115,115,115,115,115,115,115,115,115, /* 42- 55 */ 115,115,115,115,115,115,115,115,114,114,114,114,114,114, /* 56- 69 */ 114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* 70- 83 */ 114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* 84- 97 */ 114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* 98-111 */ 114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* 112-125 */ 114,114,113,113,113,113,113,113,113,113,113,113,113,113, /* 126-139 */ 113,113,113,113,113,113,113,113,113,113,113,113,113,113, /* 140-153 */ 113,113,113,113,113,113,113,113,113,113,113,113,113,113, /* 154-167 */ 113,113,113,113,113,113,113,113,113,113,113,113,113,113, /* 168-181 */ 113,113,113,113,113,113,113,113,113,113,113,113,113,113, /* 182-195 */ 113,113,113,113,113,113,113,113,113,113,113,113,113,113, /* 196-209 */ 113,113,113,113,113,113,113,113,113,113,113,113,113,113, /* 210-223 */ 113,113,113,113,113,113,113,113,113,113,113,113,113,113, /* 224-237 */ 113,113,113,113,113,113,113,113,113,113,113,113,113,113, /* 238-251 */ 113,113,113,113 }, /* prefix 131 */ { 0, 1, 1, 1, 1, 1, 1, 1,197, 0, 0, 0,198,199, /* 0- 13 */ 0, 0,124,124, 0, 0, 0, 0, 0,130,131, 0, 0, 0, /* 14- 27 */ 0, 0,170,170,119,119,119,119,119,119,119,119,129, 0, /* 28- 41 */ 0, 0, 0, 0,122,122,123,123, 0, 0, 0, 0, 0,128, /* 42- 55 */ 120,120,120,120,120,120,120,120,116,116,116,116,116,116, /* 56- 69 */ 116,116,116,116,116,116,116,116,116,116,117,117,117,117, /* 70- 83 */ 117,117,117,117,117,117,117,117,117,117,117,117,121,121, /* 84- 97 */ 121,121, 0, 0, 0,125,126, 0, 0, 0,127, 0,106,106, /* 98-111 */ 118,118,118,118,118,118,118,118,118,118,118,118,118,118, /* 112-125 */ 118,118,115,115,115,115,115,115,115,115,115,115,115,115, /* 126-139 */ 115,115,115,115,115,115,115,115,115,115,115,115,115,115, /* 140-153 */ 115,115,115,115,115,115,114,114,114,114,114,114,114,114, /* 154-167 */ 114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* 168-181 */ 114,114,114,114,114,114,114,114,114,114,113,113,113,113, /* 182-195 */ 113,113,113,113,113,113,113,113,113,113,113,113,113,113, /* 196-209 */ 113,113,113,113,113,113,113,113,113,113,113,113,113,113, /* 210-223 */ 113,113,113,113,113,113,113,113,113,113,113,113,113,113, /* 224-237 */ 113,113,113,113,113,113,113,113,113,113,113,113,113,113, /* 238-251 */ 113,113,113,113 }, /* prefix 132 */ { 112,112,112,112,112,112,112,112,112,112,112,112,112,112, /* 0- 13 */ 112,112,112,112,112,112,112,112,112,112,112,112,112,112, /* 14- 27 */ 112,112,112,112,112,112,112,112,112,112,112,112,112,112, /* 28- 41 */ 112,112,112,112,112,112,112,112,112,112,112,112,112,112, /* 42- 55 */ 112,112,112,112,112,112,112,112,112,112,112,112,112,112, /* 56- 69 */ 112,112,112,112,112,112,112,112,112,112,112,112,112,112, /* 70- 83 */ 112,112,112,112,112,112,112,112,112,112,112,112,112,112, /* 84- 97 */ 112,112,112,112,112,112,112,112,112,112,112,112,112,112, /* 98-111 */ 112,112,112,112,112,112,112,112,112,112,112,112,112,112, /* 112-125 */ 112,112,111,111,111,111,111,111,111,111,111,111,111,111, /* 126-139 */ 111,111,111,111,111,111,111,111,111,111,111,111,111,111, /* 140-153 */ 111,111,111,111,111,111,111,111,111,111,111,111,111,111, /* 154-167 */ 111,111,111,111,111,111,111,111,111,111,111,111,111,111, /* 168-181 */ 111,111,111,111,111,111,111,111,111,111,111,111,111,111, /* 182-195 */ 111,111,111,111,111,111,111,111,111,111,111,111,111,111, /* 196-209 */ 111,111,111,111,111,111,111,111,111,111,111,111,111,111, /* 210-223 */ 111,111,111,111,111,111,111,111,111,111,111,111,111,111, /* 224-237 */ 111,111,111,111,111,111,111,111,111,111,111,111,111,111, /* 238-251 */ 111,111,111,111 }, /* prefix 133 */ { 0, 1, 1, 1, 0, 0, 0, 0,124, 0, 0, 0, 0, 0, /* 0- 13 */ 0,170,119,119,119,119, 0, 0, 0,122,123, 0, 0, 0, /* 14- 27 */ 120,120,120,120,116,116,116,116,116,116,116,116,117,117, /* 28- 41 */ 117,117,117,117,117,117,121,121, 0, 0, 0, 0, 0,106, /* 42- 55 */ 118,118,118,118,118,118,118,118,115,115,115,115,115,115, /* 56- 69 */ 115,115,115,115,115,115,115,115,115,115,114,114,114,114, /* 70- 83 */ 114,114,114,114,114,114,114,114,114,114,114,114,113,113, /* 84- 97 */ 113,113,113,113,113,113,113,113,113,113,113,113,113,113, /* 98-111 */ 113,113,113,113,113,113,113,113,113,113,113,113,113,113, /* 112-125 */ 113,113,112,112,112,112,112,112,112,112,112,112,112,112, /* 126-139 */ 112,112,112,112,112,112,112,112,112,112,112,112,112,112, /* 140-153 */ 112,112,112,112,112,112,112,112,112,112,112,112,112,112, /* 154-167 */ 112,112,112,112,112,112,112,112,112,112,112,112,112,112, /* 168-181 */ 112,112,112,112,112,112,112,112,112,112,111,111,111,111, /* 182-195 */ 111,111,111,111,111,111,111,111,111,111,111,111,111,111, /* 196-209 */ 111,111,111,111,111,111,111,111,111,111,111,111,111,111, /* 210-223 */ 111,111,111,111,111,111,111,111,111,111,111,111,111,111, /* 224-237 */ 111,111,111,111,111,111,111,111,111,111,111,111,111,111, /* 238-251 */ 111,111,111,111 }, /* prefix 134 */ { 107,107,107,107,107,107,107,107,107,107,107,107,107,107, /* 0- 13 */ 107,107,107,107,107,107,107,107,107,107,107,107,107,107, /* 14- 27 */ 107,107,107,107,107,107,107,107,107,107,107,107,107,107, /* 28- 41 */ 107,107,107,107,107,107,107,107,107,107,107,107,107,107, /* 42- 55 */ 107,107,107,107,107,107,107,107,107,107,107,107,107,107, /* 56- 69 */ 107,107,107,107,107,107,107,107,107,107,107,107,107,107, /* 70- 83 */ 107,107,107,107,107,107,107,107,107,107,107,107,107,107, /* 84- 97 */ 107,107,107,107,107,107,107,107,107,107,107,107,107,107, /* 98-111 */ 107,107,107,107,107,107,107,107,107,107,107,107,107,107, /* 112-125 */ 107,107,110,110,110,110,110,110,110,110,110,110,110,110, /* 126-139 */ 110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* 140-153 */ 110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* 154-167 */ 110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* 168-181 */ 110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* 182-195 */ 110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* 196-209 */ 110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* 210-223 */ 110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* 224-237 */ 110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* 238-251 */ 110,110,110,110 }, /* prefix 135 */ { 0, 1, 0, 0, 0, 0, 0, 0,119,119, 0, 0, 0, 0, /* 0- 13 */ 120,120,116,116,116,116,117,117,117,117,121, 0, 0, 0, /* 14- 27 */ 118,118,118,118,115,115,115,115,115,115,115,115,114,114, /* 28- 41 */ 114,114,114,114,114,114,113,113,113,113,113,113,113,113, /* 42- 55 */ 113,113,113,113,113,113,113,113,112,112,112,112,112,112, /* 56- 69 */ 112,112,112,112,112,112,112,112,112,112,112,112,112,112, /* 70- 83 */ 112,112,112,112,112,112,112,112,112,112,112,112,111,111, /* 84- 97 */ 111,111,111,111,111,111,111,111,111,111,111,111,111,111, /* 98-111 */ 111,111,111,111,111,111,111,111,111,111,111,111,111,111, /* 112-125 */ 111,111,107,107,107,107,107,107,107,107,107,107,107,107, /* 126-139 */ 107,107,107,107,107,107,107,107,107,107,107,107,107,107, /* 140-153 */ 107,107,107,107,107,107,107,107,107,107,107,107,107,107, /* 154-167 */ 107,107,107,107,107,107,107,107,107,107,107,107,107,107, /* 168-181 */ 107,107,107,107,107,107,107,107,107,107,110,110,110,110, /* 182-195 */ 110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* 196-209 */ 110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* 210-223 */ 110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* 224-237 */ 110,110,110,110,110,110,110,110,110,110,110,110,110,110, /* 238-251 */ 110,110,110,110 }, /* prefix 136 */ { 109,109,109,109,109,109,109,109,109,109,109,109,109,109, /* 0- 13 */ 109,109,109,109,109,109,109,109,109,109,109,109,109,109, /* 14- 27 */ 109,109,109,109,109,109,109,109,109,109,109,109,109,109, /* 28- 41 */ 109,109,109,109,109,109,109,109,109,109,109,109,109,109, /* 42- 55 */ 109,109,109,109,109,109,109,109,109,109,109,109,109,109, /* 56- 69 */ 109,109,109,109,109,109,109,109,109,109,109,109,109,109, /* 70- 83 */ 109,109,109,109,109,109,109,109,109,109,109,109,109,109, /* 84- 97 */ 109,109,109,109,109,109,109,109,109,109,109,109,109,109, /* 98-111 */ 109,109,109,109,109,109,109,109,109,109,109,109,109,109, /* 112-125 */ 109,109,108,108,108,108,108,108,108,108,108,108,108,108, /* 126-139 */ 108,108,108,108,108,108,108,108,108,108,108,108,108,108, /* 140-153 */ 108,108,108,108,108,108,108,108,108,108,108,108,108,108, /* 154-167 */ 108,108,108,108,108,108,108,108,108,108,108,108,108,108, /* 168-181 */ 108,108,108,108,108,108,108,108,108,108,108,108,108,108, /* 182-195 */ 108,108,108,108,108,108,108,108,108,108,108,108,108,108, /* 196-209 */ 108,108,108,108,108,108,108,108,108,108,108,108,108,108, /* 210-223 */ 108,108,108,108,108,108,108,108,108,108,108,108,108,108, /* 224-237 */ 108,108,108,108,108,108,108,108,108,108,108,108,108,108, /* 238-251 */ 108,108,108,108 }, /* prefix 137 */ { 0,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 0- 13 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 14- 27 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 28- 41 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 42- 55 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 56- 69 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 70- 83 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 84- 97 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 98-111 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 112-125 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 126-139 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 140-153 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 154-167 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 168-181 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 182-195 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 196-209 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 210-223 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 224-237 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 238-251 */ 210,210,210,210 }, /* prefix 138 */ { 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* 0- 13 */ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* 14- 27 */ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* 28- 41 */ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* 42- 55 */ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* 56- 69 */ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* 70- 83 */ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* 84- 97 */ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* 98-111 */ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* 112-125 */ 96, 96, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, /* 126-139 */ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, /* 140-153 */ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, /* 154-167 */ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, /* 168-181 */ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, /* 182-195 */ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, /* 196-209 */ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, /* 210-223 */ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, /* 224-237 */ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, /* 238-251 */ 97, 97, 97, 97 }, /* prefix 139 */ { 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* 0- 13 */ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* 14- 27 */ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* 28- 41 */ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* 42- 55 */ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* 56- 69 */ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* 70- 83 */ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* 84- 97 */ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* 98-111 */ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* 112-125 */ 98, 98, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, /* 126-139 */ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, /* 140-153 */ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, /* 154-167 */ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, /* 168-181 */ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, /* 182-195 */ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, /* 196-209 */ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, /* 210-223 */ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, /* 224-237 */ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, /* 238-251 */ 99, 99, 99, 99 }, /* prefix 140 */ { 100,100,100,100,100,100,100,100,100,100,100,100,100,100, /* 0- 13 */ 100,100,100,100,100,100,100,100,100,100,100,100,100,100, /* 14- 27 */ 100,100,100,100,100,100,100,100,100,100,100,100,100,100, /* 28- 41 */ 100,100,100,100,100,100,100,100,100,100,100,100,100,100, /* 42- 55 */ 100,100,100,100,100,100,100,100,100,100,100,100,100,100, /* 56- 69 */ 100,100,100,100,100,100,100,100,100,100,100,100,100,100, /* 70- 83 */ 100,100,100,100,100,100,100,100,100,100,100,100,100,100, /* 84- 97 */ 100,100,100,100,100,100,100,100,100,100,100,100,100,100, /* 98-111 */ 100,100,100,100,100,100,100,100,100,100,100,100,100,100, /* 112-125 */ 100,100,101,101,101,101,101,101,101,101,101,101,101,101, /* 126-139 */ 101,101,101,101,101,101,101,101,101,101,101,101,101,101, /* 140-153 */ 101,101,101,101,101,101,101,101,101,101,101,101,101,101, /* 154-167 */ 101,101,101,101,101,101,101,101,101,101,101,101,101,101, /* 168-181 */ 101,101,101,101,101,101,101,101,101,101,101,101,101,101, /* 182-195 */ 101,101,101,101,101,101,101,101,101,101,101,101,101,101, /* 196-209 */ 101,101,101,101,101,101,101,101,101,101,101,101,101,101, /* 210-223 */ 101,101,101,101,101,101,101,101,101,101,101,101,101,101, /* 224-237 */ 101,101,101,101,101,101,101,101,101,101,101,101,101,101, /* 238-251 */ 101,101,101,101 }, /* prefix 141 */ { 102,102,102,102,102,102,102,102,102,102,102,102,102,102, /* 0- 13 */ 102,102,102,102,102,102,102,102,102,102,102,102,102,102, /* 14- 27 */ 102,102,102,102,102,102,102,102,102,102,102,102,102,102, /* 28- 41 */ 102,102,102,102,102,102,102,102,102,102,102,102,102,102, /* 42- 55 */ 102,102,102,102,102,102,102,102,102,102,102,102,102,102, /* 56- 69 */ 102,102,102,102,102,102,102,102,102,102,102,102,102,102, /* 70- 83 */ 102,102,102,102,102,102,102,102,102,102,102,102,102,102, /* 84- 97 */ 102,102,102,102,102,102,102,102,102,102,102,102,102,102, /* 98-111 */ 102,102,102,102,102,102,102,102,102,102,102,102,102,102, /* 112-125 */ 102,102,103,103,103,103,103,103,103,103,103,103,103,103, /* 126-139 */ 103,103,103,103,103,103,103,103,103,103,103,103,103,103, /* 140-153 */ 103,103,103,103,103,103,103,103,103,103,103,103,103,103, /* 154-167 */ 103,103,103,103,103,103,103,103,103,103,103,103,103,103, /* 168-181 */ 103,103,103,103,103,103,103,103,103,103,103,103,103,103, /* 182-195 */ 103,103,103,103,103,103,103,103,103,103,103,103,103,103, /* 196-209 */ 103,103,103,103,103,103,103,103,103,103,103,103,103,103, /* 210-223 */ 103,103,103,103,103,103,103,103,103,103,103,103,103,103, /* 224-237 */ 103,103,103,103,103,103,103,103,103,103,103,103,103,103, /* 238-251 */ 103,103,103,103 }, /* prefix 142 */ { 104,104,104,104,104,104,104,104,104,104,104,104,104,104, /* 0- 13 */ 104,104,104,104,104,104,104,104,104,104,104,104,104,104, /* 14- 27 */ 104,104,104,104,104,104,104,104,104,104,104,104,104,104, /* 28- 41 */ 104,104,104,104,104,104,104,104,104,104,104,104,104,104, /* 42- 55 */ 104,104,104,104,104,104,104,104,104,104,104,104,104,104, /* 56- 69 */ 104,104,104,104,104,104,104,104,104,104,104,104,104,104, /* 70- 83 */ 104,104,104,104,104,104,104,104,104,104,104,104,104,104, /* 84- 97 */ 104,104,104,104,104,104,104,104,104,104,104,104,104,104, /* 98-111 */ 104,104,104,104,104,104,104,104,104,104,104,104,104,104, /* 112-125 */ 104,104,105,105,105,105,105,105,105,105,105,105,105,105, /* 126-139 */ 105,105,105,105,105,105,105,105,105,105,105,105,105,105, /* 140-153 */ 105,105,105,105,105,105,105,105,105,105,105,105,105,105, /* 154-167 */ 105,105,105,105,105,105,105,105,105,105,105,105,105,105, /* 168-181 */ 105,105,105,105,105,105,105,105,105,105,105,105,105,105, /* 182-195 */ 105,105,105,105,105,105,105,105,105,105,105,105,105,105, /* 196-209 */ 105,105,105,105,105,105,105,105,105,105,105,105,105,105, /* 210-223 */ 105,105,105,105,105,105,105,105,105,105,105,105,105,105, /* 224-237 */ 105,105,105,105,105,105,105,105,105,105,105,105,105,105, /* 238-251 */ 105,105,105,105 }, /* prefix 143 */ { 0,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 0- 13 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 14- 27 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 28- 41 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 42- 55 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 56- 69 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 70- 83 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 84- 97 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 98-111 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 112-125 */ 210,210, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 144 */ { 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, /* 0- 13 */ 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, /* 14- 27 */ 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, /* 28- 41 */ 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, /* 42- 55 */ 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, /* 56- 69 */ 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, /* 70- 83 */ 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, /* 84- 97 */ 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, /* 98-111 */ 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, /* 112-125 */ 93, 93, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* 126-139 */ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* 140-153 */ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* 154-167 */ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* 168-181 */ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 97, 97, 97, 97, /* 182-195 */ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, /* 196-209 */ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, /* 210-223 */ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, /* 224-237 */ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, /* 238-251 */ 97, 97, 97, 97 }, /* prefix 145 */ { 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* 0- 13 */ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* 14- 27 */ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* 28- 41 */ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* 42- 55 */ 98, 98, 98, 98, 98, 98, 98, 98, 99, 99, 99, 99, 99, 99, /* 56- 69 */ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, /* 70- 83 */ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, /* 84- 97 */ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, /* 98-111 */ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, /* 112-125 */ 99, 99,100,100,100,100,100,100,100,100,100,100,100,100, /* 126-139 */ 100,100,100,100,100,100,100,100,100,100,100,100,100,100, /* 140-153 */ 100,100,100,100,100,100,100,100,100,100,100,100,100,100, /* 154-167 */ 100,100,100,100,100,100,100,100,100,100,100,100,100,100, /* 168-181 */ 100,100,100,100,100,100,100,100,100,100,101,101,101,101, /* 182-195 */ 101,101,101,101,101,101,101,101,101,101,101,101,101,101, /* 196-209 */ 101,101,101,101,101,101,101,101,101,101,101,101,101,101, /* 210-223 */ 101,101,101,101,101,101,101,101,101,101,101,101,101,101, /* 224-237 */ 101,101,101,101,101,101,101,101,101,101,101,101,101,101, /* 238-251 */ 101,101,101,101 }, /* prefix 146 */ { 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, /* 0- 13 */ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, /* 14- 27 */ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, /* 28- 41 */ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, /* 42- 55 */ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, /* 56- 69 */ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, /* 70- 83 */ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, /* 84- 97 */ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, /* 98-111 */ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, /* 112-125 */ 94, 94, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* 126-139 */ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* 140-153 */ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* 154-167 */ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* 168-181 */ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* 182-195 */ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* 196-209 */ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* 210-223 */ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* 224-237 */ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* 238-251 */ 95, 95, 95, 95 }, /* prefix 147 */ { 102,102,102,102,102,102,102,102,102,102,102,102,102,102, /* 0- 13 */ 102,102,102,102,102,102,102,102,102,102,102,102,102,102, /* 14- 27 */ 102,102,102,102,102,102,102,102,102,102,102,102,102,102, /* 28- 41 */ 102,102,102,102,102,102,102,102,102,102,102,102,102,102, /* 42- 55 */ 102,102,102,102,102,102,102,102,103,103,103,103,103,103, /* 56- 69 */ 103,103,103,103,103,103,103,103,103,103,103,103,103,103, /* 70- 83 */ 103,103,103,103,103,103,103,103,103,103,103,103,103,103, /* 84- 97 */ 103,103,103,103,103,103,103,103,103,103,103,103,103,103, /* 98-111 */ 103,103,103,103,103,103,103,103,103,103,103,103,103,103, /* 112-125 */ 103,103,104,104,104,104,104,104,104,104,104,104,104,104, /* 126-139 */ 104,104,104,104,104,104,104,104,104,104,104,104,104,104, /* 140-153 */ 104,104,104,104,104,104,104,104,104,104,104,104,104,104, /* 154-167 */ 104,104,104,104,104,104,104,104,104,104,104,104,104,104, /* 168-181 */ 104,104,104,104,104,104,104,104,104,104,105,105,105,105, /* 182-195 */ 105,105,105,105,105,105,105,105,105,105,105,105,105,105, /* 196-209 */ 105,105,105,105,105,105,105,105,105,105,105,105,105,105, /* 210-223 */ 105,105,105,105,105,105,105,105,105,105,105,105,105,105, /* 224-237 */ 105,105,105,105,105,105,105,105,105,105,105,105,105,105, /* 238-251 */ 105,105,105,105 }, /* prefix 148 */ { 0,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 0- 13 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 14- 27 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 28- 41 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 42- 55 */ 210,210,210,210,210,210,210,210, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 149 */ { 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, /* 0- 13 */ 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, /* 14- 27 */ 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, /* 28- 41 */ 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, /* 42- 55 */ 93, 93, 93, 93, 93, 93, 93, 93, 96, 96, 96, 96, 96, 96, /* 56- 69 */ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* 70- 83 */ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 97, 97, /* 84- 97 */ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, /* 98-111 */ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, /* 112-125 */ 97, 97, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* 126-139 */ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* 140-153 */ 98, 98, 98, 98, 98, 98, 99, 99, 99, 99, 99, 99, 99, 99, /* 154-167 */ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, /* 168-181 */ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,100,100,100,100, /* 182-195 */ 100,100,100,100,100,100,100,100,100,100,100,100,100,100, /* 196-209 */ 100,100,100,100,100,100,100,100,100,100,100,100,100,100, /* 210-223 */ 101,101,101,101,101,101,101,101,101,101,101,101,101,101, /* 224-237 */ 101,101,101,101,101,101,101,101,101,101,101,101,101,101, /* 238-251 */ 101,101,101,101 }, /* prefix 150 */ { 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, /* 0- 13 */ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, /* 14- 27 */ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, /* 28- 41 */ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, /* 42- 55 */ 94, 94, 94, 94, 94, 94, 94, 94, 95, 95, 95, 95, 95, 95, /* 56- 69 */ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* 70- 83 */ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* 84- 97 */ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* 98-111 */ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* 112-125 */ 95, 95,102,102,102,102,102,102,102,102,102,102,102,102, /* 126-139 */ 102,102,102,102,102,102,102,102,102,102,102,102,102,102, /* 140-153 */ 102,102,102,102,102,102,103,103,103,103,103,103,103,103, /* 154-167 */ 103,103,103,103,103,103,103,103,103,103,103,103,103,103, /* 168-181 */ 103,103,103,103,103,103,103,103,103,103,104,104,104,104, /* 182-195 */ 104,104,104,104,104,104,104,104,104,104,104,104,104,104, /* 196-209 */ 104,104,104,104,104,104,104,104,104,104,104,104,104,104, /* 210-223 */ 105,105,105,105,105,105,105,105,105,105,105,105,105,105, /* 224-237 */ 105,105,105,105,105,105,105,105,105,105,105,105,105,105, /* 238-251 */ 105,105,105,105 }, /* prefix 151 */ { 0,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 0- 13 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 14- 27 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 28- 41 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 42- 55 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 56- 69 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 70- 83 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 84- 97 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 98-111 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 112-125 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 126-139 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 140-153 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 154-167 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 168-181 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 182-195 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 196-209 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 210-223 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 224-237 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 238-251 */ 210,210,210,210 }, /* prefix 152 */ { 179,179,179,179,179,179,179,179,179,179,179,179,179,179, /* 0- 13 */ 179,179,179,179,179,179,179,179,179,179,179,179,179,179, /* 14- 27 */ 179,179,179,179,179,179,179,179,179,179,179,179,179,179, /* 28- 41 */ 179,179,179,179,179,179,179,179,179,179,179,179,179,179, /* 42- 55 */ 179,179,179,179,179,179,179,179,179,179,179,179,179,179, /* 56- 69 */ 179,179,179,179,179,179,179,179,179,179,179,179,179,179, /* 70- 83 */ 179,179,179,179,179,179,179,179,179,179,179,179,179,179, /* 84- 97 */ 179,179,179,179,179,179,179,179,179,179,179,179,179,179, /* 98-111 */ 179,179,179,179,179,179,179,179,179,179,179,179,179,179, /* 112-125 */ 179,179,180,180,180,180,180,180,180,180,180,180,180,180, /* 126-139 */ 180,180,180,180,180,180,180,180,180,180,180,180,180,180, /* 140-153 */ 180,180,180,180,180,180,180,180,180,180,180,180,180,180, /* 154-167 */ 180,180,180,180,180,180,180,180,180,180,180,180,180,180, /* 168-181 */ 180,180,180,180,180,180,180,180,180,180,180,180,180,180, /* 182-195 */ 180,180,180,180,180,180,180,180,180,180,180,180,180,180, /* 196-209 */ 180,180,180,180,180,180,180,180,180,180,180,180,180,180, /* 210-223 */ 180,180,180,180,180,180,180,180,180,180,180,180,180,180, /* 224-237 */ 180,180,180,180,180,180,180,180,180,180,180,180,180,180, /* 238-251 */ 180,180,180,180 }, /* prefix 153 */ { 181,181,181,181,181,181,181,181,181,181,181,181,181,181, /* 0- 13 */ 181,181,181,181,181,181,181,181,181,181,181,181,181,181, /* 14- 27 */ 181,181,181,181,181,181,181,181,181,181,181,181,181,181, /* 28- 41 */ 181,181,181,181,181,181,181,181,181,181,181,181,181,181, /* 42- 55 */ 181,181,181,181,181,181,181,181,181,181,181,181,181,181, /* 56- 69 */ 181,181,181,181,181,181,181,181,181,181,181,181,181,181, /* 70- 83 */ 181,181,181,181,181,181,181,181,181,181,181,181,181,181, /* 84- 97 */ 181,181,181,181,181,181,181,181,181,181,181,181,181,181, /* 98-111 */ 181,181,181,181,181,181,181,181,181,181,181,181,181,181, /* 112-125 */ 181,181,182,182,182,182,182,182,182,182,182,182,182,182, /* 126-139 */ 182,182,182,182,182,182,182,182,182,182,182,182,182,182, /* 140-153 */ 182,182,182,182,182,182,182,182,182,182,182,182,182,182, /* 154-167 */ 182,182,182,182,182,182,182,182,182,182,182,182,182,182, /* 168-181 */ 182,182,182,182,182,182,182,182,182,182,182,182,182,182, /* 182-195 */ 182,182,182,182,182,182,182,182,182,182,182,182,182,182, /* 196-209 */ 182,182,182,182,182,182,182,182,182,182,182,182,182,182, /* 210-223 */ 182,182,182,182,182,182,182,182,182,182,182,182,182,182, /* 224-237 */ 182,182,182,182,182,182,182,182,182,182,182,182,182,182, /* 238-251 */ 182,182,182,182 }, /* prefix 154 */ { 189,189,189,189,189,189,189,189,189,189,189,189,189,189, /* 0- 13 */ 189,189,189,189,189,189,189,189,189,189,189,189,189,189, /* 14- 27 */ 189,189,189,189,189,189,189,189,189,189,189,189,189,189, /* 28- 41 */ 189,189,189,189,189,189,189,189,189,189,189,189,189,189, /* 42- 55 */ 189,189,189,189,189,189,189,189,189,189,189,189,189,189, /* 56- 69 */ 189,189,189,189,189,189,189,189,189,189,189,189,189,189, /* 70- 83 */ 189,189,189,189,189,189,189,189,189,189,189,189,189,189, /* 84- 97 */ 189,189,189,189,189,189,189,189,189,189,189,189,189,189, /* 98-111 */ 189,189,189,189,189,189,189,189,189,189,189,189,189,189, /* 112-125 */ 189,189,190,190,190,190,190,190,190,190,190,190,190,190, /* 126-139 */ 190,190,190,190,190,190,190,190,190,190,190,190,190,190, /* 140-153 */ 190,190,190,190,190,190,190,190,190,190,190,190,190,190, /* 154-167 */ 190,190,190,190,190,190,190,190,190,190,190,190,190,190, /* 168-181 */ 190,190,190,190,190,190,190,190,190,190,190,190,190,190, /* 182-195 */ 190,190,190,190,190,190,190,190,190,190,190,190,190,190, /* 196-209 */ 190,190,190,190,190,190,190,190,190,190,190,190,190,190, /* 210-223 */ 190,190,190,190,190,190,190,190,190,190,190,190,190,190, /* 224-237 */ 190,190,190,190,190,190,190,190,190,190,190,190,190,190, /* 238-251 */ 190,190,190,190 }, /* prefix 155 */ { 191,191,191,191,191,191,191,191,191,191,191,191,191,191, /* 0- 13 */ 191,191,191,191,191,191,191,191,191,191,191,191,191,191, /* 14- 27 */ 191,191,191,191,191,191,191,191,191,191,191,191,191,191, /* 28- 41 */ 191,191,191,191,191,191,191,191,191,191,191,191,191,191, /* 42- 55 */ 191,191,191,191,191,191,191,191,191,191,191,191,191,191, /* 56- 69 */ 191,191,191,191,191,191,191,191,191,191,191,191,191,191, /* 70- 83 */ 191,191,191,191,191,191,191,191,191,191,191,191,191,191, /* 84- 97 */ 191,191,191,191,191,191,191,191,191,191,191,191,191,191, /* 98-111 */ 191,191,191,191,191,191,191,191,191,191,191,191,191,191, /* 112-125 */ 191,191,192,192,192,192,192,192,192,192,192,192,192,192, /* 126-139 */ 192,192,192,192,192,192,192,192,192,192,192,192,192,192, /* 140-153 */ 192,192,192,192,192,192,192,192,192,192,192,192,192,192, /* 154-167 */ 192,192,192,192,192,192,192,192,192,192,192,192,192,192, /* 168-181 */ 192,192,192,192,192,192,192,192,192,192,192,192,192,192, /* 182-195 */ 192,192,192,192,192,192,192,192,192,192,192,192,192,192, /* 196-209 */ 192,192,192,192,192,192,192,192,192,192,192,192,192,192, /* 210-223 */ 192,192,192,192,192,192,192,192,192,192,192,192,192,192, /* 224-237 */ 192,192,192,192,192,192,192,192,192,192,192,192,192,192, /* 238-251 */ 192,192,192,192 }, /* prefix 156 */ { 193,193,193,193,193,193,193,193,193,193,193,193,193,193, /* 0- 13 */ 193,193,193,193,193,193,193,193,193,193,193,193,193,193, /* 14- 27 */ 193,193,193,193,193,193,193,193,193,193,193,193,193,193, /* 28- 41 */ 193,193,193,193,193,193,193,193,193,193,193,193,193,193, /* 42- 55 */ 193,193,193,193,193,193,193,193,193,193,193,193,193,193, /* 56- 69 */ 193,193,193,193,193,193,193,193,193,193,193,193,193,193, /* 70- 83 */ 193,193,193,193,193,193,193,193,193,193,193,193,193,193, /* 84- 97 */ 193,193,193,193,193,193,193,193,193,193,193,193,193,193, /* 98-111 */ 193,193,193,193,193,193,193,193,193,193,193,193,193,193, /* 112-125 */ 193,193,194,194,194,194,194,194,194,194,194,194,194,194, /* 126-139 */ 194,194,194,194,194,194,194,194,194,194,194,194,194,194, /* 140-153 */ 194,194,194,194,194,194,194,194,194,194,194,194,194,194, /* 154-167 */ 194,194,194,194,194,194,194,194,194,194,194,194,194,194, /* 168-181 */ 194,194,194,194,194,194,194,194,194,194,194,194,194,194, /* 182-195 */ 194,194,194,194,194,194,194,194,194,194,194,194,194,194, /* 196-209 */ 194,194,194,194,194,194,194,194,194,194,194,194,194,194, /* 210-223 */ 194,194,194,194,194,194,194,194,194,194,194,194,194,194, /* 224-237 */ 194,194,194,194,194,194,194,194,194,194,194,194,194,194, /* 238-251 */ 194,194,194,194 }, /* prefix 157 */ { 195,195,195,195,195,195,195,195,195,195,195,195,195,195, /* 0- 13 */ 195,195,195,195,195,195,195,195,195,195,195,195,195,195, /* 14- 27 */ 195,195,195,195,195,195,195,195,195,195,195,195,195,195, /* 28- 41 */ 195,195,195,195,195,195,195,195,195,195,195,195,195,195, /* 42- 55 */ 195,195,195,195,195,195,195,195,195,195,195,195,195,195, /* 56- 69 */ 195,195,195,195,195,195,195,195,195,195,195,195,195,195, /* 70- 83 */ 195,195,195,195,195,195,195,195,195,195,195,195,195,195, /* 84- 97 */ 195,195,195,195,195,195,195,195,195,195,195,195,195,195, /* 98-111 */ 195,195,195,195,195,195,195,195,195,195,195,195,195,195, /* 112-125 */ 195,195,196,196,196,196,196,196,196,196,196,196,196,196, /* 126-139 */ 196,196,196,196,196,196,196,196,196,196,196,196,196,196, /* 140-153 */ 196,196,196,196,196,196,196,196,196,196,196,196,196,196, /* 154-167 */ 196,196,196,196,196,196,196,196,196,196,196,196,196,196, /* 168-181 */ 196,196,196,196,196,196,196,196,196,196,196,196,196,196, /* 182-195 */ 196,196,196,196,196,196,196,196,196,196,196,196,196,196, /* 196-209 */ 196,196,196,196,196,196,196,196,196,196,196,196,196,196, /* 210-223 */ 196,196,196,196,196,196,196,196,196,196,196,196,196,196, /* 224-237 */ 196,196,196,196,196,196,196,196,196,196,196,196,196,196, /* 238-251 */ 196,196,196,196 }, /* prefix 158 */ { 177,177,177,177,177,177,177,177,177,177,177,177,177,177, /* 0- 13 */ 177,177,177,177,177,177,177,177,177,177,177,177,177,177, /* 14- 27 */ 177,177,177,177,177,177,177,177,177,177,177,177,177,177, /* 28- 41 */ 177,177,177,177,177,177,177,177,177,177,177,177,177,177, /* 42- 55 */ 177,177,177,177,177,177,177,177,177,177,177,177,177,177, /* 56- 69 */ 177,177,177,177,177,177,177,177,177,177,177,177,177,177, /* 70- 83 */ 177,177,177,177,177,177,177,177,177,177,177,177,177,177, /* 84- 97 */ 177,177,177,177,177,177,177,177,177,177,177,177,177,177, /* 98-111 */ 177,177,177,177,177,177,177,177,177,177,177,177,177,177, /* 112-125 */ 177,177,178,178,178,178,178,178,178,178,178,178,178,178, /* 126-139 */ 178,178,178,178,178,178,178,178,178,178,178,178,178,178, /* 140-153 */ 178,178,178,178,178,178,178,178,178,178,178,178,178,178, /* 154-167 */ 178,178,178,178,178,178,178,178,178,178,178,178,178,178, /* 168-181 */ 178,178,178,178,178,178,178,178,178,178,178,178,178,178, /* 182-195 */ 178,178,178,178,178,178,178,178,178,178,178,178,178,178, /* 196-209 */ 178,178,178,178,178,178,178,178,178,178,178,178,178,178, /* 210-223 */ 178,178,178,178,178,178,178,178,178,178,178,178,178,178, /* 224-237 */ 178,178,178,178,178,178,178,178,178,178,178,178,178,178, /* 238-251 */ 178,178,178,178 }, /* prefix 159 */ { 183,183,183,183,183,183,183,183,183,183,183,183,183,183, /* 0- 13 */ 183,183,183,183,183,183,183,183,183,183,183,183,183,183, /* 14- 27 */ 183,183,183,183,183,183,183,183,183,183,183,183,183,183, /* 28- 41 */ 183,183,183,183,183,183,183,183,183,183,183,183,183,183, /* 42- 55 */ 183,183,183,183,183,183,183,183,183,183,183,183,183,183, /* 56- 69 */ 183,183,183,183,183,183,183,183,183,183,183,183,183,183, /* 70- 83 */ 183,183,183,183,183,183,183,183,183,183,183,183,183,183, /* 84- 97 */ 183,183,183,183,183,183,183,183,183,183,183,183,183,183, /* 98-111 */ 183,183,183,183,183,183,183,183,183,183,183,183,183,183, /* 112-125 */ 183,183,184,184,184,184,184,184,184,184,184,184,184,184, /* 126-139 */ 184,184,184,184,184,184,184,184,184,184,184,184,184,184, /* 140-153 */ 184,184,184,184,184,184,184,184,184,184,184,184,184,184, /* 154-167 */ 184,184,184,184,184,184,184,184,184,184,184,184,184,184, /* 168-181 */ 184,184,184,184,184,184,184,184,184,184,184,184,184,184, /* 182-195 */ 184,184,184,184,184,184,184,184,184,184,184,184,184,184, /* 196-209 */ 184,184,184,184,184,184,184,184,184,184,184,184,184,184, /* 210-223 */ 184,184,184,184,184,184,184,184,184,184,184,184,184,184, /* 224-237 */ 184,184,184,184,184,184,184,184,184,184,184,184,184,184, /* 238-251 */ 184,184,184,184 }, /* prefix 160 */ { 185,185,185,185,185,185,185,185,185,185,185,185,185,185, /* 0- 13 */ 185,185,185,185,185,185,185,185,185,185,185,185,185,185, /* 14- 27 */ 185,185,185,185,185,185,185,185,185,185,185,185,185,185, /* 28- 41 */ 185,185,185,185,185,185,185,185,185,185,185,185,185,185, /* 42- 55 */ 185,185,185,185,185,185,185,185,185,185,185,185,185,185, /* 56- 69 */ 185,185,185,185,185,185,185,185,185,185,185,185,185,185, /* 70- 83 */ 185,185,185,185,185,185,185,185,185,185,185,185,185,185, /* 84- 97 */ 185,185,185,185,185,185,185,185,185,185,185,185,185,185, /* 98-111 */ 185,185,185,185,185,185,185,185,185,185,185,185,185,185, /* 112-125 */ 185,185,186,186,186,186,186,186,186,186,186,186,186,186, /* 126-139 */ 186,186,186,186,186,186,186,186,186,186,186,186,186,186, /* 140-153 */ 186,186,186,186,186,186,186,186,186,186,186,186,186,186, /* 154-167 */ 186,186,186,186,186,186,186,186,186,186,186,186,186,186, /* 168-181 */ 186,186,186,186,186,186,186,186,186,186,186,186,186,186, /* 182-195 */ 186,186,186,186,186,186,186,186,186,186,186,186,186,186, /* 196-209 */ 186,186,186,186,186,186,186,186,186,186,186,186,186,186, /* 210-223 */ 186,186,186,186,186,186,186,186,186,186,186,186,186,186, /* 224-237 */ 186,186,186,186,186,186,186,186,186,186,186,186,186,186, /* 238-251 */ 186,186,186,186 }, /* prefix 161 */ { 187,187,187,187,187,187,187,187,187,187,187,187,187,187, /* 0- 13 */ 187,187,187,187,187,187,187,187,187,187,187,187,187,187, /* 14- 27 */ 187,187,187,187,187,187,187,187,187,187,187,187,187,187, /* 28- 41 */ 187,187,187,187,187,187,187,187,187,187,187,187,187,187, /* 42- 55 */ 187,187,187,187,187,187,187,187,187,187,187,187,187,187, /* 56- 69 */ 187,187,187,187,187,187,187,187,187,187,187,187,187,187, /* 70- 83 */ 187,187,187,187,187,187,187,187,187,187,187,187,187,187, /* 84- 97 */ 187,187,187,187,187,187,187,187,187,187,187,187,187,187, /* 98-111 */ 187,187,187,187,187,187,187,187,187,187,187,187,187,187, /* 112-125 */ 187,187,188,188,188,188,188,188,188,188,188,188,188,188, /* 126-139 */ 188,188,188,188,188,188,188,188,188,188,188,188,188,188, /* 140-153 */ 188,188,188,188,188,188,188,188,188,188,188,188,188,188, /* 154-167 */ 188,188,188,188,188,188,188,188,188,188,188,188,188,188, /* 168-181 */ 188,188,188,188,188,188,188,188,188,188,188,188,188,188, /* 182-195 */ 188,188,188,188,188,188,188,188,188,188,188,188,188,188, /* 196-209 */ 188,188,188,188,188,188,188,188,188,188,188,188,188,188, /* 210-223 */ 188,188,188,188,188,188,188,188,188,188,188,188,188,188, /* 224-237 */ 188,188,188,188,188,188,188,188,188,188,188,188,188,188, /* 238-251 */ 188,188,188,188 }, /* prefix 162 */ { 200,200,200,200,200,200,200,200,200,200,200,200,200,200, /* 0- 13 */ 200,200,200,200,200,200,200,200,200,200,200,200,200,200, /* 14- 27 */ 200,200,200,200,200,200,200,200,200,200,200,200,200,200, /* 28- 41 */ 200,200,200,200,200,200,200,200,200,200,200,200,200,200, /* 42- 55 */ 200,200,200,200,200,200,200,200,200,200,200,200,200,200, /* 56- 69 */ 200,200,200,200,200,200,200,200,200,200,200,200,200,200, /* 70- 83 */ 200,200,200,200,200,200,200,200,200,200,200,200,200,200, /* 84- 97 */ 200,200,200,200,200,200,200,200,200,200,200,200,200,200, /* 98-111 */ 200,200,200,200,200,200,200,200,200,200,200,200,200,200, /* 112-125 */ 200,200,201,201,201,201,201,201,201,201,201,201,201,201, /* 126-139 */ 201,201,201,201,201,201,201,201,201,201,201,201,201,201, /* 140-153 */ 201,201,201,201,201,201,201,201,201,201,201,201,201,201, /* 154-167 */ 201,201,201,201,201,201,201,201,201,201,201,201,201,201, /* 168-181 */ 201,201,201,201,201,201,201,201,201,201,201,201,201,201, /* 182-195 */ 201,201,201,201,201,201,201,201,201,201,201,201,201,201, /* 196-209 */ 201,201,201,201,201,201,201,201,201,201,201,201,201,201, /* 210-223 */ 201,201,201,201,201,201,201,201,201,201,201,201,201,201, /* 224-237 */ 201,201,201,201,201,201,201,201,201,201,201,201,201,201, /* 238-251 */ 201,201,201,201 }, /* prefix 163 */ { 202,202,202,202,202,202,202,202,202,202,202,202,202,202, /* 0- 13 */ 202,202,202,202,202,202,202,202,202,202,202,202,202,202, /* 14- 27 */ 202,202,202,202,202,202,202,202,202,202,202,202,202,202, /* 28- 41 */ 202,202,202,202,202,202,202,202,202,202,202,202,202,202, /* 42- 55 */ 202,202,202,202,202,202,202,202,202,202,202,202,202,202, /* 56- 69 */ 202,202,202,202,202,202,202,202,202,202,202,202,202,202, /* 70- 83 */ 202,202,202,202,202,202,202,202,202,202,202,202,202,202, /* 84- 97 */ 202,202,202,202,202,202,202,202,202,202,202,202,202,202, /* 98-111 */ 202,202,202,202,202,202,202,202,202,202,202,202,202,202, /* 112-125 */ 202,202,203,203,203,203,203,203,203,203,203,203,203,203, /* 126-139 */ 203,203,203,203,203,203,203,203,203,203,203,203,203,203, /* 140-153 */ 203,203,203,203,203,203,203,203,203,203,203,203,203,203, /* 154-167 */ 203,203,203,203,203,203,203,203,203,203,203,203,203,203, /* 168-181 */ 203,203,203,203,203,203,203,203,203,203,203,203,203,203, /* 182-195 */ 203,203,203,203,203,203,203,203,203,203,203,203,203,203, /* 196-209 */ 203,203,203,203,203,203,203,203,203,203,203,203,203,203, /* 210-223 */ 203,203,203,203,203,203,203,203,203,203,203,203,203,203, /* 224-237 */ 203,203,203,203,203,203,203,203,203,203,203,203,203,203, /* 238-251 */ 203,203,203,203 }, /* prefix 164 */ { 204,204,204,204,204,204,204,204,204,204,204,204,204,204, /* 0- 13 */ 204,204,204,204,204,204,204,204,204,204,204,204,204,204, /* 14- 27 */ 204,204,204,204,204,204,204,204,204,204,204,204,204,204, /* 28- 41 */ 204,204,204,204,204,204,204,204,204,204,204,204,204,204, /* 42- 55 */ 204,204,204,204,204,204,204,204,204,204,204,204,204,204, /* 56- 69 */ 204,204,204,204,204,204,204,204,204,204,204,204,204,204, /* 70- 83 */ 204,204,204,204,204,204,204,204,204,204,204,204,204,204, /* 84- 97 */ 204,204,204,204,204,204,204,204,204,204,204,204,204,204, /* 98-111 */ 204,204,204,204,204,204,204,204,204,204,204,204,204,204, /* 112-125 */ 204,204,205,205,205,205,205,205,205,205,205,205,205,205, /* 126-139 */ 205,205,205,205,205,205,205,205,205,205,205,205,205,205, /* 140-153 */ 205,205,205,205,205,205,205,205,205,205,205,205,205,205, /* 154-167 */ 205,205,205,205,205,205,205,205,205,205,205,205,205,205, /* 168-181 */ 205,205,205,205,205,205,205,205,205,205,205,205,205,205, /* 182-195 */ 205,205,205,205,205,205,205,205,205,205,205,205,205,205, /* 196-209 */ 205,205,205,205,205,205,205,205,205,205,205,205,205,205, /* 210-223 */ 205,205,205,205,205,205,205,205,205,205,205,205,205,205, /* 224-237 */ 205,205,205,205,205,205,205,205,205,205,205,205,205,205, /* 238-251 */ 205,205,205,205 }, /* prefix 165 */ { 206,206,206,206,206,206,206,206,206,206,206,206,206,206, /* 0- 13 */ 206,206,206,206,206,206,206,206,206,206,206,206,206,206, /* 14- 27 */ 206,206,206,206,206,206,206,206,206,206,206,206,206,206, /* 28- 41 */ 206,206,206,206,206,206,206,206,206,206,206,206,206,206, /* 42- 55 */ 206,206,206,206,206,206,206,206,206,206,206,206,206,206, /* 56- 69 */ 206,206,206,206,206,206,206,206,206,206,206,206,206,206, /* 70- 83 */ 206,206,206,206,206,206,206,206,206,206,206,206,206,206, /* 84- 97 */ 206,206,206,206,206,206,206,206,206,206,206,206,206,206, /* 98-111 */ 206,206,206,206,206,206,206,206,206,206,206,206,206,206, /* 112-125 */ 206,206,207,207,207,207,207,207,207,207,207,207,207,207, /* 126-139 */ 207,207,207,207,207,207,207,207,207,207,207,207,207,207, /* 140-153 */ 207,207,207,207,207,207,207,207,207,207,207,207,207,207, /* 154-167 */ 207,207,207,207,207,207,207,207,207,207,207,207,207,207, /* 168-181 */ 207,207,207,207,207,207,207,207,207,207,207,207,207,207, /* 182-195 */ 207,207,207,207,207,207,207,207,207,207,207,207,207,207, /* 196-209 */ 207,207,207,207,207,207,207,207,207,207,207,207,207,207, /* 210-223 */ 207,207,207,207,207,207,207,207,207,207,207,207,207,207, /* 224-237 */ 207,207,207,207,207,207,207,207,207,207,207,207,207,207, /* 238-251 */ 207,207,207,207 }, /* prefix 166 */ { 208,208,208,208,208,208,208,208,208,208,208,208,208,208, /* 0- 13 */ 208,208,208,208,208,208,208,208,208,208,208,208,208,208, /* 14- 27 */ 208,208,208,208,208,208,208,208,208,208,208,208,208,208, /* 28- 41 */ 208,208,208,208,208,208,208,208,208,208,208,208,208,208, /* 42- 55 */ 208,208,208,208,208,208,208,208,208,208,208,208,208,208, /* 56- 69 */ 208,208,208,208,208,208,208,208,208,208,208,208,208,208, /* 70- 83 */ 208,208,208,208,208,208,208,208,208,208,208,208,208,208, /* 84- 97 */ 208,208,208,208,208,208,208,208,208,208,208,208,208,208, /* 98-111 */ 208,208,208,208,208,208,208,208,208,208,208,208,208,208, /* 112-125 */ 208,208,209,209,209,209,209,209,209,209,209,209,209,209, /* 126-139 */ 209,209,209,209,209,209,209,209,209,209,209,209,209,209, /* 140-153 */ 209,209,209,209,209,209,209,209,209,209,209,209,209,209, /* 154-167 */ 209,209,209,209,209,209,209,209,209,209,209,209,209,209, /* 168-181 */ 209,209,209,209,209,209,209,209,209,209,209,209,209,209, /* 182-195 */ 209,209,209,209,209,209,209,209,209,209,209,209,209,209, /* 196-209 */ 209,209,209,209,209,209,209,209,209,209,209,209,209,209, /* 210-223 */ 209,209,209,209,209,209,209,209,209,209,209,209,209,209, /* 224-237 */ 209,209,209,209,209,209,209,209,209,209,209,209,209,209, /* 238-251 */ 209,209,209,209 }, /* prefix 167 */ { 158,158,158,158,158,158,158,158,158,158,158,158,158,158, /* 0- 13 */ 158,158,158,158,158,158,158,158,158,158,158,158,158,158, /* 14- 27 */ 158,158,158,158,158,158,158,158,158,158,158,158,158,158, /* 28- 41 */ 158,158,158,158,158,158,158,158,158,158,158,158,158,158, /* 42- 55 */ 158,158,158,158,158,158,158,158,158,158,158,158,158,158, /* 56- 69 */ 158,158,158,158,158,158,158,158,158,158,158,158,158,158, /* 70- 83 */ 158,158,158,158,158,158,158,158,158,158,158,158,158,158, /* 84- 97 */ 158,158,158,158,158,158,158,158,158,158,158,158,158,158, /* 98-111 */ 158,158,158,158,158,158,158,158,158,158,158,158,158,158, /* 112-125 */ 158,158,179,179,179,179,179,179,179,179,179,179,179,179, /* 126-139 */ 179,179,179,179,179,179,179,179,179,179,179,179,179,179, /* 140-153 */ 179,179,179,179,179,179,179,179,179,179,179,179,179,179, /* 154-167 */ 179,179,179,179,179,179,179,179,179,179,179,179,179,179, /* 168-181 */ 179,179,179,179,179,179,179,179,179,179,180,180,180,180, /* 182-195 */ 180,180,180,180,180,180,180,180,180,180,180,180,180,180, /* 196-209 */ 180,180,180,180,180,180,180,180,180,180,180,180,180,180, /* 210-223 */ 180,180,180,180,180,180,180,180,180,180,180,180,180,180, /* 224-237 */ 180,180,180,180,180,180,180,180,180,180,180,180,180,180, /* 238-251 */ 180,180,180,180 }, /* prefix 168 */ { 181,181,181,181,181,181,181,181,181,181,181,181,181,181, /* 0- 13 */ 181,181,181,181,181,181,181,181,181,181,181,181,181,181, /* 14- 27 */ 181,181,181,181,181,181,181,181,181,181,181,181,181,181, /* 28- 41 */ 181,181,181,181,181,181,181,181,181,181,181,181,181,181, /* 42- 55 */ 181,181,181,181,181,181,181,181,182,182,182,182,182,182, /* 56- 69 */ 182,182,182,182,182,182,182,182,182,182,182,182,182,182, /* 70- 83 */ 182,182,182,182,182,182,182,182,182,182,182,182,182,182, /* 84- 97 */ 182,182,182,182,182,182,182,182,182,182,182,182,182,182, /* 98-111 */ 182,182,182,182,182,182,182,182,182,182,182,182,182,182, /* 112-125 */ 182,182,161,161,161,161,161,161,161,161,161,161,161,161, /* 126-139 */ 161,161,161,161,161,161,161,161,161,161,161,161,161,161, /* 140-153 */ 161,161,161,161,161,161,161,161,161,161,161,161,161,161, /* 154-167 */ 161,161,161,161,161,161,161,161,161,161,161,161,161,161, /* 168-181 */ 161,161,161,161,161,161,161,161,161,161,161,161,161,161, /* 182-195 */ 161,161,161,161,161,161,161,161,161,161,161,161,161,161, /* 196-209 */ 161,161,161,161,161,161,161,161,161,161,161,161,161,161, /* 210-223 */ 161,161,161,161,161,161,161,161,161,161,161,161,161,161, /* 224-237 */ 161,161,161,161,161,161,161,161,161,161,161,161,161,161, /* 238-251 */ 161,161,161,161 }, /* prefix 169 */ { 162,162,162,162,162,162,162,162,162,162,162,162,162,162, /* 0- 13 */ 162,162,162,162,162,162,162,162,162,162,162,162,162,162, /* 14- 27 */ 162,162,162,162,162,162,162,162,162,162,162,162,162,162, /* 28- 41 */ 162,162,162,162,162,162,162,162,162,162,162,162,162,162, /* 42- 55 */ 162,162,162,162,162,162,162,162,162,162,162,162,162,162, /* 56- 69 */ 162,162,162,162,162,162,162,162,162,162,162,162,162,162, /* 70- 83 */ 162,162,162,162,162,162,162,162,162,162,162,162,162,162, /* 84- 97 */ 162,162,162,162,162,162,162,162,162,162,162,162,162,162, /* 98-111 */ 162,162,162,162,162,162,162,162,162,162,162,162,162,162, /* 112-125 */ 162,162,189,189,189,189,189,189,189,189,189,189,189,189, /* 126-139 */ 189,189,189,189,189,189,189,189,189,189,189,189,189,189, /* 140-153 */ 189,189,189,189,189,189,189,189,189,189,189,189,189,189, /* 154-167 */ 189,189,189,189,189,189,189,189,189,189,189,189,189,189, /* 168-181 */ 189,189,189,189,189,189,189,189,189,189,190,190,190,190, /* 182-195 */ 190,190,190,190,190,190,190,190,190,190,190,190,190,190, /* 196-209 */ 190,190,190,190,190,190,190,190,190,190,190,190,190,190, /* 210-223 */ 190,190,190,190,190,190,190,190,190,190,190,190,190,190, /* 224-237 */ 190,190,190,190,190,190,190,190,190,190,190,190,190,190, /* 238-251 */ 190,190,190,190 }, /* prefix 170 */ { 191,191,191,191,191,191,191,191,191,191,191,191,191,191, /* 0- 13 */ 191,191,191,191,191,191,191,191,191,191,191,191,191,191, /* 14- 27 */ 191,191,191,191,191,191,191,191,191,191,191,191,191,191, /* 28- 41 */ 191,191,191,191,191,191,191,191,191,191,191,191,191,191, /* 42- 55 */ 191,191,191,191,191,191,191,191,192,192,192,192,192,192, /* 56- 69 */ 192,192,192,192,192,192,192,192,192,192,192,192,192,192, /* 70- 83 */ 192,192,192,192,192,192,192,192,192,192,192,192,192,192, /* 84- 97 */ 192,192,192,192,192,192,192,192,192,192,192,192,192,192, /* 98-111 */ 192,192,192,192,192,192,192,192,192,192,192,192,192,192, /* 112-125 */ 192,192,165,165,165,165,165,165,165,165,165,165,165,165, /* 126-139 */ 165,165,165,165,165,165,165,165,165,165,165,165,165,165, /* 140-153 */ 165,165,165,165,165,165,165,165,165,165,165,165,165,165, /* 154-167 */ 165,165,165,165,165,165,165,165,165,165,165,165,165,165, /* 168-181 */ 165,165,165,165,165,165,165,165,165,165,165,165,165,165, /* 182-195 */ 165,165,165,165,165,165,165,165,165,165,165,165,165,165, /* 196-209 */ 165,165,165,165,165,165,165,165,165,165,165,165,165,165, /* 210-223 */ 165,165,165,165,165,165,165,165,165,165,165,165,165,165, /* 224-237 */ 165,165,165,165,165,165,165,165,165,165,165,165,165,165, /* 238-251 */ 165,165,165,165 }, /* prefix 171 */ { 166,166,166,166,166,166,166,166,166,166,166,166,166,166, /* 0- 13 */ 166,166,166,166,166,166,166,166,166,166,166,166,166,166, /* 14- 27 */ 166,166,166,166,166,166,166,166,166,166,166,166,166,166, /* 28- 41 */ 166,166,166,166,166,166,166,166,166,166,166,166,166,166, /* 42- 55 */ 166,166,166,166,166,166,166,166,166,166,166,166,166,166, /* 56- 69 */ 166,166,166,166,166,166,166,166,166,166,166,166,166,166, /* 70- 83 */ 166,166,166,166,166,166,166,166,166,166,166,166,166,166, /* 84- 97 */ 166,166,166,166,166,166,166,166,166,166,166,166,166,166, /* 98-111 */ 166,166,166,166,166,166,166,166,166,166,166,166,166,166, /* 112-125 */ 166,166,193,193,193,193,193,193,193,193,193,193,193,193, /* 126-139 */ 193,193,193,193,193,193,193,193,193,193,193,193,193,193, /* 140-153 */ 193,193,193,193,193,193,193,193,193,193,193,193,193,193, /* 154-167 */ 193,193,193,193,193,193,193,193,193,193,193,193,193,193, /* 168-181 */ 193,193,193,193,193,193,193,193,193,193,194,194,194,194, /* 182-195 */ 194,194,194,194,194,194,194,194,194,194,194,194,194,194, /* 196-209 */ 194,194,194,194,194,194,194,194,194,194,194,194,194,194, /* 210-223 */ 194,194,194,194,194,194,194,194,194,194,194,194,194,194, /* 224-237 */ 194,194,194,194,194,194,194,194,194,194,194,194,194,194, /* 238-251 */ 194,194,194,194 }, /* prefix 172 */ { 195,195,195,195,195,195,195,195,195,195,195,195,195,195, /* 0- 13 */ 195,195,195,195,195,195,195,195,195,195,195,195,195,195, /* 14- 27 */ 195,195,195,195,195,195,195,195,195,195,195,195,195,195, /* 28- 41 */ 195,195,195,195,195,195,195,195,195,195,195,195,195,195, /* 42- 55 */ 195,195,195,195,195,195,195,195,196,196,196,196,196,196, /* 56- 69 */ 196,196,196,196,196,196,196,196,196,196,196,196,196,196, /* 70- 83 */ 196,196,196,196,196,196,196,196,196,196,196,196,196,196, /* 84- 97 */ 196,196,196,196,196,196,196,196,196,196,196,196,196,196, /* 98-111 */ 196,196,196,196,196,196,196,196,196,196,196,196,196,196, /* 112-125 */ 196,196,174,174,174,174,174,174,174,174,174,174,174,174, /* 126-139 */ 174,174,174,174,174,174,174,174,174,174,174,174,174,174, /* 140-153 */ 174,174,174,174,174,174,174,174,174,174,174,174,174,174, /* 154-167 */ 174,174,174,174,174,174,174,174,174,174,174,174,174,174, /* 168-181 */ 174,174,174,174,174,174,174,174,174,174,174,174,174,174, /* 182-195 */ 174,174,174,174,174,174,174,174,174,174,174,174,174,174, /* 196-209 */ 174,174,174,174,174,174,174,174,174,174,174,174,174,174, /* 210-223 */ 174,174,174,174,174,174,174,174,174,174,174,174,174,174, /* 224-237 */ 174,174,174,174,174,174,174,174,174,174,174,174,174,174, /* 238-251 */ 174,174,174,174 }, /* prefix 173 */ { 175,175,175,175,175,175,175,175,175,175,175,175,175,175, /* 0- 13 */ 175,175,175,175,175,175,175,175,175,175,175,175,175,175, /* 14- 27 */ 175,175,175,175,175,175,175,175,175,175,175,175,175,175, /* 28- 41 */ 175,175,175,175,175,175,175,175,175,175,175,175,175,175, /* 42- 55 */ 175,175,175,175,175,175,175,175,175,175,175,175,175,175, /* 56- 69 */ 175,175,175,175,175,175,175,175,175,175,175,175,175,175, /* 70- 83 */ 175,175,175,175,175,175,175,175,175,175,175,175,175,175, /* 84- 97 */ 175,175,175,175,175,175,175,175,175,175,175,175,175,175, /* 98-111 */ 175,175,175,175,175,175,175,175,175,175,175,175,175,175, /* 112-125 */ 175,175,176,176,176,176,176,176,176,176,176,176,176,176, /* 126-139 */ 176,176,176,176,176,176,176,176,176,176,176,176,176,176, /* 140-153 */ 176,176,176,176,176,176,176,176,176,176,176,176,176,176, /* 154-167 */ 176,176,176,176,176,176,176,176,176,176,176,176,176,176, /* 168-181 */ 176,176,176,176,176,176,176,176,176,176,176,176,176,176, /* 182-195 */ 176,176,176,176,176,176,176,176,176,176,176,176,176,176, /* 196-209 */ 176,176,176,176,176,176,176,176,176,176,176,176,176,176, /* 210-223 */ 176,176,176,176,176,176,176,176,176,176,176,176,176,176, /* 224-237 */ 176,176,176,176,176,176,176,176,176,176,176,176,176,176, /* 238-251 */ 176,176,176,176 }, /* prefix 174 */ { 177,177,177,177,177,177,177,177,177,177,177,177,177,177, /* 0- 13 */ 177,177,177,177,177,177,177,177,177,177,177,177,177,177, /* 14- 27 */ 177,177,177,177,177,177,177,177,177,177,177,177,177,177, /* 28- 41 */ 177,177,177,177,177,177,177,177,177,177,177,177,177,177, /* 42- 55 */ 177,177,177,177,177,177,177,177,178,178,178,178,178,178, /* 56- 69 */ 178,178,178,178,178,178,178,178,178,178,178,178,178,178, /* 70- 83 */ 178,178,178,178,178,178,178,178,178,178,178,178,178,178, /* 84- 97 */ 178,178,178,178,178,178,178,178,178,178,178,178,178,178, /* 98-111 */ 178,178,178,178,178,178,178,178,178,178,178,178,178,178, /* 112-125 */ 178,178,159,159,159,159,159,159,159,159,159,159,159,159, /* 126-139 */ 159,159,159,159,159,159,159,159,159,159,159,159,159,159, /* 140-153 */ 159,159,159,159,159,159,159,159,159,159,159,159,159,159, /* 154-167 */ 159,159,159,159,159,159,159,159,159,159,159,159,159,159, /* 168-181 */ 159,159,159,159,159,159,159,159,159,159,159,159,159,159, /* 182-195 */ 159,159,159,159,159,159,159,159,159,159,159,159,159,159, /* 196-209 */ 159,159,159,159,159,159,159,159,159,159,159,159,159,159, /* 210-223 */ 159,159,159,159,159,159,159,159,159,159,159,159,159,159, /* 224-237 */ 159,159,159,159,159,159,159,159,159,159,159,159,159,159, /* 238-251 */ 159,159,159,159 }, /* prefix 175 */ { 160,160,160,160,160,160,160,160,160,160,160,160,160,160, /* 0- 13 */ 160,160,160,160,160,160,160,160,160,160,160,160,160,160, /* 14- 27 */ 160,160,160,160,160,160,160,160,160,160,160,160,160,160, /* 28- 41 */ 160,160,160,160,160,160,160,160,160,160,160,160,160,160, /* 42- 55 */ 160,160,160,160,160,160,160,160,160,160,160,160,160,160, /* 56- 69 */ 160,160,160,160,160,160,160,160,160,160,160,160,160,160, /* 70- 83 */ 160,160,160,160,160,160,160,160,160,160,160,160,160,160, /* 84- 97 */ 160,160,160,160,160,160,160,160,160,160,160,160,160,160, /* 98-111 */ 160,160,160,160,160,160,160,160,160,160,160,160,160,160, /* 112-125 */ 160,160,183,183,183,183,183,183,183,183,183,183,183,183, /* 126-139 */ 183,183,183,183,183,183,183,183,183,183,183,183,183,183, /* 140-153 */ 183,183,183,183,183,183,183,183,183,183,183,183,183,183, /* 154-167 */ 183,183,183,183,183,183,183,183,183,183,183,183,183,183, /* 168-181 */ 183,183,183,183,183,183,183,183,183,183,184,184,184,184, /* 182-195 */ 184,184,184,184,184,184,184,184,184,184,184,184,184,184, /* 196-209 */ 184,184,184,184,184,184,184,184,184,184,184,184,184,184, /* 210-223 */ 184,184,184,184,184,184,184,184,184,184,184,184,184,184, /* 224-237 */ 184,184,184,184,184,184,184,184,184,184,184,184,184,184, /* 238-251 */ 184,184,184,184 }, /* prefix 176 */ { 185,185,185,185,185,185,185,185,185,185,185,185,185,185, /* 0- 13 */ 185,185,185,185,185,185,185,185,185,185,185,185,185,185, /* 14- 27 */ 185,185,185,185,185,185,185,185,185,185,185,185,185,185, /* 28- 41 */ 185,185,185,185,185,185,185,185,185,185,185,185,185,185, /* 42- 55 */ 185,185,185,185,185,185,185,185,186,186,186,186,186,186, /* 56- 69 */ 186,186,186,186,186,186,186,186,186,186,186,186,186,186, /* 70- 83 */ 186,186,186,186,186,186,186,186,186,186,186,186,186,186, /* 84- 97 */ 186,186,186,186,186,186,186,186,186,186,186,186,186,186, /* 98-111 */ 186,186,186,186,186,186,186,186,186,186,186,186,186,186, /* 112-125 */ 186,186,187,187,187,187,187,187,187,187,187,187,187,187, /* 126-139 */ 187,187,187,187,187,187,187,187,187,187,187,187,187,187, /* 140-153 */ 187,187,187,187,187,187,187,187,187,187,187,187,187,187, /* 154-167 */ 187,187,187,187,187,187,187,187,187,187,187,187,187,187, /* 168-181 */ 187,187,187,187,187,187,187,187,187,187,188,188,188,188, /* 182-195 */ 188,188,188,188,188,188,188,188,188,188,188,188,188,188, /* 196-209 */ 188,188,188,188,188,188,188,188,188,188,188,188,188,188, /* 210-223 */ 188,188,188,188,188,188,188,188,188,188,188,188,188,188, /* 224-237 */ 188,188,188,188,188,188,188,188,188,188,188,188,188,188, /* 238-251 */ 188,188,188,188 }, /* prefix 177 */ { 156,156,156,156,156,156,156,156,156,156,156,156,156,156, /* 0- 13 */ 156,156,156,156,156,156,156,156,156,156,156,156,156,156, /* 14- 27 */ 156,156,156,156,156,156,156,156,156,156,156,156,156,156, /* 28- 41 */ 156,156,156,156,156,156,156,156,156,156,156,156,156,156, /* 42- 55 */ 156,156,156,156,156,156,156,156,156,156,156,156,156,156, /* 56- 69 */ 156,156,156,156,156,156,156,156,156,156,156,156,156,156, /* 70- 83 */ 156,156,156,156,156,156,156,156,156,156,156,156,156,156, /* 84- 97 */ 156,156,156,156,156,156,156,156,156,156,156,156,156,156, /* 98-111 */ 156,156,156,156,156,156,156,156,156,156,156,156,156,156, /* 112-125 */ 156,156,157,157,157,157,157,157,157,157,157,157,157,157, /* 126-139 */ 157,157,157,157,157,157,157,157,157,157,157,157,157,157, /* 140-153 */ 157,157,157,157,157,157,157,157,157,157,157,157,157,157, /* 154-167 */ 157,157,157,157,157,157,157,157,157,157,157,157,157,157, /* 168-181 */ 157,157,157,157,157,157,157,157,157,157,157,157,157,157, /* 182-195 */ 157,157,157,157,157,157,157,157,157,157,157,157,157,157, /* 196-209 */ 157,157,157,157,157,157,157,157,157,157,157,157,157,157, /* 210-223 */ 157,157,157,157,157,157,157,157,157,157,157,157,157,157, /* 224-237 */ 157,157,157,157,157,157,157,157,157,157,157,157,157,157, /* 238-251 */ 157,157,157,157 }, /* prefix 178 */ { 150,150,150,150,150,150,150,150,150,150,150,150,150,150, /* 0- 13 */ 150,150,150,150,150,150,150,150,150,150,150,150,150,150, /* 14- 27 */ 150,150,150,150,150,150,150,150,150,150,150,150,150,150, /* 28- 41 */ 150,150,150,150,150,150,150,150,150,150,150,150,150,150, /* 42- 55 */ 150,150,150,150,150,150,150,150,150,150,150,150,150,150, /* 56- 69 */ 150,150,150,150,150,150,150,150,150,150,150,150,150,150, /* 70- 83 */ 150,150,150,150,150,150,150,150,150,150,150,150,150,150, /* 84- 97 */ 150,150,150,150,150,150,150,150,150,150,150,150,150,150, /* 98-111 */ 150,150,150,150,150,150,150,150,150,150,150,150,150,150, /* 112-125 */ 150,150,151,151,151,151,151,151,151,151,151,151,151,151, /* 126-139 */ 151,151,151,151,151,151,151,151,151,151,151,151,151,151, /* 140-153 */ 151,151,151,151,151,151,151,151,151,151,151,151,151,151, /* 154-167 */ 151,151,151,151,151,151,151,151,151,151,151,151,151,151, /* 168-181 */ 151,151,151,151,151,151,151,151,151,151,151,151,151,151, /* 182-195 */ 151,151,151,151,151,151,151,151,151,151,151,151,151,151, /* 196-209 */ 151,151,151,151,151,151,151,151,151,151,151,151,151,151, /* 210-223 */ 151,151,151,151,151,151,151,151,151,151,151,151,151,151, /* 224-237 */ 151,151,151,151,151,151,151,151,151,151,151,151,151,151, /* 238-251 */ 151,151,151,151 }, /* prefix 179 */ { 152,152,152,152,152,152,152,152,152,152,152,152,152,152, /* 0- 13 */ 152,152,152,152,152,152,152,152,152,152,152,152,152,152, /* 14- 27 */ 152,152,152,152,152,152,152,152,152,152,152,152,152,152, /* 28- 41 */ 152,152,152,152,152,152,152,152,152,152,152,152,152,152, /* 42- 55 */ 152,152,152,152,152,152,152,152,152,152,152,152,152,152, /* 56- 69 */ 152,152,152,152,152,152,152,152,152,152,152,152,152,152, /* 70- 83 */ 152,152,152,152,152,152,152,152,152,152,152,152,152,152, /* 84- 97 */ 152,152,152,152,152,152,152,152,152,152,152,152,152,152, /* 98-111 */ 152,152,152,152,152,152,152,152,152,152,152,152,152,152, /* 112-125 */ 152,152,153,153,153,153,153,153,153,153,153,153,153,153, /* 126-139 */ 153,153,153,153,153,153,153,153,153,153,153,153,153,153, /* 140-153 */ 153,153,153,153,153,153,153,153,153,153,153,153,153,153, /* 154-167 */ 153,153,153,153,153,153,153,153,153,153,153,153,153,153, /* 168-181 */ 153,153,153,153,153,153,153,153,153,153,153,153,153,153, /* 182-195 */ 153,153,153,153,153,153,153,153,153,153,153,153,153,153, /* 196-209 */ 153,153,153,153,153,153,153,153,153,153,153,153,153,153, /* 210-223 */ 153,153,153,153,153,153,153,153,153,153,153,153,153,153, /* 224-237 */ 153,153,153,153,153,153,153,153,153,153,153,153,153,153, /* 238-251 */ 153,153,153,153 }, /* prefix 180 */ { 163,163,163,163,163,163,163,163,163,163,163,163,163,163, /* 0- 13 */ 163,163,163,163,163,163,163,163,163,163,163,163,163,163, /* 14- 27 */ 163,163,163,163,163,163,163,163,163,163,163,163,163,163, /* 28- 41 */ 163,163,163,163,163,163,163,163,163,163,163,163,163,163, /* 42- 55 */ 163,163,163,163,163,163,163,163,163,163,163,163,163,163, /* 56- 69 */ 163,163,163,163,163,163,163,163,163,163,163,163,163,163, /* 70- 83 */ 163,163,163,163,163,163,163,163,163,163,163,163,163,163, /* 84- 97 */ 163,163,163,163,163,163,163,163,163,163,163,163,163,163, /* 98-111 */ 163,163,163,163,163,163,163,163,163,163,163,163,163,163, /* 112-125 */ 163,163,164,164,164,164,164,164,164,164,164,164,164,164, /* 126-139 */ 164,164,164,164,164,164,164,164,164,164,164,164,164,164, /* 140-153 */ 164,164,164,164,164,164,164,164,164,164,164,164,164,164, /* 154-167 */ 164,164,164,164,164,164,164,164,164,164,164,164,164,164, /* 168-181 */ 164,164,164,164,164,164,164,164,164,164,164,164,164,164, /* 182-195 */ 164,164,164,164,164,164,164,164,164,164,164,164,164,164, /* 196-209 */ 164,164,164,164,164,164,164,164,164,164,164,164,164,164, /* 210-223 */ 164,164,164,164,164,164,164,164,164,164,164,164,164,164, /* 224-237 */ 164,164,164,164,164,164,164,164,164,164,164,164,164,164, /* 238-251 */ 164,164,164,164 }, /* prefix 181 */ { 167,167,167,167,167,167,167,167,167,167,167,167,167,167, /* 0- 13 */ 167,167,167,167,167,167,167,167,167,167,167,167,167,167, /* 14- 27 */ 167,167,167,167,167,167,167,167,167,167,167,167,167,167, /* 28- 41 */ 167,167,167,167,167,167,167,167,167,167,167,167,167,167, /* 42- 55 */ 167,167,167,167,167,167,167,167,167,167,167,167,167,167, /* 56- 69 */ 167,167,167,167,167,167,167,167,167,167,167,167,167,167, /* 70- 83 */ 167,167,167,167,167,167,167,167,167,167,167,167,167,167, /* 84- 97 */ 167,167,167,167,167,167,167,167,167,167,167,167,167,167, /* 98-111 */ 167,167,167,167,167,167,167,167,167,167,167,167,167,167, /* 112-125 */ 167,167,173,173,173,173,173,173,173,173,173,173,173,173, /* 126-139 */ 173,173,173,173,173,173,173,173,173,173,173,173,173,173, /* 140-153 */ 173,173,173,173,173,173,173,173,173,173,173,173,173,173, /* 154-167 */ 173,173,173,173,173,173,173,173,173,173,173,173,173,173, /* 168-181 */ 173,173,173,173,173,173,173,173,173,173,173,173,173,173, /* 182-195 */ 173,173,173,173,173,173,173,173,173,173,173,173,173,173, /* 196-209 */ 173,173,173,173,173,173,173,173,173,173,173,173,173,173, /* 210-223 */ 173,173,173,173,173,173,173,173,173,173,173,173,173,173, /* 224-237 */ 173,173,173,173,173,173,173,173,173,173,173,173,173,173, /* 238-251 */ 173,173,173,173 }, /* prefix 182 */ { 154,154,154,154,154,154,154,154,154,154,154,154,154,154, /* 0- 13 */ 154,154,154,154,154,154,154,154,154,154,154,154,154,154, /* 14- 27 */ 154,154,154,154,154,154,154,154,154,154,154,154,154,154, /* 28- 41 */ 154,154,154,154,154,154,154,154,154,154,154,154,154,154, /* 42- 55 */ 154,154,154,154,154,154,154,154,154,154,154,154,154,154, /* 56- 69 */ 154,154,154,154,154,154,154,154,154,154,154,154,154,154, /* 70- 83 */ 154,154,154,154,154,154,154,154,154,154,154,154,154,154, /* 84- 97 */ 154,154,154,154,154,154,154,154,154,154,154,154,154,154, /* 98-111 */ 154,154,154,154,154,154,154,154,154,154,154,154,154,154, /* 112-125 */ 154,154,155,155,155,155,155,155,155,155,155,155,155,155, /* 126-139 */ 155,155,155,155,155,155,155,155,155,155,155,155,155,155, /* 140-153 */ 155,155,155,155,155,155,155,155,155,155,155,155,155,155, /* 154-167 */ 155,155,155,155,155,155,155,155,155,155,155,155,155,155, /* 168-181 */ 155,155,155,155,155,155,155,155,155,155,155,155,155,155, /* 182-195 */ 155,155,155,155,155,155,155,155,155,155,155,155,155,155, /* 196-209 */ 155,155,155,155,155,155,155,155,155,155,155,155,155,155, /* 210-223 */ 155,155,155,155,155,155,155,155,155,155,155,155,155,155, /* 224-237 */ 155,155,155,155,155,155,155,155,155,155,155,155,155,155, /* 238-251 */ 155,155,155,155 }, /* prefix 183 */ { 168,168,168,168,168,168,168,168,168,168,168,168,168,168, /* 0- 13 */ 168,168,168,168,168,168,168,168,168,168,168,168,168,168, /* 14- 27 */ 168,168,168,168,168,168,168,168,168,168,168,168,168,168, /* 28- 41 */ 168,168,168,168,168,168,168,168,168,168,168,168,168,168, /* 42- 55 */ 168,168,168,168,168,168,168,168,168,168,168,168,168,168, /* 56- 69 */ 168,168,168,168,168,168,168,168,168,168,168,168,168,168, /* 70- 83 */ 168,168,168,168,168,168,168,168,168,168,168,168,168,168, /* 84- 97 */ 168,168,168,168,168,168,168,168,168,168,168,168,168,168, /* 98-111 */ 168,168,168,168,168,168,168,168,168,168,168,168,168,168, /* 112-125 */ 168,168,169,169,169,169,169,169,169,169,169,169,169,169, /* 126-139 */ 169,169,169,169,169,169,169,169,169,169,169,169,169,169, /* 140-153 */ 169,169,169,169,169,169,169,169,169,169,169,169,169,169, /* 154-167 */ 169,169,169,169,169,169,169,169,169,169,169,169,169,169, /* 168-181 */ 169,169,169,169,169,169,169,169,169,169,169,169,169,169, /* 182-195 */ 169,169,169,169,169,169,169,169,169,169,169,169,169,169, /* 196-209 */ 169,169,169,169,169,169,169,169,169,169,169,169,169,169, /* 210-223 */ 169,169,169,169,169,169,169,169,169,169,169,169,169,169, /* 224-237 */ 169,169,169,169,169,169,169,169,169,169,169,169,169,169, /* 238-251 */ 169,169,169,169 }, /* prefix 184 */ { 136,136,136,136,136,136,136,136,136,136,136,136,136,136, /* 0- 13 */ 136,136,136,136,136,136,136,136,136,136,136,136,136,136, /* 14- 27 */ 136,136,136,136,136,136,136,136,136,136,136,136,136,136, /* 28- 41 */ 136,136,136,136,136,136,136,136,136,136,136,136,136,136, /* 42- 55 */ 136,136,136,136,136,136,136,136,136,136,136,136,136,136, /* 56- 69 */ 136,136,136,136,136,136,136,136,136,136,136,136,136,136, /* 70- 83 */ 136,136,136,136,136,136,136,136,136,136,136,136,136,136, /* 84- 97 */ 136,136,136,136,136,136,136,136,136,136,136,136,136,136, /* 98-111 */ 136,136,136,136,136,136,136,136,136,136,136,136,136,136, /* 112-125 */ 136,136,137,137,137,137,137,137,137,137,137,137,137,137, /* 126-139 */ 137,137,137,137,137,137,137,137,137,137,137,137,137,137, /* 140-153 */ 137,137,137,137,137,137,137,137,137,137,137,137,137,137, /* 154-167 */ 137,137,137,137,137,137,137,137,137,137,137,137,137,137, /* 168-181 */ 137,137,137,137,137,137,137,137,137,137,137,137,137,137, /* 182-195 */ 137,137,137,137,137,137,137,137,137,137,137,137,137,137, /* 196-209 */ 137,137,137,137,137,137,137,137,137,137,137,137,137,137, /* 210-223 */ 137,137,137,137,137,137,137,137,137,137,137,137,137,137, /* 224-237 */ 137,137,137,137,137,137,137,137,137,137,137,137,137,137, /* 238-251 */ 137,137,137,137 }, /* prefix 185 */ { 138,138,138,138,138,138,138,138,138,138,138,138,138,138, /* 0- 13 */ 138,138,138,138,138,138,138,138,138,138,138,138,138,138, /* 14- 27 */ 138,138,138,138,138,138,138,138,138,138,138,138,138,138, /* 28- 41 */ 138,138,138,138,138,138,138,138,138,138,138,138,138,138, /* 42- 55 */ 138,138,138,138,138,138,138,138,138,138,138,138,138,138, /* 56- 69 */ 138,138,138,138,138,138,138,138,138,138,138,138,138,138, /* 70- 83 */ 138,138,138,138,138,138,138,138,138,138,138,138,138,138, /* 84- 97 */ 138,138,138,138,138,138,138,138,138,138,138,138,138,138, /* 98-111 */ 138,138,138,138,138,138,138,138,138,138,138,138,138,138, /* 112-125 */ 138,138,139,139,139,139,139,139,139,139,139,139,139,139, /* 126-139 */ 139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* 140-153 */ 139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* 154-167 */ 139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* 168-181 */ 139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* 182-195 */ 139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* 196-209 */ 139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* 210-223 */ 139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* 224-237 */ 139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* 238-251 */ 139,139,139,139 }, /* prefix 186 */ { 146,146,146,146,146,146,146,146,146,146,146,146,146,146, /* 0- 13 */ 146,146,146,146,146,146,146,146,146,146,146,146,146,146, /* 14- 27 */ 146,146,146,146,146,146,146,146,146,146,146,146,146,146, /* 28- 41 */ 146,146,146,146,146,146,146,146,146,146,146,146,146,146, /* 42- 55 */ 146,146,146,146,146,146,146,146,146,146,146,146,146,146, /* 56- 69 */ 146,146,146,146,146,146,146,146,146,146,146,146,146,146, /* 70- 83 */ 146,146,146,146,146,146,146,146,146,146,146,146,146,146, /* 84- 97 */ 146,146,146,146,146,146,146,146,146,146,146,146,146,146, /* 98-111 */ 146,146,146,146,146,146,146,146,146,146,146,146,146,146, /* 112-125 */ 146,146,147,147,147,147,147,147,147,147,147,147,147,147, /* 126-139 */ 147,147,147,147,147,147,147,147,147,147,147,147,147,147, /* 140-153 */ 147,147,147,147,147,147,147,147,147,147,147,147,147,147, /* 154-167 */ 147,147,147,147,147,147,147,147,147,147,147,147,147,147, /* 168-181 */ 147,147,147,147,147,147,147,147,147,147,147,147,147,147, /* 182-195 */ 147,147,147,147,147,147,147,147,147,147,147,147,147,147, /* 196-209 */ 147,147,147,147,147,147,147,147,147,147,147,147,147,147, /* 210-223 */ 147,147,147,147,147,147,147,147,147,147,147,147,147,147, /* 224-237 */ 147,147,147,147,147,147,147,147,147,147,147,147,147,147, /* 238-251 */ 147,147,147,147 }, /* prefix 187 */ { 171,171,171,171,171,171,171,171,171,171,171,171,171,171, /* 0- 13 */ 171,171,171,171,171,171,171,171,171,171,171,171,171,171, /* 14- 27 */ 171,171,171,171,171,171,171,171,171,171,171,171,171,171, /* 28- 41 */ 171,171,171,171,171,171,171,171,171,171,171,171,171,171, /* 42- 55 */ 171,171,171,171,171,171,171,171,171,171,171,171,171,171, /* 56- 69 */ 171,171,171,171,171,171,171,171,171,171,171,171,171,171, /* 70- 83 */ 171,171,171,171,171,171,171,171,171,171,171,171,171,171, /* 84- 97 */ 171,171,171,171,171,171,171,171,171,171,171,171,171,171, /* 98-111 */ 171,171,171,171,171,171,171,171,171,171,171,171,171,171, /* 112-125 */ 171,171,172,172,172,172,172,172,172,172,172,172,172,172, /* 126-139 */ 172,172,172,172,172,172,172,172,172,172,172,172,172,172, /* 140-153 */ 172,172,172,172,172,172,172,172,172,172,172,172,172,172, /* 154-167 */ 172,172,172,172,172,172,172,172,172,172,172,172,172,172, /* 168-181 */ 172,172,172,172,172,172,172,172,172,172,172,172,172,172, /* 182-195 */ 172,172,172,172,172,172,172,172,172,172,172,172,172,172, /* 196-209 */ 172,172,172,172,172,172,172,172,172,172,172,172,172,172, /* 210-223 */ 172,172,172,172,172,172,172,172,172,172,172,172,172,172, /* 224-237 */ 172,172,172,172,172,172,172,172,172,172,172,172,172,172, /* 238-251 */ 172,172,172,172 }, /* prefix 188 */ { 132,132,132,132,132,132,132,132,132,132,132,132,132,132, /* 0- 13 */ 132,132,132,132,132,132,132,132,132,132,132,132,132,132, /* 14- 27 */ 132,132,132,132,132,132,132,132,132,132,132,132,132,132, /* 28- 41 */ 132,132,132,132,132,132,132,132,132,132,132,132,132,132, /* 42- 55 */ 132,132,132,132,132,132,132,132,132,132,132,132,132,132, /* 56- 69 */ 132,132,132,132,132,132,132,132,132,132,132,132,132,132, /* 70- 83 */ 132,132,132,132,132,132,132,132,132,132,132,132,132,132, /* 84- 97 */ 132,132,132,132,132,132,132,132,132,132,132,132,132,132, /* 98-111 */ 132,132,132,132,132,132,132,132,132,132,132,132,132,132, /* 112-125 */ 132,132,133,133,133,133,133,133,133,133,133,133,133,133, /* 126-139 */ 133,133,133,133,133,133,133,133,133,133,133,133,133,133, /* 140-153 */ 133,133,133,133,133,133,133,133,133,133,133,133,133,133, /* 154-167 */ 133,133,133,133,133,133,133,133,133,133,133,133,133,133, /* 168-181 */ 133,133,133,133,133,133,133,133,133,133,133,133,133,133, /* 182-195 */ 133,133,133,133,133,133,133,133,133,133,133,133,133,133, /* 196-209 */ 133,133,133,133,133,133,133,133,133,133,133,133,133,133, /* 210-223 */ 133,133,133,133,133,133,133,133,133,133,133,133,133,133, /* 224-237 */ 133,133,133,133,133,133,133,133,133,133,133,133,133,133, /* 238-251 */ 133,133,133,133 }, /* prefix 189 */ { 134,134,134,134,134,134,134,134,134,134,134,134,134,134, /* 0- 13 */ 134,134,134,134,134,134,134,134,134,134,134,134,134,134, /* 14- 27 */ 134,134,134,134,134,134,134,134,134,134,134,134,134,134, /* 28- 41 */ 134,134,134,134,134,134,134,134,134,134,134,134,134,134, /* 42- 55 */ 134,134,134,134,134,134,134,134,134,134,134,134,134,134, /* 56- 69 */ 134,134,134,134,134,134,134,134,134,134,134,134,134,134, /* 70- 83 */ 134,134,134,134,134,134,134,134,134,134,134,134,134,134, /* 84- 97 */ 134,134,134,134,134,134,134,134,134,134,134,134,134,134, /* 98-111 */ 134,134,134,134,134,134,134,134,134,134,134,134,134,134, /* 112-125 */ 134,134,135,135,135,135,135,135,135,135,135,135,135,135, /* 126-139 */ 135,135,135,135,135,135,135,135,135,135,135,135,135,135, /* 140-153 */ 135,135,135,135,135,135,135,135,135,135,135,135,135,135, /* 154-167 */ 135,135,135,135,135,135,135,135,135,135,135,135,135,135, /* 168-181 */ 135,135,135,135,135,135,135,135,135,135,135,135,135,135, /* 182-195 */ 135,135,135,135,135,135,135,135,135,135,135,135,135,135, /* 196-209 */ 135,135,135,135,135,135,135,135,135,135,135,135,135,135, /* 210-223 */ 135,135,135,135,135,135,135,135,135,135,135,135,135,135, /* 224-237 */ 135,135,135,135,135,135,135,135,135,135,135,135,135,135, /* 238-251 */ 135,135,135,135 }, /* prefix 190 */ { 140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* 0- 13 */ 140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* 14- 27 */ 140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* 28- 41 */ 140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* 42- 55 */ 140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* 56- 69 */ 140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* 70- 83 */ 140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* 84- 97 */ 140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* 98-111 */ 140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* 112-125 */ 140,140,141,141,141,141,141,141,141,141,141,141,141,141, /* 126-139 */ 141,141,141,141,141,141,141,141,141,141,141,141,141,141, /* 140-153 */ 141,141,141,141,141,141,141,141,141,141,141,141,141,141, /* 154-167 */ 141,141,141,141,141,141,141,141,141,141,141,141,141,141, /* 168-181 */ 141,141,141,141,141,141,141,141,141,141,141,141,141,141, /* 182-195 */ 141,141,141,141,141,141,141,141,141,141,141,141,141,141, /* 196-209 */ 141,141,141,141,141,141,141,141,141,141,141,141,141,141, /* 210-223 */ 141,141,141,141,141,141,141,141,141,141,141,141,141,141, /* 224-237 */ 141,141,141,141,141,141,141,141,141,141,141,141,141,141, /* 238-251 */ 141,141,141,141 }, /* prefix 191 */ { 142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* 0- 13 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* 14- 27 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* 28- 41 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* 42- 55 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* 56- 69 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* 70- 83 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* 84- 97 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* 98-111 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* 112-125 */ 142,142,143,143,143,143,143,143,143,143,143,143,143,143, /* 126-139 */ 143,143,143,143,143,143,143,143,143,143,143,143,143,143, /* 140-153 */ 143,143,143,143,143,143,143,143,143,143,143,143,143,143, /* 154-167 */ 143,143,143,143,143,143,143,143,143,143,143,143,143,143, /* 168-181 */ 143,143,143,143,143,143,143,143,143,143,143,143,143,143, /* 182-195 */ 143,143,143,143,143,143,143,143,143,143,143,143,143,143, /* 196-209 */ 143,143,143,143,143,143,143,143,143,143,143,143,143,143, /* 210-223 */ 143,143,143,143,143,143,143,143,143,143,143,143,143,143, /* 224-237 */ 143,143,143,143,143,143,143,143,143,143,143,143,143,143, /* 238-251 */ 143,143,143,143 }, /* prefix 192 */ { 144,144,144,144,144,144,144,144,144,144,144,144,144,144, /* 0- 13 */ 144,144,144,144,144,144,144,144,144,144,144,144,144,144, /* 14- 27 */ 144,144,144,144,144,144,144,144,144,144,144,144,144,144, /* 28- 41 */ 144,144,144,144,144,144,144,144,144,144,144,144,144,144, /* 42- 55 */ 144,144,144,144,144,144,144,144,144,144,144,144,144,144, /* 56- 69 */ 144,144,144,144,144,144,144,144,144,144,144,144,144,144, /* 70- 83 */ 144,144,144,144,144,144,144,144,144,144,144,144,144,144, /* 84- 97 */ 144,144,144,144,144,144,144,144,144,144,144,144,144,144, /* 98-111 */ 144,144,144,144,144,144,144,144,144,144,144,144,144,144, /* 112-125 */ 144,144,145,145,145,145,145,145,145,145,145,145,145,145, /* 126-139 */ 145,145,145,145,145,145,145,145,145,145,145,145,145,145, /* 140-153 */ 145,145,145,145,145,145,145,145,145,145,145,145,145,145, /* 154-167 */ 145,145,145,145,145,145,145,145,145,145,145,145,145,145, /* 168-181 */ 145,145,145,145,145,145,145,145,145,145,145,145,145,145, /* 182-195 */ 145,145,145,145,145,145,145,145,145,145,145,145,145,145, /* 196-209 */ 145,145,145,145,145,145,145,145,145,145,145,145,145,145, /* 210-223 */ 145,145,145,145,145,145,145,145,145,145,145,145,145,145, /* 224-237 */ 145,145,145,145,145,145,145,145,145,145,145,145,145,145, /* 238-251 */ 145,145,145,145 }, /* prefix 193 */ { 148,148,148,148,148,148,148,148,148,148,148,148,148,148, /* 0- 13 */ 148,148,148,148,148,148,148,148,148,148,148,148,148,148, /* 14- 27 */ 148,148,148,148,148,148,148,148,148,148,148,148,148,148, /* 28- 41 */ 148,148,148,148,148,148,148,148,148,148,148,148,148,148, /* 42- 55 */ 148,148,148,148,148,148,148,148,148,148,148,148,148,148, /* 56- 69 */ 148,148,148,148,148,148,148,148,148,148,148,148,148,148, /* 70- 83 */ 148,148,148,148,148,148,148,148,148,148,148,148,148,148, /* 84- 97 */ 148,148,148,148,148,148,148,148,148,148,148,148,148,148, /* 98-111 */ 148,148,148,148,148,148,148,148,148,148,148,148,148,148, /* 112-125 */ 148,148,149,149,149,149,149,149,149,149,149,149,149,149, /* 126-139 */ 149,149,149,149,149,149,149,149,149,149,149,149,149,149, /* 140-153 */ 149,149,149,149,149,149,149,149,149,149,149,149,149,149, /* 154-167 */ 149,149,149,149,149,149,149,149,149,149,149,149,149,149, /* 168-181 */ 149,149,149,149,149,149,149,149,149,149,149,149,149,149, /* 182-195 */ 149,149,149,149,149,149,149,149,149,149,149,149,149,149, /* 196-209 */ 149,149,149,149,149,149,149,149,149,149,149,149,149,149, /* 210-223 */ 149,149,149,149,149,149,149,149,149,149,149,149,149,149, /* 224-237 */ 149,149,149,149,149,149,149,149,149,149,149,149,149,149, /* 238-251 */ 149,149,149,149 }, /* prefix 194 */ { 0,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 0- 13 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 14- 27 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 28- 41 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 42- 55 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 56- 69 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 70- 83 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 84- 97 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 98-111 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 112-125 */ 210,210, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 195 */ { 197,197,197,197,197,197,197,197,197,197,197,197,197,197, /* 0- 13 */ 197,197,197,197,197,197,197,197,197,197,197,197,197,197, /* 14- 27 */ 197,197,197,197,197,197,197,197,197,197,197,197,197,197, /* 28- 41 */ 197,197,197,197,197,197,197,197,197,197,197,197,197,197, /* 42- 55 */ 197,197,197,197,197,197,197,197,197,197,197,197,197,197, /* 56- 69 */ 197,197,197,197,197,197,197,197,197,197,197,197,197,197, /* 70- 83 */ 197,197,197,197,197,197,197,197,197,197,197,197,197,197, /* 84- 97 */ 197,197,197,197,197,197,197,197,197,197,197,197,197,197, /* 98-111 */ 197,197,197,197,197,197,197,197,197,197,197,197,197,197, /* 112-125 */ 197,197,200,200,200,200,200,200,200,200,200,200,200,200, /* 126-139 */ 200,200,200,200,200,200,200,200,200,200,200,200,200,200, /* 140-153 */ 200,200,200,200,200,200,200,200,200,200,200,200,200,200, /* 154-167 */ 200,200,200,200,200,200,200,200,200,200,200,200,200,200, /* 168-181 */ 200,200,200,200,200,200,200,200,200,200,201,201,201,201, /* 182-195 */ 201,201,201,201,201,201,201,201,201,201,201,201,201,201, /* 196-209 */ 201,201,201,201,201,201,201,201,201,201,201,201,201,201, /* 210-223 */ 201,201,201,201,201,201,201,201,201,201,201,201,201,201, /* 224-237 */ 201,201,201,201,201,201,201,201,201,201,201,201,201,201, /* 238-251 */ 201,201,201,201 }, /* prefix 196 */ { 202,202,202,202,202,202,202,202,202,202,202,202,202,202, /* 0- 13 */ 202,202,202,202,202,202,202,202,202,202,202,202,202,202, /* 14- 27 */ 202,202,202,202,202,202,202,202,202,202,202,202,202,202, /* 28- 41 */ 202,202,202,202,202,202,202,202,202,202,202,202,202,202, /* 42- 55 */ 202,202,202,202,202,202,202,202,203,203,203,203,203,203, /* 56- 69 */ 203,203,203,203,203,203,203,203,203,203,203,203,203,203, /* 70- 83 */ 203,203,203,203,203,203,203,203,203,203,203,203,203,203, /* 84- 97 */ 203,203,203,203,203,203,203,203,203,203,203,203,203,203, /* 98-111 */ 203,203,203,203,203,203,203,203,203,203,203,203,203,203, /* 112-125 */ 203,203,204,204,204,204,204,204,204,204,204,204,204,204, /* 126-139 */ 204,204,204,204,204,204,204,204,204,204,204,204,204,204, /* 140-153 */ 204,204,204,204,204,204,204,204,204,204,204,204,204,204, /* 154-167 */ 204,204,204,204,204,204,204,204,204,204,204,204,204,204, /* 168-181 */ 204,204,204,204,204,204,204,204,204,204,205,205,205,205, /* 182-195 */ 205,205,205,205,205,205,205,205,205,205,205,205,205,205, /* 196-209 */ 205,205,205,205,205,205,205,205,205,205,205,205,205,205, /* 210-223 */ 205,205,205,205,205,205,205,205,205,205,205,205,205,205, /* 224-237 */ 205,205,205,205,205,205,205,205,205,205,205,205,205,205, /* 238-251 */ 205,205,205,205 }, /* prefix 197 */ { 198,198,198,198,198,198,198,198,198,198,198,198,198,198, /* 0- 13 */ 198,198,198,198,198,198,198,198,198,198,198,198,198,198, /* 14- 27 */ 198,198,198,198,198,198,198,198,198,198,198,198,198,198, /* 28- 41 */ 198,198,198,198,198,198,198,198,198,198,198,198,198,198, /* 42- 55 */ 198,198,198,198,198,198,198,198,198,198,198,198,198,198, /* 56- 69 */ 198,198,198,198,198,198,198,198,198,198,198,198,198,198, /* 70- 83 */ 198,198,198,198,198,198,198,198,198,198,198,198,198,198, /* 84- 97 */ 198,198,198,198,198,198,198,198,198,198,198,198,198,198, /* 98-111 */ 198,198,198,198,198,198,198,198,198,198,198,198,198,198, /* 112-125 */ 198,198,199,199,199,199,199,199,199,199,199,199,199,199, /* 126-139 */ 199,199,199,199,199,199,199,199,199,199,199,199,199,199, /* 140-153 */ 199,199,199,199,199,199,199,199,199,199,199,199,199,199, /* 154-167 */ 199,199,199,199,199,199,199,199,199,199,199,199,199,199, /* 168-181 */ 199,199,199,199,199,199,199,199,199,199,199,199,199,199, /* 182-195 */ 199,199,199,199,199,199,199,199,199,199,199,199,199,199, /* 196-209 */ 199,199,199,199,199,199,199,199,199,199,199,199,199,199, /* 210-223 */ 199,199,199,199,199,199,199,199,199,199,199,199,199,199, /* 224-237 */ 199,199,199,199,199,199,199,199,199,199,199,199,199,199, /* 238-251 */ 199,199,199,199 }, /* prefix 198 */ { 206,206,206,206,206,206,206,206,206,206,206,206,206,206, /* 0- 13 */ 206,206,206,206,206,206,206,206,206,206,206,206,206,206, /* 14- 27 */ 206,206,206,206,206,206,206,206,206,206,206,206,206,206, /* 28- 41 */ 206,206,206,206,206,206,206,206,206,206,206,206,206,206, /* 42- 55 */ 206,206,206,206,206,206,206,206,207,207,207,207,207,207, /* 56- 69 */ 207,207,207,207,207,207,207,207,207,207,207,207,207,207, /* 70- 83 */ 207,207,207,207,207,207,207,207,207,207,207,207,207,207, /* 84- 97 */ 207,207,207,207,207,207,207,207,207,207,207,207,207,207, /* 98-111 */ 207,207,207,207,207,207,207,207,207,207,207,207,207,207, /* 112-125 */ 207,207,208,208,208,208,208,208,208,208,208,208,208,208, /* 126-139 */ 208,208,208,208,208,208,208,208,208,208,208,208,208,208, /* 140-153 */ 208,208,208,208,208,208,208,208,208,208,208,208,208,208, /* 154-167 */ 208,208,208,208,208,208,208,208,208,208,208,208,208,208, /* 168-181 */ 208,208,208,208,208,208,208,208,208,208,209,209,209,209, /* 182-195 */ 209,209,209,209,209,209,209,209,209,209,209,209,209,209, /* 196-209 */ 209,209,209,209,209,209,209,209,209,209,209,209,209,209, /* 210-223 */ 209,209,209,209,209,209,209,209,209,209,209,209,209,209, /* 224-237 */ 209,209,209,209,209,209,209,209,209,209,209,209,209,209, /* 238-251 */ 209,209,209,209 }, /* prefix 199 */ { 158,158,158,158,158,158,158,158,158,158,158,158,158,158, /* 0- 13 */ 158,158,158,158,158,158,158,158,158,158,158,158,158,158, /* 14- 27 */ 158,158,158,158,158,158,158,158,158,158,158,158,158,158, /* 28- 41 */ 158,158,158,158,158,158,158,158,158,158,158,158,158,158, /* 42- 55 */ 158,158,158,158,158,158,158,158,179,179,179,179,179,179, /* 56- 69 */ 179,179,179,179,179,179,179,179,179,179,179,179,179,179, /* 70- 83 */ 179,179,179,179,179,179,179,179,179,179,179,179,180,180, /* 84- 97 */ 180,180,180,180,180,180,180,180,180,180,180,180,180,180, /* 98-111 */ 180,180,180,180,180,180,180,180,180,180,180,180,180,180, /* 112-125 */ 180,180,181,181,181,181,181,181,181,181,181,181,181,181, /* 126-139 */ 181,181,181,181,181,181,181,181,181,181,181,181,181,181, /* 140-153 */ 181,181,181,181,181,181,182,182,182,182,182,182,182,182, /* 154-167 */ 182,182,182,182,182,182,182,182,182,182,182,182,182,182, /* 168-181 */ 182,182,182,182,182,182,182,182,182,182,161,161,161,161, /* 182-195 */ 161,161,161,161,161,161,161,161,161,161,161,161,161,161, /* 196-209 */ 161,161,161,161,161,161,161,161,161,161,161,161,161,161, /* 210-223 */ 161,161,161,161,161,161,161,161,161,161,161,161,161,161, /* 224-237 */ 161,161,161,161,161,161,161,161,161,161,161,161,161,161, /* 238-251 */ 161,161,161,161 }, /* prefix 200 */ { 162,162,162,162,162,162,162,162,162,162,162,162,162,162, /* 0- 13 */ 162,162,162,162,162,162,162,162,162,162,162,162,162,162, /* 14- 27 */ 162,162,162,162,162,162,162,162,162,162,162,162,162,162, /* 28- 41 */ 162,162,162,162,162,162,162,162,162,162,162,162,162,162, /* 42- 55 */ 162,162,162,162,162,162,162,162,189,189,189,189,189,189, /* 56- 69 */ 189,189,189,189,189,189,189,189,189,189,189,189,189,189, /* 70- 83 */ 189,189,189,189,189,189,189,189,189,189,189,189,190,190, /* 84- 97 */ 190,190,190,190,190,190,190,190,190,190,190,190,190,190, /* 98-111 */ 190,190,190,190,190,190,190,190,190,190,190,190,190,190, /* 112-125 */ 190,190,191,191,191,191,191,191,191,191,191,191,191,191, /* 126-139 */ 191,191,191,191,191,191,191,191,191,191,191,191,191,191, /* 140-153 */ 191,191,191,191,191,191,192,192,192,192,192,192,192,192, /* 154-167 */ 192,192,192,192,192,192,192,192,192,192,192,192,192,192, /* 168-181 */ 192,192,192,192,192,192,192,192,192,192,165,165,165,165, /* 182-195 */ 165,165,165,165,165,165,165,165,165,165,165,165,165,165, /* 196-209 */ 165,165,165,165,165,165,165,165,165,165,165,165,165,165, /* 210-223 */ 165,165,165,165,165,165,165,165,165,165,165,165,165,165, /* 224-237 */ 165,165,165,165,165,165,165,165,165,165,165,165,165,165, /* 238-251 */ 165,165,165,165 }, /* prefix 201 */ { 166,166,166,166,166,166,166,166,166,166,166,166,166,166, /* 0- 13 */ 166,166,166,166,166,166,166,166,166,166,166,166,166,166, /* 14- 27 */ 166,166,166,166,166,166,166,166,166,166,166,166,166,166, /* 28- 41 */ 166,166,166,166,166,166,166,166,166,166,166,166,166,166, /* 42- 55 */ 166,166,166,166,166,166,166,166,193,193,193,193,193,193, /* 56- 69 */ 193,193,193,193,193,193,193,193,193,193,193,193,193,193, /* 70- 83 */ 193,193,193,193,193,193,193,193,193,193,193,193,194,194, /* 84- 97 */ 194,194,194,194,194,194,194,194,194,194,194,194,194,194, /* 98-111 */ 194,194,194,194,194,194,194,194,194,194,194,194,194,194, /* 112-125 */ 194,194,130,130,130,130,130,130,130,130,130,130,130,130, /* 126-139 */ 130,130,130,130,130,130,130,130,130,130,130,130,130,130, /* 140-153 */ 130,130,130,130,130,130,130,130,130,130,130,130,130,130, /* 154-167 */ 130,130,130,130,130,130,130,130,130,130,130,130,130,130, /* 168-181 */ 130,130,130,130,130,130,130,130,130,130,130,130,130,130, /* 182-195 */ 130,130,130,130,130,130,130,130,130,130,130,130,130,130, /* 196-209 */ 130,130,130,130,130,130,130,130,130,130,130,130,130,130, /* 210-223 */ 130,130,130,130,130,130,130,130,130,130,130,130,130,130, /* 224-237 */ 130,130,130,130,130,130,130,130,130,130,130,130,130,130, /* 238-251 */ 130,130,130,130 }, /* prefix 202 */ { 131,131,131,131,131,131,131,131,131,131,131,131,131,131, /* 0- 13 */ 131,131,131,131,131,131,131,131,131,131,131,131,131,131, /* 14- 27 */ 131,131,131,131,131,131,131,131,131,131,131,131,131,131, /* 28- 41 */ 131,131,131,131,131,131,131,131,131,131,131,131,131,131, /* 42- 55 */ 131,131,131,131,131,131,131,131,131,131,131,131,131,131, /* 56- 69 */ 131,131,131,131,131,131,131,131,131,131,131,131,131,131, /* 70- 83 */ 131,131,131,131,131,131,131,131,131,131,131,131,131,131, /* 84- 97 */ 131,131,131,131,131,131,131,131,131,131,131,131,131,131, /* 98-111 */ 131,131,131,131,131,131,131,131,131,131,131,131,131,131, /* 112-125 */ 131,131,195,195,195,195,195,195,195,195,195,195,195,195, /* 126-139 */ 195,195,195,195,195,195,195,195,195,195,195,195,195,195, /* 140-153 */ 195,195,195,195,195,195,196,196,196,196,196,196,196,196, /* 154-167 */ 196,196,196,196,196,196,196,196,196,196,196,196,196,196, /* 168-181 */ 196,196,196,196,196,196,196,196,196,196,174,174,174,174, /* 182-195 */ 174,174,174,174,174,174,174,174,174,174,174,174,174,174, /* 196-209 */ 174,174,174,174,174,174,174,174,174,174,174,174,174,174, /* 210-223 */ 174,174,174,174,174,174,174,174,174,174,174,174,174,174, /* 224-237 */ 174,174,174,174,174,174,174,174,174,174,174,174,174,174, /* 238-251 */ 174,174,174,174 }, /* prefix 203 */ { 175,175,175,175,175,175,175,175,175,175,175,175,175,175, /* 0- 13 */ 175,175,175,175,175,175,175,175,175,175,175,175,175,175, /* 14- 27 */ 175,175,175,175,175,175,175,175,175,175,175,175,175,175, /* 28- 41 */ 175,175,175,175,175,175,175,175,175,175,175,175,175,175, /* 42- 55 */ 175,175,175,175,175,175,175,175,176,176,176,176,176,176, /* 56- 69 */ 176,176,176,176,176,176,176,176,176,176,176,176,176,176, /* 70- 83 */ 176,176,176,176,176,176,176,176,176,176,176,176,176,176, /* 84- 97 */ 176,176,176,176,176,176,176,176,176,176,176,176,176,176, /* 98-111 */ 176,176,176,176,176,176,176,176,176,176,176,176,176,176, /* 112-125 */ 176,176,177,177,177,177,177,177,177,177,177,177,177,177, /* 126-139 */ 177,177,177,177,177,177,177,177,177,177,177,177,177,177, /* 140-153 */ 177,177,177,177,177,177,178,178,178,178,178,178,178,178, /* 154-167 */ 178,178,178,178,178,178,178,178,178,178,178,178,178,178, /* 168-181 */ 178,178,178,178,178,178,178,178,178,178,159,159,159,159, /* 182-195 */ 159,159,159,159,159,159,159,159,159,159,159,159,159,159, /* 196-209 */ 159,159,159,159,159,159,159,159,159,159,159,159,159,159, /* 210-223 */ 159,159,159,159,159,159,159,159,159,159,159,159,159,159, /* 224-237 */ 159,159,159,159,159,159,159,159,159,159,159,159,159,159, /* 238-251 */ 159,159,159,159 }, /* prefix 204 */ { 160,160,160,160,160,160,160,160,160,160,160,160,160,160, /* 0- 13 */ 160,160,160,160,160,160,160,160,160,160,160,160,160,160, /* 14- 27 */ 160,160,160,160,160,160,160,160,160,160,160,160,160,160, /* 28- 41 */ 160,160,160,160,160,160,160,160,160,160,160,160,160,160, /* 42- 55 */ 160,160,160,160,160,160,160,160,183,183,183,183,183,183, /* 56- 69 */ 183,183,183,183,183,183,183,183,183,183,183,183,183,183, /* 70- 83 */ 183,183,183,183,183,183,183,183,183,183,183,183,184,184, /* 84- 97 */ 184,184,184,184,184,184,184,184,184,184,184,184,184,184, /* 98-111 */ 184,184,184,184,184,184,184,184,184,184,184,184,184,184, /* 112-125 */ 184,184,185,185,185,185,185,185,185,185,185,185,185,185, /* 126-139 */ 185,185,185,185,185,185,185,185,185,185,185,185,185,185, /* 140-153 */ 185,185,185,185,185,185,186,186,186,186,186,186,186,186, /* 154-167 */ 186,186,186,186,186,186,186,186,186,186,186,186,186,186, /* 168-181 */ 186,186,186,186,186,186,186,186,186,186,187,187,187,187, /* 182-195 */ 187,187,187,187,187,187,187,187,187,187,187,187,187,187, /* 196-209 */ 187,187,187,187,187,187,187,187,187,187,187,187,187,187, /* 210-223 */ 188,188,188,188,188,188,188,188,188,188,188,188,188,188, /* 224-237 */ 188,188,188,188,188,188,188,188,188,188,188,188,188,188, /* 238-251 */ 188,188,188,188 }, /* prefix 205 */ { 129,129,129,129,129,129,129,129,129,129,129,129,129,129, /* 0- 13 */ 129,129,129,129,129,129,129,129,129,129,129,129,129,129, /* 14- 27 */ 129,129,129,129,129,129,129,129,129,129,129,129,129,129, /* 28- 41 */ 129,129,129,129,129,129,129,129,129,129,129,129,129,129, /* 42- 55 */ 129,129,129,129,129,129,129,129,129,129,129,129,129,129, /* 56- 69 */ 129,129,129,129,129,129,129,129,129,129,129,129,129,129, /* 70- 83 */ 129,129,129,129,129,129,129,129,129,129,129,129,129,129, /* 84- 97 */ 129,129,129,129,129,129,129,129,129,129,129,129,129,129, /* 98-111 */ 129,129,129,129,129,129,129,129,129,129,129,129,129,129, /* 112-125 */ 129,129,156,156,156,156,156,156,156,156,156,156,156,156, /* 126-139 */ 156,156,156,156,156,156,156,156,156,156,156,156,156,156, /* 140-153 */ 156,156,156,156,156,156,156,156,156,156,156,156,156,156, /* 154-167 */ 156,156,156,156,156,156,156,156,156,156,156,156,156,156, /* 168-181 */ 156,156,156,156,156,156,156,156,156,156,157,157,157,157, /* 182-195 */ 157,157,157,157,157,157,157,157,157,157,157,157,157,157, /* 196-209 */ 157,157,157,157,157,157,157,157,157,157,157,157,157,157, /* 210-223 */ 157,157,157,157,157,157,157,157,157,157,157,157,157,157, /* 224-237 */ 157,157,157,157,157,157,157,157,157,157,157,157,157,157, /* 238-251 */ 157,157,157,157 }, /* prefix 206 */ { 150,150,150,150,150,150,150,150,150,150,150,150,150,150, /* 0- 13 */ 150,150,150,150,150,150,150,150,150,150,150,150,150,150, /* 14- 27 */ 150,150,150,150,150,150,150,150,150,150,150,150,150,150, /* 28- 41 */ 150,150,150,150,150,150,150,150,150,150,150,150,150,150, /* 42- 55 */ 150,150,150,150,150,150,150,150,151,151,151,151,151,151, /* 56- 69 */ 151,151,151,151,151,151,151,151,151,151,151,151,151,151, /* 70- 83 */ 151,151,151,151,151,151,151,151,151,151,151,151,151,151, /* 84- 97 */ 151,151,151,151,151,151,151,151,151,151,151,151,151,151, /* 98-111 */ 151,151,151,151,151,151,151,151,151,151,151,151,151,151, /* 112-125 */ 151,151,152,152,152,152,152,152,152,152,152,152,152,152, /* 126-139 */ 152,152,152,152,152,152,152,152,152,152,152,152,152,152, /* 140-153 */ 152,152,152,152,152,152,152,152,152,152,152,152,152,152, /* 154-167 */ 152,152,152,152,152,152,152,152,152,152,152,152,152,152, /* 168-181 */ 152,152,152,152,152,152,152,152,152,152,153,153,153,153, /* 182-195 */ 153,153,153,153,153,153,153,153,153,153,153,153,153,153, /* 196-209 */ 153,153,153,153,153,153,153,153,153,153,153,153,153,153, /* 210-223 */ 153,153,153,153,153,153,153,153,153,153,153,153,153,153, /* 224-237 */ 153,153,153,153,153,153,153,153,153,153,153,153,153,153, /* 238-251 */ 153,153,153,153 }, /* prefix 207 */ { 163,163,163,163,163,163,163,163,163,163,163,163,163,163, /* 0- 13 */ 163,163,163,163,163,163,163,163,163,163,163,163,163,163, /* 14- 27 */ 163,163,163,163,163,163,163,163,163,163,163,163,163,163, /* 28- 41 */ 163,163,163,163,163,163,163,163,163,163,163,163,163,163, /* 42- 55 */ 163,163,163,163,163,163,163,163,164,164,164,164,164,164, /* 56- 69 */ 164,164,164,164,164,164,164,164,164,164,164,164,164,164, /* 70- 83 */ 164,164,164,164,164,164,164,164,164,164,164,164,164,164, /* 84- 97 */ 164,164,164,164,164,164,164,164,164,164,164,164,164,164, /* 98-111 */ 164,164,164,164,164,164,164,164,164,164,164,164,164,164, /* 112-125 */ 164,164,167,167,167,167,167,167,167,167,167,167,167,167, /* 126-139 */ 167,167,167,167,167,167,167,167,167,167,167,167,167,167, /* 140-153 */ 167,167,167,167,167,167,167,167,167,167,167,167,167,167, /* 154-167 */ 167,167,167,167,167,167,167,167,167,167,167,167,167,167, /* 168-181 */ 167,167,167,167,167,167,167,167,167,167,173,173,173,173, /* 182-195 */ 173,173,173,173,173,173,173,173,173,173,173,173,173,173, /* 196-209 */ 173,173,173,173,173,173,173,173,173,173,173,173,173,173, /* 210-223 */ 173,173,173,173,173,173,173,173,173,173,173,173,173,173, /* 224-237 */ 173,173,173,173,173,173,173,173,173,173,173,173,173,173, /* 238-251 */ 173,173,173,173 }, /* prefix 208 */ { 154,154,154,154,154,154,154,154,154,154,154,154,154,154, /* 0- 13 */ 154,154,154,154,154,154,154,154,154,154,154,154,154,154, /* 14- 27 */ 154,154,154,154,154,154,154,154,154,154,154,154,154,154, /* 28- 41 */ 154,154,154,154,154,154,154,154,154,154,154,154,154,154, /* 42- 55 */ 154,154,154,154,154,154,154,154,155,155,155,155,155,155, /* 56- 69 */ 155,155,155,155,155,155,155,155,155,155,155,155,155,155, /* 70- 83 */ 155,155,155,155,155,155,155,155,155,155,155,155,155,155, /* 84- 97 */ 155,155,155,155,155,155,155,155,155,155,155,155,155,155, /* 98-111 */ 155,155,155,155,155,155,155,155,155,155,155,155,155,155, /* 112-125 */ 155,155,168,168,168,168,168,168,168,168,168,168,168,168, /* 126-139 */ 168,168,168,168,168,168,168,168,168,168,168,168,168,168, /* 140-153 */ 168,168,168,168,168,168,168,168,168,168,168,168,168,168, /* 154-167 */ 168,168,168,168,168,168,168,168,168,168,168,168,168,168, /* 168-181 */ 168,168,168,168,168,168,168,168,168,168,169,169,169,169, /* 182-195 */ 169,169,169,169,169,169,169,169,169,169,169,169,169,169, /* 196-209 */ 169,169,169,169,169,169,169,169,169,169,169,169,169,169, /* 210-223 */ 169,169,169,169,169,169,169,169,169,169,169,169,169,169, /* 224-237 */ 169,169,169,169,169,169,169,169,169,169,169,169,169,169, /* 238-251 */ 169,169,169,169 }, /* prefix 209 */ { 136,136,136,136,136,136,136,136,136,136,136,136,136,136, /* 0- 13 */ 136,136,136,136,136,136,136,136,136,136,136,136,136,136, /* 14- 27 */ 136,136,136,136,136,136,136,136,136,136,136,136,136,136, /* 28- 41 */ 136,136,136,136,136,136,136,136,136,136,136,136,136,136, /* 42- 55 */ 136,136,136,136,136,136,136,136,137,137,137,137,137,137, /* 56- 69 */ 137,137,137,137,137,137,137,137,137,137,137,137,137,137, /* 70- 83 */ 137,137,137,137,137,137,137,137,137,137,137,137,137,137, /* 84- 97 */ 137,137,137,137,137,137,137,137,137,137,137,137,137,137, /* 98-111 */ 137,137,137,137,137,137,137,137,137,137,137,137,137,137, /* 112-125 */ 137,137,138,138,138,138,138,138,138,138,138,138,138,138, /* 126-139 */ 138,138,138,138,138,138,138,138,138,138,138,138,138,138, /* 140-153 */ 138,138,138,138,138,138,138,138,138,138,138,138,138,138, /* 154-167 */ 138,138,138,138,138,138,138,138,138,138,138,138,138,138, /* 168-181 */ 138,138,138,138,138,138,138,138,138,138,139,139,139,139, /* 182-195 */ 139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* 196-209 */ 139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* 210-223 */ 139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* 224-237 */ 139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* 238-251 */ 139,139,139,139 }, /* prefix 210 */ { 146,146,146,146,146,146,146,146,146,146,146,146,146,146, /* 0- 13 */ 146,146,146,146,146,146,146,146,146,146,146,146,146,146, /* 14- 27 */ 146,146,146,146,146,146,146,146,146,146,146,146,146,146, /* 28- 41 */ 146,146,146,146,146,146,146,146,146,146,146,146,146,146, /* 42- 55 */ 146,146,146,146,146,146,146,146,147,147,147,147,147,147, /* 56- 69 */ 147,147,147,147,147,147,147,147,147,147,147,147,147,147, /* 70- 83 */ 147,147,147,147,147,147,147,147,147,147,147,147,147,147, /* 84- 97 */ 147,147,147,147,147,147,147,147,147,147,147,147,147,147, /* 98-111 */ 147,147,147,147,147,147,147,147,147,147,147,147,147,147, /* 112-125 */ 147,147,128,128,128,128,128,128,128,128,128,128,128,128, /* 126-139 */ 128,128,128,128,128,128,128,128,128,128,128,128,128,128, /* 140-153 */ 128,128,128,128,128,128,128,128,128,128,128,128,128,128, /* 154-167 */ 128,128,128,128,128,128,128,128,128,128,128,128,128,128, /* 168-181 */ 128,128,128,128,128,128,128,128,128,128,128,128,128,128, /* 182-195 */ 128,128,128,128,128,128,128,128,128,128,128,128,128,128, /* 196-209 */ 128,128,128,128,128,128,128,128,128,128,128,128,128,128, /* 210-223 */ 128,128,128,128,128,128,128,128,128,128,128,128,128,128, /* 224-237 */ 128,128,128,128,128,128,128,128,128,128,128,128,128,128, /* 238-251 */ 128,128,128,128 }, /* prefix 211 */ { 171,171,171,171,171,171,171,171,171,171,171,171,171,171, /* 0- 13 */ 171,171,171,171,171,171,171,171,171,171,171,171,171,171, /* 14- 27 */ 171,171,171,171,171,171,171,171,171,171,171,171,171,171, /* 28- 41 */ 171,171,171,171,171,171,171,171,171,171,171,171,171,171, /* 42- 55 */ 171,171,171,171,171,171,171,171,172,172,172,172,172,172, /* 56- 69 */ 172,172,172,172,172,172,172,172,172,172,172,172,172,172, /* 70- 83 */ 172,172,172,172,172,172,172,172,172,172,172,172,172,172, /* 84- 97 */ 172,172,172,172,172,172,172,172,172,172,172,172,172,172, /* 98-111 */ 172,172,172,172,172,172,172,172,172,172,172,172,172,172, /* 112-125 */ 172,172,132,132,132,132,132,132,132,132,132,132,132,132, /* 126-139 */ 132,132,132,132,132,132,132,132,132,132,132,132,132,132, /* 140-153 */ 132,132,132,132,132,132,132,132,132,132,132,132,132,132, /* 154-167 */ 132,132,132,132,132,132,132,132,132,132,132,132,132,132, /* 168-181 */ 132,132,132,132,132,132,132,132,132,132,133,133,133,133, /* 182-195 */ 133,133,133,133,133,133,133,133,133,133,133,133,133,133, /* 196-209 */ 133,133,133,133,133,133,133,133,133,133,133,133,133,133, /* 210-223 */ 133,133,133,133,133,133,133,133,133,133,133,133,133,133, /* 224-237 */ 133,133,133,133,133,133,133,133,133,133,133,133,133,133, /* 238-251 */ 133,133,133,133 }, /* prefix 212 */ { 134,134,134,134,134,134,134,134,134,134,134,134,134,134, /* 0- 13 */ 134,134,134,134,134,134,134,134,134,134,134,134,134,134, /* 14- 27 */ 134,134,134,134,134,134,134,134,134,134,134,134,134,134, /* 28- 41 */ 134,134,134,134,134,134,134,134,134,134,134,134,134,134, /* 42- 55 */ 134,134,134,134,134,134,134,134,135,135,135,135,135,135, /* 56- 69 */ 135,135,135,135,135,135,135,135,135,135,135,135,135,135, /* 70- 83 */ 135,135,135,135,135,135,135,135,135,135,135,135,135,135, /* 84- 97 */ 135,135,135,135,135,135,135,135,135,135,135,135,135,135, /* 98-111 */ 135,135,135,135,135,135,135,135,135,135,135,135,135,135, /* 112-125 */ 135,135,125,125,125,125,125,125,125,125,125,125,125,125, /* 126-139 */ 125,125,125,125,125,125,125,125,125,125,125,125,125,125, /* 140-153 */ 125,125,125,125,125,125,125,125,125,125,125,125,125,125, /* 154-167 */ 125,125,125,125,125,125,125,125,125,125,125,125,125,125, /* 168-181 */ 125,125,125,125,125,125,125,125,125,125,125,125,125,125, /* 182-195 */ 125,125,125,125,125,125,125,125,125,125,125,125,125,125, /* 196-209 */ 125,125,125,125,125,125,125,125,125,125,125,125,125,125, /* 210-223 */ 125,125,125,125,125,125,125,125,125,125,125,125,125,125, /* 224-237 */ 125,125,125,125,125,125,125,125,125,125,125,125,125,125, /* 238-251 */ 125,125,125,125 }, /* prefix 213 */ { 126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* 0- 13 */ 126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* 14- 27 */ 126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* 28- 41 */ 126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* 42- 55 */ 126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* 56- 69 */ 126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* 70- 83 */ 126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* 84- 97 */ 126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* 98-111 */ 126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* 112-125 */ 126,126,140,140,140,140,140,140,140,140,140,140,140,140, /* 126-139 */ 140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* 140-153 */ 140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* 154-167 */ 140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* 168-181 */ 140,140,140,140,140,140,140,140,140,140,141,141,141,141, /* 182-195 */ 141,141,141,141,141,141,141,141,141,141,141,141,141,141, /* 196-209 */ 141,141,141,141,141,141,141,141,141,141,141,141,141,141, /* 210-223 */ 141,141,141,141,141,141,141,141,141,141,141,141,141,141, /* 224-237 */ 141,141,141,141,141,141,141,141,141,141,141,141,141,141, /* 238-251 */ 141,141,141,141 }, /* prefix 214 */ { 142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* 0- 13 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* 14- 27 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* 28- 41 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* 42- 55 */ 142,142,142,142,142,142,142,142,143,143,143,143,143,143, /* 56- 69 */ 143,143,143,143,143,143,143,143,143,143,143,143,143,143, /* 70- 83 */ 143,143,143,143,143,143,143,143,143,143,143,143,143,143, /* 84- 97 */ 143,143,143,143,143,143,143,143,143,143,143,143,143,143, /* 98-111 */ 143,143,143,143,143,143,143,143,143,143,143,143,143,143, /* 112-125 */ 143,143,144,144,144,144,144,144,144,144,144,144,144,144, /* 126-139 */ 144,144,144,144,144,144,144,144,144,144,144,144,144,144, /* 140-153 */ 144,144,144,144,144,144,144,144,144,144,144,144,144,144, /* 154-167 */ 144,144,144,144,144,144,144,144,144,144,144,144,144,144, /* 168-181 */ 144,144,144,144,144,144,144,144,144,144,145,145,145,145, /* 182-195 */ 145,145,145,145,145,145,145,145,145,145,145,145,145,145, /* 196-209 */ 145,145,145,145,145,145,145,145,145,145,145,145,145,145, /* 210-223 */ 145,145,145,145,145,145,145,145,145,145,145,145,145,145, /* 224-237 */ 145,145,145,145,145,145,145,145,145,145,145,145,145,145, /* 238-251 */ 145,145,145,145 }, /* prefix 215 */ { 127,127,127,127,127,127,127,127,127,127,127,127,127,127, /* 0- 13 */ 127,127,127,127,127,127,127,127,127,127,127,127,127,127, /* 14- 27 */ 127,127,127,127,127,127,127,127,127,127,127,127,127,127, /* 28- 41 */ 127,127,127,127,127,127,127,127,127,127,127,127,127,127, /* 42- 55 */ 127,127,127,127,127,127,127,127,127,127,127,127,127,127, /* 56- 69 */ 127,127,127,127,127,127,127,127,127,127,127,127,127,127, /* 70- 83 */ 127,127,127,127,127,127,127,127,127,127,127,127,127,127, /* 84- 97 */ 127,127,127,127,127,127,127,127,127,127,127,127,127,127, /* 98-111 */ 127,127,127,127,127,127,127,127,127,127,127,127,127,127, /* 112-125 */ 127,127,148,148,148,148,148,148,148,148,148,148,148,148, /* 126-139 */ 148,148,148,148,148,148,148,148,148,148,148,148,148,148, /* 140-153 */ 148,148,148,148,148,148,148,148,148,148,148,148,148,148, /* 154-167 */ 148,148,148,148,148,148,148,148,148,148,148,148,148,148, /* 168-181 */ 148,148,148,148,148,148,148,148,148,148,149,149,149,149, /* 182-195 */ 149,149,149,149,149,149,149,149,149,149,149,149,149,149, /* 196-209 */ 149,149,149,149,149,149,149,149,149,149,149,149,149,149, /* 210-223 */ 149,149,149,149,149,149,149,149,149,149,149,149,149,149, /* 224-237 */ 149,149,149,149,149,149,149,149,149,149,149,149,149,149, /* 238-251 */ 149,149,149,149 }, /* prefix 216 */ { 0,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 0- 13 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 14- 27 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 28- 41 */ 210,210,210,210,210,210,210,210,210,210,210,210,210,210, /* 42- 55 */ 210,210,210,210,210,210,210,210, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 217 */ { 197,197,197,197,197,197,197,197,197,197,197,197,197,197, /* 0- 13 */ 197,197,197,197,197,197,197,197,197,197,197,197,197,197, /* 14- 27 */ 197,197,197,197,197,197,197,197,197,197,197,197,197,197, /* 28- 41 */ 197,197,197,197,197,197,197,197,197,197,197,197,197,197, /* 42- 55 */ 197,197,197,197,197,197,197,197,200,200,200,200,200,200, /* 56- 69 */ 200,200,200,200,200,200,200,200,200,200,200,200,200,200, /* 70- 83 */ 200,200,200,200,200,200,200,200,200,200,200,200,201,201, /* 84- 97 */ 201,201,201,201,201,201,201,201,201,201,201,201,201,201, /* 98-111 */ 201,201,201,201,201,201,201,201,201,201,201,201,201,201, /* 112-125 */ 201,201,202,202,202,202,202,202,202,202,202,202,202,202, /* 126-139 */ 202,202,202,202,202,202,202,202,202,202,202,202,202,202, /* 140-153 */ 202,202,202,202,202,202,203,203,203,203,203,203,203,203, /* 154-167 */ 203,203,203,203,203,203,203,203,203,203,203,203,203,203, /* 168-181 */ 203,203,203,203,203,203,203,203,203,203,204,204,204,204, /* 182-195 */ 204,204,204,204,204,204,204,204,204,204,204,204,204,204, /* 196-209 */ 204,204,204,204,204,204,204,204,204,204,204,204,204,204, /* 210-223 */ 205,205,205,205,205,205,205,205,205,205,205,205,205,205, /* 224-237 */ 205,205,205,205,205,205,205,205,205,205,205,205,205,205, /* 238-251 */ 205,205,205,205 }, /* prefix 218 */ { 198,198,198,198,198,198,198,198,198,198,198,198,198,198, /* 0- 13 */ 198,198,198,198,198,198,198,198,198,198,198,198,198,198, /* 14- 27 */ 198,198,198,198,198,198,198,198,198,198,198,198,198,198, /* 28- 41 */ 198,198,198,198,198,198,198,198,198,198,198,198,198,198, /* 42- 55 */ 198,198,198,198,198,198,198,198,199,199,199,199,199,199, /* 56- 69 */ 199,199,199,199,199,199,199,199,199,199,199,199,199,199, /* 70- 83 */ 199,199,199,199,199,199,199,199,199,199,199,199,199,199, /* 84- 97 */ 199,199,199,199,199,199,199,199,199,199,199,199,199,199, /* 98-111 */ 199,199,199,199,199,199,199,199,199,199,199,199,199,199, /* 112-125 */ 199,199,206,206,206,206,206,206,206,206,206,206,206,206, /* 126-139 */ 206,206,206,206,206,206,206,206,206,206,206,206,206,206, /* 140-153 */ 206,206,206,206,206,206,207,207,207,207,207,207,207,207, /* 154-167 */ 207,207,207,207,207,207,207,207,207,207,207,207,207,207, /* 168-181 */ 207,207,207,207,207,207,207,207,207,207,208,208,208,208, /* 182-195 */ 208,208,208,208,208,208,208,208,208,208,208,208,208,208, /* 196-209 */ 208,208,208,208,208,208,208,208,208,208,208,208,208,208, /* 210-223 */ 209,209,209,209,209,209,209,209,209,209,209,209,209,209, /* 224-237 */ 209,209,209,209,209,209,209,209,209,209,209,209,209,209, /* 238-251 */ 209,209,209,209 }, /* prefix 219 */ { 124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* 0- 13 */ 124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* 14- 27 */ 124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* 28- 41 */ 124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* 42- 55 */ 124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* 56- 69 */ 124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* 70- 83 */ 124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* 84- 97 */ 124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* 98-111 */ 124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* 112-125 */ 124,124,158,158,158,158,158,158,158,158,158,158,158,158, /* 126-139 */ 158,158,158,158,158,158,158,158,158,158,158,158,158,158, /* 140-153 */ 158,158,158,158,158,158,179,179,179,179,179,179,179,179, /* 154-167 */ 179,179,179,179,179,179,179,179,180,180,180,180,180,180, /* 168-181 */ 180,180,180,180,180,180,180,180,180,180,181,181,181,181, /* 182-195 */ 181,181,181,181,181,181,181,181,181,181,181,181,182,182, /* 196-209 */ 182,182,182,182,182,182,182,182,182,182,182,182,182,182, /* 210-223 */ 161,161,161,161,161,161,161,161,161,161,161,161,161,161, /* 224-237 */ 161,161,161,161,161,161,161,161,161,161,161,161,161,161, /* 238-251 */ 161,161,161,161 }, /* prefix 220 */ { 162,162,162,162,162,162,162,162,162,162,162,162,162,162, /* 0- 13 */ 162,162,162,162,162,162,162,162,162,162,162,162,162,162, /* 14- 27 */ 162,162,162,162,189,189,189,189,189,189,189,189,189,189, /* 28- 41 */ 189,189,189,189,189,189,190,190,190,190,190,190,190,190, /* 42- 55 */ 190,190,190,190,190,190,190,190,191,191,191,191,191,191, /* 56- 69 */ 191,191,191,191,191,191,191,191,191,191,192,192,192,192, /* 70- 83 */ 192,192,192,192,192,192,192,192,192,192,192,192,165,165, /* 84- 97 */ 165,165,165,165,165,165,165,165,165,165,165,165,165,165, /* 98-111 */ 165,165,165,165,165,165,165,165,165,165,165,165,165,165, /* 112-125 */ 165,165,166,166,166,166,166,166,166,166,166,166,166,166, /* 126-139 */ 166,166,166,166,166,166,166,166,166,166,166,166,166,166, /* 140-153 */ 166,166,166,166,166,166,193,193,193,193,193,193,193,193, /* 154-167 */ 193,193,193,193,193,193,193,193,194,194,194,194,194,194, /* 168-181 */ 194,194,194,194,194,194,194,194,194,194,130,130,130,130, /* 182-195 */ 130,130,130,130,130,130,130,130,130,130,130,130,130,130, /* 196-209 */ 130,130,130,130,130,130,130,130,130,130,130,130,130,130, /* 210-223 */ 130,130,130,130,130,130,130,130,130,130,130,130,130,130, /* 224-237 */ 130,130,130,130,130,130,130,130,130,130,130,130,130,130, /* 238-251 */ 130,130,130,130 }, /* prefix 221 */ { 131,131,131,131,131,131,131,131,131,131,131,131,131,131, /* 0- 13 */ 131,131,131,131,131,131,131,131,131,131,131,131,131,131, /* 14- 27 */ 131,131,131,131,131,131,131,131,131,131,131,131,131,131, /* 28- 41 */ 131,131,131,131,131,131,131,131,131,131,131,131,131,131, /* 42- 55 */ 131,131,131,131,131,131,131,131,195,195,195,195,195,195, /* 56- 69 */ 195,195,195,195,195,195,195,195,195,195,196,196,196,196, /* 70- 83 */ 196,196,196,196,196,196,196,196,196,196,196,196,174,174, /* 84- 97 */ 174,174,174,174,174,174,174,174,174,174,174,174,174,174, /* 98-111 */ 174,174,174,174,174,174,174,174,174,174,174,174,174,174, /* 112-125 */ 174,174,175,175,175,175,175,175,175,175,175,175,175,175, /* 126-139 */ 175,175,175,175,175,175,175,175,175,175,175,175,175,175, /* 140-153 */ 175,175,175,175,175,175,176,176,176,176,176,176,176,176, /* 154-167 */ 176,176,176,176,176,176,176,176,176,176,176,176,176,176, /* 168-181 */ 176,176,176,176,176,176,176,176,176,176,177,177,177,177, /* 182-195 */ 177,177,177,177,177,177,177,177,177,177,177,177,178,178, /* 196-209 */ 178,178,178,178,178,178,178,178,178,178,178,178,178,178, /* 210-223 */ 159,159,159,159,159,159,159,159,159,159,159,159,159,159, /* 224-237 */ 159,159,159,159,159,159,159,159,159,159,159,159,159,159, /* 238-251 */ 159,159,159,159 }, /* prefix 222 */ { 160,160,160,160,160,160,160,160,160,160,160,160,160,160, /* 0- 13 */ 160,160,160,160,160,160,160,160,160,160,160,160,160,160, /* 14- 27 */ 160,160,160,160,183,183,183,183,183,183,183,183,183,183, /* 28- 41 */ 183,183,183,183,183,183,184,184,184,184,184,184,184,184, /* 42- 55 */ 184,184,184,184,184,184,184,184,185,185,185,185,185,185, /* 56- 69 */ 185,185,185,185,185,185,185,185,185,185,186,186,186,186, /* 70- 83 */ 186,186,186,186,186,186,186,186,186,186,186,186,187,187, /* 84- 97 */ 187,187,187,187,187,187,187,187,187,187,187,187,187,187, /* 98-111 */ 188,188,188,188,188,188,188,188,188,188,188,188,188,188, /* 112-125 */ 188,188,170,170,170,170,170,170,170,170,170,170,170,170, /* 126-139 */ 170,170,170,170,170,170,170,170,170,170,170,170,170,170, /* 140-153 */ 170,170,170,170,170,170,170,170,170,170,170,170,170,170, /* 154-167 */ 170,170,170,170,170,170,170,170,170,170,170,170,170,170, /* 168-181 */ 170,170,170,170,170,170,170,170,170,170,170,170,170,170, /* 182-195 */ 170,170,170,170,170,170,170,170,170,170,170,170,170,170, /* 196-209 */ 170,170,170,170,170,170,170,170,170,170,170,170,170,170, /* 210-223 */ 170,170,170,170,170,170,170,170,170,170,170,170,170,170, /* 224-237 */ 170,170,170,170,170,170,170,170,170,170,170,170,170,170, /* 238-251 */ 170,170,170,170 }, /* prefix 223 */ { 129,129,129,129,129,129,129,129,129,129,129,129,129,129, /* 0- 13 */ 129,129,129,129,129,129,129,129,129,129,129,129,129,129, /* 14- 27 */ 129,129,129,129,129,129,129,129,129,129,129,129,129,129, /* 28- 41 */ 129,129,129,129,129,129,129,129,129,129,129,129,129,129, /* 42- 55 */ 129,129,129,129,129,129,129,129,156,156,156,156,156,156, /* 56- 69 */ 156,156,156,156,156,156,156,156,156,156,156,156,156,156, /* 70- 83 */ 156,156,156,156,156,156,156,156,156,156,156,156,157,157, /* 84- 97 */ 157,157,157,157,157,157,157,157,157,157,157,157,157,157, /* 98-111 */ 157,157,157,157,157,157,157,157,157,157,157,157,157,157, /* 112-125 */ 157,157,150,150,150,150,150,150,150,150,150,150,150,150, /* 126-139 */ 150,150,150,150,150,150,150,150,150,150,150,150,150,150, /* 140-153 */ 150,150,150,150,150,150,151,151,151,151,151,151,151,151, /* 154-167 */ 151,151,151,151,151,151,151,151,151,151,151,151,151,151, /* 168-181 */ 151,151,151,151,151,151,151,151,151,151,152,152,152,152, /* 182-195 */ 152,152,152,152,152,152,152,152,152,152,152,152,152,152, /* 196-209 */ 152,152,152,152,152,152,152,152,152,152,152,152,152,152, /* 210-223 */ 153,153,153,153,153,153,153,153,153,153,153,153,153,153, /* 224-237 */ 153,153,153,153,153,153,153,153,153,153,153,153,153,153, /* 238-251 */ 153,153,153,153 }, /* prefix 224 */ { 163,163,163,163,163,163,163,163,163,163,163,163,163,163, /* 0- 13 */ 163,163,163,163,163,163,163,163,163,163,163,163,163,163, /* 14- 27 */ 163,163,163,163,164,164,164,164,164,164,164,164,164,164, /* 28- 41 */ 164,164,164,164,164,164,164,164,164,164,164,164,164,164, /* 42- 55 */ 164,164,164,164,164,164,164,164,167,167,167,167,167,167, /* 56- 69 */ 167,167,167,167,167,167,167,167,167,167,167,167,167,167, /* 70- 83 */ 167,167,167,167,167,167,167,167,167,167,167,167,173,173, /* 84- 97 */ 173,173,173,173,173,173,173,173,173,173,173,173,173,173, /* 98-111 */ 173,173,173,173,173,173,173,173,173,173,173,173,173,173, /* 112-125 */ 173,173,122,122,122,122,122,122,122,122,122,122,122,122, /* 126-139 */ 122,122,122,122,122,122,122,122,122,122,122,122,122,122, /* 140-153 */ 122,122,122,122,122,122,122,122,122,122,122,122,122,122, /* 154-167 */ 122,122,122,122,122,122,122,122,122,122,122,122,122,122, /* 168-181 */ 122,122,122,122,122,122,122,122,122,122,122,122,122,122, /* 182-195 */ 122,122,122,122,122,122,122,122,122,122,122,122,122,122, /* 196-209 */ 122,122,122,122,122,122,122,122,122,122,122,122,122,122, /* 210-223 */ 122,122,122,122,122,122,122,122,122,122,122,122,122,122, /* 224-237 */ 122,122,122,122,122,122,122,122,122,122,122,122,122,122, /* 238-251 */ 122,122,122,122 }, /* prefix 225 */ { 123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* 0- 13 */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* 14- 27 */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* 28- 41 */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* 42- 55 */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* 56- 69 */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* 70- 83 */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* 84- 97 */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* 98-111 */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* 112-125 */ 123,123,154,154,154,154,154,154,154,154,154,154,154,154, /* 126-139 */ 154,154,154,154,154,154,154,154,154,154,154,154,154,154, /* 140-153 */ 154,154,154,154,154,154,155,155,155,155,155,155,155,155, /* 154-167 */ 155,155,155,155,155,155,155,155,155,155,155,155,155,155, /* 168-181 */ 155,155,155,155,155,155,155,155,155,155,168,168,168,168, /* 182-195 */ 168,168,168,168,168,168,168,168,168,168,168,168,168,168, /* 196-209 */ 168,168,168,168,168,168,168,168,168,168,168,168,168,168, /* 210-223 */ 169,169,169,169,169,169,169,169,169,169,169,169,169,169, /* 224-237 */ 169,169,169,169,169,169,169,169,169,169,169,169,169,169, /* 238-251 */ 169,169,169,169 }, /* prefix 226 */ { 136,136,136,136,136,136,136,136,136,136,136,136,136,136, /* 0- 13 */ 136,136,136,136,136,136,136,136,136,136,136,136,136,136, /* 14- 27 */ 136,136,136,136,137,137,137,137,137,137,137,137,137,137, /* 28- 41 */ 137,137,137,137,137,137,137,137,137,137,137,137,137,137, /* 42- 55 */ 137,137,137,137,137,137,137,137,138,138,138,138,138,138, /* 56- 69 */ 138,138,138,138,138,138,138,138,138,138,138,138,138,138, /* 70- 83 */ 138,138,138,138,138,138,138,138,138,138,138,138,139,139, /* 84- 97 */ 139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* 98-111 */ 139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* 112-125 */ 139,139,146,146,146,146,146,146,146,146,146,146,146,146, /* 126-139 */ 146,146,146,146,146,146,146,146,146,146,146,146,146,146, /* 140-153 */ 146,146,146,146,146,146,147,147,147,147,147,147,147,147, /* 154-167 */ 147,147,147,147,147,147,147,147,147,147,147,147,147,147, /* 168-181 */ 147,147,147,147,147,147,147,147,147,147,128,128,128,128, /* 182-195 */ 128,128,128,128,128,128,128,128,128,128,128,128,128,128, /* 196-209 */ 128,128,128,128,128,128,128,128,128,128,128,128,128,128, /* 210-223 */ 128,128,128,128,128,128,128,128,128,128,128,128,128,128, /* 224-237 */ 128,128,128,128,128,128,128,128,128,128,128,128,128,128, /* 238-251 */ 128,128,128,128 }, /* prefix 227 */ { 171,171,171,171,171,171,171,171,171,171,171,171,171,171, /* 0- 13 */ 171,171,171,171,171,171,171,171,171,171,171,171,171,171, /* 14- 27 */ 171,171,171,171,172,172,172,172,172,172,172,172,172,172, /* 28- 41 */ 172,172,172,172,172,172,172,172,172,172,172,172,172,172, /* 42- 55 */ 172,172,172,172,172,172,172,172,132,132,132,132,132,132, /* 56- 69 */ 132,132,132,132,132,132,132,132,132,132,132,132,132,132, /* 70- 83 */ 132,132,132,132,132,132,132,132,132,132,132,132,133,133, /* 84- 97 */ 133,133,133,133,133,133,133,133,133,133,133,133,133,133, /* 98-111 */ 133,133,133,133,133,133,133,133,133,133,133,133,133,133, /* 112-125 */ 133,133,134,134,134,134,134,134,134,134,134,134,134,134, /* 126-139 */ 134,134,134,134,134,134,134,134,134,134,134,134,134,134, /* 140-153 */ 134,134,134,134,134,134,135,135,135,135,135,135,135,135, /* 154-167 */ 135,135,135,135,135,135,135,135,135,135,135,135,135,135, /* 168-181 */ 135,135,135,135,135,135,135,135,135,135,125,125,125,125, /* 182-195 */ 125,125,125,125,125,125,125,125,125,125,125,125,125,125, /* 196-209 */ 125,125,125,125,125,125,125,125,125,125,125,125,125,125, /* 210-223 */ 125,125,125,125,125,125,125,125,125,125,125,125,125,125, /* 224-237 */ 125,125,125,125,125,125,125,125,125,125,125,125,125,125, /* 238-251 */ 125,125,125,125 }, /* prefix 228 */ { 126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* 0- 13 */ 126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* 14- 27 */ 126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* 28- 41 */ 126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* 42- 55 */ 126,126,126,126,126,126,126,126,140,140,140,140,140,140, /* 56- 69 */ 140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* 70- 83 */ 140,140,140,140,140,140,140,140,140,140,140,140,141,141, /* 84- 97 */ 141,141,141,141,141,141,141,141,141,141,141,141,141,141, /* 98-111 */ 141,141,141,141,141,141,141,141,141,141,141,141,141,141, /* 112-125 */ 141,141,142,142,142,142,142,142,142,142,142,142,142,142, /* 126-139 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* 140-153 */ 142,142,142,142,142,142,143,143,143,143,143,143,143,143, /* 154-167 */ 143,143,143,143,143,143,143,143,143,143,143,143,143,143, /* 168-181 */ 143,143,143,143,143,143,143,143,143,143,144,144,144,144, /* 182-195 */ 144,144,144,144,144,144,144,144,144,144,144,144,144,144, /* 196-209 */ 144,144,144,144,144,144,144,144,144,144,144,144,144,144, /* 210-223 */ 145,145,145,145,145,145,145,145,145,145,145,145,145,145, /* 224-237 */ 145,145,145,145,145,145,145,145,145,145,145,145,145,145, /* 238-251 */ 145,145,145,145 }, /* prefix 229 */ { 127,127,127,127,127,127,127,127,127,127,127,127,127,127, /* 0- 13 */ 127,127,127,127,127,127,127,127,127,127,127,127,127,127, /* 14- 27 */ 127,127,127,127,127,127,127,127,127,127,127,127,127,127, /* 28- 41 */ 127,127,127,127,127,127,127,127,127,127,127,127,127,127, /* 42- 55 */ 127,127,127,127,127,127,127,127,148,148,148,148,148,148, /* 56- 69 */ 148,148,148,148,148,148,148,148,148,148,148,148,148,148, /* 70- 83 */ 148,148,148,148,148,148,148,148,148,148,148,148,149,149, /* 84- 97 */ 149,149,149,149,149,149,149,149,149,149,149,149,149,149, /* 98-111 */ 149,149,149,149,149,149,149,149,149,149,149,149,149,149, /* 112-125 */ 149,149,106,106,106,106,106,106,106,106,106,106,106,106, /* 126-139 */ 106,106,106,106,106,106,106,106,106,106,106,106,106,106, /* 140-153 */ 106,106,106,106,106,106,106,106,106,106,106,106,106,106, /* 154-167 */ 106,106,106,106,106,106,106,106,106,106,106,106,106,106, /* 168-181 */ 106,106,106,106,106,106,106,106,106,106,106,106,106,106, /* 182-195 */ 106,106,106,106,106,106,106,106,106,106,106,106,106,106, /* 196-209 */ 106,106,106,106,106,106,106,106,106,106,106,106,106,106, /* 210-223 */ 106,106,106,106,106,106,106,106,106,106,106,106,106,106, /* 224-237 */ 106,106,106,106,106,106,106,106,106,106,106,106,106,106, /* 238-251 */ 106,106,106,106 } }; u_char TIFFFax1DNextState[230][256] = { /* prefix 0 */ { 16, 17, 0, 0, 0, 0, 7, 7, 7, 7, 0, 0, 6, 6, /* 0- 13 */ 6, 6, 7, 7, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, /* 14- 27 */ 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 7, 7, 0, 0, /* 28- 41 */ 0, 0, 0, 0, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, /* 42- 55 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 56- 69 */ 5, 5, 7, 7, 0, 0, 18, 19, 7, 7, 7, 7, 0, 0, /* 70- 83 */ 0, 0, 7, 7, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, /* 84- 97 */ 6, 6, 0, 0, 20, 0, 0, 21, 22, 23, 24, 25, 7, 7, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 140-153 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 154-167 */ 6, 6, 6, 6, 6, 6, 6, 6, 4, 4, 4, 4, 4, 4, /* 168-181 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 182-195 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, /* 196-209 */ 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 210-223 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 224-237 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 238-251 */ 4, 4, 4, 4 }, /* prefix 1 */ { 26, 27, 28, 0, 0, 29, 7, 7, 0, 30, 31, 32, 0, 33, /* 0- 13 */ 7, 7, 7, 7, 34, 0, 35, 36, 37, 0, 0, 38, 39, 40, /* 14- 27 */ 6, 6, 6, 6, 6, 6, 6, 6, 0, 41, 42, 0, 0, 43, /* 28- 41 */ 44, 0, 45, 46, 7, 7, 7, 7, 47, 48, 49, 50, 51, 0, /* 42- 55 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 56- 69 */ 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 70- 83 */ 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 84- 97 */ 5, 5, 5, 5, 5, 5, 7, 7, 7, 7, 6, 6, 6, 6, /* 98-111 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 112-125 */ 5, 5, 26, 27, 28, 0, 0, 29, 7, 7, 0, 30, 31, 32, /* 126-139 */ 0, 33, 7, 7, 7, 7, 34, 0, 35, 36, 37, 0, 0, 38, /* 140-153 */ 39, 40, 6, 6, 6, 6, 6, 6, 6, 6, 0, 41, 42, 0, /* 154-167 */ 0, 43, 44, 0, 45, 46, 7, 7, 7, 7, 47, 48, 49, 50, /* 168-181 */ 51, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 182-195 */ 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 196-209 */ 6, 6, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, /* 210-223 */ 5, 5, 5, 5, 5, 5, 5, 5, 7, 7, 7, 7, 6, 6, /* 224-237 */ 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 238-251 */ 5, 5, 5, 5 }, /* prefix 2 */ { 52, 53, 54, 0, 55, 56, 57, 0, 0, 58, 59, 60, 61, 62, /* 0- 13 */ 7, 7, 7, 7, 63, 64, 65, 66, 67, 0, 0, 68, 69, 70, /* 14- 27 */ 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, /* 28- 41 */ 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 7, 7, /* 42- 55 */ 6, 6, 6, 6, 6, 6, 6, 6, 52, 53, 54, 0, 55, 56, /* 56- 69 */ 57, 0, 0, 58, 59, 60, 61, 62, 7, 7, 7, 7, 63, 64, /* 70- 83 */ 65, 66, 67, 0, 0, 68, 69, 70, 6, 6, 6, 6, 6, 6, /* 84- 97 */ 6, 6, 7, 7, 7, 7, 7, 7, 0, 0, 6, 6, 6, 6, /* 98-111 */ 6, 6, 6, 6, 0, 0, 7, 7, 6, 6, 6, 6, 6, 6, /* 112-125 */ 6, 6, 52, 53, 54, 0, 55, 56, 57, 0, 0, 58, 59, 60, /* 126-139 */ 61, 62, 7, 7, 7, 7, 63, 64, 65, 66, 67, 0, 0, 68, /* 140-153 */ 69, 70, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, /* 154-167 */ 7, 7, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, /* 168-181 */ 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 52, 53, 54, 0, /* 182-195 */ 55, 56, 57, 0, 0, 58, 59, 60, 61, 62, 7, 7, 7, 7, /* 196-209 */ 63, 64, 65, 66, 67, 0, 0, 68, 69, 70, 6, 6, 6, 6, /* 210-223 */ 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 0, 0, 6, 6, /* 224-237 */ 6, 6, 6, 6, 6, 6, 0, 0, 7, 7, 6, 6, 6, 6, /* 238-251 */ 6, 6, 6, 6 }, /* prefix 3 */ { 71, 72, 73, 74, 75, 76, 77, 0, 0, 78, 79, 80, 81, 82, /* 0- 13 */ 7, 7, 7, 7, 0, 0, 0, 83, 7, 7, 7, 7, 84, 0, /* 14- 27 */ 7, 7, 7, 7, 71, 72, 73, 74, 75, 76, 77, 0, 0, 78, /* 28- 41 */ 79, 80, 81, 82, 7, 7, 7, 7, 0, 0, 0, 83, 7, 7, /* 42- 55 */ 7, 7, 84, 0, 7, 7, 7, 7, 71, 72, 73, 74, 75, 76, /* 56- 69 */ 77, 0, 0, 78, 79, 80, 81, 82, 7, 7, 7, 7, 0, 0, /* 70- 83 */ 0, 83, 7, 7, 7, 7, 84, 0, 7, 7, 7, 7, 71, 72, /* 84- 97 */ 73, 74, 75, 76, 77, 0, 0, 78, 79, 80, 81, 82, 7, 7, /* 98-111 */ 7, 7, 0, 0, 0, 83, 7, 7, 7, 7, 84, 0, 7, 7, /* 112-125 */ 7, 7, 71, 72, 73, 74, 75, 76, 77, 0, 0, 78, 79, 80, /* 126-139 */ 81, 82, 7, 7, 7, 7, 0, 0, 0, 83, 7, 7, 7, 7, /* 140-153 */ 84, 0, 7, 7, 7, 7, 71, 72, 73, 74, 75, 76, 77, 0, /* 154-167 */ 0, 78, 79, 80, 81, 82, 7, 7, 7, 7, 0, 0, 0, 83, /* 168-181 */ 7, 7, 7, 7, 84, 0, 7, 7, 7, 7, 71, 72, 73, 74, /* 182-195 */ 75, 76, 77, 0, 0, 78, 79, 80, 81, 82, 7, 7, 7, 7, /* 196-209 */ 0, 0, 0, 83, 7, 7, 7, 7, 84, 0, 7, 7, 7, 7, /* 210-223 */ 71, 72, 73, 74, 75, 76, 77, 0, 0, 78, 79, 80, 81, 82, /* 224-237 */ 7, 7, 7, 7, 0, 0, 0, 83, 7, 7, 7, 7, 84, 0, /* 238-251 */ 7, 7, 7, 7 }, /* prefix 4 */ { 85, 86, 87, 88, 89, 90, 91, 0, 0, 92, 93, 0, 0, 94, /* 0- 13 */ 0, 0, 85, 86, 87, 88, 89, 90, 91, 0, 0, 92, 93, 0, /* 14- 27 */ 0, 94, 0, 0, 85, 86, 87, 88, 89, 90, 91, 0, 0, 92, /* 28- 41 */ 93, 0, 0, 94, 0, 0, 85, 86, 87, 88, 89, 90, 91, 0, /* 42- 55 */ 0, 92, 93, 0, 0, 94, 0, 0, 85, 86, 87, 88, 89, 90, /* 56- 69 */ 91, 0, 0, 92, 93, 0, 0, 94, 0, 0, 85, 86, 87, 88, /* 70- 83 */ 89, 90, 91, 0, 0, 92, 93, 0, 0, 94, 0, 0, 85, 86, /* 84- 97 */ 87, 88, 89, 90, 91, 0, 0, 92, 93, 0, 0, 94, 0, 0, /* 98-111 */ 85, 86, 87, 88, 89, 90, 91, 0, 0, 92, 93, 0, 0, 94, /* 112-125 */ 0, 0, 85, 86, 87, 88, 89, 90, 91, 0, 0, 92, 93, 0, /* 126-139 */ 0, 94, 0, 0, 85, 86, 87, 88, 89, 90, 91, 0, 0, 92, /* 140-153 */ 93, 0, 0, 94, 0, 0, 85, 86, 87, 88, 89, 90, 91, 0, /* 154-167 */ 0, 92, 93, 0, 0, 94, 0, 0, 85, 86, 87, 88, 89, 90, /* 168-181 */ 91, 0, 0, 92, 93, 0, 0, 94, 0, 0, 85, 86, 87, 88, /* 182-195 */ 89, 90, 91, 0, 0, 92, 93, 0, 0, 94, 0, 0, 85, 86, /* 196-209 */ 87, 88, 89, 90, 91, 0, 0, 92, 93, 0, 0, 94, 0, 0, /* 210-223 */ 85, 86, 87, 88, 89, 90, 91, 0, 0, 92, 93, 0, 0, 94, /* 224-237 */ 0, 0, 85, 86, 87, 88, 89, 90, 91, 0, 0, 92, 93, 0, /* 238-251 */ 0, 94, 0, 0 }, /* prefix 5 */ { 95, 96, 97, 98, 99,100,101,102, 95, 96, 97, 98, 99,100, /* 0- 13 */ 101,102, 95, 96, 97, 98, 99,100,101,102, 95, 96, 97, 98, /* 14- 27 */ 99,100,101,102, 95, 96, 97, 98, 99,100,101,102, 95, 96, /* 28- 41 */ 97, 98, 99,100,101,102, 95, 96, 97, 98, 99,100,101,102, /* 42- 55 */ 95, 96, 97, 98, 99,100,101,102, 95, 96, 97, 98, 99,100, /* 56- 69 */ 101,102, 95, 96, 97, 98, 99,100,101,102, 95, 96, 97, 98, /* 70- 83 */ 99,100,101,102, 95, 96, 97, 98, 99,100,101,102, 95, 96, /* 84- 97 */ 97, 98, 99,100,101,102, 95, 96, 97, 98, 99,100,101,102, /* 98-111 */ 95, 96, 97, 98, 99,100,101,102, 95, 96, 97, 98, 99,100, /* 112-125 */ 101,102, 95, 96, 97, 98, 99,100,101,102, 95, 96, 97, 98, /* 126-139 */ 99,100,101,102, 95, 96, 97, 98, 99,100,101,102, 95, 96, /* 140-153 */ 97, 98, 99,100,101,102, 95, 96, 97, 98, 99,100,101,102, /* 154-167 */ 95, 96, 97, 98, 99,100,101,102, 95, 96, 97, 98, 99,100, /* 168-181 */ 101,102, 95, 96, 97, 98, 99,100,101,102, 95, 96, 97, 98, /* 182-195 */ 99,100,101,102, 95, 96, 97, 98, 99,100,101,102, 95, 96, /* 196-209 */ 97, 98, 99,100,101,102, 95, 96, 97, 98, 99,100,101,102, /* 210-223 */ 95, 96, 97, 98, 99,100,101,102, 95, 96, 97, 98, 99,100, /* 224-237 */ 101,102, 95, 96, 97, 98, 99,100,101,102, 95, 96, 97, 98, /* 238-251 */ 99,100,101,102 }, /* prefix 6 */ { 103,104,105,106,103,104,105,106,103,104,105,106,103,104, /* 0- 13 */ 105,106,103,104,105,106,103,104,105,106,103,104,105,106, /* 14- 27 */ 103,104,105,106,103,104,105,106,103,104,105,106,103,104, /* 28- 41 */ 105,106,103,104,105,106,103,104,105,106,103,104,105,106, /* 42- 55 */ 103,104,105,106,103,104,105,106,103,104,105,106,103,104, /* 56- 69 */ 105,106,103,104,105,106,103,104,105,106,103,104,105,106, /* 70- 83 */ 103,104,105,106,103,104,105,106,103,104,105,106,103,104, /* 84- 97 */ 105,106,103,104,105,106,103,104,105,106,103,104,105,106, /* 98-111 */ 103,104,105,106,103,104,105,106,103,104,105,106,103,104, /* 112-125 */ 105,106,103,104,105,106,103,104,105,106,103,104,105,106, /* 126-139 */ 103,104,105,106,103,104,105,106,103,104,105,106,103,104, /* 140-153 */ 105,106,103,104,105,106,103,104,105,106,103,104,105,106, /* 154-167 */ 103,104,105,106,103,104,105,106,103,104,105,106,103,104, /* 168-181 */ 105,106,103,104,105,106,103,104,105,106,103,104,105,106, /* 182-195 */ 103,104,105,106,103,104,105,106,103,104,105,106,103,104, /* 196-209 */ 105,106,103,104,105,106,103,104,105,106,103,104,105,106, /* 210-223 */ 103,104,105,106,103,104,105,106,103,104,105,106,103,104, /* 224-237 */ 105,106,103,104,105,106,103,104,105,106,103,104,105,106, /* 238-251 */ 103,104,105,106 }, /* prefix 7 */ { 107,108,107,108,107,108,107,108,107,108,107,108,107,108, /* 0- 13 */ 107,108,107,108,107,108,107,108,107,108,107,108,107,108, /* 14- 27 */ 107,108,107,108,107,108,107,108,107,108,107,108,107,108, /* 28- 41 */ 107,108,107,108,107,108,107,108,107,108,107,108,107,108, /* 42- 55 */ 107,108,107,108,107,108,107,108,107,108,107,108,107,108, /* 56- 69 */ 107,108,107,108,107,108,107,108,107,108,107,108,107,108, /* 70- 83 */ 107,108,107,108,107,108,107,108,107,108,107,108,107,108, /* 84- 97 */ 107,108,107,108,107,108,107,108,107,108,107,108,107,108, /* 98-111 */ 107,108,107,108,107,108,107,108,107,108,107,108,107,108, /* 112-125 */ 107,108,107,108,107,108,107,108,107,108,107,108,107,108, /* 126-139 */ 107,108,107,108,107,108,107,108,107,108,107,108,107,108, /* 140-153 */ 107,108,107,108,107,108,107,108,107,108,107,108,107,108, /* 154-167 */ 107,108,107,108,107,108,107,108,107,108,107,108,107,108, /* 168-181 */ 107,108,107,108,107,108,107,108,107,108,107,108,107,108, /* 182-195 */ 107,108,107,108,107,108,107,108,107,108,107,108,107,108, /* 196-209 */ 107,108,107,108,107,108,107,108,107,108,107,108,107,108, /* 210-223 */ 107,108,107,108,107,108,107,108,107,108,107,108,107,108, /* 224-237 */ 107,108,107,108,107,108,107,108,107,108,107,108,107,108, /* 238-251 */ 107,108,107,108 }, /* prefix 8 */ { 109,110,111,112, 0,113,114, 0, 7, 7, 7, 7,115,116, /* 0- 13 */ 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, /* 14- 27 */ 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 28- 41 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 42- 55 */ 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 9 */ { 117,118,119,120, 0, 0,121, 0, 7, 7, 7, 7, 6, 6, /* 0- 13 */ 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 14- 27 */ 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 28- 41 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 42- 55 */ 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3,117,118,119,120, 0, 0,121, 0, 7, 7, 7, 7, /* 126-139 */ 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 140-153 */ 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, /* 154-167 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 168-181 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, /* 182-195 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 196-209 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 10 */ { 122,123,124,125, 0, 0, 7, 7, 6, 6, 6, 6, 6, 6, /* 0- 13 */ 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 14- 27 */ 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 28- 41 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 42- 55 */ 4, 4, 4, 4, 4, 4, 4, 4,122,123,124,125, 0, 0, /* 56- 69 */ 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, /* 70- 83 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, /* 84- 97 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4,122,123,124,125, 0, 0, 7, 7, 6, 6, 6, 6, /* 126-139 */ 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 140-153 */ 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, /* 154-167 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 168-181 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,122,123,124,125, /* 182-195 */ 0, 0, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, /* 196-209 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 210-223 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 224-237 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 238-251 */ 4, 4, 4, 4 }, /* prefix 11 */ { 126,127,128, 0, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, /* 0- 13 */ 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 14- 27 */ 5, 5, 5, 5,126,127,128, 0, 7, 7, 7, 7, 6, 6, /* 28- 41 */ 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, /* 42- 55 */ 5, 5, 5, 5, 5, 5, 5, 5,126,127,128, 0, 7, 7, /* 56- 69 */ 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, /* 70- 83 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,126,127, /* 84- 97 */ 128, 0, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, /* 98-111 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 112-125 */ 5, 5,126,127,128, 0, 7, 7, 7, 7, 6, 6, 6, 6, /* 126-139 */ 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 140-153 */ 5, 5, 5, 5, 5, 5,126,127,128, 0, 7, 7, 7, 7, /* 154-167 */ 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, /* 168-181 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,126,127,128, 0, /* 182-195 */ 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, /* 196-209 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 210-223 */ 126,127,128, 0, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, /* 224-237 */ 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 238-251 */ 5, 5, 5, 5 }, /* prefix 12 */ { 129,130, 0, 0, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, /* 0- 13 */ 6, 6,129,130, 0, 0, 7, 7, 7, 7, 6, 6, 6, 6, /* 14- 27 */ 6, 6, 6, 6,129,130, 0, 0, 7, 7, 7, 7, 6, 6, /* 28- 41 */ 6, 6, 6, 6, 6, 6,129,130, 0, 0, 7, 7, 7, 7, /* 42- 55 */ 6, 6, 6, 6, 6, 6, 6, 6,129,130, 0, 0, 7, 7, /* 56- 69 */ 7, 7, 6, 6, 6, 6, 6, 6, 6, 6,129,130, 0, 0, /* 70- 83 */ 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6,129,130, /* 84- 97 */ 0, 0, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, /* 98-111 */ 129,130, 0, 0, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, /* 112-125 */ 6, 6,129,130, 0, 0, 7, 7, 7, 7, 6, 6, 6, 6, /* 126-139 */ 6, 6, 6, 6,129,130, 0, 0, 7, 7, 7, 7, 6, 6, /* 140-153 */ 6, 6, 6, 6, 6, 6,129,130, 0, 0, 7, 7, 7, 7, /* 154-167 */ 6, 6, 6, 6, 6, 6, 6, 6,129,130, 0, 0, 7, 7, /* 168-181 */ 7, 7, 6, 6, 6, 6, 6, 6, 6, 6,129,130, 0, 0, /* 182-195 */ 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6,129,130, /* 196-209 */ 0, 0, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, /* 210-223 */ 129,130, 0, 0, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, /* 224-237 */ 6, 6,129,130, 0, 0, 7, 7, 7, 7, 6, 6, 6, 6, /* 238-251 */ 6, 6, 6, 6 }, /* prefix 13 */ { 131,132, 0, 0, 7, 7, 7, 7,131,132, 0, 0, 7, 7, /* 0- 13 */ 7, 7,131,132, 0, 0, 7, 7, 7, 7,131,132, 0, 0, /* 14- 27 */ 7, 7, 7, 7,131,132, 0, 0, 7, 7, 7, 7,131,132, /* 28- 41 */ 0, 0, 7, 7, 7, 7,131,132, 0, 0, 7, 7, 7, 7, /* 42- 55 */ 131,132, 0, 0, 7, 7, 7, 7,131,132, 0, 0, 7, 7, /* 56- 69 */ 7, 7,131,132, 0, 0, 7, 7, 7, 7,131,132, 0, 0, /* 70- 83 */ 7, 7, 7, 7,131,132, 0, 0, 7, 7, 7, 7,131,132, /* 84- 97 */ 0, 0, 7, 7, 7, 7,131,132, 0, 0, 7, 7, 7, 7, /* 98-111 */ 131,132, 0, 0, 7, 7, 7, 7,131,132, 0, 0, 7, 7, /* 112-125 */ 7, 7,131,132, 0, 0, 7, 7, 7, 7,131,132, 0, 0, /* 126-139 */ 7, 7, 7, 7,131,132, 0, 0, 7, 7, 7, 7,131,132, /* 140-153 */ 0, 0, 7, 7, 7, 7,131,132, 0, 0, 7, 7, 7, 7, /* 154-167 */ 131,132, 0, 0, 7, 7, 7, 7,131,132, 0, 0, 7, 7, /* 168-181 */ 7, 7,131,132, 0, 0, 7, 7, 7, 7,131,132, 0, 0, /* 182-195 */ 7, 7, 7, 7,131,132, 0, 0, 7, 7, 7, 7,131,132, /* 196-209 */ 0, 0, 7, 7, 7, 7,131,132, 0, 0, 7, 7, 7, 7, /* 210-223 */ 131,132, 0, 0, 7, 7, 7, 7,131,132, 0, 0, 7, 7, /* 224-237 */ 7, 7,131,132, 0, 0, 7, 7, 7, 7,131,132, 0, 0, /* 238-251 */ 7, 7, 7, 7 }, /* prefix 14 */ { 133,134, 0, 0,133,134, 0, 0,133,134, 0, 0,133,134, /* 0- 13 */ 0, 0,133,134, 0, 0,133,134, 0, 0,133,134, 0, 0, /* 14- 27 */ 133,134, 0, 0,133,134, 0, 0,133,134, 0, 0,133,134, /* 28- 41 */ 0, 0,133,134, 0, 0,133,134, 0, 0,133,134, 0, 0, /* 42- 55 */ 133,134, 0, 0,133,134, 0, 0,133,134, 0, 0,133,134, /* 56- 69 */ 0, 0,133,134, 0, 0,133,134, 0, 0,133,134, 0, 0, /* 70- 83 */ 133,134, 0, 0,133,134, 0, 0,133,134, 0, 0,133,134, /* 84- 97 */ 0, 0,133,134, 0, 0,133,134, 0, 0,133,134, 0, 0, /* 98-111 */ 133,134, 0, 0,133,134, 0, 0,133,134, 0, 0,133,134, /* 112-125 */ 0, 0,133,134, 0, 0,133,134, 0, 0,133,134, 0, 0, /* 126-139 */ 133,134, 0, 0,133,134, 0, 0,133,134, 0, 0,133,134, /* 140-153 */ 0, 0,133,134, 0, 0,133,134, 0, 0,133,134, 0, 0, /* 154-167 */ 133,134, 0, 0,133,134, 0, 0,133,134, 0, 0,133,134, /* 168-181 */ 0, 0,133,134, 0, 0,133,134, 0, 0,133,134, 0, 0, /* 182-195 */ 133,134, 0, 0,133,134, 0, 0,133,134, 0, 0,133,134, /* 196-209 */ 0, 0,133,134, 0, 0,133,134, 0, 0,133,134, 0, 0, /* 210-223 */ 133,134, 0, 0,133,134, 0, 0,133,134, 0, 0,133,134, /* 224-237 */ 0, 0,133,134, 0, 0,133,134, 0, 0,133,134, 0, 0, /* 238-251 */ 133,134, 0, 0 }, /* prefix 15 */ { 135,136,135,136,135,136,135,136,135,136,135,136,135,136, /* 0- 13 */ 135,136,135,136,135,136,135,136,135,136,135,136,135,136, /* 14- 27 */ 135,136,135,136,135,136,135,136,135,136,135,136,135,136, /* 28- 41 */ 135,136,135,136,135,136,135,136,135,136,135,136,135,136, /* 42- 55 */ 135,136,135,136,135,136,135,136,135,136,135,136,135,136, /* 56- 69 */ 135,136,135,136,135,136,135,136,135,136,135,136,135,136, /* 70- 83 */ 135,136,135,136,135,136,135,136,135,136,135,136,135,136, /* 84- 97 */ 135,136,135,136,135,136,135,136,135,136,135,136,135,136, /* 98-111 */ 135,136,135,136,135,136,135,136,135,136,135,136,135,136, /* 112-125 */ 135,136,135,136,135,136,135,136,135,136,135,136,135,136, /* 126-139 */ 135,136,135,136,135,136,135,136,135,136,135,136,135,136, /* 140-153 */ 135,136,135,136,135,136,135,136,135,136,135,136,135,136, /* 154-167 */ 135,136,135,136,135,136,135,136,135,136,135,136,135,136, /* 168-181 */ 135,136,135,136,135,136,135,136,135,136,135,136,135,136, /* 182-195 */ 135,136,135,136,135,136,135,136,135,136,135,136,135,136, /* 196-209 */ 135,136,135,136,135,136,135,136,135,136,135,136,135,136, /* 210-223 */ 135,136,135,136,135,136,135,136,135,136,135,136,135,136, /* 224-237 */ 135,136,135,136,135,136,135,136,135,136,135,136,135,136, /* 238-251 */ 135,136,135,136 }, /* prefix 16 */ { 137, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, /* 0- 13 */ 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 14- 27 */ 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 126-139 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 140-153 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 154-167 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 168-181 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 182-195 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 196-209 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 210-223 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 224-237 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 238-251 */ 0, 0, 0, 0 }, /* prefix 17 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 28- 41 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 42- 55 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 56- 69 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 70- 83 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 84- 97 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, /* 182-195 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 196-209 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 210-223 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 224-237 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 238-251 */ 4, 4, 4, 4 }, /* prefix 18 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 19 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 20 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 21 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 22 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 23 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 24 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 25 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 26 */ { 137, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, /* 0- 13 */ 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 140-153 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 154-167 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 168-181 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, /* 182-195 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 196-209 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 210-223 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 224-237 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 238-251 */ 5, 5, 5, 5 }, /* prefix 27 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 28 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 29 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 30 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 31 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 32 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 33 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 34 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 35 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 36 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 37 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 38 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 39 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 40 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 41 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 42 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 43 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 44 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 45 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 46 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 47 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 48 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 49 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 50 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 51 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 52 */ { 137, 0, 7, 7, 6, 6, 6, 6, 4, 4, 4, 4, 4, 4, /* 0- 13 */ 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 5, 5, 5, 5, 5, 5, /* 56- 69 */ 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 70- 83 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, /* 84- 97 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 98-111 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 112-125 */ 6, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 53 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 54 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 55 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 56 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 57 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 58 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 59 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 60 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 61 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 62 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 63 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 64 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 28- 41 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 42- 55 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 65 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 66 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 67 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 68 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 69 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 182-195 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 196-209 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 70 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 28- 41 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 42- 55 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 71 */ { 137, 0, 7, 7, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, /* 0- 13 */ 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, /* 28- 41 */ 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, /* 42- 55 */ 7, 7, 7, 7, 7, 7, 7, 7, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 72 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 73 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 182-195 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 196-209 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 74 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 75 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 76 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 28- 41 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 42- 55 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 77 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 182-195 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 196-209 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 78 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 140-153 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 154-167 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 168-181 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 79 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 80 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 28- 41 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 42- 55 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 81 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, /* 182-195 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 196-209 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 82 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 28- 41 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 42- 55 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 56- 69 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 70- 83 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 84- 97 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 140-153 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 154-167 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 168-181 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 83 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 84 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 85 */ { 137, 0, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, /* 0- 13 */ 4, 4, 7, 7, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, /* 14- 27 */ 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 28- 41 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 42- 55 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 56- 69 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 70- 83 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, /* 154-167 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 168-181 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 86 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 28- 41 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 42- 55 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 56- 69 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 70- 83 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 84- 97 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, /* 154-167 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 168-181 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 87 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, /* 56- 69 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 70- 83 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 140-153 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 154-167 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 168-181 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 182-195 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 196-209 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 88 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 28- 41 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 42- 55 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 56- 69 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 70- 83 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 84- 97 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 89 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, /* 154-167 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 168-181 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, /* 182-195 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 196-209 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 90 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 28- 41 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 42- 55 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 56- 69 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 70- 83 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 140-153 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 154-167 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 168-181 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 91 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, /* 56- 69 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 70- 83 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, /* 84- 97 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 140-153 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 154-167 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 168-181 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 182-195 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 196-209 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 92 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 93 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 94 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 95 */ { 137, 7, 6, 6, 5, 5, 5, 5, 0,138,139,140, 0, 0, /* 0- 13 */ 141,142, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 14- 27 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 28- 41 */ 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, /* 42- 55 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 56- 69 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, /* 70- 83 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 140-153 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 154-167 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 168-181 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, /* 182-195 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, /* 196-209 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 96 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 28- 41 */ 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, /* 42- 55 */ 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, /* 56- 69 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 70- 83 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 84- 97 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 140-153 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 154-167 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 168-181 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 97 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, /* 56- 69 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, /* 70- 83 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, /* 84- 97 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 140-153 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 154-167 */ 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, /* 168-181 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, /* 182-195 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 196-209 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 98 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 28- 41 */ 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, /* 42- 55 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 56- 69 */ 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 70- 83 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 84- 97 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 99 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 100 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 101 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 102 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 103 */ { 143, 7, 6, 6,144,145,146,147, 6, 6, 6, 6, 6, 6, /* 0- 13 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, /* 14- 27 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, /* 28- 41 */ 6, 6, 6, 6, 6, 6, 4, 4, 4, 4, 4, 4, 4, 4, /* 42- 55 */ 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, /* 56- 69 */ 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 70- 83 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, /* 84- 97 */ 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, /* 140-153 */ 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, /* 154-167 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 168-181 */ 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 182-195 */ 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 196-209 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 104 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, /* 28- 41 */ 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, /* 42- 55 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 56- 69 */ 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 70- 83 */ 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, /* 84- 97 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, /* 140-153 */ 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, /* 154-167 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 168-181 */ 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 105 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, /* 154-167 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 168-181 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 106 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, /* 56- 69 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 70- 83 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 107 */ { 148, 7,149,150, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, /* 0- 13 */ 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 5, 5, 5, 5, /* 14- 27 */ 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, /* 28- 41 */ 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 7, 7, 7, 7, /* 42- 55 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 56- 69 */ 5, 5, 7, 7, 7, 7, 6, 6, 6, 6, 7, 7, 7, 7, /* 70- 83 */ 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, /* 84- 97 */ 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 6, 6, 6, 6, 7, 7, 7, 7, 0, 0, /* 140-153 */ 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, /* 154-167 */ 7, 7, 7, 7, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, /* 168-181 */ 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 182-195 */ 5, 5, 5, 5, 7, 7, 7, 7, 0, 0, 7, 7, 7, 7, /* 196-209 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 108 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 28- 41 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 42- 55 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 56- 69 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, /* 70- 83 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, /* 154-167 */ 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, /* 168-181 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, /* 182-195 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 196-209 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 109 */ { 151, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, /* 0- 13 */ 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 14- 27 */ 4, 4, 4, 4, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, /* 28- 41 */ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, /* 42- 55 */ 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, /* 56- 69 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 70- 83 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 84- 97 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 98-111 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 112-125 */ 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 126-139 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 140-153 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 154-167 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 168-181 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 182-195 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 196-209 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 210-223 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 224-237 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 238-251 */ 8, 8, 8, 8 }, /* prefix 110 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 28- 41 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 42- 55 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 56- 69 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 70- 83 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 84- 97 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, /* 182-195 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 196-209 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 210-223 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 224-237 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 238-251 */ 4, 4, 4, 4 }, /* prefix 111 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, /* 56- 69 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, /* 70- 83 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 84- 97 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 140-153 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 154-167 */ 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, /* 168-181 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 182-195 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, /* 196-209 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 112 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 28- 41 */ 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, /* 42- 55 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 56- 69 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 70- 83 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, /* 84- 97 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 140-153 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 154-167 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 168-181 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 113 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 28- 41 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 42- 55 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 56- 69 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 70- 83 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 84- 97 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 140-153 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 154-167 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 168-181 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 114 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, /* 56- 69 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 70- 83 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 84- 97 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 140-153 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 154-167 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 168-181 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 182-195 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 196-209 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 115 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 140-153 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 154-167 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 168-181 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 182-195 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 196-209 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 116 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 28- 41 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 42- 55 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 56- 69 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 70- 83 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 84- 97 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, /* 154-167 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 168-181 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 117 */ { 151, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, /* 0- 13 */ 5, 5, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, /* 14- 27 */ 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, /* 28- 41 */ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, /* 42- 55 */ 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, /* 56- 69 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 70- 83 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 84- 97 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 98-111 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 112-125 */ 9, 9, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 140-153 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 154-167 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 168-181 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, /* 182-195 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 196-209 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 210-223 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 224-237 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 238-251 */ 5, 5, 5, 5 }, /* prefix 118 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, /* 28- 41 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 42- 55 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 56- 69 */ 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 70- 83 */ 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 84- 97 */ 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, /* 140-153 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 154-167 */ 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, /* 168-181 */ 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 182-195 */ 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 196-209 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 119 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 140-153 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 154-167 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 168-181 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 182-195 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 196-209 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 120 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 28- 41 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 42- 55 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 56- 69 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 70- 83 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 84- 97 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 121 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 5, 5, 5, 5, 5, 5, /* 56- 69 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 70- 83 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 84- 97 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 140-153 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 154-167 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 168-181 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, /* 182-195 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, /* 196-209 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 122 */ { 151, 0, 7, 7, 6, 6, 6, 6, 12, 12, 12, 12, 12, 12, /* 0- 13 */ 12, 12, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, /* 14- 27 */ 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, /* 28- 41 */ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, /* 42- 55 */ 10, 10, 10, 10, 10, 10, 10, 10, 5, 5, 5, 5, 5, 5, /* 56- 69 */ 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 70- 83 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, /* 84- 97 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 98-111 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 112-125 */ 6, 6, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, /* 140-153 */ 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, /* 154-167 */ 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, /* 168-181 */ 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 182-195 */ 5, 5, 5, 5, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, /* 196-209 */ 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 6, 6, 6, 6, /* 210-223 */ 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 224-237 */ 7, 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 238-251 */ 4, 4, 4, 4 }, /* prefix 123 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 5, 5, 5, 5, 5, 5, /* 56- 69 */ 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 70- 83 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 84- 97 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 140-153 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 154-167 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 168-181 */ 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 124 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 125 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 28- 41 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 42- 55 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 56- 69 */ 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 70- 83 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, /* 84- 97 */ 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 126 */ { 151, 0, 7, 7, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, /* 0- 13 */ 12, 12, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, /* 14- 27 */ 11, 11, 11, 11, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, /* 28- 41 */ 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, /* 42- 55 */ 7, 7, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, /* 56- 69 */ 5, 5, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 0, 0, /* 70- 83 */ 0, 0, 7, 7, 7, 7, 0, 0, 6, 6, 6, 6, 6, 6, /* 84- 97 */ 6, 6, 0, 0, 7, 7, 7, 7, 7, 7, 0, 0, 7, 7, /* 98-111 */ 7, 7, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, /* 112-125 */ 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 6, 6, 6, 6, 7, 7, 7, 7, /* 154-167 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 168-181 */ 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 182-195 */ 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 196-209 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 127 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 126-139 */ 4, 4, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 140-153 */ 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, /* 154-167 */ 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 7, 7, /* 168-181 */ 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 128 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 129 */ { 151, 0, 14, 14, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, /* 0- 13 */ 12, 12, 7, 7, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, /* 14- 27 */ 0, 0, 0, 0, 6, 6, 6, 6, 0,152,153, 0, 0,154, /* 28- 41 */ 155, 0, 0,156, 7, 7, 7, 7,157, 0, 0, 0,158, 0, /* 42- 55 */ 0,159,160,161, 6, 6, 6, 6, 4, 4, 4, 4, 4, 4, /* 56- 69 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7, 7, 0, 0, /* 70- 83 */ 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, /* 84- 97 */ 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, 5, /* 182-195 */ 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, /* 196-209 */ 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 6, 6, 6, 6, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 130 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 131 */ { 151, 15, 14, 14, 13, 13, 13, 13, 0,162,163,164, 0, 0, /* 0- 13 */ 165,166, 7, 7,167,168,169,170,171, 0, 0,172,173,174, /* 14- 27 */ 175,176, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, 0,177, /* 28- 41 */ 178,179,180,181, 7, 7, 7, 7,182,183,184,185,186, 0, /* 42- 55 */ 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, /* 56- 69 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 70- 83 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, /* 84- 97 */ 6, 6,187,188,189, 0, 0,190,191,192, 0,193, 7, 7, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 132 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 133 */ { 194, 15, 14, 14,195,196,197,198, 0,199,200,201,202,203, /* 0- 13 */ 204, 0, 6, 6, 6, 6,205,206,207, 0, 0,208,209,210, /* 14- 27 */ 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 28- 41 */ 5, 5, 5, 5, 5, 5, 7, 7,211,212,213,214,215, 0, /* 42- 55 */ 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, /* 56- 69 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 70- 83 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 134 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 135 */ { 216, 15,217,218,219,220,221,222, 7, 7,223,224,225,226, /* 0- 13 */ 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 0,227,228,229, /* 14- 27 */ 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 28- 41 */ 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, /* 42- 55 */ 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 136 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 137 */ { 137, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, /* 0- 13 */ 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 14- 27 */ 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 28- 41 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 42- 55 */ 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 138 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 139 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 140 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 141 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 142 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 143 */ { 137, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, /* 0- 13 */ 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 14- 27 */ 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 28- 41 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 42- 55 */ 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 126-139 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 140-153 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 154-167 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 168-181 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 182-195 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 196-209 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 210-223 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 224-237 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 238-251 */ 0, 0, 0, 0 }, /* prefix 144 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 145 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 146 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 147 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 148 */ { 137, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, /* 0- 13 */ 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 14- 27 */ 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 28- 41 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 42- 55 */ 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 126-139 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 140-153 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 154-167 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 168-181 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 182-195 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 196-209 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 210-223 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 224-237 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 238-251 */ 0, 0, 0, 0 }, /* prefix 149 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 182-195 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 196-209 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 150 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 182-195 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 196-209 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 151 */ { 151, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, /* 0- 13 */ 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 14- 27 */ 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 28- 41 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 42- 55 */ 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 152 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 153 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 154 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 155 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 156 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 157 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 158 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 159 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 160 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 161 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 162 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 163 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 164 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 165 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 166 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 167 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 168 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 169 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 170 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 171 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 172 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 173 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 174 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 175 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 176 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 177 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 178 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 179 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 180 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 181 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 182 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 183 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 184 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 185 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 186 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 187 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 188 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 189 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 190 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 191 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 192 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 193 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 194 */ { 151, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, /* 0- 13 */ 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 14- 27 */ 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 28- 41 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 42- 55 */ 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 126-139 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 140-153 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 154-167 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 168-181 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 182-195 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 196-209 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 210-223 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 224-237 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 238-251 */ 8, 8, 8, 8 }, /* prefix 195 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 196 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 197 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 198 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 199 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 200 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 201 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 202 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 203 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 204 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 182-195 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 196-209 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 205 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 206 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 207 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 208 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 209 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 210 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 211 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 212 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 213 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 214 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 215 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 126-139 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 140-153 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 154-167 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 168-181 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 216 */ { 151, 0, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, /* 0- 13 */ 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 14- 27 */ 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 28- 41 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 42- 55 */ 3, 3, 3, 3, 3, 3, 3, 3, 9, 9, 9, 9, 9, 9, /* 56- 69 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 70- 83 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 84- 97 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 98-111 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 112-125 */ 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 126-139 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 140-153 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 154-167 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 168-181 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 182-195 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 196-209 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 210-223 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 224-237 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 238-251 */ 8, 8, 8, 8 }, /* prefix 217 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 182-195 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 196-209 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 218 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 56- 69 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 70- 83 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 84- 97 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 98-111 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 112-125 */ 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 182-195 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 196-209 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 219 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, /* 154-167 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 168-181 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 182-195 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 196-209 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 220 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 28- 41 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 42- 55 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 56- 69 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 70- 83 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, /* 154-167 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 168-181 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 221 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, /* 56- 69 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 70- 83 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, /* 182-195 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 196-209 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 222 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 28- 41 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 42- 55 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 56- 69 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 70- 83 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 84- 97 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 98-111 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 112-125 */ 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 223 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 182-195 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 196-209 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 224 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 28- 41 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 42- 55 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 }, /* prefix 225 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 13 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 14- 27 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 28- 41 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 42- 55 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 56- 69 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70- 83 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 84- 97 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 98-111 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 112-125 */ 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 182-195 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 196-209 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 226 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 28- 41 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 42- 55 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 227 */ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0- 13 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 14- 27 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 28- 41 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 42- 55 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, /* 182-195 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 196-209 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 210-223 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 224-237 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 238-251 */ 2, 2, 2, 2 }, /* prefix 228 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 126-139 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 140-153 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 154-167 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 168-181 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 182-195 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 196-209 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 210-223 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 224-237 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 238-251 */ 3, 3, 3, 3 }, /* prefix 229 */ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0- 13 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 14- 27 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 28- 41 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 42- 55 */ 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, /* 56- 69 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 70- 83 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 84- 97 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 98-111 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 112-125 */ 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 126-139 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140-153 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 154-167 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 168-181 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 182-195 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 196-209 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 210-223 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 224-237 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 238-251 */ 1, 1, 1, 1 } }; #else extern u_char TIFFFax2DMode[][256]; extern u_char TIFFFax2DNextState[][256]; extern u_char TIFFFaxUncompAction[][256]; extern u_char TIFFFaxUncompNextState[][256]; extern u_char TIFFFax1DAction[][256]; extern u_char TIFFFax1DNextState[][256]; #endif neuron-7.6.3/src/lib/TIFF/machdep.h000077500000000000000000000170041340731477100167100ustar00rootroot00000000000000/* /local/src/master/iv/src/lib/TIFF/machdep.h,v 1.2 1997/03/26 15:06:58 hines Exp */ /* * Copyright (c) 1988, 1989, 1990, 1991 Sam Leffler * Copyright (c) 1991 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _MACHDEP_ #define _MACHDEP_ /* * Machine dependent definitions: * o floating point formats * o byte ordering * * NB, there are lots of assumptions here: * - 32-bit natural integers (sign extension code) * - native float is 4 bytes (floating point conversion) * - native double is 8 bytes (floating point conversion) */ #if defined(sun) || defined(sparc) || defined(stellar) || defined(MIPSEB) || defined(hpux) || defined(apollo) || defined(NeXT) || defined(_IBMR2) #define BIGENDIAN 1 #define IEEEFP #endif /* sun || sparc || stellar || MIPSEB || hpux || apollo || NeXT || _IBMR2 */ /* MIPSEL = MIPS w/ Little Endian byte ordering (e.g. DEC 3100) */ #if defined(MIPSEL) #define BIGENDIAN 0 #define IEEEFP #endif /* MIPSEL */ #ifdef transputer #define BIGENDIAN 0 #define IEEEFP /* IEEE floating point supported */ #endif /* transputer */ #if defined(m386) || defined(M_I86) || defined(i386) #define BIGENDIAN 0 #define IEEEFP /* IEEE floating point supported */ #endif /* m386 || M_I86 || i386 */ #ifdef IEEEFP typedef struct ieeedouble nativedouble; typedef struct ieeefloat nativefloat; #define ISFRACTION(e) (1022 - 4 <= (e) && (e) <= 1022 + 15) #define EXTRACTFRACTION(dp, fract) \ ((fract) = ((unsigned long)(1<<31)|((dp)->native.mant<<11)|\ ((dp)->native.mant2>>21)) >> (1022+16-(dp)->native.exp)) #define EXTRACTEXPONENT(dp, exponent) ((exponent) = (dp)->native.exp) #define NATIVE2IEEEFLOAT(fp) #define IEEEFLOAT2NATIVE(fp) #define IEEEDOUBLE2NATIVE(dp) #define TIFFSwabArrayOfFloat(fp,n) TIFFSwabArrayOfLong((unsigned long *)fp,n) #define TIFFSwabArrayOfDouble(dp,n) TIFFSwabArrayOfLong((unsigned long *)dp,2*n) #endif /* IEEEFP */ #ifdef tahoe #define BIGENDIAN 1 typedef struct { unsigned sign:1; unsigned exp:8; unsigned mant:23; unsigned mant2; } nativedouble; typedef struct { unsigned sign:1; unsigned exp:8; unsigned mant:23; } nativefloat; #define ISFRACTION(e) (128 - 4 <= (e) && (e) <= 128 + 15) #define EXTRACTFRACTION(dp, fract) \ ((fract) = ((1<<31)|((dp)->native.mant<<8)|((dp)->native.mant2>>15)) >> \ (128+16-(dp)->native.exp)) #define EXTRACTEXPONENT(dp, exponent) ((exponent) = (dp)->native.exp - 2) /* * Beware, over/under-flow in conversions will * result in garbage values -- handling it would * require a subroutine call or lots more code. */ #define NATIVE2IEEEFLOAT(fp) { \ if ((fp)->native.exp) \ (fp)->ieee.exp = (fp)->native.exp - 129 + 127; /* alter bias */\ } #define IEEEFLOAT2NATIVE(fp) { \ if ((fp)->ieee.exp) \ (fp)->native.exp = (fp)->ieee.exp - 127 + 129; /* alter bias */\ } #define IEEEDOUBLE2NATIVE(dp) { \ if ((dp)->native.exp = (dp)->ieee.exp) \ (dp)->native.exp += -1023 + 129; \ (dp)->native.mant = ((dp)->ieee.mant<<3)|((dp)->native.mant2>>29); \ (dp)->native.mant2 <<= 3; \ } /* the following is to work around a compiler bug... */ #define SIGNEXTEND(a,b) { char ch; ch = (a); (b) = ch; } #define TIFFSwabArrayOfFloat(fp,n) TIFFSwabArrayOfLong((unsigned long *)fp,n) #define TIFFSwabArrayOfDouble(dp,n) TIFFSwabArrayOfLong((unsigned long *)dp,2*n) #endif /* tahoe */ #ifdef vax #define BIGENDIAN 0 typedef struct { unsigned mant1:7; unsigned exp:8; unsigned sign:1; unsigned mant2:16; unsigned mant3; } nativedouble; typedef struct { unsigned mant1:7; unsigned exp:8; unsigned sign:1; unsigned mant2:16; } nativefloat; #define ISFRACTION(e) (128 - 4 <= (e) && (e) <= 128 + 15) #define EXTRACTFRACTION(dp, fract) \ ((fract) = ((1<<31)|((dp)->native.mant1<<16)|(dp)->native.mant2)) >> \ (128+16-(dp)->native.exp)) #define EXTRACTEXPONENT(dp, exponent) ((exponent) = (dp)->native.exp - 2) /* * Beware, these do not handle over/under-flow * during conversion from ieee to native format. */ #define NATIVE2IEEEFLOAT(fp) { \ float_t t; \ if (t.ieee.exp = (fp)->native.exp) \ t.ieee.exp += -129 + 127; \ t.ieee.sign = (fp)->native.sign; \ t.ieee.mant = ((fp)->native.mant1<<16)|(fp)->native.mant2; \ *(fp) = t; \ } #define IEEEFLOAT2NATIVE(fp) { \ float_t t; int v = (fp)->ieee.exp; \ if (v) v += -127 + 129; /* alter bias of exponent */\ t.native.exp = v; /* implicit truncation of exponent */\ t.native.sign = (fp)->ieee.sign; \ v = (fp)->ieee.mant; \ t.native.mant1 = v >> 16; \ t.native.mant2 = v;\ *(fp) = v; \ } #define IEEEDOUBLE2NATIVE(dp) { \ double_t t; int v = (dp)->ieee.exp; \ if (v) v += -1023 + 129; /* if can alter bias of exponent */\ t.native.exp = v; /* implicit truncation of exponent */\ v = (dp)->ieee.mant; \ t.native.sign = (dp)->ieee.sign; \ t.native.mant1 = v >> 16; \ t.native.mant2 = v;\ t.native.mant3 = (dp)->mant2; \ *(dp) = t; \ } #define TIFFSwabArrayOfFloat(fp,n) TIFFSwabArrayOfLong((unsigned long *)fp,n) #define TIFFSwabArrayOfDouble(dp,n) TIFFSwabArrayOfLong((unsigned long *)dp,2*n) #endif /* vax */ /* * These unions are used during floating point * conversions. The macros given above define * the conversion operations. */ typedef struct ieeedouble { #if BIGENDIAN == 1 #if !defined(_IBMR2) unsigned sign:1; unsigned exp:11; unsigned long mant:20; unsigned mant2; #else /* _IBMR2 */ unsigned sign:1; unsigned exp:11; unsigned mant:20; unsigned mant2; #endif /* _IBMR2 */ #else #if !defined(vax) #ifdef INT_16_BIT /* MSDOS C compilers */ unsigned long mant2; unsigned long mant:20; unsigned long exp:11; unsigned long sign:1; #else /* 32 bit ints */ unsigned mant2; unsigned long mant:20; unsigned exp:11; unsigned sign:1; #endif /* 32 bit ints */ #else unsigned long mant:20; unsigned exp:11; unsigned sign:1; unsigned mant2; #endif /* !vax */ #endif } ieeedouble; typedef struct ieeefloat { #if BIGENDIAN == 1 #if !defined(_IBMR2) unsigned sign:1; unsigned exp:8; unsigned long mant:23; #else /* _IBMR2 */ unsigned sign:1; unsigned exp:8; unsigned mant:23; #endif /* _IBMR2 */ #else #ifdef INT_16_BIT /* MSDOS C compilers */ unsigned long mant:23; unsigned long exp:8; unsigned long sign:1; #else /* 32 bit ints */ unsigned long mant:23; unsigned exp:8; unsigned sign:1; #endif /* 32 bit ints */ #endif } ieeefloat; typedef union { ieeedouble ieee; nativedouble native; char b[8]; double d; } double_t; typedef union { ieeefloat ieee; nativefloat native; char b[4]; float f; } float_t; #endif /* _MACHDEP_ */ neuron-7.6.3/src/lib/TIFF/mkg3states.c000077500000000000000000000601411340731477100173670ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/mkg3states.c,v 1.2 1997/03/26 15:06:59 hines Exp"; #endif /* * Copyright (c) 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Program to construct Group 3 & Group 4 decoding tables. * * This code is derived from code by Michael P. Marking. In * particular, the algorithms to generate the null_mode and * horiz_mode state tables are his. See the comments below * for more information. * * BEGIN (from the original source) LEGAL * Copyright 1989, 1990 Michael P. Marking, Post Office Box 8039, * Scottsdale, Arizona 85252-8039. All rights reserved. * * License is granted by the copyright holder to distribute and use this * code without payment of royalties or the necessity of notification as * long as this notice (all the text under "LEGAL") is included. * * Reference: mkg3states.c,v 1.2 1997/03/26 15:06:59 hines Exp * * This program is offered without any warranty of any kind. It includes * no warranty of merchantability or fitness for any purpose. Testing and * suitability for any use are the sole responsibility of the user. * INFORMATION * Although there is no support offered with this program, the author will * endeavor to correct errors. Updates will also be made available from * time to time. * * Contact: Michael P. Marking, Post Office Box 8039, Scottsdale, Arizona * 85252-8039 USA. Replies are not guaranteed to be swift. Beginning * July 1990, e-mail may be sent to uunet!ipel!marking. * * Also beginning in July 1990, this code will be archived at the * ipel!phoenix BBS in file g3g4.zoo. The 24-hour telephone number * for 300/1200/2400 is (602)274-0462. When logging in, specify user * "public", system "bbs", and password "public". * * This code is also available from the C Users Group in volume 317. * * END (from the original source) */ #include #include #include #include "prototypes.h" #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif #define WHITE 0 #define BLACK 1 /* * G3 2D and G4 decoding modes. Note that * the vertical modes are ordered so that * (mode - MODE_VERT_V0) gives the vertical * adjustment for the b1 parameter. */ #define MODE_NULL 0 #define MODE_PASS 1 #define MODE_HORIZ 2 #define MODE_VERT_VL3 3 #define MODE_VERT_VL2 4 #define MODE_VERT_VL1 5 #define MODE_VERT_V0 6 #define MODE_VERT_VR1 7 #define MODE_VERT_VR2 8 #define MODE_VERT_VR3 9 #define MODE_UNCOMP 10 #define MODE_ERROR 11 #define MODE_ERROR_1 12 unsigned long DECLARE1(append_0, unsigned long, prefix) { return (prefix + (1L<<16)); } unsigned long DECLARE1(append_1, unsigned long, prefix) { static unsigned short prefix_bit[16] = { 0x8000, 0x4000, 0x2000, 0x1000, 0x0800, 0x0400, 0x0200, 0x0100, 0x0080, 0x0040, 0x0020, 0x0010, 0x0008, 0x0004, 0x0002, 0x0001 }; unsigned char len = (prefix >> 16) & 0xf; return (append_0(prefix) + prefix_bit[len]); } #define G3CODES #include "t4.h" short #if defined(__STDC__) || defined(__EXTENDED__) || USE_CONST DECLARE3(search_table, unsigned long, prefix, tableentry const*, tab, int, n) #else DECLARE3(search_table, unsigned long, prefix, tableentry*, tab, int, n) #endif { unsigned short len = (prefix >> 16) & 0xf; unsigned short code = (prefix & 0xffff) >> (16 - len); while (n-- > 0) { if (tab->length == len && tab->code == code) return ((short) tab->runlen); tab++; } return (G3CODE_INCOMP); } #define NCODES(a) (sizeof (a) / sizeof (a[0])) short DECLARE1(white_run_length, unsigned long, prefix) { return (search_table(prefix, TIFFFaxWhiteCodes, NCODES(TIFFFaxWhiteCodes))); } short DECLARE1(black_run_length, unsigned long, prefix) { return (search_table(prefix, TIFFFaxBlackCodes, NCODES(TIFFFaxBlackCodes))); } #undef NCODES #define MAX_NULLPREFIX 200 /* max # of null-mode prefixes */ typedef unsigned char NullModeTable[MAX_NULLPREFIX][256]; #define MAX_HORIZPREFIX 250 /* max # of incomplete 1-D prefixes */ typedef unsigned char HorizModeTable[MAX_HORIZPREFIX][256]; /* the bit string corresponding to this row of the decoding table */ long null_mode_prefix[MAX_NULLPREFIX]; NullModeTable null_mode; /* MODE_*, indexed by bit and byte */ NullModeTable null_mode_next_state; /* next row of decoding tables to use */ /* number of prefixes or rows in the G4 decoding tables */ short null_mode_prefix_count = 0; /* * 2D uncompressed mode codes. Note * that two groups of codes are arranged * so that the decoder can caluclate the * length of the run by subtracting the * code from a known base value. */ #define UNCOMP_INCOMP 0 /* runs of [0]*1 */ #define UNCOMP_RUN0 1 #define UNCOMP_RUN1 2 #define UNCOMP_RUN2 3 #define UNCOMP_RUN3 4 #define UNCOMP_RUN4 5 #define UNCOMP_RUN5 6 #define UNCOMP_RUN6 7 /* runs of [0]* w/ terminating color */ #define UNCOMP_TRUN0 8 #define UNCOMP_TRUN1 9 #define UNCOMP_TRUN2 10 #define UNCOMP_TRUN3 11 #define UNCOMP_TRUN4 12 /* special code for unexpected EOF */ #define UNCOMP_EOF 13 /* invalid code encountered */ #define UNCOMP_INVALID 14 long uncomp_mode_prefix[MAX_NULLPREFIX]; NullModeTable uncomp_mode; NullModeTable uncomp_mode_next_state; short uncomp_mode_prefix_count = 0; /* * Decoding action values for horiz_mode. */ #define ACT_INCOMP 0 /* incompletely decoded code */ #define ACT_INVALID 1 /* invalide code */ #define ACT_WRUNT 2 /* terminating white run code */ #define ACT_WRUN 65 /* non-terminating white run code */ #define ACT_BRUNT 106 /* terminating black run code */ #define ACT_BRUN 169 /* non-terminating black run code */ #define ACT_EOL 210 /* end-of-line code */ HorizModeTable horiz_mode; short DECLARE1(horiz_mode_code_black, short, runlen) { return (runlen < 64 ? runlen + ACT_BRUNT : (runlen / 64) + ACT_BRUN); } short DECLARE1(horiz_mode_code_white, short, runlen) { return (runlen < 64 ? runlen + ACT_WRUNT : (runlen / 64) + ACT_WRUN); } /* * If the corresponding horiz_mode entry is ACT_INCOMP * this entry is a row number for decoding the next byte; * otherwise, it is the bit number with which to continue * decoding the next codeword. */ HorizModeTable horiz_mode_next_state; /* prefixes corresponding to the rows of the decoding table */ long horiz_mode_prefix[MAX_HORIZPREFIX]; /* color of next run, BLACK or WHITE */ char horiz_mode_color[MAX_HORIZPREFIX]; short horiz_mode_prefix_count = 0; static unsigned char bit_mask[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; #if USE_PROTOTYPES void build_null_mode_tables(void); short find_horiz_mode_prefix(long, char); short find_null_mode_prefix(long); short null_mode_type(long); void build_horiz_mode_tables(void); short horiz_mode_code_black(short); short horiz_mode_code_white(short); void build_uncomp_mode_tables(void); void write_tables(FILE*); #else void build_null_mode_tables(); short find_horiz_mode_prefix(); short find_null_mode_prefix(); short null_mode_type(); void build_horiz_mode_tables(); short horiz_mode_code_black(); short horiz_mode_code_white(); void build_uncomp_mode_tables(); void write_tables(); #endif int verbose = FALSE; char *storage_class = ""; int DECLARE2(main, int, argc, char**, argv) { while (argc > 1 && argv[1][0] == '-') { if (strcmp(argv[1], "-v") == 0) { verbose = TRUE; argc--, argv++; } else if (strcmp(argv[1], "-c") == 0) { storage_class = "const "; argc--, argv++; } } build_null_mode_tables(); /* null mode decoding tables */ if (verbose) { fprintf(stderr, "%d null mode prefixes defined\n", (int) null_mode_prefix_count); fprintf(stderr, "building uncompressed mode scripts...\n"); } build_uncomp_mode_tables(); /* uncompressed mode decoding tables */ if (verbose) { fprintf(stderr, "%d uncompressed mode prefixes defined\n", (int) uncomp_mode_prefix_count); fprintf(stderr, "building 1D scripts...\n"); } build_horiz_mode_tables(); /* 1D decoding tables */ if (verbose) fprintf(stderr, "%d incomplete prefixes defined\n", (int) horiz_mode_prefix_count); write_tables(stdout); return 0; } void DECLARE3(write_null_mode_table, FILE*, fd, NullModeTable, table, char*, name) { int i, j; char* outersep; char* sep; fprintf(fd, "%su_char\t%s[%d][256] = {", storage_class, name, (int) null_mode_prefix_count); outersep = ""; for (i = 0; i < null_mode_prefix_count; i++) { fprintf(fd, "%s\n/* prefix %d */ {\n", outersep, i); sep = " "; for (j = 0; j < 256; j++) { fprintf(fd, "%s%2d", sep, (int) table[i][j]); if (((j+1) % 16) == 0) { fprintf(fd, ", /* %3d-%3d */\n", j-15, j); sep = " "; } else sep = ","; } fprintf(fd, "}"); outersep = ","; } fprintf(fd, "\n};\n"); } void DECLARE3(write_horiz_mode_table, FILE*, fd, HorizModeTable, table, char*, name) { int i, j; char* outersep; char* sep; fprintf(fd, "%s u_char\t%s[%d][256] = {", storage_class, name, (int) horiz_mode_prefix_count); outersep = ""; for (i = 0; i < horiz_mode_prefix_count; i++) { fprintf(fd, "%s\n/* prefix %d */ {\n", outersep, i); sep = " "; for (j = 0; j < 256; j++) { fprintf(fd, "%s%3d", sep, (int) table[i][j]); if (((j+1) % 14) == 0) { fprintf(fd, ", /* %3d-%3d */\n", j-13, j); sep = " "; } else sep = ","; } fprintf(fd, "\n}"); outersep = ","; } fprintf(fd, "\n};\n"); } void write_define(fd, name, value, comment) FILE *fd; char *name; int value; char *comment; { fprintf(fd, "#define\t%s\t%d", name, value); if (comment) fprintf(fd, "\t/* %s */", comment); fprintf(fd, "\n"); } void write_preamble(fd) FILE *fd; { fprintf(fd, "%s\n", "/* DO NOT EDIT THIS FILE, IT WAS AUTOMATICALLY CREATED BY mkg3state */"); write_define(fd, "ACT_INCOMP", ACT_INCOMP, "incompletely decoded code"); write_define(fd, "ACT_INVALID", ACT_INVALID, "invalide code"); write_define(fd, "ACT_WRUNT", ACT_WRUNT, "terminating white run code"); write_define(fd, "ACT_WRUN", ACT_WRUN, "non-terminating white run code"); write_define(fd, "ACT_BRUNT", ACT_BRUNT, "terminating black run code"); write_define(fd, "ACT_BRUN", ACT_BRUN, "non-terminating black run code"); write_define(fd, "ACT_EOL", ACT_EOL, "end-of-line code"); fprintf(fd, "\n"); fprintf(fd, "/* modes that the decoder can be in */\n"); write_define(fd, "MODE_NULL", MODE_NULL, NULL); write_define(fd, "MODE_PASS", MODE_PASS, NULL); write_define(fd, "MODE_HORIZ", MODE_HORIZ, NULL); write_define(fd, "MODE_VERT_V0", MODE_VERT_V0, NULL); write_define(fd, "MODE_VERT_VR1", MODE_VERT_VR1, NULL); write_define(fd, "MODE_VERT_VR2", MODE_VERT_VR2, NULL); write_define(fd, "MODE_VERT_VR3", MODE_VERT_VR3, NULL); write_define(fd, "MODE_VERT_VL1", MODE_VERT_VL1, NULL); write_define(fd, "MODE_VERT_VL2", MODE_VERT_VL2, NULL); write_define(fd, "MODE_VERT_VL3", MODE_VERT_VL3, NULL); write_define(fd, "MODE_UNCOMP", MODE_UNCOMP, NULL); write_define(fd, "MODE_ERROR", MODE_ERROR, NULL); write_define(fd, "MODE_ERROR_1", MODE_ERROR_1, NULL); fprintf(fd, "\n"); fprintf(fd, "#define\tRUNLENGTH(ix) (TIFFFaxWhiteCodes[ix].runlen)\n"); fprintf(fd, "\n"); write_define(fd, "UNCOMP_INCOMP", UNCOMP_INCOMP, NULL); fprintf(fd, "/* runs of [0]*1 */\n"); write_define(fd, "UNCOMP_RUN0", UNCOMP_RUN0, NULL); write_define(fd, "UNCOMP_RUN1", UNCOMP_RUN1, NULL); write_define(fd, "UNCOMP_RUN2", UNCOMP_RUN2, NULL); write_define(fd, "UNCOMP_RUN3", UNCOMP_RUN3, NULL); write_define(fd, "UNCOMP_RUN4", UNCOMP_RUN4, NULL); write_define(fd, "UNCOMP_RUN5", UNCOMP_RUN5, NULL); write_define(fd, "UNCOMP_RUN6", UNCOMP_RUN6, NULL); fprintf(fd, "/* runs of [0]* w/ terminating color */\n"); write_define(fd, "UNCOMP_TRUN0", UNCOMP_TRUN0, NULL); write_define(fd, "UNCOMP_TRUN1", UNCOMP_TRUN1, NULL); write_define(fd, "UNCOMP_TRUN2", UNCOMP_TRUN2, NULL); write_define(fd, "UNCOMP_TRUN3", UNCOMP_TRUN3, NULL); write_define(fd, "UNCOMP_TRUN4", UNCOMP_TRUN4, NULL); fprintf(fd, "/* special code for unexpected EOF */\n"); write_define(fd, "UNCOMP_EOF", UNCOMP_EOF, NULL); fprintf(fd, "/* invalid code encountered */\n"); write_define(fd, "UNCOMP_INVALID", UNCOMP_INVALID, NULL); fprintf(fd, "/* codes >= terminate uncompress mode */\n"); fprintf(fd, "#define\tUNCOMP_EXIT UNCOMP_TRUN0\n"); fprintf(fd, "\n"); } void extern_table(fd, name) FILE* fd; char* name; { fprintf(fd, "extern\t%su_char %s[][256];\n", storage_class, name); } void write_tables(fd) FILE* fd; { write_preamble(fd); fprintf(fd, "#ifdef G3STATES\n"); write_null_mode_table(fd, null_mode, "TIFFFax2DMode"); write_null_mode_table(fd, null_mode_next_state, "TIFFFax2DNextState"); write_null_mode_table(fd, uncomp_mode, "TIFFFaxUncompAction"); write_null_mode_table(fd, uncomp_mode_next_state, "TIFFFaxUncompNextState"); write_horiz_mode_table(fd, horiz_mode, "TIFFFax1DAction"); write_horiz_mode_table(fd, horiz_mode_next_state, "TIFFFax1DNextState"); fprintf(fd, "#else\n"); extern_table(fd, "TIFFFax2DMode"); extern_table(fd, "TIFFFax2DNextState"); extern_table(fd, "TIFFFaxUncompAction"); extern_table(fd, "TIFFFaxUncompNextState"); extern_table(fd, "TIFFFax1DAction"); extern_table(fd, "TIFFFax1DNextState"); fprintf(fd, "#endif\n"); } short DECLARE1(find_null_mode_prefix, long, prefix) { short j1; if (prefix == 0L) return (0); for (j1 = 8; j1 < null_mode_prefix_count; j1++) if (prefix == null_mode_prefix[j1]) return (j1); if (null_mode_prefix_count == MAX_NULLPREFIX) { fprintf(stderr, "ERROR: null mode prefix table overflow\n"); exit(1); } if (verbose) fprintf(stderr, "adding null mode prefix[%d] 0x%lx\n", (int) null_mode_prefix_count, prefix); null_mode_prefix[null_mode_prefix_count++] = prefix; return (null_mode_prefix_count-1); } short DECLARE2(find_horiz_mode_prefix, long, prefix, char, color) { short j1; for (j1 = 0; j1 < horiz_mode_prefix_count; j1++) if (prefix == horiz_mode_prefix[j1] && horiz_mode_color[j1] == color) return (j1); /* * It wasn't found, so add it to the tables, but first, is there room? */ if (horiz_mode_prefix_count == MAX_HORIZPREFIX) { fprintf(stderr, "ERROR: 1D prefix table overflow\n"); exit(1); } /* OK, there's room... */ if (verbose) fprintf(stderr, "\nhoriz mode prefix %d, color %c = 0x%lx ", (int) horiz_mode_prefix_count, "WB"[color], prefix); horiz_mode_prefix[horiz_mode_prefix_count] = prefix; horiz_mode_color[horiz_mode_prefix_count] = color; horiz_mode_prefix_count++; return (horiz_mode_prefix_count - 1); } short DECLARE1(find_uncomp_mode_prefix, long, prefix) { short j1; if (prefix == 0L) return (0); for (j1 = 8; j1 < uncomp_mode_prefix_count; j1++) if (prefix == uncomp_mode_prefix[j1]) return (j1); if (uncomp_mode_prefix_count == MAX_NULLPREFIX) { fprintf(stderr, "ERROR: uncomp mode prefix table overflow\n"); exit(1); } if (verbose) fprintf(stderr, "adding uncomp mode prefix[%d] 0x%lx\n", (int) uncomp_mode_prefix_count, prefix); uncomp_mode_prefix[uncomp_mode_prefix_count++] = prefix; return (uncomp_mode_prefix_count-1); } short DECLARE1(null_mode_type, long, prefix) { switch (prefix) { case 0x18000L: return (MODE_VERT_V0); /* 1 */ case 0x36000L: return (MODE_VERT_VR1); /* 011 */ case 0x34000L: return (MODE_VERT_VL1); /* 010 */ case 0x32000L: return (MODE_HORIZ); /* 001 */ case 0x41000L: return (MODE_PASS); /* 0001 */ case 0x60C00L: return (MODE_VERT_VR2); /* 0000 11 */ case 0x60800L: return (MODE_VERT_VL2); /* 0000 10 */ case 0x70600L: return (MODE_VERT_VR3); /* 0000 011 */ case 0x70400L: return (MODE_VERT_VL3); /* 0000 010 */ case 0x80200L: return (MODE_ERROR); /* 0000 0010 */ case 0x90300L: return (MODE_ERROR); /* 0000 0011 0 */ case 0xA0380L: return (MODE_ERROR); /* 0000 0011 10 */ case 0xA03C0L: return (MODE_UNCOMP); /* 0000 0011 11 */ /* * Under the assumption that there are no * errors in the file, then this bit string * can only be the beginning of an EOL code. */ case 0x70000L: return (MODE_ERROR_1); /* 0000 000 */ } return (-1); } short DECLARE1(uncomp_mode_type, long, prefix) { short code; short len; switch (prefix) { case 0x18000L: return (UNCOMP_RUN1); /* 1 */ case 0x24000L: return (UNCOMP_RUN2); /* 01 */ case 0x32000L: return (UNCOMP_RUN3); /* 001 */ case 0x41000L: return (UNCOMP_RUN4); /* 0001 */ case 0x50800L: return (UNCOMP_RUN5); /* 0000 1 */ case 0x60400L: return (UNCOMP_RUN6); /* 0000 01 */ case 0x70200L: return (UNCOMP_TRUN0); /* 0000 001 */ case 0x80100L: return (UNCOMP_TRUN1); /* 0000 0001 */ case 0x90080L: return (UNCOMP_TRUN2); /* 0000 0000 1 */ case 0xA0040L: return (UNCOMP_TRUN3); /* 0000 0000 01 */ case 0xB0020L: return (UNCOMP_TRUN4); /* 0000 0000 001 */ } code = prefix & 0xffffL; len = (prefix >> 16) & 0xf; return ((code || len > 10) ? UNCOMP_INVALID : -1); } #define BASESTATE(b) ((unsigned char) ((b) & 0x7)) void build_null_mode_tables() { short prefix; /* * Note: the first eight entries correspond to * a null prefix and starting bit numbers 0-7. */ null_mode_prefix_count = 8; for (prefix = 0; prefix < null_mode_prefix_count; prefix++) { short byte; for (byte = 0; byte < 256; byte++) { short firstbit; short bit; long curprefix; char found_code = FALSE; if (prefix < 8) { curprefix = 0L; firstbit = prefix; } else { curprefix = null_mode_prefix[prefix]; firstbit = 0; } for (bit = firstbit; bit < 8 && !found_code; bit++) { short mode; if (bit_mask[bit] & byte) curprefix = append_1(curprefix); else curprefix = append_0(curprefix); switch (mode = null_mode_type(curprefix)) { case MODE_PASS: case MODE_HORIZ: case MODE_VERT_V0: case MODE_VERT_VR1: case MODE_VERT_VR2: case MODE_VERT_VR3: case MODE_VERT_VL1: case MODE_VERT_VL2: case MODE_VERT_VL3: case MODE_UNCOMP: case MODE_ERROR: case MODE_ERROR_1: /* * NOTE: if the bit number is 8, then the table * entry will be zero, which indicates a new byte * is to be fetched during the decoding process */ found_code = TRUE; null_mode[prefix][byte] = (unsigned char) mode; null_mode_next_state[prefix][byte] = BASESTATE(bit+1); break; } } if (!found_code) { null_mode_next_state[prefix][byte] = (unsigned char) find_null_mode_prefix(curprefix); /* * This indicates to the decoder that * no valid code has yet been identified. */ null_mode[prefix][byte] = MODE_NULL; } } } } void build_horiz_mode_tables() { unsigned short byte; short prefix; /* * The first 8 are for white, * the second 8 are for black, * beginning with bits 0-7. */ horiz_mode_prefix_count = 16; for (prefix = 0; prefix < horiz_mode_prefix_count; prefix++) for (byte = 0; byte < 256; byte++) { short bits_digested = 0; short bit; short firstbit; char color; unsigned long curprefix; if (prefix < 8) { color = WHITE; curprefix = 0L; firstbit = prefix; } else if (prefix < 16) { color = BLACK; curprefix = 0L; firstbit = prefix - 8; } else { color = horiz_mode_color[prefix]; curprefix = horiz_mode_prefix[prefix]; firstbit = 0; } for (bit = firstbit; bit < 8 && !bits_digested; bit++) { if (bit_mask[bit] & byte) curprefix = append_1(curprefix); else curprefix = append_0(curprefix); /* * The following conversion allows for arbitrary strings of * zeroes to precede the end-of-line code 0000 0000 0001. * It assumes no errors in the data, and is based on * the assumption that the code replaced (12 consecutive * zeroes) can only be "legally" encountered before the * end-of-line code. This assumption is valid only for * a Group 3 image; the combination will never occur * in horizontal mode in a proper Group 4 image. */ if (curprefix == 0xC0000L) curprefix = 0xB0000L; if (color == WHITE) { short runlength = white_run_length(curprefix); if (runlength == G3CODE_INVALID) { horiz_mode[prefix][byte] = (unsigned char) ACT_INVALID; horiz_mode_next_state[prefix][byte] = (unsigned char) bit; bits_digested = bit + 1; } else if (runlength == G3CODE_EOL) { /* Group 3 only */ horiz_mode[prefix][byte] = (unsigned char) ACT_EOL; horiz_mode_next_state[prefix][byte] = BASESTATE(bit+1); bits_digested = bit + 1; } else if (runlength != G3CODE_INCOMP) { horiz_mode[prefix][byte] = (unsigned char) horiz_mode_code_white(runlength); horiz_mode_next_state[prefix][byte] = BASESTATE(bit+1); bits_digested = bit + 1; } } else { /* color == BLACK */ short runlength = black_run_length(curprefix); if (runlength == G3CODE_INVALID) { horiz_mode[prefix][byte] = (unsigned char) ACT_INVALID; horiz_mode_next_state[prefix][byte] = (unsigned char) (bit+8); bits_digested = bit + 1; } else if (runlength == G3CODE_EOL) { /* Group 3 only */ horiz_mode[prefix][byte] = (unsigned char) ACT_EOL; horiz_mode_next_state[prefix][byte] = BASESTATE(bit+1); bits_digested = bit + 1; } else if (runlength != G3CODE_INCOMP) { horiz_mode[prefix][byte] = (unsigned char) horiz_mode_code_black(runlength); horiz_mode_next_state[prefix][byte] = BASESTATE(bit+1); bits_digested = bit + 1; } } } if (!bits_digested) { /* no codewords after examining byte */ horiz_mode[prefix][byte] = (unsigned char) ACT_INCOMP; horiz_mode_next_state[prefix][byte] = (unsigned char) find_horiz_mode_prefix(curprefix, color); } } } void build_uncomp_mode_tables() { short prefix; /* * Note: the first eight entries correspond to * a null prefix and starting bit numbers 0-7. */ uncomp_mode_prefix_count = 8; for (prefix = 0; prefix < uncomp_mode_prefix_count; prefix++) { short byte; for (byte = 0; byte < 256; byte++) { short firstbit; short bit; long curprefix; char found_code = FALSE; if (prefix < 8) { curprefix = 0L; firstbit = prefix; } else { curprefix = uncomp_mode_prefix[prefix]; firstbit = 0; } for (bit = firstbit; bit < 8 && !found_code; bit++) { short mode; if (bit_mask[bit] & byte) curprefix = append_1(curprefix); else curprefix = append_0(curprefix); mode = uncomp_mode_type(curprefix); if (mode != -1) { /* * NOTE: if the bit number is 8, then the table * entry will be zero, which indicates a new byte * is to be fetched during the decoding process */ found_code = TRUE; uncomp_mode[prefix][byte] = (unsigned char) mode; uncomp_mode_next_state[prefix][byte] = BASESTATE(bit+1); break; } } if (!found_code) { uncomp_mode_next_state[prefix][byte] = (unsigned char) find_uncomp_mode_prefix(curprefix); /* * This indicates to the decoder that * no valid code has yet been identified. */ uncomp_mode[prefix][byte] = UNCOMP_INCOMP; } } } } neuron-7.6.3/src/lib/TIFF/mkspans.c000077500000000000000000000021341340731477100167540ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/mkspans.c,v 1.2 1997/03/26 15:06:59 hines Exp"; #endif #include "tiffcompat.h" /* * Hack program to construct tables used to find * runs of zeros and ones in Group 3 Fax encoding. */ dumparray(name, runs) char *name; unsigned char runs[256]; { register int i; register char *sep; printf("static u_char %s[256] = {\n", name); sep = " "; for (i = 0; i < 256; i++) { printf("%s%d", sep, runs[i]); if (((i + 1) % 16) == 0) { printf(", /* 0x%02x - 0x%02x */\n", i-15, i); sep = " "; } else sep = ", "; } printf("\n};\n"); } main() { unsigned char runs[2][256]; bzero(runs[0], 256*sizeof (char)); bzero(runs[1], 256*sizeof (char)); { register int run, runlen, i; runlen = 1; for (run = 0x80; run != 0xff; run = (run>>1)|0x80) { for (i = run-1; i >= 0; i--) { runs[1][run|i] = runlen; runs[0][(~(run|i)) & 0xff] = runlen; } runlen++; } runs[1][0xff] = runs[0][0] = 8; } dumparray("bruns", runs[0]); dumparray("wruns", runs[1]); } neuron-7.6.3/src/lib/TIFF/prototypes.h000077500000000000000000000053001340731477100175330ustar00rootroot00000000000000/* /local/src/master/iv/src/lib/TIFF/prototypes.h,v 1.2 1997/03/26 15:07:00 hines Exp */ /* * Copyright (c) 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #if USE_PROTOTYPES #define DECLARE1(f,t1,a1) f(t1 a1) #define DECLARE2(f,t1,a1,t2,a2) f(t1 a1, t2 a2) #define DECLARE3(f,t1,a1,t2,a2,t3,a3) f(t1 a1, t2 a2, t3 a3) #define DECLARE4(f,t1,a1,t2,a2,t3,a3,t4,a4)\ f(t1 a1, t2 a2, t3 a3, t4 a4) #define DECLARE5(f,t1,a1,t2,a2,t3,a3,t4,a4,t5,a5)\ f(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) #define DECLARE6(f,t1,a1,t2,a2,t3,a3,t4,a4,t5,a5,t6,a6)\ f(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6) #define DECLARE1V(f,t1,a1) f(t1 a1 ...) #define DECLARE2V(f,t1,a1,t2,a2) f(t1 a1, t2 a2, ...) #define DECLARE3V(f,t1,a1,t2,a2,t3,a3) f(t1 a1, t2 a2, t3 a3, ...) #else #define DECLARE1(f,t1,a1) f(a1) t1 a1; #define DECLARE2(f,t1,a1,t2,a2) f(a1,a2) t1 a1; t2 a2; #define DECLARE3(f,t1,a1,t2,a2,t3,a3) f(a1, a2, a3) t1 a1; t2 a2; t3 a3; #define DECLARE4(f,t1,a1,t2,a2,t3,a3,t4,a4) \ f(a1, a2, a3, a4) t1 a1; t2 a2; t3 a3; t4 a4; #define DECLARE5(f,t1,a1,t2,a2,t3,a3,t4,a4,t5,a5)\ f(a1, a2, a3, a4, a5) t1 a1; t2 a2; t3 a3; t4 a4; t5 a5; #define DECLARE6(f,t1,a1,t2,a2,t3,a3,t4,a4,t5,a5,t6,a6)\ f(a1, a2, a3, a4, a5, a6) t1 a1; t2 a2; t3 a3; t4 a4; t5 a5; t6 a6; #if USE_VARARGS #define DECLARE1V(f,t1,a1) \ f(a1, va_alist) t1 a1; va_dcl #define DECLARE2V(f,t1,a1,t2,a2) \ f(a1, a2, va_alist) t1 a1; t2 a2; va_dcl #define DECLARE3V(f,t1,a1,t2,a2,t3,a3) \ f(a1, a2, a3, va_alist) t1 a1; t2 a2; t3 a3; va_dcl #else "Help, I don't know how to handle this case: !USE_PROTOTYPES and !USE_VARARGS?" #endif #endif neuron-7.6.3/src/lib/TIFF/t4.h000077500000000000000000000265301340731477100156420ustar00rootroot00000000000000/* /local/src/master/iv/src/lib/TIFF/t4.h,v 1.2 1997/03/26 15:07:01 hines Exp */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _T4_ #define _T4_ /* * CCITT T.4 1D Huffman runlength codes and * related definitions. Given the small sizes * of these tables it might does not seem * worthwhile to make code & length 8 bits. */ typedef struct tableentry { unsigned short length; /* bit length of g3 code */ unsigned short code; /* g3 code */ short runlen; /* run length in bits */ } tableentry; #define EOL 0x001 /* EOL code value - 0000 0000 0000 1 */ /* status values returned instead of a run length */ #define G3CODE_INVALID -1 #define G3CODE_INCOMP -2 #define G3CODE_EOL -3 #define G3CODE_EOF -4 /* * Note that these tables are ordered such that the * index into the table is known to be either the * run length, or (run length / 64) + a fixed offset. * * NB: The G3CODE_INVALID entries are only used * during state generation (see mkg3states.c). */ #ifdef G3CODES #if defined(__STDC__) || defined(__EXTENDED__) || USE_CONST const tableentry TIFFFaxWhiteCodes[] = { #else tableentry TIFFFaxWhiteCodes[] = { #endif { 8, 0x35, 0 }, /* 0011 0101 */ { 6, 0x7, 1 }, /* 0001 11 */ { 4, 0x7, 2 }, /* 0111 */ { 4, 0x8, 3 }, /* 1000 */ { 4, 0xB, 4 }, /* 1011 */ { 4, 0xC, 5 }, /* 1100 */ { 4, 0xE, 6 }, /* 1110 */ { 4, 0xF, 7 }, /* 1111 */ { 5, 0x13, 8 }, /* 1001 1 */ { 5, 0x14, 9 }, /* 1010 0 */ { 5, 0x7, 10 }, /* 0011 1 */ { 5, 0x8, 11 }, /* 0100 0 */ { 6, 0x8, 12 }, /* 0010 00 */ { 6, 0x3, 13 }, /* 0000 11 */ { 6, 0x34, 14 }, /* 1101 00 */ { 6, 0x35, 15 }, /* 1101 01 */ { 6, 0x2A, 16 }, /* 1010 10 */ { 6, 0x2B, 17 }, /* 1010 11 */ { 7, 0x27, 18 }, /* 0100 111 */ { 7, 0xC, 19 }, /* 0001 100 */ { 7, 0x8, 20 }, /* 0001 000 */ { 7, 0x17, 21 }, /* 0010 111 */ { 7, 0x3, 22 }, /* 0000 011 */ { 7, 0x4, 23 }, /* 0000 100 */ { 7, 0x28, 24 }, /* 0101 000 */ { 7, 0x2B, 25 }, /* 0101 011 */ { 7, 0x13, 26 }, /* 0010 011 */ { 7, 0x24, 27 }, /* 0100 100 */ { 7, 0x18, 28 }, /* 0011 000 */ { 8, 0x2, 29 }, /* 0000 0010 */ { 8, 0x3, 30 }, /* 0000 0011 */ { 8, 0x1A, 31 }, /* 0001 1010 */ { 8, 0x1B, 32 }, /* 0001 1011 */ { 8, 0x12, 33 }, /* 0001 0010 */ { 8, 0x13, 34 }, /* 0001 0011 */ { 8, 0x14, 35 }, /* 0001 0100 */ { 8, 0x15, 36 }, /* 0001 0101 */ { 8, 0x16, 37 }, /* 0001 0110 */ { 8, 0x17, 38 }, /* 0001 0111 */ { 8, 0x28, 39 }, /* 0010 1000 */ { 8, 0x29, 40 }, /* 0010 1001 */ { 8, 0x2A, 41 }, /* 0010 1010 */ { 8, 0x2B, 42 }, /* 0010 1011 */ { 8, 0x2C, 43 }, /* 0010 1100 */ { 8, 0x2D, 44 }, /* 0010 1101 */ { 8, 0x4, 45 }, /* 0000 0100 */ { 8, 0x5, 46 }, /* 0000 0101 */ { 8, 0xA, 47 }, /* 0000 1010 */ { 8, 0xB, 48 }, /* 0000 1011 */ { 8, 0x52, 49 }, /* 0101 0010 */ { 8, 0x53, 50 }, /* 0101 0011 */ { 8, 0x54, 51 }, /* 0101 0100 */ { 8, 0x55, 52 }, /* 0101 0101 */ { 8, 0x24, 53 }, /* 0010 0100 */ { 8, 0x25, 54 }, /* 0010 0101 */ { 8, 0x58, 55 }, /* 0101 1000 */ { 8, 0x59, 56 }, /* 0101 1001 */ { 8, 0x5A, 57 }, /* 0101 1010 */ { 8, 0x5B, 58 }, /* 0101 1011 */ { 8, 0x4A, 59 }, /* 0100 1010 */ { 8, 0x4B, 60 }, /* 0100 1011 */ { 8, 0x32, 61 }, /* 0011 0010 */ { 8, 0x33, 62 }, /* 0011 0011 */ { 8, 0x34, 63 }, /* 0011 0100 */ { 5, 0x1B, 64 }, /* 1101 1 */ { 5, 0x12, 128 }, /* 1001 0 */ { 6, 0x17, 192 }, /* 0101 11 */ { 7, 0x37, 256 }, /* 0110 111 */ { 8, 0x36, 320 }, /* 0011 0110 */ { 8, 0x37, 384 }, /* 0011 0111 */ { 8, 0x64, 448 }, /* 0110 0100 */ { 8, 0x65, 512 }, /* 0110 0101 */ { 8, 0x68, 576 }, /* 0110 1000 */ { 8, 0x67, 640 }, /* 0110 0111 */ { 9, 0xCC, 704 }, /* 0110 0110 0 */ { 9, 0xCD, 768 }, /* 0110 0110 1 */ { 9, 0xD2, 832 }, /* 0110 1001 0 */ { 9, 0xD3, 896 }, /* 0110 1001 1 */ { 9, 0xD4, 960 }, /* 0110 1010 0 */ { 9, 0xD5, 1024 }, /* 0110 1010 1 */ { 9, 0xD6, 1088 }, /* 0110 1011 0 */ { 9, 0xD7, 1152 }, /* 0110 1011 1 */ { 9, 0xD8, 1216 }, /* 0110 1100 0 */ { 9, 0xD9, 1280 }, /* 0110 1100 1 */ { 9, 0xDA, 1344 }, /* 0110 1101 0 */ { 9, 0xDB, 1408 }, /* 0110 1101 1 */ { 9, 0x98, 1472 }, /* 0100 1100 0 */ { 9, 0x99, 1536 }, /* 0100 1100 1 */ { 9, 0x9A, 1600 }, /* 0100 1101 0 */ { 6, 0x18, 1664 }, /* 0110 00 */ { 9, 0x9B, 1728 }, /* 0100 1101 1 */ { 11, 0x8, 1792 }, /* 0000 0001 000 */ { 11, 0xC, 1856 }, /* 0000 0001 100 */ { 11, 0xD, 1920 }, /* 0000 0001 101 */ { 12, 0x12, 1984 }, /* 0000 0001 0010 */ { 12, 0x13, 2048 }, /* 0000 0001 0011 */ { 12, 0x14, 2112 }, /* 0000 0001 0100 */ { 12, 0x15, 2176 }, /* 0000 0001 0101 */ { 12, 0x16, 2240 }, /* 0000 0001 0110 */ { 12, 0x17, 2304 }, /* 0000 0001 0111 */ { 12, 0x1C, 2368 }, /* 0000 0001 1100 */ { 12, 0x1D, 2432 }, /* 0000 0001 1101 */ { 12, 0x1E, 2496 }, /* 0000 0001 1110 */ { 12, 0x1F, 2560 }, /* 0000 0001 1111 */ { 12, 0x1, G3CODE_EOL }, /* 0000 0000 0001 */ { 9, 0x1, G3CODE_INVALID }, /* 0000 0000 1 */ { 10, 0x1, G3CODE_INVALID }, /* 0000 0000 01 */ { 11, 0x1, G3CODE_INVALID }, /* 0000 0000 001 */ { 12, 0x0, G3CODE_INVALID }, /* 0000 0000 0000 */ }; #if defined(__STDC__) || defined(__EXTENDED__) || USE_CONST const tableentry TIFFFaxBlackCodes[] = { #else tableentry TIFFFaxBlackCodes[] = { #endif { 10, 0x37, 0 }, /* 0000 1101 11 */ { 3, 0x2, 1 }, /* 010 */ { 2, 0x3, 2 }, /* 11 */ { 2, 0x2, 3 }, /* 10 */ { 3, 0x3, 4 }, /* 011 */ { 4, 0x3, 5 }, /* 0011 */ { 4, 0x2, 6 }, /* 0010 */ { 5, 0x3, 7 }, /* 0001 1 */ { 6, 0x5, 8 }, /* 0001 01 */ { 6, 0x4, 9 }, /* 0001 00 */ { 7, 0x4, 10 }, /* 0000 100 */ { 7, 0x5, 11 }, /* 0000 101 */ { 7, 0x7, 12 }, /* 0000 111 */ { 8, 0x4, 13 }, /* 0000 0100 */ { 8, 0x7, 14 }, /* 0000 0111 */ { 9, 0x18, 15 }, /* 0000 1100 0 */ { 10, 0x17, 16 }, /* 0000 0101 11 */ { 10, 0x18, 17 }, /* 0000 0110 00 */ { 10, 0x8, 18 }, /* 0000 0010 00 */ { 11, 0x67, 19 }, /* 0000 1100 111 */ { 11, 0x68, 20 }, /* 0000 1101 000 */ { 11, 0x6C, 21 }, /* 0000 1101 100 */ { 11, 0x37, 22 }, /* 0000 0110 111 */ { 11, 0x28, 23 }, /* 0000 0101 000 */ { 11, 0x17, 24 }, /* 0000 0010 111 */ { 11, 0x18, 25 }, /* 0000 0011 000 */ { 12, 0xCA, 26 }, /* 0000 1100 1010 */ { 12, 0xCB, 27 }, /* 0000 1100 1011 */ { 12, 0xCC, 28 }, /* 0000 1100 1100 */ { 12, 0xCD, 29 }, /* 0000 1100 1101 */ { 12, 0x68, 30 }, /* 0000 0110 1000 */ { 12, 0x69, 31 }, /* 0000 0110 1001 */ { 12, 0x6A, 32 }, /* 0000 0110 1010 */ { 12, 0x6B, 33 }, /* 0000 0110 1011 */ { 12, 0xD2, 34 }, /* 0000 1101 0010 */ { 12, 0xD3, 35 }, /* 0000 1101 0011 */ { 12, 0xD4, 36 }, /* 0000 1101 0100 */ { 12, 0xD5, 37 }, /* 0000 1101 0101 */ { 12, 0xD6, 38 }, /* 0000 1101 0110 */ { 12, 0xD7, 39 }, /* 0000 1101 0111 */ { 12, 0x6C, 40 }, /* 0000 0110 1100 */ { 12, 0x6D, 41 }, /* 0000 0110 1101 */ { 12, 0xDA, 42 }, /* 0000 1101 1010 */ { 12, 0xDB, 43 }, /* 0000 1101 1011 */ { 12, 0x54, 44 }, /* 0000 0101 0100 */ { 12, 0x55, 45 }, /* 0000 0101 0101 */ { 12, 0x56, 46 }, /* 0000 0101 0110 */ { 12, 0x57, 47 }, /* 0000 0101 0111 */ { 12, 0x64, 48 }, /* 0000 0110 0100 */ { 12, 0x65, 49 }, /* 0000 0110 0101 */ { 12, 0x52, 50 }, /* 0000 0101 0010 */ { 12, 0x53, 51 }, /* 0000 0101 0011 */ { 12, 0x24, 52 }, /* 0000 0010 0100 */ { 12, 0x37, 53 }, /* 0000 0011 0111 */ { 12, 0x38, 54 }, /* 0000 0011 1000 */ { 12, 0x27, 55 }, /* 0000 0010 0111 */ { 12, 0x28, 56 }, /* 0000 0010 1000 */ { 12, 0x58, 57 }, /* 0000 0101 1000 */ { 12, 0x59, 58 }, /* 0000 0101 1001 */ { 12, 0x2B, 59 }, /* 0000 0010 1011 */ { 12, 0x2C, 60 }, /* 0000 0010 1100 */ { 12, 0x5A, 61 }, /* 0000 0101 1010 */ { 12, 0x66, 62 }, /* 0000 0110 0110 */ { 12, 0x67, 63 }, /* 0000 0110 0111 */ { 10, 0xF, 64 }, /* 0000 0011 11 */ { 12, 0xC8, 128 }, /* 0000 1100 1000 */ { 12, 0xC9, 192 }, /* 0000 1100 1001 */ { 12, 0x5B, 256 }, /* 0000 0101 1011 */ { 12, 0x33, 320 }, /* 0000 0011 0011 */ { 12, 0x34, 384 }, /* 0000 0011 0100 */ { 12, 0x35, 448 }, /* 0000 0011 0101 */ { 13, 0x6C, 512 }, /* 0000 0011 0110 0 */ { 13, 0x6D, 576 }, /* 0000 0011 0110 1 */ { 13, 0x4A, 640 }, /* 0000 0010 0101 0 */ { 13, 0x4B, 704 }, /* 0000 0010 0101 1 */ { 13, 0x4C, 768 }, /* 0000 0010 0110 0 */ { 13, 0x4D, 832 }, /* 0000 0010 0110 1 */ { 13, 0x72, 896 }, /* 0000 0011 1001 0 */ { 13, 0x73, 960 }, /* 0000 0011 1001 1 */ { 13, 0x74, 1024 }, /* 0000 0011 1010 0 */ { 13, 0x75, 1088 }, /* 0000 0011 1010 1 */ { 13, 0x76, 1152 }, /* 0000 0011 1011 0 */ { 13, 0x77, 1216 }, /* 0000 0011 1011 1 */ { 13, 0x52, 1280 }, /* 0000 0010 1001 0 */ { 13, 0x53, 1344 }, /* 0000 0010 1001 1 */ { 13, 0x54, 1408 }, /* 0000 0010 1010 0 */ { 13, 0x55, 1472 }, /* 0000 0010 1010 1 */ { 13, 0x5A, 1536 }, /* 0000 0010 1101 0 */ { 13, 0x5B, 1600 }, /* 0000 0010 1101 1 */ { 13, 0x64, 1664 }, /* 0000 0011 0010 0 */ { 13, 0x65, 1728 }, /* 0000 0011 0010 1 */ { 11, 0x8, 1792 }, /* 0000 0001 000 */ { 11, 0xC, 1856 }, /* 0000 0001 100 */ { 11, 0xD, 1920 }, /* 0000 0001 101 */ { 12, 0x12, 1984 }, /* 0000 0001 0010 */ { 12, 0x13, 2048 }, /* 0000 0001 0011 */ { 12, 0x14, 2112 }, /* 0000 0001 0100 */ { 12, 0x15, 2176 }, /* 0000 0001 0101 */ { 12, 0x16, 2240 }, /* 0000 0001 0110 */ { 12, 0x17, 2304 }, /* 0000 0001 0111 */ { 12, 0x1C, 2368 }, /* 0000 0001 1100 */ { 12, 0x1D, 2432 }, /* 0000 0001 1101 */ { 12, 0x1E, 2496 }, /* 0000 0001 1110 */ { 12, 0x1F, 2560 }, /* 0000 0001 1111 */ { 12, 0x1, G3CODE_EOL }, /* 0000 0000 0001 */ { 9, 0x1, G3CODE_INVALID }, /* 0000 0000 1 */ { 10, 0x1, G3CODE_INVALID }, /* 0000 0000 01 */ { 11, 0x1, G3CODE_INVALID }, /* 0000 0000 001 */ { 12, 0x0, G3CODE_INVALID }, /* 0000 0000 0000 */ }; #else #if defined(__STDC__) || defined(__EXTENDED__) || USE_CONST extern const tableentry TIFFFaxWhiteCodes[]; extern const tableentry TIFFFaxBlackCodes[]; #else extern tableentry TIFFFaxWhiteCodes[]; extern tableentry TIFFFaxBlackCodes[]; #endif /* !__STDC__ */ #endif #endif /* _T4_ */ neuron-7.6.3/src/lib/TIFF/tif_aux.c000077500000000000000000000126631340731477100167470ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_aux.c,v 1.2 1997/03/26 15:07:02 hines Exp"; #endif /* * Copyright (c) 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * Auxiliary Support Routines. */ #include "tiffioP.h" #include "prototypes.h" /* * Like TIFFGetField, but return any default * value if the tag is not present in the directory. * * NB: We use the value in the directory, rather than * explcit values so that defaults exist only one * place in the library -- in TIFFDefaultDirectory. */ int TIFFVGetFieldDefaulted(tif, tag, ap) TIFF *tif; int tag; va_list ap; { TIFFDirectory *td = &tif->tif_dir; int i; if (TIFFVGetField(tif, tag, ap)) return (1); switch (tag) { case TIFFTAG_SUBFILETYPE: *va_arg(ap, u_short *) = td->td_subfiletype; return (1); case TIFFTAG_BITSPERSAMPLE: *va_arg(ap, u_short *) = td->td_bitspersample; return (1); case TIFFTAG_THRESHHOLDING: *va_arg(ap, u_short *) = td->td_threshholding; return (1); case TIFFTAG_FILLORDER: *va_arg(ap, u_short *) = td->td_fillorder; return (1); case TIFFTAG_ORIENTATION: *va_arg(ap, u_short *) = td->td_orientation; return (1); case TIFFTAG_SAMPLESPERPIXEL: *va_arg(ap, u_short *) = td->td_samplesperpixel; return (1); case TIFFTAG_ROWSPERSTRIP: *va_arg(ap, u_long *) = td->td_rowsperstrip; return (1); case TIFFTAG_MINSAMPLEVALUE: *va_arg(ap, u_short *) = td->td_minsamplevalue; return (1); case TIFFTAG_MAXSAMPLEVALUE: *va_arg(ap, u_short *) = td->td_maxsamplevalue; return (1); case TIFFTAG_PLANARCONFIG: *va_arg(ap, u_short *) = td->td_planarconfig; return (1); case TIFFTAG_GROUP4OPTIONS: *va_arg(ap, u_long *) = td->td_group4options; return (1); case TIFFTAG_RESOLUTIONUNIT: *va_arg(ap, u_short *) = td->td_resolutionunit; return (1); case TIFFTAG_PREDICTOR: *va_arg(ap, u_short *) = td->td_predictor; return (1); #ifdef CMYK_SUPPORT case TIFFTAG_DOTRANGE: *va_arg(ap, u_short *) = 0; *va_arg(ap, u_short *) = (1<td_bitspersample)-1; return (1); case TIFFTAG_INKSET: *va_arg(ap, u_short *) = td->td_inkset; return (1); #endif case TIFFTAG_TILEDEPTH: *va_arg(ap, u_long *) = td->td_tiledepth; return (1); case TIFFTAG_DATATYPE: *va_arg(ap, u_short *) = td->td_sampleformat-1; return (1); case TIFFTAG_IMAGEDEPTH: *va_arg(ap, u_short *) = td->td_imagedepth; return (1); #ifdef YCBCR_SUPPORT case TIFFTAG_YCBCRCOEFFICIENTS: if (!td->td_ycbcrcoeffs) { td->td_ycbcrcoeffs = (float *)malloc(3*sizeof (float)); /* defaults are from CCIR Recommendation 601-1 */ td->td_ycbcrcoeffs[0] = .299; td->td_ycbcrcoeffs[1] = .587; td->td_ycbcrcoeffs[2] = .114; } *va_arg(ap, float **) = td->td_ycbcrcoeffs; return (1); case TIFFTAG_YCBCRSUBSAMPLING: *va_arg(ap, u_short *) = td->td_ycbcrsubsampling[0]; *va_arg(ap, u_short *) = td->td_ycbcrsubsampling[1]; return (1); case TIFFTAG_YCBCRPOSITIONING: *va_arg(ap, u_short *) = td->td_ycbcrpositioning; return (1); #endif #ifdef COLORIMETRY_SUPPORT case TIFFTAG_TRANSFERFUNCTION: if (!td->td_transferfunction[0]) { u_short **tf = td->td_transferfunction; int n = 1<td_bitspersample; tf[0] = (u_short *)malloc(n * sizeof (u_short)); tf[0][0] = 0; for (i = 1; i < n; i++) tf[0][i] = (u_short) floor(65535.*pow(i/(n-1.), 2.2) + .5); for (i = 1; i < td->td_samplesperpixel; i++) { tf[i] = (u_short *)malloc(n * sizeof (u_short)); bcopy(tf[0], tf[i], n * sizeof (u_short)); } } for (i = 0; i < td->td_samplesperpixel; i++) *va_arg(ap, u_short **) = td->td_transferfunction[i]; return (1); case TIFFTAG_REFERENCEBLACKWHITE: if (!td->td_refblackwhite) { td->td_refblackwhite = (float *) malloc(2*td->td_samplesperpixel * sizeof (float)); for (i = 0; i < td->td_samplesperpixel; i++) { td->td_refblackwhite[2*i+0] = 0; td->td_refblackwhite[2*i+1] = 1L<td_bitspersample; } } *va_arg(ap, float **) = td->td_refblackwhite; return (1); #endif } return (0); } /* * Like TIFFGetField, but return any default * value if the tag is not present in the directory. */ /*VARARGS2*/ int DECLARE2V(TIFFGetFieldDefaulted, TIFF*, tif, int, tag) { int ok; va_list ap; VA_START(ap, tag); ok = TIFFVGetFieldDefaulted(tif, tag, ap); va_end(ap); return (ok); } neuron-7.6.3/src/lib/TIFF/tif_ccittrle.c000077500000000000000000000052371340731477100177620ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_ccittrle.c,v 1.2 1997/03/26 15:07:02 hines Exp"; #endif /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * CCITT Group 3 1-D Modified Huffman * Run Length Encoding Compression Support */ #include "tiffioP.h" #include "tif_fax3.h" extern int TIFFInitCCITTFax3(TIFF*); int TIFFInitCCITTRLE(tif) TIFF *tif; { TIFFInitCCITTFax3(tif); /* reuse G3 compression */ tif->tif_preencode = NULL; tif->tif_postencode = NULL; tif->tif_encoderow = TIFFNoRowEncode; tif->tif_encodestrip = TIFFNoStripEncode; tif->tif_encodetile = TIFFNoTileEncode; tif->tif_close = NULL; /* * This magic causes the regular G3 decompression * code to not skip to the EOL mark at the end of * a row, and to flush input data to a byte boundary * at the end of each row. */ tif->tif_options |= FAX3_NOEOL|FAX3_BYTEALIGN; return (1); } int TIFFInitCCITTRLEW(tif) TIFF *tif; { TIFFInitCCITTFax3(tif); /* reuse G3 compression */ tif->tif_preencode = NULL; tif->tif_postencode = NULL; tif->tif_encoderow = TIFFNoRowEncode; tif->tif_encodestrip = TIFFNoStripEncode; tif->tif_encodetile = TIFFNoTileEncode; tif->tif_close = NULL; /* * This magic causes the regular G3 decompression * code to not skip to the EOL mark at the end of * a row, and to flush input data to a byte boundary * at the end of each row. */ tif->tif_options |= FAX3_NOEOL|FAX3_WORDALIGN; return (1); } neuron-7.6.3/src/lib/TIFF/tif_close.c000077500000000000000000000037731340731477100172610ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_close.c,v 1.2 1997/03/26 15:07:03 hines Exp"; #endif /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. */ #include #include "tiffioP.h" #if USE_PROTOTYPES extern int TIFFFreeDirectory(TIFF*); #else extern int TIFFFreeDirectory(); #endif void TIFFClose(tif) TIFF *tif; { if (tif->tif_mode != O_RDONLY) /* * Flush buffered data and directory (if dirty). */ TIFFFlush(tif); if (tif->tif_cleanup) (*tif->tif_cleanup)(tif); TIFFFreeDirectory(tif); if (tif->tif_rawdata && (tif->tif_flags&TIFF_MYBUFFER)) free(tif->tif_rawdata); #ifdef MMAP_SUPPORT if (isMapped(tif)) TIFFUnmapFileContents(tif->tif_base, tif->tif_size); #endif (void) close(tif->tif_fd); free((char *)tif); } neuron-7.6.3/src/lib/TIFF/tif_cmprs.c000077500000000000000000000130241340731477100172660ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_cmprs.c,v 1.1 1997/03/31 16:45:21 hines Exp"; #endif /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library * * Compression Scheme Configuration Support. */ #include "tiffioP.h" #if USE_PROTOTYPES extern int TIFFInitDumpMode(TIFF*); #ifdef PACKBITS_SUPPORT extern int TIFFInitPackBits(TIFF*); #endif #ifdef CCITT_SUPPORT extern int TIFFInitCCITTRLE(TIFF*), TIFFInitCCITTRLEW(TIFF*); extern int TIFFInitCCITTFax3(TIFF*), TIFFInitCCITTFax4(TIFF*); #endif #ifdef THUNDER_SUPPORT extern int TIFFInitThunderScan(TIFF*); #endif #ifdef NEXT_SUPPORT extern int TIFFInitNeXT(TIFF*); #endif #ifdef LZW_SUPPORT extern int TIFFInitLZW(TIFF*); #endif #ifdef JPEG_SUPPORT extern int TIFFInitJPEG(TIFF*); #endif #else extern int TIFFInitDumpMode(); #ifdef PACKBITS_SUPPORT extern int TIFFInitPackBits(); #endif #ifdef CCITT_SUPPORT extern int TIFFInitCCITTRLE(), TIFFInitCCITTRLEW(); extern int TIFFInitCCITTFax3(), TIFFInitCCITTFax4(); #endif #ifdef THUNDER_SUPPORT extern int TIFFInitThunderScan(); #endif #ifdef NEXT_SUPPORT extern int TIFFInitNeXT(); #endif #ifdef LZW_SUPPORT extern int TIFFInitLZW(); #endif #ifdef JPEG_SUPPORT extern int TIFFInitJPEG(); #endif #endif struct cscheme { char* name; int scheme; int (*init)(); }; static const struct cscheme CompressionSchemes[] = { { "Null", COMPRESSION_NONE, TIFFInitDumpMode }, #ifdef LZW_SUPPORT { "LZW", COMPRESSION_LZW, TIFFInitLZW }, #endif #ifdef PACKBITS_SUPPORT { "PackBits", COMPRESSION_PACKBITS, TIFFInitPackBits }, #endif #ifdef THUNDER_SUPPORT { "ThunderScan", COMPRESSION_THUNDERSCAN,TIFFInitThunderScan }, #endif #ifdef NEXT_SUPPORT { "NeXT", COMPRESSION_NEXT, TIFFInitNeXT }, #endif #ifdef JPEG_SUPPORT { "JPEG", COMPRESSION_JPEG, TIFFInitJPEG }, #endif #ifdef CCITT_SUPPORT { "CCITT RLE", COMPRESSION_CCITTRLE, TIFFInitCCITTRLE }, { "CCITT RLE/W", COMPRESSION_CCITTRLEW, TIFFInitCCITTRLEW }, { "CCITT Group3", COMPRESSION_CCITTFAX3, TIFFInitCCITTFax3 }, { "CCITT Group4", COMPRESSION_CCITTFAX4, TIFFInitCCITTFax4 }, #endif }; #define NSCHEMES (sizeof (CompressionSchemes) / sizeof (CompressionSchemes[0])) static struct cscheme const * findScheme(scheme) int scheme; { register struct cscheme const *c; for (c = CompressionSchemes; c < &CompressionSchemes[NSCHEMES]; c++) if (c->scheme == scheme) return (c); return ((struct cscheme const *)0); } static int TIFFNoEncode(tif, method) TIFF *tif; char *method; { struct cscheme const *c = findScheme(tif->tif_dir.td_compression); TIFFError(tif->tif_name, "%s %s encoding is not implemented", c->name, method); return (-1); } int TIFFNoRowEncode(tif, pp, cc, s) TIFF *tif; u_char *pp; int cc; u_int s; { return (TIFFNoEncode(tif, "scanline")); } int TIFFNoStripEncode(tif, pp, cc, s) TIFF *tif; u_char *pp; int cc; u_int s; { return (TIFFNoEncode(tif, "strip")); } int TIFFNoTileEncode(tif, pp, cc, s) TIFF *tif; u_char *pp; int cc; u_int s; { return (TIFFNoEncode(tif, "tile")); } int TIFFNoDecode(tif, method) TIFF *tif; char *method; { struct cscheme const *c = findScheme(tif->tif_dir.td_compression); TIFFError(tif->tif_name, "%s %s decoding is not implemented", c->name, method); return (-1); } int TIFFNoRowDecode(tif, pp, cc, s) TIFF *tif; u_char *pp; int cc; u_int s; { return (TIFFNoDecode(tif, "scanline")); } int TIFFNoStripDecode(tif, pp, cc, s) TIFF *tif; u_char *pp; int cc; u_int s; { return (TIFFNoDecode(tif, "strip")); } int TIFFNoTileDecode(tif, pp, cc, s) TIFF *tif; u_char *pp; int cc; u_int s; { return (TIFFNoDecode(tif, "tile")); } int TIFFSetCompressionScheme(tif, scheme) TIFF *tif; int scheme; { struct cscheme const *c = findScheme(scheme); if (!c) { TIFFError(tif->tif_name, "Unknown data compression algorithm %u (0x%x)", scheme, scheme); return (0); } tif->tif_predecode = NULL; tif->tif_decoderow = TIFFNoRowDecode; tif->tif_decodestrip = TIFFNoStripDecode; tif->tif_decodetile = TIFFNoTileDecode; tif->tif_preencode = NULL; tif->tif_postencode = NULL; tif->tif_encoderow = TIFFNoRowEncode; tif->tif_encodestrip = TIFFNoStripEncode; tif->tif_encodetile = TIFFNoTileEncode; tif->tif_close = NULL; tif->tif_seek = NULL; tif->tif_cleanup = NULL; tif->tif_flags &= ~TIFF_NOBITREV; tif->tif_options = 0; return ((*c->init)(tif)); } neuron-7.6.3/src/lib/TIFF/tif_compat.c000077500000000000000000000136761340731477100174420ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_compat.c,v 1.2 1997/03/26 15:07:04 hines Exp"; #endif /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library Compatibility Routines. */ #include "tiffioP.h" #if defined(HAVE_SYS_STAT_H) || defined(unix) || defined(__unix) || defined(MSDOS) || defined(VMS) || defined(AIXV3) #include long TIFFGetFileSize(fd) int fd; { struct stat sb; return (fstat(fd, &sb) < 0 ? 0 : sb.st_size); } #endif #if (defined(HAVE_SYS_MMAN_H) || defined(unix) || defined(__unix)) && defined(MMAP_SUPPORT) #include int TIFFMapFileContents(fd, pbase, psize) int fd; char **pbase; long *psize; { long size = TIFFGetFileSize(fd); if (size != -1) { *pbase = (char *) mmap(0, size, PROT_READ, MAP_SHARED, fd, 0); if (*pbase != (char *)-1) { *psize = size; return (1); } } return (0); } void TIFFUnmapFileContents(base, size) char *base; long size; { (void) munmap(base, size); } #endif /* (defined(unix) || defined(__unix)) && defined(MMAP_SUPPORT) */ #if defined(VMS) && defined(MMAP_SUPPORT) #include #include /* * Table for storing information on current open sections. * (You may want to substitute a linked list...) */ #define MAX_MAPPED 100 static int no_mapped = 0; static struct { void *base; void *top; unsigned channel; } map_table[MAX_MAPPED]; /* * This routine maps a file into a private section. Note that this * method of accessing a file is by far the fastest under VMS. * The routine may fail (i.e. return 0) for several reasons, for * example: * - There is no more room for storing the info on sections. * - The process is out of open file quota, channels, ... * - fd does not describe an opened file. * - The file is already opened for write access by this process * or another process * - There is no free "hole" in virtual memory that fits the * size of the file */ int TIFFMapFileContents(fd, pbase, psize) int fd; char **pbase; long *psize; { char name[256]; struct FAB fab; unsigned short channel; void *inadr[2], *retadr[2]; unsigned long status; long size; if (no_mapped >= MAX_MAPPED) return(0); /* * We cannot use a file descriptor, we * must open the file once more. */ if (getname(fd, name, 1) == NULL) return(0); /* prepare the FAB for a user file open */ fab = cc$rms_fab; fab.fab$v_ufo = 1; fab.fab$b_fac = FAB$M_GET; fab.fab$b_shr = FAB$M_SHRGET; fab.fab$l_fna = name; fab.fab$b_fns = strlen(name); status = sys$open(&fab); /* open file & get channel number */ if ((status&1) == 0) return(0); channel = (unsigned short)fab.fab$l_stv; inadr[0] = inadr[1] = &channel; /* just an address in P0 space */ /* * Map the blocks of the file up to * the EOF block into virtual memory. */ size = TIFFGetFileSize(fd); status = sys$crmpsc(inadr, retadr, 0, SEC$M_EXPREG, 0,0,0, channel, howmany(size,512), 0,0,0); if ((status&1) == 0) return(0); *pbase = retadr[0]; /* starting virtual address */ /* * Use the size of the file up to the * EOF mark for UNIX compatibility. */ *psize = size; /* Record the section in the table */ map_table[no_mapped].base = retadr[0]; map_table[no_mapped].top = retadr[1]; map_table[no_mapped].channel = channel; no_mapped++; return(1); } /* * This routine unmaps a section from the virtual address space of * the process, but only if the base was the one returned from a * call to TIFFMapFileContents. */ void TIFFUnmapFileContents(base, size) char *base; long size; { void *inadr[2]; int i, j; /* Find the section in the table */ for (i = 0;i < no_mapped; i++) { if (map_table[i].base == base) { /* Unmap the section */ inadr[1] = base; inadr[0] = map_table[i].top; sys$deltva(inadr, 0, 0); sys$dassgn(map_table[i].channel); /* Remove this section from the list */ for (j = i+1; j < no_mapped; j++) map_table[j-1] = map_table[j]; no_mapped--; return; } } } #endif /* defined(VMS) && defined(MMAP_SUPPORT) */ #if defined(THINK_C) || defined(applec) long TIFFGetFileSize(int fd) { long pos, eof; pos = lseek(fd, 0, SEEK_CUR); eof = lseek(fd, 0, SEEK_END); lseek(fd, pos, SEEK_SET); return(eof); } #endif /* THINK_C || applec */ #if defined(applec) #include #include #undef lseek long mpw_lseek(int fd, long offset, int whence) { long filepos, filesize, newpos; short macfd; if ((filepos = lseek(fd, 0, SEEK_CUR)) < 0 || (filesize = lseek(fd, 0, SEEK_END)) < 0) return (EOF); newpos = offset + (whence == SEEK_SET ? 0 : whence == SEEK_CUR ? filepos : filesize); if (newpos > filesize) if (ioctl(fd, FIOREFNUM, &macfd) == -1 || SetEOF(macfd, newpos) != 0) return (EOF); return (lseek(fd, newpos, SEEK_SET)); } #endif /* applec */ neuron-7.6.3/src/lib/TIFF/tif_dir.c000077500000000000000000000620561340731477100167310ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_dir.c,v 1.2 1997/03/26 15:07:05 hines Exp"; #endif /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * Directory Tag Get & Set Routines. * (and also some miscellaneous stuff) * * NB: Beware of the varargs declarations for routines in * this file. The names and types of variables has been * carefully chosen to make things work with compilers that * are busted in one way or another (e.g. SGI/MIPS). */ #include #include #include "tiffioP.h" #include "prototypes.h" extern int TIFFSetCompressionScheme(TIFF *, int); static void DECLARE2(setString, char**, cpp, char*, cp) { if (*cpp) free(*cpp), *cpp = 0; if (cp) { int len = strlen(cp)+1; if ((*cpp = malloc(len))) bcopy(cp, *cpp, len); } } static void DECLARE3(setShortArray, u_short**, wpp, u_short*, wp, long, n) { if (*wpp) free((char *)*wpp), *wpp = 0; n *= sizeof (u_short); if (wp && (*wpp = (u_short *)malloc(n))) bcopy(wp, *wpp, n); } static void DECLARE3(setLongArray, u_long**, wpp, u_long*, wp, long, n) { if (*wpp) free((char *)*wpp), *wpp = 0; n *= sizeof (u_long); if (wp && (*wpp = (u_long *)malloc(n))) bcopy(wp, *wpp, n); } static void DECLARE3(setFloatArray, float**, wpp, float*, wp, long, n) { if (*wpp) free((char *)*wpp), *wpp = 0; n *= sizeof (float); if (wp && (*wpp = (float *)malloc(n))) bcopy(wp, *wpp, n); } #ifdef JPEG_SUPPORT /* * Install a JPEG Quantization table. * Note that we reorder the elements * of the array in the zig-zag order * that is expected by the compression code * and that is to be stored in the file. */ static void DECLARE3(setJPEGQTable, u_char***, wpp, u_char**, wp, int, nc) { static u_char zigzag[64] = { 0, 1, 5, 6, 14, 15, 27, 28, 2, 4, 7, 13, 16, 26, 29, 42, 3, 8, 12, 17, 25, 30, 41, 43, 9, 11, 18, 24, 31, 40, 44, 53, 10, 19, 23, 32, 39, 45, 52, 54, 20, 22, 33, 38, 46, 51, 55, 60, 21, 34, 37, 47, 50, 56, 59, 61, 35, 36, 48, 49, 57, 58, 62, 63 }; char *tab; int i, j; if (*wpp) free((char *)*wpp), *wpp = 0; *wpp = (u_char **) malloc(nc * (sizeof (u_char *) + 64*sizeof (u_char))); tab = (((char *)*wpp) + nc*sizeof (u_short *)); for (i = 0; i < nc; i++) { (*wpp)[i] = (u_char *)tab; for (j = 0; j < 64; j++) tab[zigzag[j]] = wp[i][j]; tab += 64*sizeof (u_char); } } /* * Install a JPEG Coefficient table. */ static void DECLARE3(setJPEGCTable, u_char***, cpp, u_char**, cp, int, nc) { u_char *tab; int i, j, nw; if (*cpp) free(*cpp), *cpp = 0; /* * Calculate the size of the table by counting * the number of codes specified in the bits array. */ nw = 0; for (i = 0; i < nc; i++) { nw += 16; /* 16 bytes for bits array */ for (j = 0; j < 16; j++)/* sum up count of codes */ nw += cp[i][j]; } *cpp = (u_char **)malloc(nc*sizeof (u_char *) + nw); tab = ((u_char *)*cpp) + nc*sizeof (u_char *); /* * Setup internal array and copy user data. */ for (i = 0; i < nc; i++) { (*cpp)[i] = tab; for (nw = 16, j = 0; j < 16; j++) nw += cp[i][j]; bcopy(cp[i], tab, nw); tab += nw; } } #endif static int TIFFSetField1(tif, tag, ap) TIFF *tif; int tag; va_list ap; { TIFFDirectory *td = &tif->tif_dir; int i, status = 1; long v; switch (tag) { case TIFFTAG_SUBFILETYPE: td->td_subfiletype = va_arg(ap, u_long); break; case TIFFTAG_IMAGEWIDTH: td->td_imagewidth = va_arg(ap, u_long); break; case TIFFTAG_IMAGELENGTH: td->td_imagelength = va_arg(ap, u_long); break; case TIFFTAG_BITSPERSAMPLE: td->td_bitspersample = va_arg(ap, int); break; case TIFFTAG_COMPRESSION: v = va_arg(ap, int) & 0xffff; /* * If we're changing the compression scheme, * the notify the previous module so that it * can cleanup any state it's setup. */ if (TIFFFieldSet(tif, FIELD_COMPRESSION)) { if (td->td_compression == v) break; if (tif->tif_cleanup) (*tif->tif_cleanup)(tif); } /* * Setup new compression routine state. */ if ((status = TIFFSetCompressionScheme(tif, v))) td->td_compression = v; break; case TIFFTAG_PHOTOMETRIC: td->td_photometric = va_arg(ap, int); break; case TIFFTAG_THRESHHOLDING: td->td_threshholding = va_arg(ap, int); break; case TIFFTAG_FILLORDER: v = va_arg(ap, int); if (v != FILLORDER_LSB2MSB && v != FILLORDER_MSB2LSB) goto badvalue; td->td_fillorder = v; break; case TIFFTAG_DOCUMENTNAME: setString(&td->td_documentname, va_arg(ap, char *)); break; case TIFFTAG_ARTIST: setString(&td->td_artist, va_arg(ap, char *)); break; case TIFFTAG_DATETIME: setString(&td->td_datetime, va_arg(ap, char *)); break; case TIFFTAG_HOSTCOMPUTER: setString(&td->td_hostcomputer, va_arg(ap, char *)); break; case TIFFTAG_IMAGEDESCRIPTION: setString(&td->td_imagedescription, va_arg(ap, char *)); break; case TIFFTAG_MAKE: setString(&td->td_make, va_arg(ap, char *)); break; case TIFFTAG_MODEL: setString(&td->td_model, va_arg(ap, char *)); break; case TIFFTAG_SOFTWARE: setString(&td->td_software, va_arg(ap, char *)); break; case TIFFTAG_ORIENTATION: v = va_arg(ap, int); if (v < ORIENTATION_TOPLEFT || ORIENTATION_LEFTBOT < v) { TIFFWarning(tif->tif_name, "Bad value %ld for \"%s\" tag ignored", v, TIFFFieldWithTag(tag)->field_name); } else td->td_orientation = v; break; case TIFFTAG_SAMPLESPERPIXEL: /* XXX should cross check -- e.g. if pallette, then 1 */ v = va_arg(ap, int); if (v == 0) goto badvalue; if (v > 4) { TIFFError(tif->tif_name, "Cannot handle %ld-channel data", v); status = 0; } else td->td_samplesperpixel = v; break; case TIFFTAG_ROWSPERSTRIP: v = va_arg(ap, u_long); if (v == 0) goto badvalue; td->td_rowsperstrip = v; if (!TIFFFieldSet(tif, FIELD_TILEDIMENSIONS)) { td->td_tilelength = v; td->td_tilewidth = td->td_imagewidth; } break; case TIFFTAG_MINSAMPLEVALUE: td->td_minsamplevalue = va_arg(ap, int) & 0xffff; break; case TIFFTAG_MAXSAMPLEVALUE: td->td_maxsamplevalue = va_arg(ap, int) & 0xffff; break; case TIFFTAG_XRESOLUTION: td->td_xresolution = va_arg(ap, dblparam_t); break; case TIFFTAG_YRESOLUTION: td->td_yresolution = va_arg(ap, dblparam_t); break; case TIFFTAG_PLANARCONFIG: v = va_arg(ap, int); if (v != PLANARCONFIG_CONTIG && v != PLANARCONFIG_SEPARATE) goto badvalue; td->td_planarconfig = v; break; case TIFFTAG_PAGENAME: setString(&td->td_pagename, va_arg(ap, char *)); break; case TIFFTAG_XPOSITION: td->td_xposition = va_arg(ap, dblparam_t); break; case TIFFTAG_YPOSITION: td->td_yposition = va_arg(ap, dblparam_t); break; case TIFFTAG_GROUP3OPTIONS: td->td_group3options = va_arg(ap, u_long); break; case TIFFTAG_GROUP4OPTIONS: td->td_group4options = va_arg(ap, u_long); break; case TIFFTAG_RESOLUTIONUNIT: v = va_arg(ap, int); if (v < RESUNIT_NONE || RESUNIT_CENTIMETER < v) goto badvalue; td->td_resolutionunit = v; break; case TIFFTAG_PAGENUMBER: td->td_pagenumber[0] = va_arg(ap, int); td->td_pagenumber[1] = va_arg(ap, int); break; case TIFFTAG_HALFTONEHINTS: td->td_halftonehints[0] = va_arg(ap, int); td->td_halftonehints[1] = va_arg(ap, int); break; case TIFFTAG_COLORMAP: v = 1L<td_bitspersample; setShortArray(&td->td_colormap[0], va_arg(ap, u_short *), v); setShortArray(&td->td_colormap[1], va_arg(ap, u_short *), v); setShortArray(&td->td_colormap[2], va_arg(ap, u_short *), v); break; case TIFFTAG_PREDICTOR: td->td_predictor = va_arg(ap, int); break; case TIFFTAG_EXTRASAMPLES: v = va_arg(ap, int); if (v > td->td_samplesperpixel) goto badvalue; if (v != 1) /* XXX */ goto badvalue; /* XXX */ v = va_arg(ap, int); if (v != EXTRASAMPLE_ASSOCALPHA)/* XXX */ goto badvalue; /* XXX */ td->td_matteing = 1; break; case TIFFTAG_MATTEING: td->td_matteing = va_arg(ap, int); break; case TIFFTAG_BADFAXLINES: td->td_badfaxlines = va_arg(ap, u_long); break; case TIFFTAG_CLEANFAXDATA: td->td_cleanfaxdata = va_arg(ap, int); break; case TIFFTAG_CONSECUTIVEBADFAXLINES: td->td_badfaxrun = va_arg(ap, u_long); break; case TIFFTAG_TILEWIDTH: v = va_arg(ap, u_long); if (v % 8) goto badvalue; td->td_tilewidth = v; tif->tif_flags |= TIFF_ISTILED; break; case TIFFTAG_TILELENGTH: v = va_arg(ap, u_long); if (v % 8) goto badvalue; td->td_tilelength = v; tif->tif_flags |= TIFF_ISTILED; break; case TIFFTAG_TILEDEPTH: v = va_arg(ap, u_long); if (v == 0) goto badvalue; td->td_tiledepth = v; break; case TIFFTAG_DATATYPE: case TIFFTAG_SAMPLEFORMAT: v = va_arg(ap, int); if (tag == TIFFTAG_DATATYPE && v == 0) v = SAMPLEFORMAT_VOID; if (v < SAMPLEFORMAT_INT || SAMPLEFORMAT_VOID < v) goto badvalue; td->td_sampleformat = v; break; case TIFFTAG_IMAGEDEPTH: td->td_imagedepth = va_arg(ap, u_long); break; #ifdef YCBCR_SUPPORT case TIFFTAG_YCBCRCOEFFICIENTS: setFloatArray(&td->td_ycbcrcoeffs, va_arg(ap, float *), 3); break; case TIFFTAG_YCBCRPOSITIONING: td->td_ycbcrpositioning = va_arg(ap, int); break; case TIFFTAG_YCBCRSUBSAMPLING: td->td_ycbcrsubsampling[0] = va_arg(ap, int); td->td_ycbcrsubsampling[1] = va_arg(ap, int); break; #endif #ifdef JPEG_SUPPORT case TIFFTAG_JPEGPROC: td->td_jpegproc = va_arg(ap, int); break; case TIFFTAG_JPEGRESTARTINTERVAL: td->td_jpegrestartinterval = va_arg(ap, int); break; case TIFFTAG_JPEGQTABLES: setJPEGQTable(&td->td_qtab, va_arg(ap, u_char **), td->td_samplesperpixel); break; case TIFFTAG_JPEGDCTABLES: setJPEGCTable(&td->td_dctab, va_arg(ap, u_char **), td->td_samplesperpixel); break; case TIFFTAG_JPEGACTABLES: setJPEGCTable(&td->td_actab, va_arg(ap, u_char **), td->td_samplesperpixel); break; #endif #ifdef COLORIMETRY_SUPPORT case TIFFTAG_WHITEPOINT: setFloatArray(&td->td_whitepoint, va_arg(ap, float *), 2); break; case TIFFTAG_PRIMARYCHROMATICITIES: setFloatArray(&td->td_primarychromas, va_arg(ap, float *), 6); break; case TIFFTAG_TRANSFERFUNCTION: for (i = 0; i < td->td_samplesperpixel; i++) setShortArray(&td->td_transferfunction[i], va_arg(ap, u_short *), 1L<td_bitspersample); break; case TIFFTAG_REFERENCEBLACKWHITE: /* XXX should check for null range */ v = 2 * td->td_samplesperpixel; setFloatArray(&td->td_refblackwhite, va_arg(ap, float *), v); break; #endif #ifdef CMYK_SUPPORT case TIFFTAG_INKSET: td->td_inkset = va_arg(ap, int); break; case TIFFTAG_DOTRANGE: /* XXX should check for null range */ td->td_dotrange[0] = va_arg(ap, int); td->td_dotrange[1] = va_arg(ap, int); break; case TIFFTAG_INKNAMES: setString(&td->td_inknames, va_arg(ap, char *)); break; case TIFFTAG_TARGETPRINTER: setString(&td->td_targetprinter, va_arg(ap, char *)); break; #endif default: TIFFError(tif->tif_name, "Internal error, tag value botch, tag \"%s\"", TIFFFieldWithTag(tag)->field_name); status = 0; break; } if (status) { TIFFSetFieldBit(tif, TIFFFieldWithTag(tag)->field_bit); tif->tif_flags |= TIFF_DIRTYDIRECT; } va_end(ap); return (status); badvalue: TIFFError(tif->tif_name, "%ld: Bad value for \"%s\"", v, TIFFFieldWithTag(tag)->field_name); va_end(ap); return (0); } /* * Return 1/0 according to whether or not * it is permissible to set the tag's value. * Note that we allow ImageLength to be changed * so that we can append and extend to images. * Any other tag may not be altered once writing * has commenced, unless its value has no effect * on the format of the data that is written. */ static int OkToChangeTag(tif, tag) TIFF *tif; int tag; { if (tag != TIFFTAG_IMAGELENGTH && (tif->tif_flags & TIFF_BEENWRITING)) { TIFFFieldInfo const *fip = TIFFFindFieldInfo(tag, TIFF_ANY); /* * Consult info table to see if tag can be changed * after we've started writing. We only allow changes * to those tags that don't/shouldn't affect the * compression and/or format of the data. */ if (fip && !fip->field_oktochange) return (0); } return (1); } /* * Record the value of a field in the * internal directory structure. The * field will be written to the file * when/if the directory structure is * updated. */ /*VARARGS2*/ int DECLARE2V(TIFFSetField, TIFF*, tif, int, tag) { int status = 0; if (OkToChangeTag(tif, tag)) { va_list ap; VA_START(ap, tag); status = TIFFSetField1(tif, tag, ap); va_end(ap); } else { TIFFFieldInfo const *fip = TIFFFindFieldInfo(tag, TIFF_ANY); if (fip) TIFFError("TIFFSetField", "%s: Cannot modify tag \"%s\" while writing", tif->tif_name, fip->field_name); } return (status); } /* * Like TIFFSetField, but taking a varargs * parameter list. This routine is useful * for building higher-level interfaces on * top of the library. */ int TIFFVSetField(tif, tag, ap) TIFF *tif; int tag; va_list ap; { int status = 0; if (!OkToChangeTag(tif, tag)) { TIFFFieldInfo const *fip = TIFFFindFieldInfo(tag, TIFF_ANY); if (fip) TIFFError("TIFFVSetField", "%s: Cannot modify tag \"%s\" while writing", tif->tif_name, fip->field_name); } else status = TIFFSetField1(tif, tag, ap); return (status); } static void TIFFGetField1(td, tag, ap) TIFFDirectory *td; int tag; va_list ap; { switch (tag) { case TIFFTAG_SUBFILETYPE: *va_arg(ap, u_long *) = td->td_subfiletype; break; case TIFFTAG_IMAGEWIDTH: *va_arg(ap, u_long *) = td->td_imagewidth; break; case TIFFTAG_IMAGELENGTH: *va_arg(ap, u_long *) = td->td_imagelength; break; case TIFFTAG_BITSPERSAMPLE: *va_arg(ap, u_short *) = td->td_bitspersample; break; case TIFFTAG_COMPRESSION: *va_arg(ap, u_short *) = td->td_compression; break; case TIFFTAG_PHOTOMETRIC: *va_arg(ap, u_short *) = td->td_photometric; break; case TIFFTAG_THRESHHOLDING: *va_arg(ap, u_short *) = td->td_threshholding; break; case TIFFTAG_FILLORDER: *va_arg(ap, u_short *) = td->td_fillorder; break; case TIFFTAG_DOCUMENTNAME: *va_arg(ap, char **) = td->td_documentname; break; case TIFFTAG_ARTIST: *va_arg(ap, char **) = td->td_artist; break; case TIFFTAG_DATETIME: *va_arg(ap, char **) = td->td_datetime; break; case TIFFTAG_HOSTCOMPUTER: *va_arg(ap, char **) = td->td_hostcomputer; break; case TIFFTAG_IMAGEDESCRIPTION: *va_arg(ap, char **) = td->td_imagedescription; break; case TIFFTAG_MAKE: *va_arg(ap, char **) = td->td_make; break; case TIFFTAG_MODEL: *va_arg(ap, char **) = td->td_model; break; case TIFFTAG_SOFTWARE: *va_arg(ap, char **) = td->td_software; break; case TIFFTAG_ORIENTATION: *va_arg(ap, u_short *) = td->td_orientation; break; case TIFFTAG_SAMPLESPERPIXEL: *va_arg(ap, u_short *) = td->td_samplesperpixel; break; case TIFFTAG_ROWSPERSTRIP: *va_arg(ap, u_long *) = td->td_rowsperstrip; break; case TIFFTAG_MINSAMPLEVALUE: *va_arg(ap, u_short *) = td->td_minsamplevalue; break; case TIFFTAG_MAXSAMPLEVALUE: *va_arg(ap, u_short *) = td->td_maxsamplevalue; break; case TIFFTAG_XRESOLUTION: *va_arg(ap, float *) = td->td_xresolution; break; case TIFFTAG_YRESOLUTION: *va_arg(ap, float *) = td->td_yresolution; break; case TIFFTAG_PLANARCONFIG: *va_arg(ap, u_short *) = td->td_planarconfig; break; case TIFFTAG_XPOSITION: *va_arg(ap, float *) = td->td_xposition; break; case TIFFTAG_YPOSITION: *va_arg(ap, float *) = td->td_yposition; break; case TIFFTAG_PAGENAME: *va_arg(ap, char **) = td->td_pagename; break; case TIFFTAG_GROUP3OPTIONS: *va_arg(ap, u_long *) = td->td_group3options; break; case TIFFTAG_GROUP4OPTIONS: *va_arg(ap, u_long *) = td->td_group4options; break; case TIFFTAG_RESOLUTIONUNIT: *va_arg(ap, u_short *) = td->td_resolutionunit; break; case TIFFTAG_PAGENUMBER: *va_arg(ap, u_short *) = td->td_pagenumber[0]; *va_arg(ap, u_short *) = td->td_pagenumber[1]; break; case TIFFTAG_HALFTONEHINTS: *va_arg(ap, u_short *) = td->td_halftonehints[0]; *va_arg(ap, u_short *) = td->td_halftonehints[1]; break; case TIFFTAG_COLORMAP: *va_arg(ap, u_short **) = td->td_colormap[0]; *va_arg(ap, u_short **) = td->td_colormap[1]; *va_arg(ap, u_short **) = td->td_colormap[2]; break; case TIFFTAG_PREDICTOR: *va_arg(ap, u_short *) = td->td_predictor; break; case TIFFTAG_STRIPOFFSETS: case TIFFTAG_TILEOFFSETS: *va_arg(ap, u_long **) = td->td_stripoffset; break; case TIFFTAG_STRIPBYTECOUNTS: case TIFFTAG_TILEBYTECOUNTS: *va_arg(ap, u_long **) = td->td_stripbytecount; break; case TIFFTAG_MATTEING: *va_arg(ap, u_short *) = td->td_matteing; break; case TIFFTAG_EXTRASAMPLES: *va_arg(ap, u_short *) = td->td_matteing; *va_arg(ap, u_short **) = &td->td_matteing; break; case TIFFTAG_BADFAXLINES: *va_arg(ap, u_long *) = td->td_badfaxlines; break; case TIFFTAG_CLEANFAXDATA: *va_arg(ap, u_short *) = td->td_cleanfaxdata; break; case TIFFTAG_CONSECUTIVEBADFAXLINES: *va_arg(ap, u_long *) = td->td_badfaxrun; break; case TIFFTAG_TILEWIDTH: *va_arg(ap, u_long *) = td->td_tilewidth; break; case TIFFTAG_TILELENGTH: *va_arg(ap, u_long *) = td->td_tilelength; break; case TIFFTAG_TILEDEPTH: *va_arg(ap, u_long *) = td->td_tiledepth; break; case TIFFTAG_DATATYPE: *va_arg(ap, u_short *) = (td->td_sampleformat == SAMPLEFORMAT_VOID ? 0 : td->td_sampleformat); break; case TIFFTAG_SAMPLEFORMAT: *va_arg(ap, u_short *) = td->td_sampleformat; break; case TIFFTAG_IMAGEDEPTH: *va_arg(ap, u_long *) = td->td_imagedepth; break; #ifdef YCBCR_SUPPORT case TIFFTAG_YCBCRCOEFFICIENTS: *va_arg(ap, float **) = td->td_ycbcrcoeffs; break; case TIFFTAG_YCBCRPOSITIONING: *va_arg(ap, u_short *) = td->td_ycbcrpositioning; break; case TIFFTAG_YCBCRSUBSAMPLING: *va_arg(ap, u_short *) = td->td_ycbcrsubsampling[0]; *va_arg(ap, u_short *) = td->td_ycbcrsubsampling[1]; break; #endif #ifdef JPEG_SUPPORT case TIFFTAG_JPEGPROC: *va_arg(ap, u_short *) = td->td_jpegproc; break; case TIFFTAG_JPEGRESTARTINTERVAL: *va_arg(ap, u_short *) = td->td_jpegrestartinterval; break; case TIFFTAG_JPEGQTABLES: *va_arg(ap, u_char ***) = td->td_qtab; break; case TIFFTAG_JPEGDCTABLES: *va_arg(ap, u_char ***) = td->td_dctab; break; case TIFFTAG_JPEGACTABLES: *va_arg(ap, u_char ***) = td->td_actab; break; #endif #ifdef COLORIMETRY_SUPPORT case TIFFTAG_WHITEPOINT: *va_arg(ap, float **) = td->td_whitepoint; break; case TIFFTAG_PRIMARYCHROMATICITIES: *va_arg(ap, float **) = td->td_primarychromas; break; case TIFFTAG_TRANSFERFUNCTION: { int i; for (i = 0; i < td->td_samplesperpixel; i++) *va_arg(ap, u_short **) = td->td_transferfunction[i]; break; } case TIFFTAG_REFERENCEBLACKWHITE: *va_arg(ap, float **) = td->td_refblackwhite; break; #endif #ifdef CMYK_SUPPORT case TIFFTAG_INKSET: *va_arg(ap, u_short *) = td->td_inkset; break; case TIFFTAG_DOTRANGE: *va_arg(ap, u_short *) = td->td_dotrange[0]; *va_arg(ap, u_short *) = td->td_dotrange[1]; break; case TIFFTAG_INKNAMES: *va_arg(ap, char **) = td->td_inknames; break; case TIFFTAG_TARGETPRINTER: *va_arg(ap, char **) = td->td_targetprinter; break; #endif default: TIFFError("TIFFGetField1", "Internal error, no value returned for tag \"%s\"", TIFFFieldWithTag(tag)->field_name); break; } va_end(ap); } /* * Return the value of a field in the * internal directory structure. */ /*VARARGS2*/ int DECLARE2V(TIFFGetField, TIFF*, tif, int, tag) { TIFFFieldInfo const *fip = TIFFFindFieldInfo(tag, TIFF_ANY); if (fip) { u_short bit = fip->field_bit; if (bit != FIELD_IGNORE && TIFFFieldSet(tif, bit)) { va_list ap; VA_START(ap, tag); (void) TIFFGetField1(&tif->tif_dir, tag, ap); va_end(ap); return (1); } } else TIFFError("TIFFGetField", "Unknown field, tag 0x%x", tag); return (0); } /* * Like TIFFGetField, but taking a varargs * parameter list. This routine is useful * for building higher-level interfaces on * top of the library. */ int TIFFVGetField(tif, tag, ap) TIFF *tif; int tag; va_list ap; { TIFFFieldInfo const *fip = TIFFFindFieldInfo(tag, TIFF_ANY); if (fip) { u_short bit = fip->field_bit; if (bit != FIELD_IGNORE && TIFFFieldSet(tif, bit)) { (void) TIFFGetField1(&tif->tif_dir, tag, ap); return (1); } } else TIFFError("TIFFGetField", "Unknown field, tag 0x%x", tag); return (0); } /* * Internal interface to TIFFGetField... */ /*VARARGS2*/ void DECLARE2V(_TIFFgetfield, TIFFDirectory*, td, int, tag) { va_list ap; VA_START(ap, tag); (void) TIFFGetField1(td, tag, ap); va_end(ap); } #define CleanupField(member) { \ if (td->member) { \ free((char *)td->member); \ td->member = 0; \ } \ } /* * Release storage associated with a directory. */ void TIFFFreeDirectory(tif) TIFF *tif; { register TIFFDirectory *td = &tif->tif_dir; CleanupField(td_colormap[0]); CleanupField(td_colormap[1]); CleanupField(td_colormap[2]); CleanupField(td_documentname); CleanupField(td_artist); CleanupField(td_datetime); CleanupField(td_hostcomputer); CleanupField(td_imagedescription); CleanupField(td_make); CleanupField(td_model); CleanupField(td_software); CleanupField(td_pagename); #ifdef YCBCR_SUPPORT CleanupField(td_ycbcrcoeffs); #endif #ifdef JPEG_SUPPORT CleanupField(td_qtab); CleanupField(td_dctab); CleanupField(td_actab); #endif #ifdef CMYK_SUPPORT CleanupField(td_inknames); CleanupField(td_targetprinter); #endif #ifdef COLORIMETRY_SUPPORT CleanupField(td_whitepoint); CleanupField(td_primarychromas); CleanupField(td_refblackwhite); CleanupField(td_transferfunction[0]); CleanupField(td_transferfunction[1]); CleanupField(td_transferfunction[2]); CleanupField(td_transferfunction[3]); #endif CleanupField(td_stripoffset); CleanupField(td_stripbytecount); } #undef CleanupField /* * Setup a default directory structure. */ int TIFFDefaultDirectory(tif) TIFF *tif; { register TIFFDirectory *td = &tif->tif_dir; bzero((char *)td, sizeof (*td)); td->td_fillorder = FILLORDER_MSB2LSB; td->td_bitspersample = 1; td->td_threshholding = THRESHHOLD_BILEVEL; td->td_orientation = ORIENTATION_TOPLEFT; td->td_samplesperpixel = 1; td->td_predictor = 1; td->td_rowsperstrip = 0xffffffff; td->td_tilewidth = 0xffffffff; td->td_tilelength = 0xffffffff; td->td_tiledepth = 1; td->td_resolutionunit = RESUNIT_INCH; td->td_sampleformat = SAMPLEFORMAT_VOID; td->td_imagedepth = 1; #ifdef YCBCR_SUPPORT td->td_ycbcrsubsampling[0] = 2; td->td_ycbcrsubsampling[1] = 2; td->td_ycbcrpositioning = YCBCRPOSITION_CENTERED; #endif #ifdef CMYK_SUPPORT td->td_inkset = INKSET_CMYK; #endif (void) TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE); /* * NB: The directory is marked dirty as a result of setting * up the default compression scheme. However, this really * isn't correct -- we want TIFF_DIRTYDIRECT to be set only * if the user does something. We could just do the setup * by hand, but it seems better to use the normal mechanism * (i.e. TIFFSetField). */ tif->tif_flags &= ~TIFF_DIRTYDIRECT; return (1); } /* * Set the n-th directory as the current directory. * NB: Directories are numbered starting at 0. */ int TIFFSetDirectory(tif, dirn) register TIFF *tif; int dirn; { static char module[] = "TIFFSetDirectory"; u_short dircount; long nextdir; int n; nextdir = tif->tif_header.tiff_diroff; for (n = dirn; n > 0 && nextdir != 0; n--) { if (!SeekOK(tif->tif_fd, nextdir) || !ReadOK(tif->tif_fd, &dircount, sizeof (dircount))) { TIFFError(module, "%s: Error fetching directory count", tif->tif_name); return (0); } if (tif->tif_flags & TIFF_SWAB) TIFFSwabShort(&dircount); lseek(tif->tif_fd, dircount*sizeof (TIFFDirEntry), L_INCR); if (!ReadOK(tif->tif_fd, &nextdir, sizeof (nextdir))) { TIFFError(module, "%s: Error fetching directory link", tif->tif_name); return (0); } if (tif->tif_flags & TIFF_SWAB) TIFFSwabLong((u_long *)&nextdir); } tif->tif_nextdiroff = nextdir; /* * Set curdir to the actual directory index. The * -1 is because TIFFReadDirectory will increment * tif_curdir after successfully reading the directory. */ tif->tif_curdir = (dirn - n) - 1; return (TIFFReadDirectory(tif)); } neuron-7.6.3/src/lib/TIFF/tif_dirinfo.c000077500000000000000000000300341340731477100175740ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_dirinfo.c,v 1.2 1997/03/26 15:07:06 hines Exp"; #endif /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * Known Directory Tag Support. */ #include "tiffioP.h" #include "prototypes.h" #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif /* * NB: THIS ARRAY IS ASSUMED TO BE SORTED BY TAG. * Also, if a tag can have both LONG and SHORT types * then the LONG must be placed before the SHORT for * writing to work properly. */ const TIFFFieldInfo tiffFieldInfo[] = { { TIFFTAG_SUBFILETYPE, 1, 1, TIFF_LONG, FIELD_SUBFILETYPE, TRUE, "SubfileType" }, /* XXX SHORT for compatibility w/ old versions of the library */ { TIFFTAG_SUBFILETYPE, 1, 1, TIFF_SHORT, FIELD_SUBFILETYPE, TRUE, "SubfileType" }, { TIFFTAG_OSUBFILETYPE, 1, 1, TIFF_SHORT, FIELD_SUBFILETYPE, TRUE, "OldSubfileType" }, { TIFFTAG_IMAGEWIDTH, 1, 1, TIFF_LONG, FIELD_IMAGEDIMENSIONS, FALSE, "ImageWidth" }, { TIFFTAG_IMAGEWIDTH, 1, 1, TIFF_SHORT, FIELD_IMAGEDIMENSIONS, FALSE, "ImageWidth" }, { TIFFTAG_IMAGELENGTH, 1, 1, TIFF_LONG, FIELD_IMAGEDIMENSIONS, TRUE, "ImageLength" }, { TIFFTAG_IMAGELENGTH, 1, 1, TIFF_SHORT, FIELD_IMAGEDIMENSIONS, TRUE, "ImageLength" }, { TIFFTAG_BITSPERSAMPLE, -1,-1, TIFF_SHORT, FIELD_BITSPERSAMPLE, FALSE, "BitsPerSample" }, { TIFFTAG_COMPRESSION, -1, 1, TIFF_SHORT, FIELD_COMPRESSION, FALSE, "Compression" }, { TIFFTAG_PHOTOMETRIC, 1, 1, TIFF_SHORT, FIELD_PHOTOMETRIC, FALSE, "PhotometricInterpretation" }, { TIFFTAG_THRESHHOLDING, 1, 1, TIFF_SHORT, FIELD_THRESHHOLDING, TRUE, "Threshholding" }, { TIFFTAG_CELLWIDTH, 1, 1, TIFF_SHORT, FIELD_IGNORE, TRUE, "CellWidth" }, { TIFFTAG_CELLLENGTH, 1, 1, TIFF_SHORT, FIELD_IGNORE, TRUE, "CellLength" }, { TIFFTAG_FILLORDER, 1, 1, TIFF_SHORT, FIELD_FILLORDER, FALSE, "FillOrder" }, { TIFFTAG_DOCUMENTNAME, -1,-1, TIFF_ASCII, FIELD_DOCUMENTNAME, TRUE, "DocumentName" }, { TIFFTAG_IMAGEDESCRIPTION, -1,-1, TIFF_ASCII, FIELD_IMAGEDESCRIPTION, TRUE, "ImageDescription" }, { TIFFTAG_MAKE, -1,-1, TIFF_ASCII, FIELD_MAKE, TRUE, "Make" }, { TIFFTAG_MODEL, -1,-1, TIFF_ASCII, FIELD_MODEL, TRUE, "Model" }, { TIFFTAG_STRIPOFFSETS, -1,-1, TIFF_LONG, FIELD_STRIPOFFSETS, FALSE, "StripOffsets" }, { TIFFTAG_STRIPOFFSETS, -1,-1, TIFF_SHORT, FIELD_STRIPOFFSETS, FALSE, "StripOffsets" }, { TIFFTAG_ORIENTATION, 1, 1, TIFF_SHORT, FIELD_ORIENTATION, FALSE, "Orientation" }, { TIFFTAG_SAMPLESPERPIXEL, 1, 1, TIFF_SHORT, FIELD_SAMPLESPERPIXEL, FALSE, "SamplesPerPixel" }, { TIFFTAG_ROWSPERSTRIP, 1, 1, TIFF_LONG, FIELD_ROWSPERSTRIP, FALSE, "RowsPerStrip" }, { TIFFTAG_ROWSPERSTRIP, 1, 1, TIFF_SHORT, FIELD_ROWSPERSTRIP, FALSE, "RowsPerStrip" }, { TIFFTAG_STRIPBYTECOUNTS, -1,-1, TIFF_LONG, FIELD_STRIPBYTECOUNTS, FALSE, "StripByteCounts" }, { TIFFTAG_STRIPBYTECOUNTS, -1,-1, TIFF_SHORT, FIELD_STRIPBYTECOUNTS, FALSE, "StripByteCounts" }, { TIFFTAG_MINSAMPLEVALUE, -2,-1, TIFF_SHORT, FIELD_MINSAMPLEVALUE, TRUE, "MinSampleValue" }, { TIFFTAG_MAXSAMPLEVALUE, -2,-1, TIFF_SHORT, FIELD_MAXSAMPLEVALUE, TRUE, "MaxSampleValue" }, { TIFFTAG_XRESOLUTION, 1, 1, TIFF_RATIONAL, FIELD_RESOLUTION, FALSE, "XResolution" }, { TIFFTAG_YRESOLUTION, 1, 1, TIFF_RATIONAL, FIELD_RESOLUTION, FALSE, "YResolution" }, { TIFFTAG_PLANARCONFIG, 1, 1, TIFF_SHORT, FIELD_PLANARCONFIG, FALSE, "PlanarConfiguration" }, { TIFFTAG_PAGENAME, -1,-1, TIFF_ASCII, FIELD_PAGENAME, TRUE, "PageName" }, { TIFFTAG_XPOSITION, 1, 1, TIFF_RATIONAL, FIELD_POSITION, TRUE, "XPosition" }, { TIFFTAG_YPOSITION, 1, 1, TIFF_RATIONAL, FIELD_POSITION, TRUE, "YPosition" }, { TIFFTAG_FREEOFFSETS, -1,-1, TIFF_LONG, FIELD_IGNORE, FALSE, "FreeOffsets" }, { TIFFTAG_FREEBYTECOUNTS, -1,-1, TIFF_LONG, FIELD_IGNORE, FALSE, "FreeByteCounts" }, { TIFFTAG_GRAYRESPONSEUNIT, 1, 1, TIFF_SHORT, FIELD_IGNORE, TRUE, "GrayResponseUnit" }, { TIFFTAG_GRAYRESPONSECURVE,-1,-1, TIFF_SHORT, FIELD_IGNORE, TRUE, "GrayResponseCurve" }, { TIFFTAG_GROUP3OPTIONS, 1, 1, TIFF_LONG, FIELD_GROUP3OPTIONS, FALSE, "Group3Options" }, { TIFFTAG_GROUP4OPTIONS, 1, 1, TIFF_LONG, FIELD_GROUP4OPTIONS, FALSE, "Group4Options" }, { TIFFTAG_RESOLUTIONUNIT, 1, 1, TIFF_SHORT, FIELD_RESOLUTIONUNIT, FALSE, "ResolutionUnit" }, { TIFFTAG_PAGENUMBER, 2, 2, TIFF_SHORT, FIELD_PAGENUMBER, TRUE, "PageNumber" }, { TIFFTAG_COLORRESPONSEUNIT, 1, 1, TIFF_SHORT, FIELD_IGNORE, TRUE, "ColorResponseUnit" }, #ifdef COLORIMETRY_SUPPORT { TIFFTAG_TRANSFERFUNCTION, -1,-1, TIFF_SHORT, FIELD_TRANSFERFUNCTION, TRUE, "TransferFunction" }, #endif { TIFFTAG_SOFTWARE, -1,-1, TIFF_ASCII, FIELD_SOFTWARE, TRUE, "Software" }, { TIFFTAG_DATETIME, 20,20, TIFF_ASCII, FIELD_DATETIME, TRUE, "DateTime" }, { TIFFTAG_ARTIST, -1,-1, TIFF_ASCII, FIELD_ARTIST, TRUE, "Artist" }, { TIFFTAG_HOSTCOMPUTER, -1,-1, TIFF_ASCII, FIELD_HOSTCOMPUTER, TRUE, "HostComputer" }, { TIFFTAG_PREDICTOR, 1, 1, TIFF_SHORT, FIELD_PREDICTOR, FALSE, "Predictor" }, #ifdef COLORIMETRY_SUPPORT { TIFFTAG_WHITEPOINT, 2, 2, TIFF_RATIONAL,FIELD_WHITEPOINT, TRUE, "WhitePoint" }, { TIFFTAG_PRIMARYCHROMATICITIES,6,6,TIFF_RATIONAL,FIELD_PRIMARYCHROMAS, TRUE, "PrimaryChromaticities" }, #endif { TIFFTAG_COLORMAP, -1,-1, TIFF_SHORT, FIELD_COLORMAP, TRUE, "ColorMap" }, { TIFFTAG_HALFTONEHINTS, 2, 2, TIFF_SHORT, FIELD_HALFTONEHINTS, TRUE, "HalftoneHints" }, { TIFFTAG_TILEWIDTH, 1, 1, TIFF_LONG, FIELD_TILEDIMENSIONS, FALSE, "TileWidth" }, { TIFFTAG_TILEWIDTH, 1, 1, TIFF_SHORT, FIELD_TILEDIMENSIONS, FALSE, "TileWidth" }, { TIFFTAG_TILELENGTH, 1, 1, TIFF_LONG, FIELD_TILEDIMENSIONS, FALSE, "TileLength" }, { TIFFTAG_TILELENGTH, 1, 1, TIFF_SHORT, FIELD_TILEDIMENSIONS, FALSE, "TileLength" }, { TIFFTAG_TILEOFFSETS, -1, 1, TIFF_LONG, FIELD_STRIPOFFSETS, FALSE, "TileOffsets" }, { TIFFTAG_TILEBYTECOUNTS, -1, 1, TIFF_LONG, FIELD_STRIPBYTECOUNTS, FALSE, "TileByteCounts" }, { TIFFTAG_TILEBYTECOUNTS, -1, 1, TIFF_SHORT, FIELD_STRIPBYTECOUNTS, FALSE, "TileByteCounts" }, { TIFFTAG_BADFAXLINES, 1, 1, TIFF_LONG, FIELD_BADFAXLINES, TRUE, "BadFaxLines" }, { TIFFTAG_BADFAXLINES, 1, 1, TIFF_SHORT, FIELD_BADFAXLINES, TRUE, "BadFaxLines" }, { TIFFTAG_CLEANFAXDATA, 1, 1, TIFF_SHORT, FIELD_CLEANFAXDATA, TRUE, "CleanFaxData" }, { TIFFTAG_CONSECUTIVEBADFAXLINES,1,1, TIFF_LONG,FIELD_BADFAXRUN, TRUE, "ConsecutiveBadFaxLines" }, { TIFFTAG_CONSECUTIVEBADFAXLINES,1,1, TIFF_SHORT,FIELD_BADFAXRUN, TRUE, "ConsecutiveBadFaxLines" }, #ifdef CMYK_SUPPORT /* 6.0 CMYK tags */ { TIFFTAG_INKSET, 1, 1, TIFF_SHORT, FIELD_INKSET, FALSE, "InkSet" }, { TIFFTAG_INKNAMES, -1,-1, TIFF_ASCII, FIELD_INKNAMES, TRUE, "InkNames" }, { TIFFTAG_DOTRANGE, 2, 2, TIFF_SHORT, FIELD_DOTRANGE, FALSE, "DotRange" }, { TIFFTAG_DOTRANGE, 2, 2, TIFF_BYTE, FIELD_DOTRANGE, FALSE, "DotRange" }, { TIFFTAG_TARGETPRINTER, -1,-1, TIFF_ASCII, FIELD_TARGETPRINTER, TRUE, "TargetPrinter" }, #endif { TIFFTAG_EXTRASAMPLES, -1,-1, TIFF_SHORT, FIELD_MATTEING, FALSE, "ExtraSamples" }, { TIFFTAG_SAMPLEFORMAT, -1,-1, TIFF_SHORT, FIELD_SAMPLEFORMAT, FALSE, "SampleFormat" }, #ifdef notdef { TIFFTAG_SMINSAMPLEVALUE, -2,-1, TIFF_ANY, FIELD_SMINSAMPLEVALUE, TRUE, "SMinSampleValue" }, { TIFFTAG_SMAXSAMPLEVALUE, -2,-1, TIFF_ANY, FIELD_SMAXSAMPLEVALUE, TRUE, "SMaxSampleValue" }, #endif #ifdef JPEG_SUPPORT /* 6.0 JPEG tags */ { TIFFTAG_JPEGPROC, 1, 1, TIFF_SHORT, FIELD_JPEGPROC, FALSE, "JPEGProc" }, { TIFFTAG_JPEGIFOFFSET, 1, 1, TIFF_LONG, FIELD_IGNORE, FALSE, "JPEGInterchangeFormat" }, { TIFFTAG_JPEGIFBYTECOUNT, 1, 1, TIFF_LONG, FIELD_IGNORE, FALSE, "JPEGInterchangeFormatLength" }, { TIFFTAG_JPEGRESTARTINTERVAL,1,1, TIFF_SHORT,FIELD_JPEGRESTARTINTERVAL, FALSE, "JPEGRestartInterval" }, { TIFFTAG_JPEGQTABLES, -2,-1, TIFF_LONG, FIELD_JPEGQTABLES, FALSE, "JPEGQTables" }, { TIFFTAG_JPEGDCTABLES, -2,-1, TIFF_LONG, FIELD_JPEGDCTABLES, FALSE, "JPEGDCTables" }, { TIFFTAG_JPEGACTABLES, -2,-1, TIFF_LONG, FIELD_JPEGACTABLES, FALSE, "JPEGACTables" }, #endif #ifdef YCBCR_SUPPORT /* 6.0 YCbCr tags */ { TIFFTAG_YCBCRCOEFFICIENTS, 3, 3, TIFF_RATIONAL, FIELD_YCBCRCOEFFICIENTS, FALSE, "YCbCrCoefficients" }, { TIFFTAG_YCBCRSUBSAMPLING, 2, 2, TIFF_SHORT, FIELD_YCBCRSUBSAMPLING, FALSE, "YCbCrSubsampling" }, { TIFFTAG_YCBCRPOSITIONING, 1, 1, TIFF_SHORT, FIELD_YCBCRPOSITIONING, FALSE, "YCbCrPositioning" }, #endif #ifdef COLORIMETRY_SUPPORT { TIFFTAG_REFERENCEBLACKWHITE,-1,-1,TIFF_RATIONAL, FIELD_REFBLACKWHITE, FALSE, "ReferenceBlackWhite" }, /* XXX temporarily accept LONG for backwards compatibility */ { TIFFTAG_REFERENCEBLACKWHITE,-1,-1,TIFF_LONG, FIELD_REFBLACKWHITE, FALSE, "ReferenceBlackWhite" }, #endif /* begin SGI tags */ { TIFFTAG_MATTEING, 1, 1, TIFF_SHORT, FIELD_MATTEING, FALSE, "Matteing" }, { TIFFTAG_DATATYPE, -2,-1, TIFF_SHORT, FIELD_SAMPLEFORMAT, FALSE, "DataType" }, { TIFFTAG_IMAGEDEPTH, 1, 1, TIFF_LONG, FIELD_IMAGEDEPTH, FALSE, "ImageDepth" }, { TIFFTAG_IMAGEDEPTH, 1, 1, TIFF_SHORT, FIELD_IMAGEDEPTH, FALSE, "ImageDepth" }, { TIFFTAG_TILEDEPTH, 1, 1, TIFF_LONG, FIELD_TILEDEPTH, FALSE, "TileDepth" }, { TIFFTAG_TILEDEPTH, 1, 1, TIFF_SHORT, FIELD_TILEDEPTH, FALSE, "TileDepth" }, /* end SGI tags */ { 0 } }; const int tiffDataWidth[] = { 1, /* nothing */ 1, /* TIFF_BYTE */ 1, /* TIFF_ASCII */ 2, /* TIFF_SHORT */ 4, /* TIFF_LONG */ 8, /* TIFF_RATIONAL */ 1, /* TIFF_SBYTE */ 1, /* TIFF_UNDEFINED */ 2, /* TIFF_SSHORT */ 4, /* TIFF_SLONG */ 8, /* TIFF_SRATIONAL */ 4, /* TIFF_FLOAT */ 8, /* TIFF_DOUBLE */ }; TIFFFieldInfo const * DECLARE2(TIFFFindFieldInfo, u_short, tag, TIFFDataType, dt) { static TIFFFieldInfo const *last = NULL; register TIFFFieldInfo const *fip; if (last && last->field_tag == tag && (dt == TIFF_ANY || dt == last->field_type)) return (last); /* NB: if table gets big, use sorted search (e.g. binary search) */ for (fip = tiffFieldInfo; fip->field_tag; fip++) if (fip->field_tag == tag && (dt == TIFF_ANY || fip->field_type == dt)) return (last = fip); return ((TIFFFieldInfo *)0); } TIFFFieldInfo const * DECLARE1(TIFFFieldWithTag, u_short, tag) { TIFFFieldInfo const *fip = TIFFFindFieldInfo(tag, TIFF_ANY); if (fip) return (fip); TIFFError("TIFFFieldWithTag", "Internal error, unknown tag 0x%x", tag); exit(-1); /*NOTREACHED*/ } neuron-7.6.3/src/lib/TIFF/tif_dirread.c000077500000000000000000000767161340731477100175750ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_dirread.c,v 1.2 1997/03/26 15:07:07 hines Exp"; #endif /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * Directory Read Support Routines. * * NB: Beware of the varargs declarations for routines in * this file. The names and types of variables has been * carefully chosen to make things work with compilers that * are busted in one way or another (e.g. SGI/MIPS). */ #include #include #include "tiffioP.h" #define IGNORE 0 /* tag placeholder used below */ #if HAVE_IEEEFP #define TIFFCvtIEEEFloatToNative(tif, n, fp) #endif #include "prototypes.h" #if USE_PROTOTYPES static void EstimateStripByteCounts(TIFF *, TIFFDirEntry *, u_int); static void MissingRequired(TIFF *, char *); static int CheckDirCount(TIFF *, TIFFDirEntry *, u_long); static int TIFFFetchData(TIFF *, TIFFDirEntry *, char *); static int TIFFFetchString(TIFF *, TIFFDirEntry *, char *); static float TIFFFetchRational(TIFF *, TIFFDirEntry *); static int TIFFFetchNormalTag(TIFF *, TIFFDirEntry *); static int TIFFFetchPerSampleShorts(TIFF *, TIFFDirEntry *, long *); static int TIFFFetchShortArray(TIFF *, TIFFDirEntry *, u_short []); static int TIFFFetchStripThing(TIFF *, TIFFDirEntry *, long, u_long **); static int TIFFFetchRefBlackWhite(TIFF *, TIFFDirEntry *); static int TIFFFetchJPEGQTables(TIFF *, TIFFDirEntry *); static int TIFFFetchJPEGCTables(TIFF *, TIFFDirEntry *, u_char ***); static int TIFFFetchExtraSamples(TIFF *, TIFFDirEntry *); static float TIFFFetchFloat(TIFF *, TIFFDirEntry *); static int TIFFFetchFloatArray(TIFF *, TIFFDirEntry *, float *); extern int TIFFSetCompressionScheme(TIFF *, int); extern int TIFFDefaultDirectory(TIFF*); extern int TIFFFreeDirectory(TIFF*); #else static void EstimateStripByteCounts(); static void MissingRequired(); static int CheckDirCount(); static int TIFFFetchData(); static int TIFFFetchString(); static float TIFFFetchRational(); static int TIFFFetchNormalTag(); static int TIFFFetchPerSampleShorts(); static int TIFFFetchShortArray(); static int TIFFFetchStripThing(); static int TIFFFetchRefBlackWhite(); static int TIFFFetchJPEGQTables(); static int TIFFFetchJPEGCTables(); static int TIFFFetchExtraSamples(); static float TIFFFetchFloat(); static int TIFFFetchFloatArray(); extern int TIFFSetCompressionScheme(); extern int TIFFDefaultDirectory(); extern int TIFFFreeDirectory(); #endif static char * CheckMalloc(tif, n, what) TIFF *tif; int n; char *what; { char *cp = malloc(n); if (cp == NULL) TIFFError(tif->tif_name, "No space %s", what); return (cp); } /* * Read the next TIFF directory from a file * and convert it to the internal format. * We read directories sequentially. */ int TIFFReadDirectory(tif) TIFF *tif; { register TIFFDirEntry *dp; register int n; register TIFFDirectory *td; TIFFDirEntry *dir; long v; const TIFFFieldInfo *fip; u_short dircount; char *cp; int diroutoforderwarning = 0; tif->tif_diroff = tif->tif_nextdiroff; if (tif->tif_diroff == 0) /* no more directories */ return (0); tif->tif_curdir++; if (!isMapped(tif)) { if (!SeekOK(tif->tif_fd, tif->tif_diroff)) { TIFFError(tif->tif_name, "Seek error accessing TIFF directory"); return (0); } if (!ReadOK(tif->tif_fd, &dircount, sizeof (short))) { TIFFError(tif->tif_name, "Can not read TIFF directory count"); return (0); } if (tif->tif_flags & TIFF_SWAB) TIFFSwabShort(&dircount); dir = (TIFFDirEntry *)CheckMalloc(tif, dircount * sizeof (TIFFDirEntry), "to read TIFF directory"); if (dir == NULL) return (0); if (!ReadOK(tif->tif_fd, dir, dircount*sizeof (TIFFDirEntry))) { TIFFError(tif->tif_name, "Can not read TIFF directory"); goto bad; } /* * Read offset to next directory for sequential scans. */ if (!ReadOK(tif->tif_fd, &tif->tif_nextdiroff, sizeof (long))) tif->tif_nextdiroff = 0; #ifdef MMAP_SUPPORT } else { off_t off = tif->tif_diroff; if (off + sizeof (short) > tif->tif_size) { TIFFError(tif->tif_name, "Can not read TIFF directory count"); return (0); } else bcopy(tif->tif_base + off, &dircount, sizeof (short)); off += sizeof (short); if (tif->tif_flags & TIFF_SWAB) TIFFSwabShort(&dircount); dir = (TIFFDirEntry *)CheckMalloc(tif, dircount * sizeof (TIFFDirEntry), "to read TIFF directory"); if (dir == NULL) return (0); if (off + dircount*sizeof (TIFFDirEntry) > tif->tif_size) { TIFFError(tif->tif_name, "Can not read TIFF directory"); goto bad; } else bcopy(tif->tif_base + off, dir, dircount*sizeof (TIFFDirEntry)); off += dircount* sizeof (TIFFDirEntry); if (off + sizeof (long) < tif->tif_size) bcopy(tif->tif_base + off, &tif->tif_nextdiroff, sizeof (long)); else tif->tif_nextdiroff = 0; #endif } if (tif->tif_flags & TIFF_SWAB) TIFFSwabLong((u_long *)&tif->tif_nextdiroff); tif->tif_flags &= ~TIFF_BEENWRITING; /* reset before new dir */ /* * Setup default value and then make a pass over * the fields to check type and tag information, * and to extract info required to size data * structures. A second pass is made afterwards * to read in everthing not taken in the first pass. */ td = &tif->tif_dir; /* free any old stuff and reinit */ TIFFFreeDirectory(tif); TIFFDefaultDirectory(tif); /* * Electronic Arts writes gray-scale TIFF files * without a PlanarConfiguration directory entry. * Thus we setup a default value here, even though * the TIFF spec says there is no default value. */ TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); for (fip = tiffFieldInfo, dp = dir, n = dircount; n > 0; n--, dp++) { if (tif->tif_flags & TIFF_SWAB) { TIFFSwabArrayOfShort(&dp->tdir_tag, 2); TIFFSwabArrayOfLong(&dp->tdir_count, 2); } /* * Find the field information entry for this tag. */ /* * Silicon Beach (at least) writes unordered * directory tags (violating the spec). Handle * it here, but be obnoxious (maybe they'll fix it?). */ if (dp->tdir_tag < fip->field_tag) { if (!diroutoforderwarning) { TIFFWarning(tif->tif_name, "invalid TIFF directory; tags are not sorted in ascending order"); diroutoforderwarning = 1; } fip = tiffFieldInfo; /* O(n^2) */ } while (fip->field_tag && fip->field_tag < dp->tdir_tag) fip++; if (!fip->field_tag || fip->field_tag != dp->tdir_tag) { TIFFWarning(tif->tif_name, "unknown field with tag %d (0x%x) ignored", dp->tdir_tag, dp->tdir_tag); dp->tdir_tag = IGNORE; fip = tiffFieldInfo; /* restart search */ continue; } /* * Null out old tags that we ignore. */ if (fip->field_bit == FIELD_IGNORE) { ignore: dp->tdir_tag = IGNORE; continue; } /* * Check data type. */ while (dp->tdir_type != (u_short)fip->field_type) { if (fip->field_type == TIFF_ANY) /* wildcard */ break; fip++; if (!fip->field_tag || fip->field_tag != dp->tdir_tag) { TIFFWarning(tif->tif_name, "wrong data type %d for \"%s\"; tag ignored", dp->tdir_type, fip[-1].field_name); goto ignore; } } /* * Check count if known in advance. */ if (fip->field_readcount != TIFF_VARIABLE) { u_long expected = (fip->field_readcount == TIFF_SPP) ? (u_long) td->td_samplesperpixel : (u_long) fip->field_readcount; if (!CheckDirCount(tif, dp, expected)) goto ignore; } switch (dp->tdir_tag) { case TIFFTAG_STRIPOFFSETS: case TIFFTAG_STRIPBYTECOUNTS: case TIFFTAG_TILEOFFSETS: case TIFFTAG_TILEBYTECOUNTS: TIFFSetFieldBit(tif, fip->field_bit); break; case TIFFTAG_IMAGEWIDTH: case TIFFTAG_IMAGELENGTH: case TIFFTAG_IMAGEDEPTH: case TIFFTAG_TILELENGTH: case TIFFTAG_TILEWIDTH: case TIFFTAG_TILEDEPTH: case TIFFTAG_PLANARCONFIG: case TIFFTAG_SAMPLESPERPIXEL: case TIFFTAG_ROWSPERSTRIP: if (!TIFFFetchNormalTag(tif, dp)) goto bad; break; } } /* * Allocate directory structure and setup defaults. */ if (!TIFFFieldSet(tif, FIELD_IMAGEDIMENSIONS)) { MissingRequired(tif, "ImageLength"); goto bad; } if (!TIFFFieldSet(tif, FIELD_PLANARCONFIG)) { MissingRequired(tif, "PlanarConfiguration"); goto bad; } /* * Setup appropriate structures (by strip or by tile) */ if (!TIFFFieldSet(tif, FIELD_TILEDIMENSIONS)) { td->td_stripsperimage = (td->td_rowsperstrip == 0xffffffff ? (td->td_imagelength != 0 ? 1 : 0) : howmany(td->td_imagelength, td->td_rowsperstrip)); td->td_tilewidth = td->td_imagewidth; td->td_tilelength = td->td_rowsperstrip; td->td_tiledepth = td->td_imagedepth; tif->tif_flags &= ~TIFF_ISTILED; } else { td->td_stripsperimage = TIFFNumberOfTiles(tif); tif->tif_flags |= TIFF_ISTILED; } td->td_nstrips = td->td_stripsperimage; if (td->td_planarconfig == PLANARCONFIG_SEPARATE) td->td_nstrips *= td->td_samplesperpixel; if (td->td_nstrips > 0 && !TIFFFieldSet(tif, FIELD_STRIPOFFSETS)) { MissingRequired(tif, isTiled(tif) ? "TileOffsets" : "StripOffsets"); goto bad; } /* * Second pass: extract other information. */ for (dp = dir, n = dircount; n > 0; n--, dp++) { if (dp->tdir_tag == IGNORE) continue; switch (dp->tdir_tag) { case TIFFTAG_COMPRESSION: case TIFFTAG_MINSAMPLEVALUE: case TIFFTAG_MAXSAMPLEVALUE: case TIFFTAG_BITSPERSAMPLE: /* * The 5.0 spec says the Compression tag has * one value, while earlier specs say it has * one value per sample. Because of this, we * accept the tag if one value is supplied. * * The MinSampleValue, MaxSampleValue and * BitsPerSample tags are supposed to be written * as one value/sample, but some vendors incorrectly * write one value only -- so we accept that * as well (yech). */ if (dp->tdir_count == 1) { v = TIFFExtractData(tif, dp->tdir_type, dp->tdir_offset); if (!TIFFSetField(tif, dp->tdir_tag, (int)v)) goto bad; break; } /* fall thru... */ case TIFFTAG_DATATYPE: case TIFFTAG_SAMPLEFORMAT: if (!TIFFFetchPerSampleShorts(tif, dp, &v) || !TIFFSetField(tif, dp->tdir_tag, (int)v)) goto bad; break; case TIFFTAG_STRIPOFFSETS: case TIFFTAG_TILEOFFSETS: if (!TIFFFetchStripThing(tif, dp, td->td_nstrips, &td->td_stripoffset)) goto bad; break; case TIFFTAG_STRIPBYTECOUNTS: case TIFFTAG_TILEBYTECOUNTS: if (!TIFFFetchStripThing(tif, dp, td->td_nstrips, &td->td_stripbytecount)) goto bad; break; case TIFFTAG_IMAGELENGTH: case TIFFTAG_ROWSPERSTRIP: case TIFFTAG_TILELENGTH: case TIFFTAG_TILEWIDTH: case TIFFTAG_TILEDEPTH: case TIFFTAG_SAMPLESPERPIXEL: case TIFFTAG_PLANARCONFIG: /* handled in first pass above */ break; case TIFFTAG_COLORMAP: if (!CheckDirCount(tif,dp,3*(1L<td_bitspersample))) break; /* fall thru... */ case TIFFTAG_TRANSFERFUNCTION: v = (1L<td_bitspersample) * sizeof (u_short); cp = CheckMalloc(tif, dp->tdir_count * sizeof (u_short), "to read \"TransferFunction\" tag"); if (cp != NULL) { if (TIFFFetchData(tif, dp, cp)) { /* * This deals with there being only * one array to apply to all samples. */ if (dp->tdir_count == 1L<td_bitspersample) v = 0; /* NB: we assume samples/pixel <= 4 */ TIFFSetField(tif, dp->tdir_tag, cp, cp+v, cp+2*v, cp+3*v); } free(cp); } break; case TIFFTAG_PAGENUMBER: if (TIFFFetchShortArray(tif, dp, td->td_pagenumber)) TIFFSetFieldBit(tif, FIELD_PAGENUMBER); break; case TIFFTAG_HALFTONEHINTS: if (TIFFFetchShortArray(tif, dp, td->td_halftonehints)) TIFFSetFieldBit(tif, FIELD_HALFTONEHINTS); break; #ifdef COLORIMETRY_SUPPORT case TIFFTAG_REFERENCEBLACKWHITE: (void) TIFFFetchRefBlackWhite(tif, dp); break; #endif #ifdef YCBCR_SUPPORT case TIFFTAG_YCBCRSUBSAMPLING: if (TIFFFetchShortArray(tif, dp, td->td_ycbcrsubsampling)) TIFFSetFieldBit(tif, FIELD_YCBCRSUBSAMPLING); break; #endif #ifdef CMYK_SUPPORT case TIFFTAG_DOTRANGE: if (TIFFFetchShortArray(tif, dp, td->td_dotrange)) TIFFSetFieldBit(tif, FIELD_DOTRANGE); break; #endif #ifdef JPEG_SUPPORT case TIFFTAG_JPEGQTABLES: if (TIFFFetchJPEGQTables(tif, dp)) TIFFSetFieldBit(tif, FIELD_JPEGQTABLES); break; case TIFFTAG_JPEGDCTABLES: if (TIFFFetchJPEGCTables(tif, dp, &td->td_dctab)) TIFFSetFieldBit(tif, FIELD_JPEGDCTABLES); break; case TIFFTAG_JPEGACTABLES: if (TIFFFetchJPEGCTables(tif, dp, &td->td_actab)) TIFFSetFieldBit(tif, FIELD_JPEGACTABLES); break; #endif case TIFFTAG_EXTRASAMPLES: (void) TIFFFetchExtraSamples(tif, dp); break; /* BEGIN REV 4.0 COMPATIBILITY */ case TIFFTAG_OSUBFILETYPE: v = 0; switch (TIFFExtractData(tif, dp->tdir_type, dp->tdir_offset)) { case OFILETYPE_REDUCEDIMAGE: v = FILETYPE_REDUCEDIMAGE; break; case OFILETYPE_PAGE: v = FILETYPE_PAGE; break; } if (v) (void) TIFFSetField(tif, TIFFTAG_SUBFILETYPE, (int)v); break; /* END REV 4.0 COMPATIBILITY */ default: (void) TIFFFetchNormalTag(tif, dp); break; } } /* * Verify Palette image has a Colormap. */ if (td->td_photometric == PHOTOMETRIC_PALETTE && !TIFFFieldSet(tif, FIELD_COLORMAP)) { MissingRequired(tif, "Colormap"); goto bad; } /* * Attempt to deal with a missing StripByteCounts tag. */ if (!TIFFFieldSet(tif, FIELD_STRIPBYTECOUNTS)) { /* * Some manufacturers violate the spec by not giving * the size of the strips. In this case, assume there * is one uncompressed strip of data. */ if (td->td_nstrips > 1) { MissingRequired(tif, "StripByteCounts"); goto bad; } TIFFWarning(tif->tif_name, "TIFF directory is missing required \"%s\" field, calculating from imagelength", TIFFFieldWithTag(TIFFTAG_STRIPBYTECOUNTS)->field_name); EstimateStripByteCounts(tif, dir, dircount); } else if (td->td_nstrips == 1 && td->td_stripbytecount[0] == 0) { /* * Plexus (and others) sometimes give a value * of zero for a tag when they don't know what * the correct value is! Try and handle the * simple case of estimating the size of a one * strip image. */ TIFFWarning(tif->tif_name, "Bogus \"%s\" field, ignoring and calculating from imagelength", TIFFFieldWithTag(TIFFTAG_STRIPBYTECOUNTS)->field_name); EstimateStripByteCounts(tif, dir, dircount); } if (dir) free((char *)dir); if (!TIFFFieldSet(tif, FIELD_MAXSAMPLEVALUE)) td->td_maxsamplevalue = (1L<td_bitspersample)-1; /* * Setup default compression scheme. */ if (!TIFFFieldSet(tif, FIELD_COMPRESSION)) TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE); /* * Reinitialize i/o since we are starting on a new directory. */ tif->tif_row = -1; tif->tif_curstrip = -1; tif->tif_col = -1; tif->tif_curtile = -1; tif->tif_tilesize = TIFFTileSize(tif); tif->tif_scanlinesize = TIFFScanlineSize(tif); return (1); bad: if (dir) free((char *)dir); return (0); } static void EstimateStripByteCounts(tif, dir, dircount) TIFF *tif; TIFFDirEntry *dir; u_int dircount; { register TIFFDirEntry *dp; register TIFFDirectory *td = &tif->tif_dir; register int n; td->td_stripbytecount = (u_long *) CheckMalloc(tif, sizeof (u_long), "for \"StripByteCounts\" array"); if (td->td_compression != COMPRESSION_NONE) { u_long space = sizeof (TIFFHeader) + sizeof (short) + (dircount * sizeof (TIFFDirEntry)) + sizeof (long); long filesize = TIFFGetFileSize(tif->tif_fd); /* calculate amount of space used by indirect values */ for (dp = dir, n = dircount; n > 0; n--, dp++) { int cc = dp->tdir_count * tiffDataWidth[dp->tdir_type]; if (cc > sizeof (long)) space += cc; } td->td_stripbytecount[0] = filesize - space; /* * This gross hack handles the case were the offset to * the strip is past the place where we think the strip * should begin. Since a strip of data must be contiguous, * it's safe to assume that we've overestimated the amount * of data in the strip and trim this number back accordingly. */ if (td->td_stripoffset[0] + td->td_stripbytecount[0] > filesize) td->td_stripbytecount[0] = filesize - td->td_stripoffset[0]; } else { u_long rowbytes = howmany(td->td_bitspersample * td->td_samplesperpixel * td->td_imagewidth, 8); td->td_stripbytecount[0] = td->td_imagelength * rowbytes; } TIFFSetFieldBit(tif, FIELD_STRIPBYTECOUNTS); if (!TIFFFieldSet(tif, FIELD_ROWSPERSTRIP)) td->td_rowsperstrip = td->td_imagelength; } static void MissingRequired(tif, tagname) TIFF *tif; char *tagname; { TIFFError(tif->tif_name, "TIFF directory is missing required \"%s\" field", tagname); } /* * Check the count field of a directory * entry against a known value. The caller * is expected to skip/ignore the tag if * there is a mismatch. */ static int CheckDirCount(tif, dir, count) TIFF *tif; TIFFDirEntry *dir; u_long count; { if (count != dir->tdir_count) { TIFFWarning(tif->tif_name, "incorrect count for field \"%s\" (%lu, expecting %lu); tag ignored", TIFFFieldWithTag(dir->tdir_tag)->field_name, dir->tdir_count, count); return (0); } return (1); } /* * Fetch a contiguous directory item. */ static int TIFFFetchData(tif, dir, cp) TIFF *tif; TIFFDirEntry *dir; char *cp; { int cc, w; w = tiffDataWidth[dir->tdir_type]; cc = dir->tdir_count * w; if (!isMapped(tif)) { if (!SeekOK(tif->tif_fd, dir->tdir_offset)) goto bad; if (!ReadOK(tif->tif_fd, cp, cc)) goto bad; #ifdef MMAP_SUPPORT } else { if (dir->tdir_offset + cc > tif->tif_size) goto bad; bcopy(tif->tif_base + dir->tdir_offset, cp, cc); #endif } if (tif->tif_flags & TIFF_SWAB) { switch (dir->tdir_type) { case TIFF_SHORT: case TIFF_SSHORT: TIFFSwabArrayOfShort((u_short *)cp, dir->tdir_count); break; case TIFF_LONG: case TIFF_SLONG: case TIFF_FLOAT: TIFFSwabArrayOfLong((u_long *)cp, dir->tdir_count); break; case TIFF_RATIONAL: case TIFF_SRATIONAL: TIFFSwabArrayOfLong((u_long *)cp, 2*dir->tdir_count); break; } } return (cc); bad: TIFFError(tif->tif_name, "Error fetching data for field \"%s\"", TIFFFieldWithTag(dir->tdir_tag)->field_name); return (0); } /* * Fetch an ASCII item from the file. */ static int TIFFFetchString(tif, dir, cp) TIFF *tif; TIFFDirEntry *dir; char *cp; { if (dir->tdir_count <= 4) { u_long l = dir->tdir_offset; if (tif->tif_flags & TIFF_SWAB) TIFFSwabLong(&l); bcopy(&l, cp, dir->tdir_count); return (1); } return (TIFFFetchData(tif, dir, cp)); } /* * Convert numerator+denominator to float. */ static int cvtRational(tif, dir, num, denom, rv) TIFF *tif; TIFFDirEntry *dir; u_long num, denom; float *rv; { if (denom == 0) { TIFFError(tif->tif_name, "%s: Rational with zero denominator (num = %lu)", TIFFFieldWithTag(dir->tdir_tag)->field_name, num); return (0); } else { if (dir->tdir_type == TIFF_RATIONAL) *rv = ((float)num / (float)denom); else *rv = ((float)(long)num / (float)(long)denom); return (1); } } /* * Fetch a rational item from the file * at offset off and return the value * as a floating point number. */ static float TIFFFetchRational(tif, dir) TIFF *tif; TIFFDirEntry *dir; { u_long l[2]; float v; return (!TIFFFetchData(tif, dir, (char *)l) || !cvtRational(tif, dir, l[0], l[1], &v) ? 1. : v); } /* * Fetch a single floating point value * from the offset field and return it * as a native float. */ static float TIFFFetchFloat(tif, dir) TIFF *tif; TIFFDirEntry *dir; { float v = (float) TIFFExtractData(tif, dir->tdir_type, dir->tdir_offset); TIFFCvtIEEEFloatToNative(tif, 1, &v); return (v); } /* * Fetch an array of BYTE or SBYTE values. */ static int TIFFFetchByteArray(tif, dir, v) TIFF *tif; TIFFDirEntry *dir; u_short v[]; { if (dir->tdir_count <= 4) { /* * Extract data from offset field. */ if (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) { switch (dir->tdir_count) { case 4: v[3] = dir->tdir_offset & 0xff; case 3: v[2] = (dir->tdir_offset >> 8) & 0xff; case 2: v[1] = (dir->tdir_offset >> 16) & 0xff; case 1: v[0] = dir->tdir_offset >> 24; } } else { switch (dir->tdir_count) { case 4: v[3] = dir->tdir_offset >> 24; case 3: v[2] = (dir->tdir_offset >> 16) & 0xff; case 2: v[1] = (dir->tdir_offset >> 8) & 0xff; case 1: v[0] = dir->tdir_offset & 0xff; } } return (1); } else return (TIFFFetchData(tif, dir, (char *)v)); /* XXX */ } /* * Fetch an array of SHORT or SSHORT values. */ static int TIFFFetchShortArray(tif, dir, v) TIFF *tif; TIFFDirEntry *dir; u_short v[]; { if (dir->tdir_count <= 2) { if (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) { switch (dir->tdir_count) { case 2: v[1] = dir->tdir_offset & 0xffff; case 1: v[0] = dir->tdir_offset >> 16; } } else { switch (dir->tdir_count) { case 2: v[1] = dir->tdir_offset >> 16; case 1: v[0] = dir->tdir_offset & 0xffff; } } return (1); } else return (TIFFFetchData(tif, dir, (char *)v)); } /* * Fetch an array of LONG or SLONG values. */ static int TIFFFetchLongArray(tif, dir, v) TIFF *tif; TIFFDirEntry *dir; u_long v[]; { if (dir->tdir_count == 1) { v[0] = dir->tdir_offset; return (1); } else return (TIFFFetchData(tif, dir, (char *)v)); } /* * Fetch an array of RATIONAL or SRATIONAL values. */ static int TIFFFetchRationalArray(tif, dir, v) TIFF *tif; TIFFDirEntry *dir; float v[]; { int ok = 0; u_long *l; l = (u_long *)CheckMalloc(tif, dir->tdir_count*tiffDataWidth[dir->tdir_type], "to fetch array of rationals"); if (l) { if (TIFFFetchData(tif, dir, (char *)l)) { u_long i; for (i = 0; i < dir->tdir_count; i++) { ok = cvtRational(tif, dir, l[2*i+0], l[2*i+1], &v[i]); if (!ok) break; } } free((char *)l); } return (ok); } /* * Fetch an array of FLOAT values. */ static int TIFFFetchFloatArray(tif, dir, v) TIFF *tif; TIFFDirEntry *dir; float v[]; { if (TIFFFetchData(tif, dir, (char *)v)) { TIFFCvtIEEEFloatToNative(tif, dir->tdir_count, v); return (1); } else return (0); } /* * Fetch a tag that is not handled by special case code. * * NB: DOUBLE and UNDEFINED types are not handled. */ static int TIFFFetchNormalTag(tif, dp) TIFF *tif; TIFFDirEntry *dp; { static char mesg[] = "to fetch tag value"; int ok = 0; if (dp->tdir_count > 1) { /* array of values */ char *cp = NULL; switch (dp->tdir_type) { case TIFF_BYTE: case TIFF_SBYTE: /* NB: always expand BYTE values to shorts */ cp = CheckMalloc(tif, dp->tdir_count * sizeof (u_short), mesg); ok = cp && TIFFFetchByteArray(tif, dp, (u_short *)cp); break; case TIFF_SHORT: case TIFF_SSHORT: cp = CheckMalloc(tif, dp->tdir_count * sizeof (u_short), mesg); ok = cp && TIFFFetchShortArray(tif, dp, (u_short *)cp); break; case TIFF_LONG: case TIFF_SLONG: cp = CheckMalloc(tif, dp->tdir_count * sizeof (u_long), mesg); ok = cp && TIFFFetchLongArray(tif, dp, (u_long *)cp); break; case TIFF_RATIONAL: case TIFF_SRATIONAL: cp = CheckMalloc(tif, dp->tdir_count * sizeof (float), mesg); ok = cp && TIFFFetchRationalArray(tif, dp, (float *)cp); break; case TIFF_FLOAT: cp = CheckMalloc(tif, dp->tdir_count * sizeof (float), mesg); ok = cp && TIFFFetchFloatArray(tif, dp, (float *)cp); break; case TIFF_ASCII: /* * Some vendors write strings w/o the trailing * NULL byte, so always append one just in case. */ cp = CheckMalloc(tif, dp->tdir_count+1, mesg); if ((ok = (cp && TIFFFetchString(tif, dp, cp)))) cp[dp->tdir_count] = '\0'; /* XXX */ break; } if (ok) ok = TIFFSetField(tif, dp->tdir_tag, cp); if (cp != NULL) free(cp); } else if (CheckDirCount(tif, dp, 1)) { /* singleton value */ char c[2]; switch (dp->tdir_type) { case TIFF_BYTE: case TIFF_SBYTE: case TIFF_SHORT: case TIFF_SSHORT: ok = TIFFSetField(tif, dp->tdir_tag, (int) TIFFExtractData(tif, dp->tdir_type, dp->tdir_offset)); break; case TIFF_LONG: case TIFF_SLONG: ok = TIFFSetField(tif, dp->tdir_tag, (u_long) TIFFExtractData(tif, dp->tdir_type, dp->tdir_offset)); break; case TIFF_RATIONAL: case TIFF_SRATIONAL: ok = TIFFSetField(tif, dp->tdir_tag, TIFFFetchRational(tif, dp)); break; case TIFF_FLOAT: ok = TIFFSetField(tif, dp->tdir_tag, TIFFFetchFloat(tif, dp)); break; case TIFF_ASCII: if ((ok = (TIFFFetchString(tif, dp, c)))) { c[1] = '\0'; /* XXX paranoid */ ok = TIFFSetField(tif, dp->tdir_tag, c); } break; } } return (ok); } /* * Fetch samples/pixel short values for * the specified tag and verify that * all values are the same. */ static int TIFFFetchPerSampleShorts(tif, dir, pl) TIFF *tif; TIFFDirEntry *dir; long *pl; { u_short v[4]; int samples = tif->tif_dir.td_samplesperpixel; if (CheckDirCount(tif, dir, (u_long)samples) && TIFFFetchShortArray(tif, dir, v)) { int i; for (i = 1; i < samples; i++) if (v[i] != v[0]) { TIFFError(tif->tif_name, "Cannot handle different per-sample values for field \"%s\"", TIFFFieldWithTag(dir->tdir_tag)->field_name); return (0); } *pl = v[0]; return (1); } return (0); } /* * Fetch a set of offsets or lengths. * While this routine says "strips", * in fact it's also used for tiles. */ static int TIFFFetchStripThing(tif, dir, nstrips, lpp) TIFF *tif; TIFFDirEntry *dir; long nstrips; u_long **lpp; { register u_long *lp; int status; if (!CheckDirCount(tif, dir, nstrips)) return (0); /* * Allocate space for strip information. */ if (*lpp == NULL && (*lpp = (u_long *)CheckMalloc(tif, nstrips * sizeof (u_long), "for strip array")) == NULL) return (0); lp = *lpp; if (dir->tdir_type == (int)TIFF_SHORT) { /* * Handle short->long expansion. */ u_short *dp = (u_short *)CheckMalloc(tif, dir->tdir_count* sizeof (u_short), "to fetch strip tag"); if (dp == NULL) return (0); if ((status = TIFFFetchShortArray(tif, dir, dp))) { register u_short *wp = dp; while (nstrips-- > 0) *lp++ = *wp++; } free((char *)dp); } else status = TIFFFetchLongArray(tif, dir, lp); return (status); } #ifdef COLORIMETRY_SUPPORT static int TIFFFetchRefBlackWhite(tif, dir) TIFF *tif; TIFFDirEntry *dir; { static char mesg[] = "for \"ReferenceBlackWhite\" array"; char *cp; int ok; if (!CheckDirCount(tif, dir, 2*tif->tif_dir.td_samplesperpixel)) return (0); if (dir->tdir_type == TIFF_RATIONAL) return (TIFFFetchNormalTag(tif, dir)); /* * Handle LONG's for backward compatibility. */ cp = CheckMalloc(tif, dir->tdir_count * sizeof (u_long), mesg); if ((ok = (cp && TIFFFetchLongArray(tif, dir, (u_long *)cp)))) { float *fp = (float *) CheckMalloc(tif, dir->tdir_count * sizeof (float), mesg); if ((ok = (fp != NULL))) { int i; for (i = 0; i < dir->tdir_count; i++) fp[i] = (float)((u_long *)cp)[i]; ok = TIFFSetField(tif, dir->tdir_tag, fp); free((char *)fp); } } if (cp) free(cp); return (ok); } #endif #ifdef JPEG_SUPPORT /* * Fetch the JPEG Quantization tables * for the specified directory entry. * Storage for the td_qtab array is * allocated as a side effect. */ static int TIFFFetchJPEGQTables(tif, dir) TIFF *tif; TIFFDirEntry *dir; { TIFFDirectory *td = &tif->tif_dir; long off[4]; int i, j; TIFFDirEntry tdir; char *qmat; if (dir->tdir_count > 1) { /* XXX verify count <= 4 */ if (!TIFFFetchData(tif, dir, (char *)off)) return (0); } else off[0] = dir->tdir_offset; /* * We don't share per-component q matrices because * (besides complicating this logic even more), it * would make it very painful if the user does a ``set''. */ td->td_qtab = (u_char **)CheckMalloc(tif, dir->tdir_count*(sizeof (u_char *) + 64*sizeof (u_char)), "for JPEG Q table"); if (td->td_qtab == NULL) return (0); tdir.tdir_type = TIFF_BYTE; tdir.tdir_count = 64; qmat = (((char *)td->td_qtab) + dir->tdir_count*sizeof (u_char *)); for (i = 0; i < dir->tdir_count; i++) { td->td_qtab[i] = (u_char *)qmat; tdir.tdir_offset = off[i]; if (!TIFFFetchData(tif, &tdir, qmat)) return (0); qmat += 64*sizeof (u_char); } return (1); } /* * Fetch JPEG Huffman code tables for the * specified directory entry. Storage for * the tables are allocated as a side effect. */ static int TIFFFetchJPEGCTables(tif, dir, ptab) TIFF *tif; TIFFDirEntry *dir; u_char ***ptab; { long off[4]; int i, j, ncodes; TIFFDirEntry tdir; char *tab; if (dir->tdir_count > 1) { /* XXX verify count <= 4 */ if (!TIFFFetchData(tif, dir, (char *)off)) return (0); } else off[0] = dir->tdir_offset; /* * We don't share per-component tables because * (besides complicating this logic even more), it * would make it very painful if the user does a * ``set''. Note also that we don't try to optimize * storage of the tables -- we just allocate enough * space to hold the largest possible. All this * stuff is so complicated 'cuz the tag is defined * to be compatible with the JPEG table format, * rather than something that fits well into the * structure of TIFF -- argh! */ *ptab = (u_char **)CheckMalloc(tif, dir->tdir_count* (sizeof (u_char *) + (16+256)*sizeof (u_char)), "for JPEG Huffman table"); if (*ptab == NULL) return (0); tdir.tdir_type = TIFF_BYTE; tab = (((char *)*ptab) + dir->tdir_count*sizeof (u_char *)); for (i = 0; i < dir->tdir_count; i++) { (*ptab)[i] = (u_char *)tab; tdir.tdir_offset = off[i]; tdir.tdir_count = 16; /* * We must fetch the array that holds the * count of codes for each bit length first * and the count up the number of codes that * are in the variable length table. This * information is implicit in the JPEG format * 'cuz it's preceded by a length field. */ if (!TIFFFetchData(tif, &tdir, tab)) /* count array */ return (0); for (ncodes = 0, j = 0; j < 16; j++) ncodes += tab[j]; /* * Adjust offsets and fetch codes separately. */ tdir.tdir_offset += 16; tdir.tdir_count = ncodes; tab += 16; if (!TIFFFetchData(tif, &tdir, tab)) return (0); tab += ncodes; } return (1); } #endif /* * Accept matteing-only ExtraSamples tag. */ static int TIFFFetchExtraSamples(tif, dp) TIFF *tif; TIFFDirEntry *dp; { int type; if (dp->tdir_count != 1) { TIFFError(tif->tif_name, "Can not handle more than 1 extra sample/pixel"); return (0); } type = TIFFExtractData(tif, dp->tdir_type, dp->tdir_offset); if (type != EXTRASAMPLE_ASSOCALPHA) { TIFFError(tif->tif_name, "Can only handle associated-alpha extra samples"); return (0); } return (TIFFSetField(tif, TIFFTAG_MATTEING, 1)); } neuron-7.6.3/src/lib/TIFF/tif_dirwrite.c000077500000000000000000000536401340731477100200030ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_dirwrite.c,v 1.2 1997/03/26 15:07:07 hines Exp"; #endif /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * Directory Write Support Routines. * * NB: Beware of the varargs declarations for routines in * this file. The names and types of variables has been * carefully chosen to make things work with compilers that * are busted in one way or another (e.g. SGI/MIPS). */ #include #include #include "tiffioP.h" #include "prototypes.h" extern int TIFFFlushData1(TIFF *); extern int TIFFFreeDirectory(TIFF*); extern int TIFFDefaultDirectory(TIFF*); #if HAVE_IEEEFP #define TIFFCvtNativeToIEEEFloat(tif, n, fp) #endif #if USE_PROTOTYPES static int TIFFWriteNormalTag(TIFF*, TIFFDirEntry*, TIFFFieldInfo*); static void TIFFSetupShortLong(TIFF *, u_short, TIFFDirEntry *, u_long); static int TIFFSetupShortPair(TIFF *, u_short, TIFFDirEntry *); static int TIFFWriteRational(TIFF *, TIFFDataType, u_short, TIFFDirEntry *, float); static int TIFFWritePerSampleShorts(TIFF *, u_short, TIFFDirEntry *); static int TIFFWriteShortTable(TIFF *, u_short, TIFFDirEntry *, int, u_short **); static int TIFFWriteShortArray(TIFF *, TIFFDataType, u_short, TIFFDirEntry *, int, u_short *); static int TIFFWriteLongArray(TIFF *, TIFFDataType, u_short, TIFFDirEntry *, int, u_long *); static int TIFFWriteRationalArray(TIFF *, TIFFDataType, u_short, TIFFDirEntry *, int, float *); static int TIFFWriteFloatArray(TIFF *, TIFFDataType, u_short, TIFFDirEntry *, int, float *); static int TIFFWriteString(TIFF *, u_short, TIFFDirEntry *, char *); #ifdef JPEG_SUPPORT static int TIFFWriteJPEGQTables(TIFF *, TIFFDirEntry *); static int TIFFWriteJPEGCTables(TIFF *, u_short, TIFFDirEntry *, u_char **); #endif #ifdef COLORIMETRY_SUPPORT static int TIFFWriteTransferFunction(TIFF*, TIFFDirEntry*); #endif static int TIFFWriteData(TIFF *, TIFFDirEntry *, char *); static int TIFFLinkDirectory(TIFF *); #else static int TIFFWriteNormalTag(); static void TIFFSetupShortLong(); static int TIFFSetupShortPair(); static int TIFFWriteRational(); static int TIFFWritePerSampleShorts(); static int TIFFWriteShortTable(); static int TIFFWriteShortArray(); static int TIFFWriteLongArray(); static int TIFFWriteRationalArray(); static int TIFFWriteFloatArray(); static int TIFFWriteString(); #ifdef JPEG_SUPPORT static int TIFFWriteJPEGQTables(); static int TIFFWriteJPEGCTables(); #endif static int TIFFWriteData(); static int TIFFLinkDirectory(); #endif #define WriteRationalPair(type, tag1, v1, tag2, v2) { \ if (!TIFFWriteRational(tif, type, tag1, dir, v1)) \ goto bad; \ if (!TIFFWriteRational(tif, type, tag2, dir+1, v2)) \ goto bad; \ dir++; \ } static long dataoff; /* * Write the contents of the current directory * to the specified file. This routine doesn't * handle overwriting a directory with auxiliary * storage that's been changed. */ int TIFFWriteDirectory(tif) TIFF *tif; { short dircount, tag; int nfields, dirsize; char *data; const TIFFFieldInfo *fip; TIFFDirEntry *dir; TIFFDirectory *td; u_long b, fields[sizeof (td->td_fieldsset) / sizeof (u_long)]; if (tif->tif_mode == O_RDONLY) return (1); /* * Clear write state so that subsequent images with * different characteristics get the right buffers * setup for them. */ if (tif->tif_flags & TIFF_POSTENCODE) { tif->tif_flags &= ~TIFF_POSTENCODE; if (tif->tif_postencode && !(*tif->tif_postencode)(tif)) { TIFFError(tif->tif_name, "Error post-encoding before directory write"); return (0); } } if (tif->tif_close) (*tif->tif_close)(tif); if (tif->tif_cleanup) (*tif->tif_cleanup)(tif); /* * Flush any data that might have been written * by the compression close+cleanup routines. */ if (tif->tif_rawcc > 0 && !TIFFFlushData1(tif)) { TIFFError(tif->tif_name, "Error flushing data before directory write"); return (0); } if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata) { free(tif->tif_rawdata); tif->tif_rawdata = NULL; tif->tif_rawcc = 0; } tif->tif_flags &= ~(TIFF_BEENWRITING|TIFF_BUFFERSETUP); td = &tif->tif_dir; /* * Size the directory so that we can calculate * offsets for the data items that aren't kept * in-place in each field. */ nfields = 0; for (b = 0; b <= FIELD_LAST; b++) if (TIFFFieldSet(tif, b)) nfields += (b < FIELD_SUBFILETYPE ? 2 : 1); dirsize = nfields * sizeof (TIFFDirEntry); data = malloc(dirsize); if (data == NULL) { TIFFError(tif->tif_name, "Cannot write directory, out of space"); return (0); } /* * Directory hasn't been placed yet, put * it at the end of the file and link it * into the existing directory structure. */ if (tif->tif_diroff == 0 && !TIFFLinkDirectory(tif)) return (0); dataoff = tif->tif_diroff + sizeof (short) + dirsize + sizeof (long); if (dataoff & 1) dataoff++; (void) lseek(tif->tif_fd, dataoff, L_SET); tif->tif_curdir++; dir = (TIFFDirEntry *)data; /* * Setup external form of directory * entries and write data items. */ bcopy(td->td_fieldsset, fields, sizeof (fields)); /*BEGIN XXX*/ /* * Write out ExtraSamples tag only if Matteing would * be set to 1 (i.e. Associated Alpha data is present). */ if (FieldSet(fields, FIELD_MATTEING) && !td->td_matteing) { /*XXX*/ ResetFieldBit(fields, FIELD_MATTEING); /*XXX*/ nfields--; /*XXX*/ dirsize -= sizeof (TIFFDirEntry); /*XXX*/ } /*XXX*/ /*END XXX*/ for (fip = tiffFieldInfo; fip->field_tag; fip++) { if (fip->field_bit == FIELD_IGNORE || !FieldSet(fields, fip->field_bit)) continue; switch (fip->field_bit) { case FIELD_STRIPOFFSETS: /* * We use one field bit for both strip and tile * offsets, and so must be careful in selecting * the appropriate field descriptor (so that tags * are written in sorted order). */ tag = isTiled(tif) ? TIFFTAG_TILEOFFSETS : TIFFTAG_STRIPOFFSETS; if (tag != fip->field_tag) continue; if (!TIFFWriteLongArray(tif, TIFF_LONG, tag, dir, (int) td->td_nstrips, td->td_stripoffset)) goto bad; break; case FIELD_STRIPBYTECOUNTS: /* * We use one field bit for both strip and tile * byte counts, and so must be careful in selecting * the appropriate field descriptor (so that tags * are written in sorted order). */ tag = isTiled(tif) ? TIFFTAG_TILEBYTECOUNTS : TIFFTAG_STRIPBYTECOUNTS; if (tag != fip->field_tag) continue; if (!TIFFWriteLongArray(tif, TIFF_LONG, tag, dir, (int) td->td_nstrips, td->td_stripbytecount)) goto bad; break; case FIELD_COLORMAP: if (!TIFFWriteShortTable(tif, TIFFTAG_COLORMAP, dir, 3, td->td_colormap)) goto bad; break; case FIELD_IMAGEDIMENSIONS: TIFFSetupShortLong(tif, TIFFTAG_IMAGEWIDTH, dir++, td->td_imagewidth); TIFFSetupShortLong(tif, TIFFTAG_IMAGELENGTH, dir, td->td_imagelength); break; case FIELD_TILEDIMENSIONS: TIFFSetupShortLong(tif, TIFFTAG_TILEWIDTH, dir++, td->td_tilewidth); TIFFSetupShortLong(tif, TIFFTAG_TILELENGTH, dir, td->td_tilelength); break; case FIELD_POSITION: WriteRationalPair(TIFF_RATIONAL, TIFFTAG_XPOSITION, td->td_xposition, TIFFTAG_YPOSITION, td->td_yposition); break; case FIELD_RESOLUTION: WriteRationalPair(TIFF_RATIONAL, TIFFTAG_XRESOLUTION, td->td_xresolution, TIFFTAG_YRESOLUTION, td->td_yresolution); break; case FIELD_BITSPERSAMPLE: case FIELD_MINSAMPLEVALUE: case FIELD_MAXSAMPLEVALUE: case FIELD_SAMPLEFORMAT: if (!TIFFWritePerSampleShorts(tif, fip->field_tag, dir)) goto bad; break; case FIELD_PAGENUMBER: case FIELD_HALFTONEHINTS: #ifdef YCBCR_SUPPORT case FIELD_YCBCRSUBSAMPLING: #endif #ifdef CMYK_SUPPORT case FIELD_DOTRANGE: #endif TIFFSetupShortPair(tif, fip->field_tag, dir); break; #ifdef JPEG_SUPPORT case FIELD_JPEGQTABLES: if (!TIFFWriteJPEGQTables(tif, dir)) goto bad; break; case FIELD_JPEGDCTABLES: if (!TIFFWriteJPEGCTables(tif, TIFFTAG_JPEGDCTABLES, dir, td->td_dctab)) goto bad; break; case FIELD_JPEGACTABLES: if (!TIFFWriteJPEGCTables(tif, TIFFTAG_JPEGACTABLES, dir, td->td_actab)) goto bad; break; #endif #ifdef COLORIMETRY_SUPPORT case FIELD_REFBLACKWHITE: if (!TIFFWriteRationalArray(tif, TIFF_RATIONAL, TIFFTAG_REFERENCEBLACKWHITE, dir, 2*td->td_samplesperpixel, td->td_refblackwhite)) goto bad; break; case FIELD_TRANSFERFUNCTION: if (!TIFFWriteTransferFunction(tif, dir)) goto bad; break; #endif default: if (!TIFFWriteNormalTag(tif, dir, (TIFFFieldInfo*)fip)) goto bad; break; } dir++; ResetFieldBit(fields, fip->field_bit); } /* * Write directory. */ (void) lseek(tif->tif_fd, tif->tif_diroff, L_SET); dircount = nfields; if (!WriteOK(tif->tif_fd, &dircount, sizeof (short))) { TIFFError(tif->tif_name, "Error writing directory count"); goto bad; } if (!WriteOK(tif->tif_fd, data, dirsize)) { TIFFError(tif->tif_name, "Error writing directory contents"); goto bad; } if (!WriteOK(tif->tif_fd, &tif->tif_nextdiroff, sizeof (long))) { TIFFError(tif->tif_name, "Error writing directory link"); goto bad; } TIFFFreeDirectory(tif); free(data); tif->tif_flags &= ~TIFF_DIRTYDIRECT; /* * Reset directory-related state for subsequent * directories. */ TIFFDefaultDirectory(tif); tif->tif_diroff = 0; tif->tif_curoff = 0; tif->tif_row = -1; tif->tif_curstrip = -1; return (1); bad: free(data); return (0); } #undef WriteRationalPair /* * Process tags that are not special cased. */ static int DECLARE3(TIFFWriteNormalTag, TIFF*, tif, TIFFDirEntry*, dir, TIFFFieldInfo*, fip) { TIFFDirectory* td = &tif->tif_dir; u_short wc = (u_short) fip->field_writecount; dir->tdir_tag = fip->field_tag; dir->tdir_type = (u_short)fip->field_type; dir->tdir_count = wc; #define WRITE(x,y) x(tif, fip->field_type, fip->field_tag, dir, wc, y) switch (fip->field_type) { case TIFF_SHORT: case TIFF_SSHORT: if (wc > 1) { u_short *wp; if (wc == (u_short) TIFF_VARIABLE) { _TIFFgetfield(td, fip->field_tag, &wc, &wp); dir->tdir_count = wc; } else _TIFFgetfield(td, fip->field_tag, &wp); if (!WRITE(TIFFWriteShortArray, wp)) return (0); } else { u_short sv; _TIFFgetfield(td, fip->field_tag, &sv); dir->tdir_offset = TIFFInsertData(tif, dir->tdir_type, sv); } break; case TIFF_LONG: case TIFF_SLONG: if (wc > 1) { u_long *lp; if (wc == (u_short) TIFF_VARIABLE) { _TIFFgetfield(td, fip->field_tag, &wc, &lp); dir->tdir_count = wc; } else _TIFFgetfield(td, fip->field_tag, &lp); if (!WRITE(TIFFWriteLongArray, lp)) return (0); } else { /* XXX handle LONG->SHORT conversion */ _TIFFgetfield(td, fip->field_tag, &dir->tdir_offset); } break; case TIFF_RATIONAL: case TIFF_SRATIONAL: if (wc > 1) { float *fp; if (wc == (u_short) TIFF_VARIABLE) { _TIFFgetfield(td, fip->field_tag, &wc, &fp); dir->tdir_count = wc; } else _TIFFgetfield(td, fip->field_tag, &fp); if (!WRITE(TIFFWriteRationalArray, fp)) return (0); } else { float fv; _TIFFgetfield(td, fip->field_tag, &fv); if (!TIFFWriteRational(tif, fip->field_type, fip->field_tag, dir, fv)) return (0); } break; case TIFF_FLOAT: if (wc > 1) { float *fp; if (wc == (u_short) TIFF_VARIABLE) { _TIFFgetfield(td, fip->field_tag, &wc, &fp); dir->tdir_count = wc; } else _TIFFgetfield(td, fip->field_tag, &fp); if (!WRITE(TIFFWriteFloatArray, fp)) return (0); } else { float fv; _TIFFgetfield(td, fip->field_tag, &fv); TIFFCvtNativeToIEEEFloat(tif, 1, &fv); /* XXX assumes sizeof (long) == sizeof (float) */ dir->tdir_offset = *(u_long *)&fv; /* XXX */ } break; case TIFF_ASCII: { char *cp; _TIFFgetfield(td, fip->field_tag, &cp); if (!TIFFWriteString(tif, fip->field_tag, dir, cp)) return (0); break; } default: { break; } } return (1); } #undef WRITE /* * Setup a directory entry with either a SHORT * or LONG type according to the value. */ static void DECLARE4(TIFFSetupShortLong, TIFF*, tif, u_short, tag, TIFFDirEntry*, dir, u_long, v) { dir->tdir_tag = tag; dir->tdir_count = 1; if (v > 0xffffL) { dir->tdir_type = (short)TIFF_LONG; dir->tdir_offset = v; } else { dir->tdir_type = (short)TIFF_SHORT; dir->tdir_offset = TIFFInsertData(tif, (int)TIFF_SHORT, v); } } #undef MakeShortDirent /* * Setup a RATIONAL directory entry and * write the associated indirect value. */ static int DECLARE5(TIFFWriteRational, TIFF*, tif, TIFFDataType, type, u_short, tag, TIFFDirEntry*, dir, float, v) { u_long t[2]; dir->tdir_tag = tag; dir->tdir_type = (short)type; dir->tdir_count = 1; if (type == TIFF_RATIONAL && v < 0) TIFFWarning(tif->tif_name, "\"%s\": Information lost writing value (%g) as (unsigned) RATIONAL", TIFFFieldWithTag(tag)->field_name, v); /* need algorithm to convert ... XXX */ t[0] = v*10000.0 + 0.5; t[1] = 10000; return (TIFFWriteData(tif, dir, (char *)t)); } /* * Setup a directory entry that references a * samples/pixel array of SHORT values and * (potentially) write the associated indirect * values. */ static int DECLARE3(TIFFWritePerSampleShorts, TIFF*, tif, u_short, tag, TIFFDirEntry*, dir) { u_short w[4], v; int i, samplesperpixel = tif->tif_dir.td_samplesperpixel; _TIFFgetfield(&tif->tif_dir, tag, &v); for (i = 0; i < samplesperpixel; i++) w[i] = v; return (TIFFWriteShortArray( tif, TIFF_SHORT, tag, dir, samplesperpixel, w)); } /* * Setup a pair of shorts that are returned by * value, rather than as a reference to an array. */ static int DECLARE3(TIFFSetupShortPair, TIFF*, tif, u_short, tag, TIFFDirEntry*, dir) { u_short v[2]; _TIFFgetfield(&tif->tif_dir, tag, &v[0], &v[1]); return (TIFFWriteShortArray(tif, TIFF_SHORT, tag, dir, 2, v)); } /* * Setup a directory entry for an NxM table of shorts, * where M is known to be 2**bitspersample, and write * the associated indirect data. */ static int DECLARE5(TIFFWriteShortTable, TIFF*, tif, u_short, tag, TIFFDirEntry*, dir, int, n, u_short**, table) { u_long off; int i; dir->tdir_tag = tag; dir->tdir_type = (short)TIFF_SHORT; /* XXX -- yech, fool TIFFWriteData */ dir->tdir_count = 1L<tif_dir.td_bitspersample; off = dataoff; for (i = 0; i < n; i++) if (!TIFFWriteData(tif, dir, (char *)table[i])) return (0); dir->tdir_count *= n; dir->tdir_offset = off; return (1); } /* * Setup a directory entry of an ASCII string * and write any associated indirect value. */ static int DECLARE4(TIFFWriteString, TIFF*, tif, u_short, tag, TIFFDirEntry*, dir, char*, cp) { dir->tdir_tag = tag; dir->tdir_type = (short)TIFF_ASCII; dir->tdir_count = strlen(cp) + 1; /* includes \0 byte */ if (dir->tdir_count > 4) { if (!TIFFWriteData(tif, dir, cp)) return (0); } else bcopy(cp, &dir->tdir_offset, dir->tdir_count); return (1); } /* * Setup a directory entry of an array of SHORT * or SSHORT and write the associated indirect values. */ static int DECLARE6(TIFFWriteShortArray, TIFF*, tif, TIFFDataType, type, u_short, tag, TIFFDirEntry*, dir, int, n, u_short*, v) { dir->tdir_tag = tag; dir->tdir_type = (short)type; dir->tdir_count = n; if (n <= 2) { if (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) { dir->tdir_offset = (long)v[0] << 16; if (n == 2) dir->tdir_offset |= v[1] & 0xffff; } else { dir->tdir_offset = v[0] & 0xffff; if (n == 2) dir->tdir_offset |= (long)v[1] << 16; } return (1); } else return (TIFFWriteData(tif, dir, (char *)v)); } /* * Setup a directory entry of an array of LONG * or SLONG and write the associated indirect values. */ static int DECLARE6(TIFFWriteLongArray, TIFF*, tif, TIFFDataType, type, u_short, tag, TIFFDirEntry*, dir, int, n, u_long*, v) { dir->tdir_tag = tag; dir->tdir_type = (short)type; dir->tdir_count = n; if (n == 1) { dir->tdir_offset = v[0]; return (1); } else return (TIFFWriteData(tif, dir, (char *)v)); } /* * Setup a directory entry of an array of RATIONAL * or SRATIONAL and write the associated indirect values. */ static int DECLARE6(TIFFWriteRationalArray, TIFF*, tif, TIFFDataType, type, u_short, tag, TIFFDirEntry*, dir, int, n, float*, v) { int i, status; u_long *t; dir->tdir_tag = tag; dir->tdir_type = (short)type; dir->tdir_count = n; t = (u_long *)malloc(2*n * sizeof (long)); for (i = 0; i < n; i++) { /* need algorithm to convert ... XXX */ t[2*i+0] = v[i]*10000.0 + 0.5; t[2*i+1] = 10000; } status = TIFFWriteData(tif, dir, (char *)t); free((char *)t); return (status); } static int DECLARE6(TIFFWriteFloatArray, TIFF *, tif, TIFFDataType, type, u_short, tag, TIFFDirEntry *, dir, int, n, float *, v) { dir->tdir_tag = tag; dir->tdir_type = (short)type; dir->tdir_count = n; TIFFCvtNativeToIEEEFloat(tif, n, v); if (n == 1) { dir->tdir_offset = *(u_long *)&v[0]; return (1); } else return (TIFFWriteData(tif, dir, (char *)v)); } #ifdef JPEG_SUPPORT /* * Setup a directory entry for JPEG Quantization * tables and write the associated indirect values. */ static int DECLARE2(TIFFWriteJPEGQTables, TIFF*, tif, TIFFDirEntry*, dir) { TIFFDirectory *td = &tif->tif_dir; TIFFDirEntry tdir; u_long off[4]; int i; tdir.tdir_tag = TIFFTAG_JPEGQTABLES; /* for diagnostics */ tdir.tdir_type = (short)TIFF_BYTE; tdir.tdir_count = 64; for (i = 0; i < td->td_samplesperpixel; i++) { if (!TIFFWriteData(tif, &tdir, (char *)td->td_qtab[i])) return (0); off[i] = tdir.tdir_offset; } return (TIFFWriteLongArray(tif, TIFF_LONG, TIFFTAG_JPEGQTABLES, dir, td->td_samplesperpixel, off)); } /* * Setup a directory entry for JPEG Coefficient * tables and write the associated indirect values. */ static int DECLARE4(TIFFWriteJPEGCTables, TIFF*, tif, u_short, tag, TIFFDirEntry*, dir, u_char **, tab) { TIFFDirectory *td = &tif->tif_dir; TIFFDirEntry tdir; u_long off[4]; int i, j, ncodes; tdir.tdir_tag = tag; /* for diagnostics */ tdir.tdir_type = (short)TIFF_BYTE; for (i = 0; i < td->td_samplesperpixel; i++) { for (ncodes = 0, j = 0; j < 16; j++) ncodes += tab[i][j]; tdir.tdir_count = 16+ncodes; if (!TIFFWriteData(tif, &tdir, (char *)tab[i])) return (0); off[i] = tdir.tdir_offset; } return (TIFFWriteLongArray(tif, TIFF_LONG, tag, dir, td->td_samplesperpixel, off)); } #endif #ifdef COLORIMETRY_SUPPORT static int DECLARE2(TIFFWriteTransferFunction, TIFF*, tif, TIFFDirEntry*, dir) { TIFFDirectory *td = &tif->tif_dir; int j, ncols; u_long n; u_short **tf = td->td_transferfunction; /* * Check if the table can be written as a single column. */ n = (1L<td_bitspersample) * sizeof (u_short); ncols = 1; /* assume only one column is needed */ for (j = 1; j < td->td_samplesperpixel; j++) if (bcmp(tf[0], tf[j], n)) { ncols = td->td_samplesperpixel; break; } return (TIFFWriteShortTable(tif, TIFFTAG_TRANSFERFUNCTION, dir, ncols, tf)); } #endif /* * Write a contiguous directory item. */ static int TIFFWriteData(tif, dir, cp) TIFF *tif; TIFFDirEntry *dir; char *cp; { int cc; dir->tdir_offset = dataoff; cc = dir->tdir_count * tiffDataWidth[dir->tdir_type]; if (SeekOK(tif->tif_fd, dir->tdir_offset) && WriteOK(tif->tif_fd, cp, cc)) { dataoff += (cc + 1) & ~1; return (1); } TIFFError(tif->tif_name, "Error writing data for field \"%s\"", TIFFFieldWithTag(dir->tdir_tag)->field_name); return (0); } /* * Link the current directory into the * directory chain for the file. */ static int TIFFLinkDirectory(tif) register TIFF *tif; { static char module[] = "TIFFLinkDirectory"; u_short dircount; long nextdir; tif->tif_diroff = (lseek(tif->tif_fd, 0L, L_XTND)+1) &~ 1L; if (tif->tif_header.tiff_diroff == 0) { /* * First directory, overwrite header. */ tif->tif_header.tiff_diroff = tif->tif_diroff; (void) lseek(tif->tif_fd, 0L, L_SET); if (!WriteOK(tif->tif_fd, &tif->tif_header, sizeof (tif->tif_header))) { TIFFError(tif->tif_name, "Error writing TIFF header"); return (0); } return (1); } /* * Not the first directory, search to the last and append. */ nextdir = tif->tif_header.tiff_diroff; do { if (!SeekOK(tif->tif_fd, nextdir) || !ReadOK(tif->tif_fd, &dircount, sizeof (dircount))) { TIFFError(module, "Error fetching directory count"); return (0); } if (tif->tif_flags & TIFF_SWAB) TIFFSwabShort(&dircount); lseek(tif->tif_fd, dircount * sizeof (TIFFDirEntry), L_INCR); if (!ReadOK(tif->tif_fd, &nextdir, sizeof (nextdir))) { TIFFError(module, "Error fetching directory link"); return (0); } if (tif->tif_flags & TIFF_SWAB) TIFFSwabLong((u_long *)&nextdir); } while (nextdir != 0); (void) lseek(tif->tif_fd, -sizeof (nextdir), L_INCR); if (!WriteOK(tif->tif_fd, &tif->tif_diroff, sizeof (tif->tif_diroff))) { TIFFError(module, "Error writing directory link"); return (0); } return (1); } neuron-7.6.3/src/lib/TIFF/tif_dumpmode.c000077500000000000000000000101441340731477100177540ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_dumpmode.c,v 1.2 1997/03/26 15:07:08 hines Exp"; #endif /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * "Null" Compression Algorithm Support. */ #include "tiffioP.h" #include #include extern int TIFFFlushData1(TIFF *); #if USE_PROTOTYPES static int DumpModeEncode(TIFF *, u_char *, int, u_int); static int DumpModeDecode(TIFF *, u_char *, int, u_int); static int DumpModeSeek(TIFF *, int); #else static int DumpModeEncode(), DumpModeDecode(), DumpModeSeek(); #endif /* * Initialize dump mode. */ int TIFFInitDumpMode(tif) register TIFF *tif; { tif->tif_decoderow = DumpModeDecode; tif->tif_decodestrip = DumpModeDecode; tif->tif_decodetile = DumpModeDecode; tif->tif_encoderow = DumpModeEncode; tif->tif_encodestrip = DumpModeEncode; tif->tif_encodetile = DumpModeEncode; tif->tif_seek = DumpModeSeek; return (1); } /* * Encode a hunk of pixels. */ static int DumpModeEncode(tif, pp, cc, s) register TIFF *tif; u_char *pp; int cc; u_int s; { /* * This may be overzealous, but avoids having to * worry about byte alignment for the (potential) * byte-swapping work below. */ if (tif->tif_rawcc + cc > tif->tif_rawdatasize) if (!TIFFFlushData1(tif)) return (-1); while (cc > 0) { int n; if ((n = cc) > tif->tif_rawdatasize) n = tif->tif_rawdatasize; bcopy(pp, tif->tif_rawcp, n); if (tif->tif_flags & TIFF_SWAB) { switch (tif->tif_dir.td_bitspersample) { case 16: assert((n & 3) == 0); TIFFSwabArrayOfShort((u_short *)tif->tif_rawcp, n/2); break; case 32: assert((n & 15) == 0); TIFFSwabArrayOfLong((u_long *)tif->tif_rawcp, n/4); break; } } tif->tif_rawcp += n; tif->tif_rawcc += n; pp += n; cc -= n; if (tif->tif_rawcc >= tif->tif_rawdatasize && !TIFFFlushData1(tif)) return (-1); } return (1); } /* * Decode a hunk of pixels. */ static int DumpModeDecode(tif, buf, cc, s) register TIFF *tif; u_char *buf; int cc; u_int s; { if (tif->tif_rawcc < cc) { TIFFError(tif->tif_name, "DumpModeDecode: Not enough data for scanline %d", tif->tif_row); return (0); } /* * Avoid copy if client has setup raw * data buffer to avoid extra copy. */ if (tif->tif_rawcp != (char*) buf) bcopy(tif->tif_rawcp, buf, cc); if (tif->tif_flags & TIFF_SWAB) { switch (tif->tif_dir.td_bitspersample) { case 16: assert((cc & 3) == 0); TIFFSwabArrayOfShort((u_short *)buf, cc/2); break; case 32: assert((cc & 15) == 0); TIFFSwabArrayOfLong((u_long *)buf, cc/4); break; } } tif->tif_rawcp += cc; tif->tif_rawcc -= cc; return (1); } /* * Seek forwards nrows in the current strip. */ static int DumpModeSeek(tif, nrows) register TIFF *tif; int nrows; { tif->tif_rawcp += nrows * tif->tif_scanlinesize; tif->tif_rawcc -= nrows * tif->tif_scanlinesize; return (1); } neuron-7.6.3/src/lib/TIFF/tif_error.c000077500000000000000000000042151340731477100172750ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_error.c,v 1.2 1997/03/26 15:07:09 hines Exp"; #endif /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. */ #include "tiffioP.h" #include "prototypes.h" #include static void DECLARE3(defaultHandler, char*, module, char*, fmt, va_list, ap) { if (module != NULL) fprintf(stderr, "%s: ", module); vfprintf(stderr, fmt, ap); fprintf(stderr, ".\n"); } static TIFFErrorHandler _errorHandler = defaultHandler; TIFFErrorHandler DECLARE1(TIFFSetErrorHandler, TIFFErrorHandler, handler) { TIFFErrorHandler prev = _errorHandler; _errorHandler = handler; return (prev); } void #if USE_PROTOTYPES TIFFError(char *module, char *fmt, ...) #else /*VARARGS2*/ TIFFError(module, fmt, va_alist) char *module; char *fmt; va_dcl #endif { if (_errorHandler) { va_list ap; VA_START(ap, fmt); (*_errorHandler)(module, fmt, ap); va_end(ap); } } neuron-7.6.3/src/lib/TIFF/tif_fax3.c000077500000000000000000000712521340731477100170120ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_fax3.c,v 1.3 1999/07/05 15:35:01 hines Exp"; #endif /* * Copyright (c) 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * CCITT Group 3 and Group 4 Compression Support. */ #include "tiffioP.h" #include #include #include "tif_fax3.h" #define G3CODES #include "t4.h" #define G3STATES #include "g3states.h" typedef struct { Fax3BaseState b; } Fax3DecodeState; typedef struct { Fax3BaseState b; const u_char *wruns; const u_char *bruns; short k; /* #rows left that can be 2d encoded */ short maxk; /* max #rows that can be 2d encoded */ } Fax3EncodeState; #if USE_PROTOTYPES static int Fax3PreDecode(TIFF *); static int Fax3Decode(TIFF*, u_char *, int, u_int); static int Fax3Decode1DRow(TIFF*, u_char *, int); static int Fax3PreEncode(TIFF *); static int Fax3PostEncode(TIFF *); static int Fax3Encode(TIFF*, u_char *, int, u_int); static int Fax3Encode1DRow(TIFF *, u_char *, int); static int Fax3Close(TIFF *); static int Fax3Cleanup(TIFF *); static void *Fax3SetupState(TIFF *, int); static void fillspan(char *, int, int); static int findspan(u_char **, int, int, u_char const *); static int finddiff(u_char *, int, int, int); static void skiptoeol(TIFF *, int); static void putbits(TIFF *, u_int, u_int); static void putcode(TIFF *, tableentry const *); static void putspan(TIFF *, int, tableentry const *); extern int TIFFFlushData1(TIFF *); #else static int Fax3PreEncode(), Fax3Encode(), Fax3PostEncode(); static int Fax3Encode1DRow(); static int Fax3Decode(), Fax3PreDecode(); static int Fax3Decode1DRow(); static int Fax3Close(), Fax3Cleanup(); static void *Fax3SetupState(); static void fillspan(); static int findspan(); static int finddiff(); static void skiptoeol(); static void putbits(); static void putcode(); static void putspan(); extern int TIFFFlushData1(); #endif int TIFFInitCCITTFax3(tif) TIFF *tif; { tif->tif_predecode = Fax3PreDecode; tif->tif_decoderow = Fax3Decode; tif->tif_decodestrip = Fax3Decode; tif->tif_decodetile = Fax3Decode; tif->tif_preencode = Fax3PreEncode; tif->tif_postencode = Fax3PostEncode; tif->tif_encoderow = Fax3Encode; tif->tif_encodestrip = Fax3Encode; tif->tif_encodetile = Fax3Encode; tif->tif_close = Fax3Close; tif->tif_cleanup = Fax3Cleanup; tif->tif_options |= FAX3_CLASSF; /* default */ tif->tif_flags |= TIFF_NOBITREV; /* we handle bit reversal */ return (1); } void TIFFModeCCITTFax3(tif, isClassF) TIFF *tif; int isClassF; { if (isClassF) tif->tif_options |= FAX3_CLASSF; else tif->tif_options &= ~FAX3_CLASSF; } static u_char bitMask[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; #define isBitSet(sp) ((sp)->b.data & bitMask[(sp)->b.bit]) #define is2DEncoding(tif) \ (tif->tif_dir.td_group3options & GROUP3OPT_2DENCODING) #define fetchByte(tif, sp) \ ((tif)->tif_rawcc--, (sp)->b.bitmap[*(u_char *)(tif)->tif_rawcp++]) #define BITCASE(b) \ case b: \ code <<= 1; \ if (data & (1<<(7-b))) code |= 1;\ len++; \ if (code > 0) { bit = b+1; break; } /* * Skip over input until an EOL code is found. The * value of len is passed as 0 except during error * recovery when decoding 2D data. Note also that * we don't use the optimized state tables to locate * an EOL because we can't assume much of anything * about our state (e.g. bit position). */ static void skiptoeol(tif, len) TIFF *tif; int len; { Fax3DecodeState *sp = (Fax3DecodeState *)tif->tif_data; register int bit = sp->b.bit; register int data = sp->b.data; int code = 0; /* * Our handling of ``bit'' is painful because * the rest of the code does not maintain it as * exactly the bit offset in the current data * byte (bit == 0 means refill the data byte). * Thus we have to be careful on entry and * exit to insure that we maintain a value that's * understandable elsewhere in the decoding logic. */ if (bit == 0) /* force refill */ bit = 8; for (;;) { switch (bit) { again: BITCASE(0); BITCASE(1); BITCASE(2); BITCASE(3); BITCASE(4); BITCASE(5); BITCASE(6); BITCASE(7); default: if (tif->tif_rawcc <= 0) return; data = fetchByte(tif, sp); goto again; } if (len >= 12 && code == EOL) break; code = len = 0; } sp->b.bit = bit > 7 ? 0 : bit; /* force refill */ sp->b.data = data; } /* * Return the next bit in the input stream. This is * used to extract 2D tag values and the color tag * at the end of a terminating uncompressed data code. */ static int nextbit(tif) TIFF *tif; { Fax3DecodeState *sp = (Fax3DecodeState *)tif->tif_data; int bit; if (sp->b.bit == 0 && tif->tif_rawcc > 0) sp->b.data = fetchByte(tif, sp); bit = isBitSet(sp); if (++(sp->b.bit) > 7) sp->b.bit = 0; return (bit); } static void bset1(cp, n, v) register unsigned char *cp; register int n; register int v; { while (n-- > 0) *cp++ = v; } /* * Setup G3-related compression/decompression * state before data is processed. This routine * is called once per image -- it sets up different * state based on whether or not 2D encoding is used. */ static void * Fax3SetupState(tif, space) TIFF *tif; int space; { TIFFDirectory *td = &tif->tif_dir; Fax3BaseState *sp; int cc = space; long rowbytes, rowpixels; if (td->td_bitspersample != 1) { TIFFError(tif->tif_name, "Bits/sample must be 1 for Group 3/4 encoding/decoding"); return (0); } /* * Calculate the scanline/tile widths. */ if (isTiled(tif)) { rowbytes = TIFFTileRowSize(tif); rowpixels = tif->tif_dir.td_tilewidth; } else { rowbytes = TIFFScanlineSize(tif); rowpixels = tif->tif_dir.td_imagewidth; } if (is2DEncoding(tif) || td->td_compression == COMPRESSION_CCITTFAX4) cc += rowbytes+1; tif->tif_data = malloc(cc); if (tif->tif_data == NULL) { TIFFError("Fax3SetupState", "%s: No space for Fax3 state block", tif->tif_name); return (0); } sp = (Fax3BaseState *)tif->tif_data; sp->rowbytes = rowbytes; sp->rowpixels = rowpixels; sp->bitmap = (tif->tif_fillorder != td->td_fillorder ? TIFFBitRevTable : TIFFNoBitRevTable); sp->white = (td->td_photometric == PHOTOMETRIC_MINISBLACK); if (is2DEncoding(tif) || td->td_compression == COMPRESSION_CCITTFAX4) { /* * 2d encoding/decoding requires a scanline * buffer for the ``reference line''; the * scanline against which delta encoding * is referenced. The reference line must * be initialized to be ``white'' (done elsewhere). */ sp->refline = (u_char *)tif->tif_data + space + 1; /* * Initialize pixel just to the left of the * reference line to white. This extra pixel * simplifies the edge-condition logic. */ sp->refline[-1] = sp->white ? 0xff : 0x00; } else sp->refline = 0; return (sp); } /* * Setup state for decoding a strip. */ static int Fax3PreDecode(tif) TIFF *tif; { Fax3DecodeState *sp = (Fax3DecodeState *)tif->tif_data; if (sp == NULL) { sp = (Fax3DecodeState *)Fax3SetupState(tif, sizeof (*sp)); if (!sp) return (0); } sp->b.bit = 0; /* force initial read */ sp->b.data = 0; sp->b.tag = G3_1D; if (sp->b.refline) bset1(sp->b.refline, sp->b.rowbytes, sp->b.white ? 0xff : 0x00); /* * If image has EOL codes, they precede each line * of data. We skip over the first one here so that * when we decode rows, we can use an EOL to signal * that less than the expected number of pixels are * present for the scanline. */ if ((tif->tif_options & FAX3_NOEOL) == 0) { skiptoeol(tif, 0); if (is2DEncoding(tif)) /* tag should always be 1D! */ sp->b.tag = nextbit(tif) ? G3_1D : G3_2D; } return (1); } /* * Fill a span with ones. */ static void fillspan(cp, x, count) register char *cp; register int x, count; { static const unsigned char masks[] = { 0, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff }; if (count <= 0) return; cp += x>>3; if (x &= 7) { /* align to byte boundary */ if (count < 8 - x) { *cp++ |= masks[count] >> x; return; } *cp++ |= 0xff >> x; count -= 8 - x; } while (count >= 8) { *cp++ = 0xff; count -= 8; } *cp |= masks[count]; } /* * Decode the requested amount of data. */ static int Fax3Decode(tif, buf, occ, s) TIFF *tif; u_char *buf; int occ; u_int s; { Fax3DecodeState *sp = (Fax3DecodeState *)tif->tif_data; bzero(buf, occ); /* decoding only sets non-zero bits */ while (occ > 0) { if (sp->b.tag == G3_1D) { if (!Fax3Decode1DRow(tif, buf, sp->b.rowpixels)) return (0); } else { if (!Fax3Decode2DRow(tif, buf, sp->b.rowpixels)) return (0); } if (is2DEncoding(tif)) { /* * Fetch the tag bit that indicates * whether the next row is 1d or 2d * encoded. If 2d-encoded, then setup * the reference line from the decoded * scanline just completed. */ sp->b.tag = nextbit(tif) ? G3_1D : G3_2D; if (sp->b.tag == G3_2D) bcopy(buf, sp->b.refline, sp->b.rowbytes); } buf += sp->b.rowbytes; occ -= sp->b.rowbytes; } return (1); } /* * Decode a run of white. */ static int decode_white_run(tif) TIFF *tif; { Fax3DecodeState *sp = (Fax3DecodeState *)tif->tif_data; short state = sp->b.bit; short action; int runlen = 0; for (;;) { if (sp->b.bit == 0) { nextbyte: if (tif->tif_rawcc <= 0) return (G3CODE_EOF); sp->b.data = fetchByte(tif, sp); } action = TIFFFax1DAction[state][sp->b.data]; state = TIFFFax1DNextState[state][sp->b.data]; if (action == ACT_INCOMP) goto nextbyte; if (action == ACT_INVALID) return (G3CODE_INVALID); if (action == ACT_EOL) return (G3CODE_EOL); sp->b.bit = state; action = RUNLENGTH(action - ACT_WRUNT); runlen += action; if (action < 64) return (runlen); } /*NOTREACHED*/ } /* * Decode a run of black. */ static int decode_black_run(tif) TIFF *tif; { Fax3DecodeState *sp = (Fax3DecodeState *)tif->tif_data; short state = sp->b.bit + 8; short action; int runlen = 0; for (;;) { if (sp->b.bit == 0) { nextbyte: if (tif->tif_rawcc <= 0) return (G3CODE_EOF); sp->b.data = fetchByte(tif, sp); } action = TIFFFax1DAction[state][sp->b.data]; state = TIFFFax1DNextState[state][sp->b.data]; if (action == ACT_INCOMP) goto nextbyte; if (action == ACT_INVALID) return (G3CODE_INVALID); if (action == ACT_EOL) return (G3CODE_EOL); sp->b.bit = state; action = RUNLENGTH(action - ACT_BRUNT); runlen += action; if (action < 64) return (runlen); state += 8; } /*NOTREACHED*/ } /* * Process one row of 1d Huffman-encoded data. */ static int Fax3Decode1DRow(tif, buf, npels) TIFF *tif; u_char *buf; int npels; { Fax3DecodeState *sp = (Fax3DecodeState *)tif->tif_data; int x = 0; int runlen; short action; short color = sp->b.white; static char module[] = "Fax3Decode1D"; for (;;) { if (color == sp->b.white) runlen = decode_white_run(tif); else runlen = decode_black_run(tif); switch (runlen) { case G3CODE_EOF: TIFFError(module, "%s: Premature EOF at scanline %d (x %d)", tif->tif_name, tif->tif_row, x); return (0); case G3CODE_INVALID: /* invalid code */ /* * An invalid code was encountered. * Flush the remainder of the line * and allow the caller to decide whether * or not to continue. Note that this * only works if we have a G3 image * with EOL markers. */ TIFFError(module, "%s: Bad code word at scanline %d (x %d)", tif->tif_name, tif->tif_row, x); goto done; case G3CODE_EOL: /* premature end-of-line code */ TIFFWarning(module, "%s: Premature EOL at scanline %d (x %d)", tif->tif_name, tif->tif_row, x); return (1); /* try to resynchronize... */ } if (x+runlen > npels) runlen = npels-x; if (runlen > 0) { if (color) fillspan((char *)buf, x, runlen); x += runlen; if (x >= npels) break; } color = !color; } done: /* * Cleanup at the end of the row. This convoluted * logic is merely so that we can reuse the code with * two other related compression algorithms (2 & 32771). * * Note also that our handling of word alignment assumes * that the buffer is at least word aligned. This is * the case for most all versions of malloc (typically * the buffer is returned longword aligned). */ if ((tif->tif_options & FAX3_NOEOL) == 0) skiptoeol(tif, 0); if (tif->tif_options & FAX3_BYTEALIGN) sp->b.bit = 0; if ((tif->tif_options & FAX3_WORDALIGN) && ((long)tif->tif_rawcp & 1)) (void) fetchByte(tif, sp); return (x == npels); } /* * Group 3 2d Decoding support. */ /* * Return the next uncompressed mode code word. */ static int decode_uncomp_code(tif) TIFF *tif; { Fax3DecodeState *sp = (Fax3DecodeState *)tif->tif_data; short code; do { if (sp->b.bit == 0 || sp->b.bit > 7) { if (tif->tif_rawcc <= 0) return (UNCOMP_EOF); sp->b.data = fetchByte(tif, sp); } code = TIFFFaxUncompAction[sp->b.bit][sp->b.data]; sp->b.bit = TIFFFaxUncompNextState[sp->b.bit][sp->b.data]; } while (code == ACT_INCOMP); return (code); } /* * Process one row of 2d encoded data. */ int Fax3Decode2DRow(tif, buf, npels) TIFF *tif; u_char *buf; int npels; { #define PIXEL(buf,ix) ((((buf)[(ix)>>3]) >> (7-((ix)&7))) & 1) Fax3DecodeState *sp = (Fax3DecodeState *)tif->tif_data; int a0 = -1; int b1, b2; int run1, run2; /* for horizontal mode */ short mode; short color = sp->b.white; static char module[] = "Fax3Decode2D"; do { if (sp->b.bit == 0 || sp->b.bit > 7) { if (tif->tif_rawcc <= 0) { TIFFError(module, "%s: Premature EOF at scanline %d", tif->tif_name, tif->tif_row); return (0); } sp->b.data = fetchByte(tif, sp); } mode = TIFFFax2DMode[sp->b.bit][sp->b.data]; sp->b.bit = TIFFFax2DNextState[sp->b.bit][sp->b.data]; switch (mode) { case MODE_NULL: break; case MODE_PASS: b2 = finddiff(sp->b.refline, a0, npels, !color); b1 = finddiff(sp->b.refline, b2, npels, color); b2 = finddiff(sp->b.refline, b1, npels, !color); if (color) { if (a0 < 0) a0 = 0; fillspan((char *)buf, a0, b2 - a0); } a0 = b2; break; case MODE_HORIZ: if (color == sp->b.white) { run1 = decode_white_run(tif); run2 = decode_black_run(tif); } else { run1 = decode_black_run(tif); run2 = decode_white_run(tif); } /* * Do the appropriate fill. Note that we exit * this logic with the same color that we enter * with since we do 2 fills. This explains the * somewhat obscure logic below. */ if (a0 < 0) a0 = 0; if (a0 + run1 > npels) run1 = npels - a0; if (color) fillspan((char *)buf, a0, run1); a0 += run1; if (a0 + run2 > npels) run2 = npels - a0; if (!color) fillspan((char *)buf, a0, run2); a0 += run2; break; case MODE_VERT_V0: case MODE_VERT_VR1: case MODE_VERT_VR2: case MODE_VERT_VR3: case MODE_VERT_VL1: case MODE_VERT_VL2: case MODE_VERT_VL3: b2 = finddiff(sp->b.refline, a0, npels, !color); b1 = finddiff(sp->b.refline, b2, npels, color); b1 += mode - MODE_VERT_V0; if (color) { if (a0 < 0) a0 = 0; fillspan((char *)buf, a0, b1 - a0); } color = !color; a0 = b1; break; case MODE_UNCOMP: /* * Uncompressed mode: select from the * special set of code words. */ if (a0 < 0) a0 = 0; do { mode = decode_uncomp_code(tif); switch (mode) { case UNCOMP_RUN1: case UNCOMP_RUN2: case UNCOMP_RUN3: case UNCOMP_RUN4: case UNCOMP_RUN5: run1 = mode - UNCOMP_RUN0; fillspan((char *)buf, a0+run1-1, 1); a0 += run1; break; case UNCOMP_RUN6: a0 += 5; break; case UNCOMP_TRUN0: case UNCOMP_TRUN1: case UNCOMP_TRUN2: case UNCOMP_TRUN3: case UNCOMP_TRUN4: run1 = mode - UNCOMP_TRUN0; a0 += run1; color = nextbit(tif) ? !sp->b.white : sp->b.white; break; case UNCOMP_INVALID: TIFFError(module, "%s: Bad uncompressed code word at scanline %d", tif->tif_name, tif->tif_row); goto bad; case UNCOMP_EOF: TIFFError(module, "%s: Premature EOF at scanline %d", tif->tif_name, tif->tif_row); return (0); } } while (mode < UNCOMP_EXIT); break; case MODE_ERROR_1: if ((tif->tif_options & FAX3_NOEOL) == 0) { TIFFWarning(module, "%s: Premature EOL at scanline %d (x %d)", tif->tif_name, tif->tif_row, a0); skiptoeol(tif, 7); /* seen 7 0's already */ return (1); /* try to synchronize */ } /* fall thru... */ case MODE_ERROR: TIFFError(module, "%s: Bad 2D code word at scanline %d", tif->tif_name, tif->tif_row); goto bad; default: TIFFError(module, "%s: Panic, bad decoding state at scanline %d", tif->tif_name, tif->tif_row); return (0); } } while (a0 < npels); bad: /* * Cleanup at the end of row. We check for * EOL separately so that this code can be * reused by the Group 4 decoding routine. */ if ((tif->tif_options & FAX3_NOEOL) == 0) skiptoeol(tif, 0); return (a0 >= npels); #undef PIXEL } /* * CCITT Group 3 FAX Encoding. */ /* * Write a variable-length bit-value to * the output stream. Values are * assumed to be at most 16 bits. */ static void putbits(tif, bits, length) TIFF *tif; u_int bits, length; { Fax3BaseState *sp = (Fax3BaseState *)tif->tif_data; static const int mask[9] = { 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff }; while (length > sp->bit) { sp->data |= bits >> (length - sp->bit); length -= sp->bit; Fax3FlushBits(tif, sp); } sp->data |= (bits & mask[length]) << (sp->bit - length); sp->bit -= length; if (sp->bit == 0) Fax3FlushBits(tif, sp); } /* * Write a code to the output stream. */ static void putcode(tif, te) TIFF *tif; tableentry const *te; { putbits(tif, te->code, te->length); } /* * Write the sequence of codes that describes * the specified span of zero's or one's. The * appropriate table that holds the make-up and * terminating codes is supplied. */ static void putspan(tif, span, tab) TIFF *tif; int span; tableentry const *tab; { while (span >= 2624) { tableentry const *te = &tab[63 + (2560>>6)]; putcode(tif, te); span -= te->runlen; } if (span >= 64) { tableentry const *te = &tab[63 + (span>>6)]; assert(te->runlen == 64*(span>>6)); putcode(tif, te); span -= te->runlen; } putcode(tif, &tab[span]); } /* * Write an EOL code to the output stream. The zero-fill * logic for byte-aligning encoded scanlines is handled * here. We also handle writing the tag bit for the next * scanline when doing 2d encoding. */ void Fax3PutEOL(tif) TIFF *tif; { Fax3BaseState *sp = (Fax3BaseState *)tif->tif_data; if (tif->tif_dir.td_group3options & GROUP3OPT_FILLBITS) { /* * Force bit alignment so EOL will terminate on * a byte boundary. That is, force the bit alignment * to 16-12 = 4 before putting out the EOL code. */ int align = 8 - 4; if (align != sp->bit) { if (align > sp->bit) align = sp->bit + (8 - align); else align = sp->bit - align; putbits(tif, 0, align); } } putbits(tif, EOL, 12); if (is2DEncoding(tif)) putbits(tif, sp->tag == G3_1D, 1); } static const u_char zeroruns[256] = { 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, /* 0x00 - 0x0f */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x10 - 0x1f */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x20 - 0x2f */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x30 - 0x3f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x40 - 0x4f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x50 - 0x5f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x60 - 0x6f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x70 - 0x7f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 - 0x8f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 - 0x9f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xa0 - 0xaf */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xb0 - 0xbf */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xc0 - 0xcf */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xd0 - 0xdf */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xe0 - 0xef */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xf0 - 0xff */ }; static const u_char oneruns[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00 - 0x0f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 - 0x1f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 - 0x2f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30 - 0x3f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 - 0x4f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 - 0x5f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x6f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 - 0x7f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x80 - 0x8f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x90 - 0x9f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xa0 - 0xaf */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xb0 - 0xbf */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0xc0 - 0xcf */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0xd0 - 0xdf */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xe0 - 0xef */ 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 8, /* 0xf0 - 0xff */ }; /* * Reset encoding state at the start of a strip. */ static int Fax3PreEncode(tif) TIFF *tif; { Fax3EncodeState *sp = (Fax3EncodeState *)tif->tif_data; if (sp == NULL) { sp = (Fax3EncodeState *)Fax3SetupState(tif, sizeof (*sp)); if (!sp) return (0); if (sp->b.white == 0) { sp->wruns = zeroruns; sp->bruns = oneruns; } else { sp->wruns = oneruns; sp->bruns = zeroruns; } } sp->b.bit = 8; sp->b.data = 0; sp->b.tag = G3_1D; /* * This is necessary for Group 4; otherwise it isn't * needed because the first scanline of each strip ends * up being copied into the refline. */ if (sp->b.refline) bset1(sp->b.refline, sp->b.rowbytes, sp->b.white ? 0xff : 0x00); if (is2DEncoding(tif)) { float res = tif->tif_dir.td_yresolution; /* * The CCITT spec says that when doing 2d encoding, you * should only do it on K consecutive scanlines, where K * depends on the resolution of the image being encoded * (2 for <= 200 lpi, 4 for > 200 lpi). Since the directory * code initializes td_yresolution to 0, this code will * select a K of 2 unless the YResolution tag is set * appropriately. (Note also that we fudge a little here * and use 150 lpi to avoid problems with units conversion.) */ if (tif->tif_dir.td_resolutionunit == RESUNIT_CENTIMETER) res = (res * .3937) / 2.54; /* convert to inches */ sp->maxk = (res > 150 ? 4 : 2); sp->k = sp->maxk-1; } else sp->k = sp->maxk = 0; return (1); } /* * 1d-encode a row of pixels. The encoding is * a sequence of all-white or all-black spans * of pixels encoded with Huffman codes. */ static int Fax3Encode1DRow(tif, bp, bits) TIFF *tif; u_char *bp; int bits; { Fax3EncodeState *sp = (Fax3EncodeState *)tif->tif_data; int bs = 0, span; for (;;) { span = findspan(&bp, bs, bits, sp->wruns); /* white span */ putspan(tif, span, TIFFFaxWhiteCodes); bs += span; if (bs >= bits) break; span = findspan(&bp, bs, bits, sp->bruns); /* black span */ putspan(tif, span, TIFFFaxBlackCodes); bs += span; if (bs >= bits) break; } return (1); } static const tableentry horizcode = { 3, 0x1 }; /* 001 */ static const tableentry passcode = { 4, 0x1 }; /* 0001 */ static const tableentry vcodes[7] = { { 7, 0x03 }, /* 0000 011 */ { 6, 0x03 }, /* 0000 11 */ { 3, 0x03 }, /* 011 */ { 1, 0x1 }, /* 1 */ { 3, 0x2 }, /* 010 */ { 6, 0x02 }, /* 0000 10 */ { 7, 0x02 } /* 0000 010 */ }; /* * 2d-encode a row of pixels. Consult the CCITT * documentation for the algorithm. */ int Fax3Encode2DRow(tif, bp, rp, bits) TIFF *tif; u_char *bp, *rp; int bits; { #define PIXEL(buf,ix) ((((buf)[(ix)>>3]) >> (7-((ix)&7))) & 1) short white = ((Fax3BaseState *)tif->tif_data)->white; int a0 = 0; int a1 = (PIXEL(bp, 0) != white ? 0 : finddiff(bp, 0, bits, white)); int b1 = (PIXEL(rp, 0) != white ? 0 : finddiff(rp, 0, bits, white)); int a2, b2; for (;;) { b2 = finddiff(rp, b1, bits, PIXEL(rp,b1)); if (b2 >= a1) { int d = b1 - a1; if (!(-3 <= d && d <= 3)) { /* horizontal mode */ a2 = finddiff(bp, a1, bits, PIXEL(bp,a1)); putcode(tif, &horizcode); if (a0+a1 == 0 || PIXEL(bp, a0) == white) { putspan(tif, a1-a0, TIFFFaxWhiteCodes); putspan(tif, a2-a1, TIFFFaxBlackCodes); } else { putspan(tif, a1-a0, TIFFFaxBlackCodes); putspan(tif, a2-a1, TIFFFaxWhiteCodes); } a0 = a2; } else { /* vertical mode */ putcode(tif, &vcodes[d+3]); a0 = a1; } } else { /* pass mode */ putcode(tif, &passcode); a0 = b2; } if (a0 >= bits) break; a1 = finddiff(bp, a0, bits, PIXEL(bp,a0)); b1 = finddiff(rp, a0, bits, !PIXEL(bp,a0)); b1 = finddiff(rp, b1, bits, PIXEL(bp,a0)); } return (1); #undef PIXEL } /* * Encode a buffer of pixels. */ static int Fax3Encode(tif, bp, cc, s) TIFF *tif; u_char *bp; int cc; u_int s; { Fax3EncodeState *sp = (Fax3EncodeState *)tif->tif_data; while (cc > 0) { Fax3PutEOL(tif); if (is2DEncoding(tif)) { if (sp->b.tag == G3_1D) { if (!Fax3Encode1DRow(tif, bp, sp->b.rowpixels)) return (0); sp->b.tag = G3_2D; } else { if (!Fax3Encode2DRow(tif, bp, sp->b.refline, sp->b.rowpixels)) return (0); sp->k--; } if (sp->k == 0) { sp->b.tag = G3_1D; sp->k = sp->maxk-1; } else bcopy(bp, sp->b.refline, sp->b.rowbytes); } else { if (!Fax3Encode1DRow(tif, bp, sp->b.rowpixels)) return (0); } bp += sp->b.rowbytes; cc -= sp->b.rowbytes; } return (1); } static int Fax3PostEncode(tif) TIFF *tif; { Fax3BaseState *sp = (Fax3BaseState *)tif->tif_data; if (sp->bit != 8) Fax3FlushBits(tif, sp); return (1); } static int Fax3Close(tif) TIFF *tif; { if ((tif->tif_options & FAX3_CLASSF) == 0) { /* append RTC */ int i; for (i = 0; i < 6; i++) Fax3PutEOL(tif); (void) Fax3PostEncode(tif); } return 1; } static int Fax3Cleanup(tif) TIFF *tif; { if (tif->tif_data) { free(tif->tif_data); tif->tif_data = NULL; } return 1; } /* * Bit handling utilities. */ /* * Find a span of ones or zeros using the supplied * table. The byte-aligned start of the bit string * is supplied along with the start+end bit indices. * The table gives the number of consecutive ones or * zeros starting from the msb and is indexed by byte * value. */ static int findspan(bpp, bs, be, tab) u_char **bpp; int bs, be; register u_char const *tab; { register u_char *bp = *bpp; register int bits = be - bs; register int n, span; /* * Check partial byte on lhs. */ if (bits > 0 && (n = (bs & 7))) { span = tab[(*bp << n) & 0xff]; if (span > 8-n) /* table value too generous */ span = 8-n; if (span > bits) /* constrain span to bit range */ span = bits; if (n+span < 8) /* doesn't extend to edge of byte */ goto done; bits -= span; bp++; } else span = 0; /* * Scan full bytes for all 1's or all 0's. */ while (bits >= 8) { n = tab[*bp]; span += n; bits -= n; if (n < 8) /* end of run */ goto done; bp++; } /* * Check partial byte on rhs. */ if (bits > 0) { n = tab[*bp]; span += (n > bits ? bits : n); } done: *bpp = bp; return (span); } /* * Return the offset of the next bit in the range * [bs..be] that is different from the specified * color. The end, be, is returned if no such bit * exists. */ static int finddiff(cp, bs, be, color) u_char *cp; int bs, be, color; { cp += bs >> 3; /* adjust byte offset */ return (bs + findspan(&cp, bs, be, color ? oneruns : zeroruns)); } neuron-7.6.3/src/lib/TIFF/tif_fax3.h000077500000000000000000000057361340731477100170230ustar00rootroot00000000000000/* /local/src/master/iv/src/lib/TIFF/tif_fax3.h,v 1.2 1997/03/26 15:07:11 hines Exp */ /* * Copyright (c) 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _FAX3_ #define _FAX3_ /* * CCITT Group 3 compression/decompression definitions. */ #define FAX3_CLASSF TIFF_OPT0 /* use Class F protocol */ /* the following are for use by Compression=2, 32771, and 4 (T.6) algorithms */ #define FAX3_NOEOL TIFF_OPT1 /* no EOL code at end of row */ #define FAX3_BYTEALIGN TIFF_OPT2 /* force byte alignment at end of row */ #define FAX3_WORDALIGN TIFF_OPT3 /* force word alignment at end of row */ /* * Compression+decompression state blocks are * derived from this ``base state'' block. */ typedef struct { short data; /* current i/o byte */ short bit; /* current i/o bit in byte */ short white; /* value of the color ``white'' */ u_long rowbytes; /* XXX maybe should be a long? */ u_long rowpixels; /* XXX maybe should be a long? */ enum { /* decoding/encoding mode */ G3_1D, /* basic 1-d mode */ G3_2D /* optional 2-d mode */ } tag; #if defined(__STDC__) || defined(__EXTENDED__) || USE_CONST u_char const *bitmap; /* bit reversal table */ #else u_char *bitmap; /* bit reversal table */ #endif u_char *refline; /* reference line for 2d decoding */ } Fax3BaseState; /* these routines are used for Group 4 (T.6) */ #if USE_PROTOTYPES extern int Fax3Decode2DRow(TIFF*, u_char *, int); extern int Fax3Encode2DRow(TIFF*, u_char *, u_char *, int); extern void Fax3PutEOL(TIFF*); #else extern int Fax3Decode2DRow(); extern int Fax3Encode2DRow(); extern void Fax3PutEOL(); #endif #define Fax3FlushBits(tif, sp) { \ if ((tif)->tif_rawcc >= (tif)->tif_rawdatasize) \ (void) TIFFFlushData1(tif); \ *(tif)->tif_rawcp++ = (sp)->bitmap[(sp)->data]; \ (tif)->tif_rawcc++; \ (sp)->data = 0; \ (sp)->bit = 8; \ } #endif /* _FAX3_ */ neuron-7.6.3/src/lib/TIFF/tif_fax4.c000077500000000000000000000067111340731477100170110ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_fax4.c,v 1.2 1997/03/26 15:07:11 hines Exp"; #endif /* * Copyright (c) 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * CCITT Group 4 Facsimile-compatible * Compression Scheme Support. */ #include "tiffioP.h" #include "tif_fax3.h" extern int TIFFFlushData1(TIFF *); extern int TIFFInitCCITTFax3(TIFF*); #if USE_PROTOTYPES static int Fax4Decode(TIFF*, u_char *, int, u_int); static int Fax4Encode(TIFF*, u_char *, int, u_int); static int Fax4PostEncode(TIFF*); #else static int Fax4Decode(); static int Fax4Encode(); static int Fax4PostEncode(); #endif int TIFFInitCCITTFax4(tif) TIFF *tif; { TIFFInitCCITTFax3(tif); /* reuse G3 compression */ tif->tif_decoderow = Fax4Decode; tif->tif_decodestrip = Fax4Decode; tif->tif_decodetile = Fax4Decode; tif->tif_encoderow = Fax4Encode; tif->tif_encodestrip = Fax4Encode; tif->tif_encodetile = Fax4Encode; tif->tif_postencode = Fax4PostEncode; /* * FAX3_NOEOL causes the regular G3 decompression * code to not skip to the EOL mark at the end of * a row (during normal decoding). FAX3_CLASSF * suppresses RTC generation at the end of an image. */ tif->tif_options = FAX3_NOEOL|FAX3_CLASSF; return (1); } /* * Decode the requested amount of data. */ static int Fax4Decode(tif, buf, occ, s) TIFF *tif; u_char *buf; int occ; u_int s; { Fax3BaseState *sp = (Fax3BaseState *)tif->tif_data; bzero(buf, occ); /* decoding only sets non-zero bits */ while (occ > 0) { if (!Fax3Decode2DRow(tif, buf, sp->rowpixels)) return (0); bcopy(buf, sp->refline, sp->rowbytes); buf += sp->rowbytes; occ -= sp->rowbytes; } return (1); } /* * Encode the requested amount of data. */ static int Fax4Encode(tif, bp, cc, s) TIFF *tif; u_char *bp; int cc; u_int s; { Fax3BaseState *sp = (Fax3BaseState *)tif->tif_data; while (cc > 0) { if (!Fax3Encode2DRow(tif, bp, sp->refline, sp->rowpixels)) return (0); bcopy(bp, sp->refline, sp->rowbytes); bp += sp->rowbytes; cc -= sp->rowbytes; } return (1); } static int Fax4PostEncode(tif) TIFF *tif; { Fax3BaseState *sp = (Fax3BaseState *)tif->tif_data; /* terminate strip w/ EOFB */ Fax3PutEOL(tif); Fax3PutEOL(tif); if (sp->bit != 8) Fax3FlushBits(tif, sp); return (1); } neuron-7.6.3/src/lib/TIFF/tif_flush.c000077500000000000000000000040031340731477100172600ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_flush.c,v 1.2 1997/03/26 15:07:12 hines Exp"; #endif /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. */ #include "tiffioP.h" extern int TIFFFlushData1(TIFF *); int TIFFFlush(tif) TIFF *tif; { if (tif->tif_mode != O_RDONLY) { if (!TIFFFlushData(tif)) return (0); if ((tif->tif_flags & TIFF_DIRTYDIRECT) && !TIFFWriteDirectory(tif)) return (0); } return (1); } /* * Flush buffered data to the file. */ int TIFFFlushData(tif) TIFF *tif; { if ((tif->tif_flags & TIFF_BEENWRITING) == 0) return (0); if (tif->tif_flags & TIFF_POSTENCODE) { tif->tif_flags &= ~TIFF_POSTENCODE; if (tif->tif_postencode && !(*tif->tif_postencode)(tif)) return (0); } return (TIFFFlushData1(tif)); } neuron-7.6.3/src/lib/TIFF/tif_getimage.c000077500000000000000000000643511340731477100177350ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_getimage.c,v 1.2 1997/03/26 15:07:13 hines Exp"; #endif /* * Copyright (c) 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library * * Read and return a packed RGBA image. */ #include "tiffioP.h" #include "tiffcompat.h" #include "prototypes.h" typedef u_char RGBvalue; static u_long width, height; /* image width & height */ static u_short bitspersample; static u_short samplesperpixel; static u_short photometric; static u_short orientation; /* colormap for pallete images */ static u_short *redcmap, *greencmap, *bluecmap; static int stoponerr; /* stop on read error */ static char *filename; /* YCbCr support */ static u_short YCbCrHorizSampling; static u_short YCbCrVertSampling; static float *YCbCrCoeffs; static float *refBlackWhite; static u_long **BWmap; static u_long **PALmap; static int gt(); static int makebwmap(RGBvalue *Map); static int makecmap(u_short *rmap, ushort *gmap, ushort *bmap); int TIFFReadRGBAImage(tif, rwidth, rheight, raster, stop) TIFF *tif; u_long rwidth, rheight; u_long *raster; int stop; { int ok; u_long width, height; TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &bitspersample); switch (bitspersample) { case 1: case 2: case 4: case 8: case 16: break; default: TIFFError(TIFFFileName(tif), "Sorry, can not handle %d-bit pictures", bitspersample); return (0); } TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel); switch (samplesperpixel) { case 1: case 3: case 4: break; default: TIFFError(TIFFFileName(tif), "Sorry, can not handle %d-channel images", samplesperpixel); return (0); } if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric)) { switch (samplesperpixel) { case 1: photometric = PHOTOMETRIC_MINISBLACK; break; case 3: case 4: photometric = PHOTOMETRIC_RGB; break; default: TIFFError(TIFFFileName(tif), "Missing needed \"PhotometricInterpretation\" tag"); return (0); } TIFFError(TIFFFileName(tif), "No \"PhotometricInterpretation\" tag, assuming %s\n", photometric == PHOTOMETRIC_RGB ? "RGB" : "min-is-black"); } /* XXX maybe should check photometric? */ TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &width); TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &height); /* XXX verify rwidth and rheight against width and height */ stoponerr = stop; BWmap = NULL; PALmap = NULL; ok = gt(tif, rwidth, height, raster + (rheight-height)*rwidth); if (BWmap) free((char *)BWmap); if (PALmap) free((char *)PALmap); return (ok); } static int checkcmap(n, r, g, b) int n; u_short *r, *g, *b; { while (n-- > 0) if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256) return (16); TIFFWarning(filename, "Assuming 8-bit colormap"); return (8); } static int gtTileContig(); static int gtTileSeparate(); static int gtStripContig(); static int gtStripSeparate(); static void initYCbCrConversion(); static int gt(tif, w, h, raster) TIFF *tif; int w, h; u_long *raster; { u_short minsamplevalue, maxsamplevalue, planarconfig; RGBvalue *Map; int e; TIFFGetFieldDefaulted(tif, TIFFTAG_MINSAMPLEVALUE, &minsamplevalue); TIFFGetFieldDefaulted(tif, TIFFTAG_MAXSAMPLEVALUE, &maxsamplevalue); Map = NULL; switch (photometric) { case PHOTOMETRIC_YCBCR: TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRCOEFFICIENTS, &YCbCrCoeffs); TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING, &YCbCrHorizSampling, &YCbCrVertSampling); TIFFGetFieldDefaulted(tif, TIFFTAG_REFERENCEBLACKWHITE, &refBlackWhite); initYCbCrConversion(); /* fall thru... */ case PHOTOMETRIC_RGB: if (minsamplevalue == 0 && maxsamplevalue == 255) break; /* fall thru... */ case PHOTOMETRIC_MINISBLACK: case PHOTOMETRIC_MINISWHITE: { register int x, range; range = maxsamplevalue - minsamplevalue; Map = (RGBvalue *)malloc((range + 1) * sizeof (RGBvalue)); if (Map == NULL) { TIFFError(filename, "No space for photometric conversion table"); return (0); } if (photometric == PHOTOMETRIC_MINISWHITE) { for (x = 0; x <= range; x++) Map[x] = ((range - x) * 255) / range; } else { for (x = 0; x <= range; x++) Map[x] = (x * 255) / range; } if (photometric != PHOTOMETRIC_RGB && bitspersample <= 8) { /* * Use photometric mapping table to construct * unpacking tables for samples <= 8 bits. */ if (!makebwmap(Map)) return (0); /* no longer need Map, free it */ free((char *)Map); Map = NULL; } break; } case PHOTOMETRIC_PALETTE: if (!TIFFGetField(tif, TIFFTAG_COLORMAP, &redcmap, &greencmap, &bluecmap)) { TIFFError(filename, "Missing required \"Colormap\" tag"); return (0); } /* * Convert 16-bit colormap to 8-bit (unless it looks * like an old-style 8-bit colormap). */ if (checkcmap(1< 0; i--) { #define CVT(x) (((x) * 255) / ((1L<<16)-1)) redcmap[i] = CVT(redcmap[i]); greencmap[i] = CVT(greencmap[i]); bluecmap[i] = CVT(bluecmap[i]); } } if (bitspersample <= 8) { /* * Use mapping table and colormap to construct * unpacking tables for samples < 8 bits. */ if (!makecmap(redcmap, greencmap, bluecmap)) return (0); } break; } TIFFGetField(tif, TIFFTAG_PLANARCONFIG, &planarconfig); if (planarconfig == PLANARCONFIG_SEPARATE && samplesperpixel > 1) { e = TIFFIsTiled(tif) ? gtTileSeparate(tif, raster, Map, h, w) : gtStripSeparate(tif, raster, Map, h, w); } else { e = TIFFIsTiled(tif) ? gtTileContig(tif, raster, Map, h, w) : gtStripContig(tif, raster, Map, h, w); } if (Map) free((char *)Map); return (e); } u_long setorientation(tif, h) TIFF *tif; u_long h; { u_long y; TIFFGetFieldDefaulted(tif, TIFFTAG_ORIENTATION, &orientation); switch (orientation) { case ORIENTATION_BOTRIGHT: case ORIENTATION_RIGHTBOT: /* XXX */ case ORIENTATION_LEFTBOT: /* XXX */ TIFFWarning(filename, "using bottom-left orientation"); orientation = ORIENTATION_BOTLEFT; /* fall thru... */ case ORIENTATION_BOTLEFT: y = 0; break; case ORIENTATION_TOPRIGHT: case ORIENTATION_RIGHTTOP: /* XXX */ case ORIENTATION_LEFTTOP: /* XXX */ default: TIFFWarning(filename, "using top-left orientation"); orientation = ORIENTATION_TOPLEFT; /* fall thru... */ case ORIENTATION_TOPLEFT: y = h-1; break; } return (y); } #if USE_PROTOTYPES typedef void (*tileContigRoutine) (u_long*, u_char*, RGBvalue*, u_long, u_long, int, int); static tileContigRoutine pickTileContigCase(RGBvalue*); #else typedef void (*tileContigRoutine)(); static tileContigRoutine pickTileContigCase(); #endif /* * Get an tile-organized image that has * PlanarConfiguration contiguous if SamplesPerPixel > 1 * or * SamplesPerPixel == 1 */ static int gtTileContig(tif, raster, Map, h, w) TIFF *tif; u_long *raster; RGBvalue *Map; u_long h, w; { u_long col, row, y; u_long tw, th; u_char *buf; int fromskew, toskew; u_int nrow; tileContigRoutine put; put = pickTileContigCase(Map); if (put == 0) return (0); buf = (u_char *)malloc(TIFFTileSize(tif)); if (buf == 0) { TIFFError(filename, "No space for tile buffer"); return (0); } TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw); TIFFGetField(tif, TIFFTAG_TILELENGTH, &th); y = setorientation(tif, h); toskew = (orientation == ORIENTATION_TOPLEFT ? -tw + -w : -tw + w); for (row = 0; row < h; row += th) { nrow = (row + th > h ? h - row : th); for (col = 0; col < w; col += tw) { if (TIFFReadTile(tif, buf, col, row, 0, 0) < 0 && stoponerr) break; if (col + tw > w) { /* * Tile is clipped horizontally. Calculate * visible portion and skewing factors. */ u_long npix = w - col; fromskew = tw - npix; (*put)(raster + y*w + col, buf, Map, npix, nrow, fromskew, toskew + fromskew); } else (*put)(raster + y*w + col, buf, Map, tw, nrow, 0, toskew); } y += (orientation == ORIENTATION_TOPLEFT ? -nrow : nrow); } free(buf); return (1); } #if USE_PROTOTYPES typedef void (*tileSeparateRoutine) (u_long*, u_char*, u_char*, u_char*, RGBvalue*, u_long, u_long, int, int); static tileSeparateRoutine pickTileSeparateCase(RGBvalue*); #else typedef void (*tileSeparateRoutine)(); static tileSeparateRoutine pickTileSeparateCase(); #endif /* * Get an tile-organized image that has * SamplesPerPixel > 1 * PlanarConfiguration separated * We assume that all such images are RGB. */ static int gtTileSeparate(tif, raster, Map, h, w) TIFF *tif; u_long *raster; RGBvalue *Map; u_long h, w; { u_long col, row, y; u_long tw, th; u_char *buf; u_char *r, *g, *b; int tilesize; int fromskew, toskew; u_int nrow; tileSeparateRoutine put; put = pickTileSeparateCase(Map); if (put == 0) return (0); tilesize = TIFFTileSize(tif); buf = (u_char *)malloc(3*tilesize); if (buf == 0) { TIFFError(filename, "No space for tile buffer"); return (0); } r = buf; g = r + tilesize; b = g + tilesize; TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw); TIFFGetField(tif, TIFFTAG_TILELENGTH, &th); y = setorientation(tif, h); toskew = (orientation == ORIENTATION_TOPLEFT ? -tw + -w : -tw + w); for (row = 0; row < h; row += th) { nrow = (row + th > h ? h - row : th); for (col = 0; col < w; col += tw) { if (TIFFReadTile(tif, r, col, row,0,0) < 0 && stoponerr) break; if (TIFFReadTile(tif, g, col, row,0,1) < 0 && stoponerr) break; if (TIFFReadTile(tif, b, col, row,0,2) < 0 && stoponerr) break; if (col + tw > w) { /* * Tile is clipped horizontally. Calculate * visible portion and skewing factors. */ u_long npix = w - col; fromskew = tw - npix; (*put)(raster + y*w + col, r, g, b, Map, npix, nrow, fromskew, toskew + fromskew); } else (*put)(raster + y*w + col, r, g, b, Map, tw, nrow, 0, toskew); } y += (orientation == ORIENTATION_TOPLEFT ? -nrow : nrow); } free(buf); return (1); } /* * Get a strip-organized image that has * PlanarConfiguration contiguous if SamplesPerPixel > 1 * or * SamplesPerPixel == 1 */ static int gtStripContig(tif, raster, Map, h, w) TIFF *tif; u_long *raster; RGBvalue *Map; u_long h, w; { u_long row, y, nrow; u_char *buf; tileContigRoutine put; u_long rowsperstrip; u_long imagewidth; int scanline; int fromskew, toskew; put = pickTileContigCase(Map); if (put == 0) return (0); buf = (u_char *)malloc(TIFFStripSize(tif)); if (buf == 0) { TIFFError(filename, "No space for strip buffer"); return (0); } y = setorientation(tif, h); toskew = (orientation == ORIENTATION_TOPLEFT ? -w + -w : -w + w); TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip); TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &imagewidth); scanline = TIFFScanlineSize(tif); fromskew = (w < imagewidth ? imagewidth - w : 0); for (row = 0; row < h; row += rowsperstrip) { nrow = (row + rowsperstrip > h ? h - row : rowsperstrip); if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 0), buf, nrow*scanline) < 0 && stoponerr) break; (*put)(raster + y*w, buf, Map, w, nrow, fromskew, toskew); y += (orientation == ORIENTATION_TOPLEFT ? -nrow : nrow); } free(buf); return (1); } /* * Get a strip-organized image with * SamplesPerPixel > 1 * PlanarConfiguration separated * We assume that all such images are RGB. */ static int gtStripSeparate(tif, raster, Map, h, w) TIFF *tif; u_long *raster; register RGBvalue *Map; u_long h, w; { u_char *buf; u_char *r, *g, *b; u_long row, y, nrow; int scanline; tileSeparateRoutine put; u_long rowsperstrip; u_long imagewidth; u_int stripsize; int fromskew, toskew; stripsize = TIFFStripSize(tif); r = buf = (u_char *)malloc(3*stripsize); if (buf == 0) return (0); g = r + stripsize; b = g + stripsize; put = pickTileSeparateCase(Map); if (put == 0) { TIFFError(filename, "Can not handle format"); return (0); } y = setorientation(tif, h); toskew = (orientation == ORIENTATION_TOPLEFT ? -w + -w : -w + w); TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip); TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &imagewidth); scanline = TIFFScanlineSize(tif); fromskew = (w < imagewidth ? imagewidth - w : 0); for (row = 0; row < h; row += rowsperstrip) { nrow = (row + rowsperstrip > h ? h - row : rowsperstrip); if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 0), r, nrow*scanline) < 0 && stoponerr) break; if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 1), g, nrow*scanline) < 0 && stoponerr) break; if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 2), b, nrow*scanline) < 0 && stoponerr) break; (*put)(raster + y*w, r, g, b, Map, w, nrow, fromskew, toskew); y += (orientation == ORIENTATION_TOPLEFT ? -nrow : nrow); } free(buf); return (1); } #define PACK(r,g,b) ((u_long)(r)|((u_long)(g)<<8)|((u_long)(b)<<16)) /* * Greyscale images with less than 8 bits/sample are handled * with a table to avoid lots of shifts and masks. The table * is setup so that put*bwtile (below) can retrieve 8/bitspersample * pixel values simply by indexing into the table with one * number. */ int makebwmap(Map) RGBvalue *Map; { register int i; int nsamples = 8 / bitspersample; register u_long *p; BWmap = (u_long **)malloc( 256*sizeof (u_long *)+(256*nsamples*sizeof(u_long))); if (BWmap == NULL) { TIFFError(filename, "No space for B&W mapping table"); return (0); } p = (u_long *)(BWmap + 256); for (i = 0; i < 256; i++) { BWmap[i] = p; switch (bitspersample) { register RGBvalue c; #define GREY(x) c = Map[x]; *p++ = PACK(c,c,c); case 1: GREY(i>>7); GREY((i>>6)&1); GREY((i>>5)&1); GREY((i>>4)&1); GREY((i>>3)&1); GREY((i>>2)&1); GREY((i>>1)&1); GREY(i&1); break; case 2: GREY(i>>6); GREY((i>>4)&3); GREY((i>>2)&3); GREY(i&3); break; case 4: GREY(i>>4); GREY(i&0xf); break; case 8: GREY(i); break; } #undef GREY } return (1); } /* * Palette images with <= 8 bits/sample are handled * with a table to avoid lots of shifts and masks. The table * is setup so that put*cmaptile (below) can retrieve 8/bitspersample * pixel values simply by indexing into the table with one * number. */ int makecmap(rmap, gmap, bmap) u_short *rmap, *gmap, *bmap; { register int i; int nsamples = 8 / bitspersample; register u_long *p; PALmap = (u_long **)malloc( 256*sizeof (u_long *)+(256*nsamples*sizeof(u_long))); if (PALmap == NULL) { TIFFError(filename, "No space for Palette mapping table"); return (0); } p = (u_long *)(PALmap + 256); for (i = 0; i < 256; i++) { PALmap[i] = p; #define CMAP(x) \ c = x; *p++ = PACK(rmap[c]&0xff, gmap[c]&0xff, bmap[c]&0xff); switch (bitspersample) { register RGBvalue c; case 1: CMAP(i>>7); CMAP((i>>6)&1); CMAP((i>>5)&1); CMAP((i>>4)&1); CMAP((i>>3)&1); CMAP((i>>2)&1); CMAP((i>>1)&1); CMAP(i&1); break; case 2: CMAP(i>>6); CMAP((i>>4)&3); CMAP((i>>2)&3); CMAP(i&3); break; case 4: CMAP(i>>4); CMAP(i&0xf); break; case 8: CMAP(i); break; } #undef CMAP } return (1); } /* * The following routines move decoded data returned * from the TIFF library into rasters filled with packed * ABGR pixels (i.e. suitable for passing to lrecwrite.) * * The routines have been created according to the most * important cases and optimized. pickTileContigCase and * pickTileSeparateCase analyze the parameters and select * the appropriate "put" routine to use. */ #define REPEAT8(op) REPEAT4(op); REPEAT4(op) #define REPEAT4(op) REPEAT2(op); REPEAT2(op) #define REPEAT2(op) op; op #define CASE8(x,op) \ switch (x) { \ case 7: op; case 6: op; case 5: op; \ case 4: op; case 3: op; case 2: op; \ case 1: op; \ } #define CASE4(x,op) switch (x) { case 3: op; case 2: op; case 1: op; } #define UNROLL8(w, op1, op2) { \ register u_long x; \ for (x = w; x >= 8; x -= 8) { \ op1; \ REPEAT8(op2); \ } \ if (x > 0) { \ op1; \ CASE8(x,op2); \ } \ } #define UNROLL4(w, op1, op2) { \ register u_long x; \ for (x = w; x >= 4; x -= 4) { \ op1; \ REPEAT4(op2); \ } \ if (x > 0) { \ op1; \ CASE4(x,op2); \ } \ } #define UNROLL2(w, op1, op2) { \ register u_long x; \ for (x = w; x >= 2; x -= 2) { \ op1; \ REPEAT2(op2); \ } \ if (x) { \ op1; \ op2; \ } \ } #define SKEW(r,g,b,skew) { r += skew; g += skew; b += skew; } /* * 8-bit palette => colormap/RGB */ static void put8bitcmaptile(cp, pp, Map, w, h, fromskew, toskew) register u_long *cp; register u_char *pp; RGBvalue *Map; u_long w, h; int fromskew, toskew; { while (h-- > 0) { UNROLL8(w,, *cp++ = PALmap[*pp++][0]); cp += toskew; pp += fromskew; } } /* * 4-bit palette => colormap/RGB */ static void put4bitcmaptile(cp, pp, Map, w, h, fromskew, toskew) register u_long *cp; register u_char *pp; register RGBvalue *Map; u_long w, h; int fromskew, toskew; { register u_long *bw; fromskew /= 2; while (h-- > 0) { UNROLL2(w, bw = PALmap[*pp++], *cp++ = *bw++); cp += toskew; pp += fromskew; } } /* * 2-bit palette => colormap/RGB */ static void put2bitcmaptile(cp, pp, Map, w, h, fromskew, toskew) register u_long *cp; register u_char *pp; register RGBvalue *Map; u_long w, h; int fromskew, toskew; { register u_long *bw; fromskew /= 4; while (h-- > 0) { UNROLL4(w, bw = PALmap[*pp++], *cp++ = *bw++); cp += toskew; pp += fromskew; } } /* * 1-bit palette => colormap/RGB */ static void put1bitcmaptile(cp, pp, Map, w, h, fromskew, toskew) register u_long *cp; register u_char *pp; register RGBvalue *Map; u_long w, h; int fromskew, toskew; { register u_long *bw; fromskew /= 8; while (h-- > 0) { UNROLL8(w, bw = PALmap[*pp++], *cp++ = *bw++); cp += toskew; pp += fromskew; } } /* * 8-bit greyscale => colormap/RGB */ static void putgreytile(cp, pp, Map, w, h, fromskew, toskew) register u_long *cp; register u_char *pp; RGBvalue *Map; u_long w, h; int fromskew, toskew; { while (h-- > 0) { register u_long x; for (x = w; x-- > 0;) *cp++ = BWmap[*pp++][0]; cp += toskew; pp += fromskew; } } /* * 1-bit bilevel => colormap/RGB */ static void put1bitbwtile(cp, pp, Map, w, h, fromskew, toskew) u_long *cp; u_char *pp; RGBvalue *Map; u_long w, h; int fromskew, toskew; { register u_long *bw; fromskew /= 8; while (h-- > 0) { UNROLL8(w, bw = BWmap[*pp++], *cp++ = *bw++); cp += toskew; pp += fromskew; } } /* * 2-bit greyscale => colormap/RGB */ static void put2bitbwtile(cp, pp, Map, w, h, fromskew, toskew) u_long *cp; u_char *pp; RGBvalue *Map; u_long w, h; int fromskew, toskew; { register u_long *bw; fromskew /= 4; while (h-- > 0) { UNROLL4(w, bw = BWmap[*pp++], *cp++ = *bw++); cp += toskew; pp += fromskew; } } /* * 4-bit greyscale => colormap/RGB */ static void put4bitbwtile(cp, pp, Map, w, h, fromskew, toskew) u_long *cp; u_char *pp; RGBvalue *Map; u_long w, h; int fromskew, toskew; { register u_long *bw; fromskew /= 2; while (h-- > 0) { UNROLL2(w, bw = BWmap[*pp++], *cp++ = *bw++); cp += toskew; pp += fromskew; } } /* * 8-bit packed samples => RGB */ static void putRGBcontig8bittile(cp, pp, Map, w, h, fromskew, toskew) register u_long *cp; register u_char *pp; register RGBvalue *Map; u_long w, h; int fromskew, toskew; { fromskew *= samplesperpixel; if (Map) { while (h-- > 0) { register u_long x; for (x = w; x-- > 0;) { *cp++ = PACK(Map[pp[0]], Map[pp[1]], Map[pp[2]]); pp += samplesperpixel; } pp += fromskew; cp += toskew; } } else { while (h-- > 0) { UNROLL8(w,, *cp++ = PACK(pp[0], pp[1], pp[2]); pp += samplesperpixel); cp += toskew; pp += fromskew; } } } /* * 16-bit packed samples => RGB */ static void putRGBcontig16bittile(cp, pp, Map, w, h, fromskew, toskew) register u_long *cp; u_char *pp; register RGBvalue *Map; u_long w, h; int fromskew, toskew; { register u_short *wp = (u_short *)pp; register u_int x; fromskew *= samplesperpixel; if (Map) { while (h-- > 0) { for (x = w; x-- > 0;) { *cp++ = PACK(Map[wp[0]], Map[wp[1]], Map[wp[2]]); wp += samplesperpixel; } cp += toskew; wp += fromskew; } } else { while (h-- > 0) { for (x = w; x-- > 0;) { *cp++ = PACK(wp[0], wp[1], wp[2]); wp += samplesperpixel; } cp += toskew; wp += fromskew; } } } /* * 8-bit unpacked samples => RGB */ static void putRGBseparate8bittile(cp, r, g, b, Map, w, h, fromskew, toskew) register u_long *cp; register u_char *r, *g, *b; register RGBvalue *Map; u_long w, h; int fromskew, toskew; { if (Map) { while (h-- > 0) { register u_long x; for (x = w; x > 0; x--) *cp++ = PACK(Map[*r++], Map[*g++], Map[*b++]); SKEW(r, g, b, fromskew); cp += toskew; } } else { while (h-- > 0) { UNROLL8(w,, *cp++ = PACK(*r++, *g++, *b++)); SKEW(r, g, b, fromskew); cp += toskew; } } } /* * 16-bit unpacked samples => RGB */ static void putRGBseparate16bittile(cp, br, bg, bb, Map, w, h, fromskew, toskew) register u_long *cp; u_char *br, *bg, *bb; register RGBvalue *Map; u_long w, h; int fromskew, toskew; { register u_short *r = (u_short *)br; register u_short *g = (u_short *)bg; register u_short *b = (u_short *)bb; register u_long x; if (Map) { while (h-- > 0) { for (x = w; x > 0; x--) *cp++ = PACK(Map[*r++], Map[*g++], Map[*b++]); SKEW(r, g, b, fromskew); cp += toskew; } } else { while (h-- > 0) { for (x = 0; x < w; x++) *cp++ = PACK(*r++, *g++, *b++); SKEW(r, g, b, fromskew); cp += toskew; } } } #define Code2V(c, RB, RW, CR) ((((c)-RB)*(float)CR)/(float)(RW-RB)) #define CLAMP(f,min,max) \ (int)((f)+.5 < (min) ? (min) : (f)+.5 > (max) ? (max) : (f)+.5) #define LumaRed YCbCrCoeffs[0] #define LumaGreen YCbCrCoeffs[1] #define LumaBlue YCbCrCoeffs[2] static float D1, D2; static float D3, D4; static void initYCbCrConversion() { D1 = 2 - 2*LumaRed; D2 = D1*LumaRed / LumaGreen; D3 = 2 - 2*LumaBlue; D4 = D2*LumaBlue / LumaGreen; } static void putRGBContigYCbCrClump(cp, pp, cw, ch, w, n, fromskew, toskew) register u_long *cp; register u_char *pp; int cw, ch; u_long w; int n, fromskew, toskew; { float Cb, Cr; int j, k; Cb = Code2V(pp[n], refBlackWhite[2], refBlackWhite[3], 127); Cr = Code2V(pp[n+1], refBlackWhite[4], refBlackWhite[5], 127); for (j = 0; j < ch; j++) { for (k = 0; k < cw; k++) { float Y, R, G, B; Y = Code2V(*pp++, refBlackWhite[0], refBlackWhite[1], 255); R = Y + Cr*D1; B = Y + Cb*D3; G = Y - Cb*D4 - Cr*D2; cp[k] = PACK(CLAMP(R,0,255), CLAMP(G,0,255), CLAMP(B,0,255)); } cp += w+toskew; pp += fromskew; } } #undef LumaBlue #undef LumaGreen #undef LumaRed #undef CLAMP #undef Code2V /* * 8-bit packed YCbCr samples => RGB */ static void putcontig8bitYCbCrtile(cp, pp, Map, w, h, fromskew, toskew) register u_long *cp; register u_char *pp; register RGBvalue *Map; u_long w, h; int fromskew, toskew; { u_int Coff = YCbCrVertSampling * YCbCrHorizSampling; u_long *tp; u_long x; /* XXX adjust fromskew */ while (h >= YCbCrVertSampling) { tp = cp; for (x = w; x >= YCbCrHorizSampling; x -= YCbCrHorizSampling) { putRGBContigYCbCrClump(tp, pp, YCbCrHorizSampling, YCbCrVertSampling, w, Coff, 0, toskew); tp += YCbCrHorizSampling; pp += Coff+2; } if (x > 0) { putRGBContigYCbCrClump(tp, pp, x, YCbCrVertSampling, w, Coff, YCbCrHorizSampling - x, toskew); pp += Coff+2; } cp += YCbCrVertSampling*(w + toskew); pp += fromskew; h -= YCbCrVertSampling; } if (h > 0) { tp = cp; for (x = w; x >= YCbCrHorizSampling; x -= YCbCrHorizSampling) { putRGBContigYCbCrClump(tp, pp, YCbCrHorizSampling, h, w, Coff, 0, toskew); tp += YCbCrHorizSampling; pp += Coff+2; } if (x > 0) putRGBContigYCbCrClump(tp, pp, x, h, w, Coff, YCbCrHorizSampling - x, toskew); } } /* * Select the appropriate conversion routine for packed data. */ static tileContigRoutine DECLARE1(pickTileContigCase, RGBvalue*, Map) { tileContigRoutine put = 0; switch (photometric) { case PHOTOMETRIC_RGB: put = (bitspersample == 8 ? putRGBcontig8bittile : putRGBcontig16bittile); break; case PHOTOMETRIC_PALETTE: switch (bitspersample) { case 8: put = put8bitcmaptile; break; case 4: put = put4bitcmaptile; break; case 2: put = put2bitcmaptile; break; case 1: put = put1bitcmaptile; break; } break; case PHOTOMETRIC_MINISWHITE: case PHOTOMETRIC_MINISBLACK: switch (bitspersample) { case 8: put = putgreytile; break; case 4: put = put4bitbwtile; break; case 2: put = put2bitbwtile; break; case 1: put = put1bitbwtile; break; } break; case PHOTOMETRIC_YCBCR: switch (bitspersample) { case 8: put = putcontig8bitYCbCrtile; break; } break; } if (put == 0) TIFFError(filename, "Can not handle format"); return (put); } /* * Select the appropriate conversion routine for unpacked data. * * NB: we assume that unpacked single channel data is directed * to the "packed routines. */ static tileSeparateRoutine DECLARE1(pickTileSeparateCase, RGBvalue*, Map) { tileSeparateRoutine put = 0; switch (photometric) { case PHOTOMETRIC_RGB: put = (bitspersample == 8 ? putRGBseparate8bittile : putRGBseparate16bittile); break; } if (put == 0) TIFFError(filename, "Can not handle format"); return (put); } neuron-7.6.3/src/lib/TIFF/tif_jpeg.c000077500000000000000000000030321340731477100170650ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_jpeg.c,v 1.2 1997/03/26 15:07:14 hines Exp"; #endif /* * Copyright (c) 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * Baseline JPEG Compression Algorithm Support. */ #include "tiffioP.h" int TIFFInitJPEG(tif) register TIFF *tif; { return (1); } neuron-7.6.3/src/lib/TIFF/tif_lzw.c000077500000000000000000000763421340731477100167720ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_lzw.c,v 1.2 1997/03/26 15:07:14 hines Exp"; #endif /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * Rev 5.0 Lempel-Ziv & Welch Compression Support * * This code is derived from the compress program whose code is * derived from software contributed to Berkeley by James A. Woods, * derived from original work by Spencer Thomas and Joseph Orost. * * The original Berkeley copyright notice appears below in its entirety. */ #include "tiffioP.h" #include #include #include "prototypes.h" /* * NB: The 5.0 spec describes a different algorithm than Aldus * implements. Specifically, Aldus does code length transitions * one code earlier than should be done (for real LZW). * Earlier versions of this library implemented the correct * LZW algorithm, but emitted codes in a bit order opposite * to the TIFF spec. Thus, to maintain compatibility w/ Aldus * we interpret MSB-LSB ordered codes to be images written w/ * old versions of this library, but otherwise adhere to the * Aldus "off by one" algorithm. * * Future revisions to the TIFF spec are expected to "clarify this issue". */ #define LZW_COMPAT /* include backwards compatibility code */ /* * Each strip of data is supposed to be terminated by a CODE_EOI. * If the following #define is included, the decoder will also * check for end-of-strip w/o seeing this code. This makes the * library more robust, but also slower. */ #define LZW_CHECKEOS /* include checks for strips w/o EOI code */ #define MAXCODE(n) ((1<<(n))-1) /* * The TIFF spec specifies that encoded bit * strings range from 9 to 12 bits. */ #define BITS_MIN 9 /* start with 9 bits */ #define BITS_MAX 12 /* max of 12 bit strings */ /* predefined codes */ #define CODE_CLEAR 256 /* code to clear string table */ #define CODE_EOI 257 /* end-of-information code */ #define CODE_FIRST 258 /* first free code entry */ #define CODE_MAX MAXCODE(BITS_MAX) #define HSIZE 9001 /* 91% occupancy */ #define HSHIFT (13-8) #ifdef LZW_COMPAT /* NB: +1024 is for compatibility with old files */ #define CSIZE (MAXCODE(BITS_MAX)+1024) #else #define CSIZE (MAXCODE(BITS_MAX)+1) #endif #if USE_PROTOTYPES typedef void (*predictorFunc)(char* data, int nbytes, int stride); #else typedef void (*predictorFunc)(); #endif /* * State block for each open TIFF * file using LZW compression/decompression. */ typedef struct { predictorFunc hordiff; /* horizontal differencing method */ long rowsize; /* width of tile/strip/row */ u_short stride; /* horizontal diferencing stride */ u_short nbits; /* # of bits/code */ u_short maxcode; /* maximum code for lzw_nbits */ u_short free_ent; /* next free entry in hash table */ long nextdata; /* next bits of i/o */ long nextbits; /* # of valid bits in lzw_nextdata */ } LZWState; #define lzw_hordiff base.hordiff #define lzw_rowsize base.rowsize #define lzw_stride base.stride #define lzw_nbits base.nbits #define lzw_maxcode base.maxcode #define lzw_free_ent base.free_ent #define lzw_nextdata base.nextdata #define lzw_nextbits base.nextbits /* * Decoding-specific state. */ typedef struct code_ent { struct code_ent *next; u_short length; /* string len, including this token */ u_char value; /* data value */ u_char firstchar; /* first token of string */ } code_t; #if USE_PROTOTYPES typedef int (*decodeFunc)(TIFF*, u_char*, int, u_int); #else typedef int (*decodeFunc)(); #endif typedef struct { LZWState base; long dec_nbitsmask; /* lzw_nbits 1 bits, right adjusted */ long dec_restart; /* restart count */ #ifdef LZW_CHECKEOS long dec_bitsleft; /* available bits in raw data */ #endif decodeFunc dec_decode; /* regular or backwards compatible */ code_t *dec_codep; /* current recognized code */ code_t *dec_oldcodep; /* previously recognized code */ code_t *dec_free_entp; /* next free entry */ code_t *dec_maxcodep; /* max available entry */ code_t dec_codetab[CSIZE]; } LZWDecodeState; /* * Encoding-specific state. */ typedef struct { long hash; long code; } hash_t; typedef struct { LZWState base; int enc_oldcode; /* last code encountered */ long enc_checkpoint; /* point at which to clear table */ #define CHECK_GAP 10000 /* enc_ratio check interval */ long enc_ratio; /* current compression ratio */ long enc_incount; /* (input) data bytes encoded */ long enc_outcount; /* encoded (output) bytes */ char *enc_rawlimit; /* bound on tif_rawdata buffer */ hash_t enc_hashtab[HSIZE]; } LZWEncodeState; #if USE_PROTOTYPES static int LZWPreEncode(TIFF*); static int LZWEncode(TIFF*, u_char*, int, u_int); static int LZWEncodePredRow(TIFF*, u_char*, int, u_int); static int LZWEncodePredTile(TIFF*, u_char*, int, u_int); static int LZWPostEncode(TIFF*); static int LZWDecode(TIFF*, u_char*, int, u_int); #ifdef LZW_COMPAT static int LZWDecodeCompat(TIFF*, u_char*, int, u_int); #endif static int LZWDecodePredRow(TIFF*, u_char*, int, u_int); static int LZWDecodePredTile(TIFF*, u_char*, int, u_int); static int LZWPreDecode(TIFF*); static int LZWCleanup(TIFF*); static void cl_hash(LZWEncodeState*); extern int TIFFFlushData1(TIFF *); #else static int LZWPreEncode(), LZWEncode(), LZWPostEncode(); static int LZWEncodePredRow(), LZWEncodePredTile(); static int LZWPreDecode(), LZWDecode(); #ifdef LZW_COMPAT static int LZWDecodeCompat(); #endif static int LZWDecodePredRow(), LZWDecodePredTile(); static int LZWCleanup(); static void cl_hash(); extern int TIFFFlushData1(); #endif int TIFFInitLZW(tif) TIFF *tif; { tif->tif_predecode = LZWPreDecode; tif->tif_decoderow = LZWDecode; tif->tif_decodestrip = LZWDecode; tif->tif_decodetile = LZWDecode; tif->tif_preencode = LZWPreEncode; tif->tif_postencode = LZWPostEncode; tif->tif_encoderow = LZWEncode; tif->tif_encodestrip = LZWEncode; tif->tif_encodetile = LZWEncode; tif->tif_cleanup = LZWCleanup; return (1); } static int DECLARE4(LZWCheckPredictor, TIFF*, tif, LZWState*, sp, predictorFunc, pred8bit, predictorFunc, pred16bit ) { TIFFDirectory *td = &tif->tif_dir; sp->hordiff = NULL; switch (td->td_predictor) { case 1: break; case 2: sp->stride = (td->td_planarconfig == PLANARCONFIG_CONTIG ? td->td_samplesperpixel : 1); switch (td->td_bitspersample) { case 8: sp->hordiff = pred8bit; break; case 16: sp->hordiff = pred16bit; break; default: TIFFError(tif->tif_name, "Horizontal differencing \"Predictor\" not supported with %d-bit samples", td->td_bitspersample); return (0); } break; default: TIFFError(tif->tif_name, "\"Predictor\" value %d not supported", td->td_predictor); return (0); } if (sp->hordiff != NULL) { /* * Calculate the scanline/tile-width size in bytes. */ if (isTiled(tif)) sp->rowsize = TIFFTileRowSize(tif); else sp->rowsize = TIFFScanlineSize(tif); } else sp->rowsize = 0; return (1); } /* * LZW Decoder. */ #ifdef LZW_CHECKEOS /* * This check shouldn't be necessary because each * strip is suppose to be terminated with CODE_EOI. */ #define NextCode(tif, sp, bp, code, get) { \ if ((sp)->dec_bitsleft < nbits) { \ TIFFWarning(tif->tif_name, \ "LZWDecode: Strip %d not terminated with EOI code", \ tif->tif_curstrip); \ code = CODE_EOI; \ } else { \ get(sp, bp, code); \ (sp)->dec_bitsleft -= nbits; \ } \ } #else #define NextCode(tif, sp, bp, code, get) get(sp, bp, code) #endif #define REPEAT4(n, op) \ switch (n) { \ default: { int i; for (i = n-4; i > 0; i--) { op; } } \ case 4: op; \ case 3: op; \ case 2: op; \ case 1: op; \ case 0: ; \ } #define XREPEAT4(n, op) \ switch (n) { \ default: { int i; for (i = n-4; i > 0; i--) { op; } } \ case 2: op; \ case 1: op; \ case 0: ; \ } static void DECLARE3(horizontalAccumulate8, register char*, cp, register int, cc, register int, stride ) { if (cc > stride) { cc -= stride; /* * Pipeline the most common cases. */ if (stride == 3) { u_int cr = cp[0]; u_int cg = cp[1]; u_int cb = cp[2]; do { cc -= 3, cp += 3; cp[0] = (cr += cp[0]); cp[1] = (cg += cp[1]); cp[2] = (cb += cp[2]); } while (cc > 0); } else if (stride == 4) { u_int cr = cp[0]; u_int cg = cp[1]; u_int cb = cp[2]; u_int ca = cp[3]; do { cc -= 4, cp += 4; cp[0] = (cr += cp[0]); cp[1] = (cg += cp[1]); cp[2] = (cb += cp[2]); cp[3] = (ca += cp[3]); } while (cc > 0); } else { do { XREPEAT4(stride, cp[stride] += *cp; cp++) cc -= stride; } while (cc > 0); } } } static void DECLARE3(horizontalAccumulate16, char*, cp, int, cc, register int, stride ) { register short* wp = (short *)cp; register int wc = cc / 2; if (wc > stride) { wc -= stride; do { REPEAT4(stride, wp[stride] += wp[0]; wp++) wc -= stride; } while (wc > 0); } } /* * Setup state for decoding a strip. */ static int LZWPreDecode(tif) TIFF *tif; { register LZWDecodeState *sp = (LZWDecodeState *)tif->tif_data; if (sp == NULL) { tif->tif_data = malloc(sizeof (LZWDecodeState)); if (tif->tif_data == NULL) { TIFFError("LZWPreDecode", "No space for LZW state block"); return (0); } sp = (LZWDecodeState *)tif->tif_data; sp->dec_decode = NULL; if (!LZWCheckPredictor(tif, &sp->base, horizontalAccumulate8, horizontalAccumulate16)) return (0); if (sp->lzw_hordiff) { /* * Override default decoding method with * one that does the predictor stuff. */ tif->tif_decoderow = LZWDecodePredRow; tif->tif_decodestrip = LZWDecodePredTile; tif->tif_decodetile = LZWDecodePredTile; } /* * Pre-load the table. */ { int code; for (code = 255; code >= 0; code--) { sp->dec_codetab[code].value = code; sp->dec_codetab[code].firstchar = code; sp->dec_codetab[code].length = 1; sp->dec_codetab[code].next = NULL; } } } /* * Check for old bit-reversed codes. */ if (tif->tif_rawdata[0] == 0 && (tif->tif_rawdata[1] & 0x1)) { #ifdef LZW_COMPAT if (!sp->dec_decode) { if (sp->lzw_hordiff == NULL) { /* * Override default decoding methods with * ones that deal with the old coding. * Otherwise the predictor versions set * above will call the compatibility routines * through the dec_decode method. */ tif->tif_decoderow = LZWDecodeCompat; tif->tif_decodestrip = LZWDecodeCompat; tif->tif_decodetile = LZWDecodeCompat; } TIFFWarning(tif->tif_name, "Old-style LZW codes, convert file"); } sp->lzw_maxcode = MAXCODE(BITS_MIN); sp->dec_decode = LZWDecodeCompat; #else /* !LZW_COMPAT */ if (!sp->dec_decode) { TIFFError(tif->tif_name, "Old-style LZW codes not supported"); sp->dec_decode = LZWDecode; } return (0); #endif/* !LZW_COMPAT */ } else { sp->lzw_maxcode = MAXCODE(BITS_MIN)-1; sp->dec_decode = LZWDecode; } sp->lzw_nbits = BITS_MIN; sp->lzw_nextbits = 0; sp->lzw_nextdata = 0; sp->dec_restart = 0; sp->dec_nbitsmask = MAXCODE(BITS_MIN); #ifdef LZW_CHECKEOS sp->dec_bitsleft = tif->tif_rawdatasize << 3; #endif sp->dec_free_entp = sp->dec_codetab + CODE_FIRST; sp->dec_oldcodep = sp->dec_codetab - 1; sp->dec_maxcodep = &sp->dec_codetab[sp->dec_nbitsmask-1]; return (1); } /* * Decode a "hunk of data". */ #define GetNextCode(sp, bp, code) { \ nextdata = (nextdata<<8) | *(bp)++; \ nextbits += 8; \ if (nextbits < nbits) { \ nextdata = (nextdata<<8) | *(bp)++; \ nextbits += 8; \ } \ code = (nextdata >> (nextbits-nbits)) & nbitsmask; \ nextbits -= nbits; \ } static int LZWDecode(tif, op0, occ0, s) TIFF *tif; u_char *op0; int occ0; u_int s; { LZWDecodeState *sp = (LZWDecodeState *)tif->tif_data; char *op = (char *)op0; int occ = occ0; char *tp; u_char *bp; int code, nbits, nextbits; long nextdata, nbitsmask; code_t *codep, *free_entp, *maxcodep, *oldcodep; assert(sp != NULL); /* * Restart interrupted output operation. */ if (sp->dec_restart) { int residue; codep = sp->dec_codep; residue = codep->length - sp->dec_restart; if (residue > occ) { /* * Residue from previous decode is sufficient * to satisfy decode request. Skip to the * start of the decoded string, place decoded * values in the output buffer, and return. */ sp->dec_restart += occ; do { codep = codep->next; } while (--residue > occ); tp = op + occ; do { *--tp = codep->value; codep = codep->next; } while (--occ); return (1); } /* * Residue satisfies only part of the decode request. */ op += residue, occ -= residue; tp = op; do { int t; --tp; t = codep->value; codep = codep->next; *tp = t; } while (--residue); sp->dec_restart = 0; } bp = (u_char *)tif->tif_rawcp; nbits = sp->lzw_nbits; nextdata = sp->lzw_nextdata; nextbits = sp->lzw_nextbits; nbitsmask = sp->dec_nbitsmask; oldcodep = sp->dec_oldcodep; free_entp = sp->dec_free_entp; maxcodep = sp->dec_maxcodep; while (occ > 0) { NextCode(tif, sp, bp, code, GetNextCode); if (code == CODE_EOI) break; if (code == CODE_CLEAR) { free_entp = sp->dec_codetab + CODE_FIRST; nbits = BITS_MIN; nbitsmask = MAXCODE(BITS_MIN); maxcodep = sp->dec_codetab + nbitsmask-1; NextCode(tif, sp, bp, code, GetNextCode); if (code == CODE_EOI) break; *op++ = code, occ--; oldcodep = sp->dec_codetab + code; continue; } codep = sp->dec_codetab + code; /* * Add the new entry to the code table. */ assert(&sp->dec_codetab[0] <= free_entp && free_entp < &sp->dec_codetab[CSIZE]); free_entp->next = oldcodep; free_entp->firstchar = free_entp->next->firstchar; free_entp->length = free_entp->next->length+1; free_entp->value = (codep < free_entp) ? codep->firstchar : free_entp->firstchar; if (++free_entp > maxcodep) { if (++nbits > BITS_MAX) /* should not happen */ nbits = BITS_MAX; nbitsmask = MAXCODE(nbits); maxcodep = sp->dec_codetab + nbitsmask-1; } oldcodep = codep; if (code >= 256) { /* * Code maps to a string, copy string * value to output (written in reverse). */ if (codep->length > occ) { /* * String is too long for decode buffer, * locate portion that will fit, copy to * the decode buffer, and setup restart * logic for the next decoding call. */ sp->dec_codep = codep; do { codep = codep->next; } while (codep->length > occ); sp->dec_restart = occ; tp = op + occ; do { *--tp = codep->value; codep = codep->next; } while (--occ); break; } op += codep->length, occ -= codep->length; tp = op; do { int t; --tp; t = codep->value; codep = codep->next; *tp = t; } while (codep); } else *op++ = code, occ--; } tif->tif_rawcp = (char *)bp; sp->lzw_nbits = nbits; sp->lzw_nextdata = nextdata; sp->lzw_nextbits = nextbits; sp->dec_nbitsmask = nbitsmask; sp->dec_oldcodep = oldcodep; sp->dec_free_entp = free_entp; sp->dec_maxcodep = maxcodep; if (occ > 0) { TIFFError(tif->tif_name, "LZWDecode: Not enough data at scanline %d (short %d bytes)", tif->tif_row, occ); return (0); } return (1); } #ifdef LZW_COMPAT /* * Decode a "hunk of data" for old images. */ #define GetNextCodeCompat(sp, bp, code) { \ nextdata |= *(bp)++ << nextbits; \ nextbits += 8; \ if (nextbits < nbits) { \ nextdata |= *(bp)++ << nextbits; \ nextbits += 8; \ } \ code = nextdata & nbitsmask; \ nextdata >>= nbits; \ nextbits -= nbits; \ } static int LZWDecodeCompat(tif, op0, occ0, s) TIFF *tif; u_char *op0; int occ0; u_int s; { LZWDecodeState *sp = (LZWDecodeState *)tif->tif_data; char *op = (char *)op0; int occ = occ0; char *tp; u_char *bp; int code, nbits, nextbits; long nextdata, nbitsmask; code_t *codep, *free_entp, *maxcodep, *oldcodep; assert(sp != NULL); /* * Restart interrupted output operation. */ if (sp->dec_restart) { int residue; codep = sp->dec_codep; residue = codep->length - sp->dec_restart; if (residue > occ) { /* * Residue from previous decode is sufficient * to satisfy decode request. Skip to the * start of the decoded string, place decoded * values in the output buffer, and return. */ sp->dec_restart += occ; do { codep = codep->next; } while (--residue > occ); tp = op + occ; do { *--tp = codep->value; codep = codep->next; } while (--occ); return (1); } /* * Residue satisfies only part of the decode request. */ op += residue, occ -= residue; tp = op; do { *--tp = codep->value; codep = codep->next; } while (--residue); sp->dec_restart = 0; } bp = (u_char *)tif->tif_rawcp; nbits = sp->lzw_nbits; nextdata = sp->lzw_nextdata; nextbits = sp->lzw_nextbits; nbitsmask = sp->dec_nbitsmask; oldcodep = sp->dec_oldcodep; free_entp = sp->dec_free_entp; maxcodep = sp->dec_maxcodep; while (occ > 0) { NextCode(tif, sp, bp, code, GetNextCodeCompat); if (code == CODE_EOI) break; if (code == CODE_CLEAR) { free_entp = sp->dec_codetab + CODE_FIRST; nbits = BITS_MIN; nbitsmask = MAXCODE(BITS_MIN); maxcodep = sp->dec_codetab + nbitsmask; NextCode(tif, sp, bp, code, GetNextCodeCompat); if (code == CODE_EOI) break; *op++ = code, occ--; oldcodep = sp->dec_codetab + code; continue; } codep = sp->dec_codetab + code; /* * Add the new entry to the code table. */ assert(&sp->dec_codetab[0] <= free_entp && free_entp < &sp->dec_codetab[CSIZE]); free_entp->next = oldcodep; free_entp->firstchar = free_entp->next->firstchar; free_entp->length = free_entp->next->length+1; free_entp->value = (codep < free_entp) ? codep->firstchar : free_entp->firstchar; if (++free_entp > maxcodep) { if (++nbits > BITS_MAX) /* should not happen */ nbits = BITS_MAX; nbitsmask = MAXCODE(nbits); maxcodep = sp->dec_codetab + nbitsmask; } oldcodep = codep; if (code >= 256) { /* * Code maps to a string, copy string * value to output (written in reverse). */ if (codep->length > occ) { /* * String is too long for decode buffer, * locate portion that will fit, copy to * the decode buffer, and setup restart * logic for the next decoding call. */ sp->dec_codep = codep; do { codep = codep->next; } while (codep->length > occ); sp->dec_restart = occ; tp = op + occ; do { *--tp = codep->value; codep = codep->next; } while (--occ); break; } op += codep->length, occ -= codep->length; tp = op; do { *--tp = codep->value; } while ((codep = codep->next)); } else *op++ = code, occ--; } tif->tif_rawcp = (char *)bp; sp->lzw_nbits = nbits; sp->lzw_nextdata = nextdata; sp->lzw_nextbits = nextbits; sp->dec_nbitsmask = nbitsmask; sp->dec_oldcodep = oldcodep; sp->dec_free_entp = free_entp; sp->dec_maxcodep = maxcodep; if (occ > 0) { TIFFError(tif->tif_name, "LZWDecodeCompat: Not enough data at scanline %d (short %d bytes)", tif->tif_row, occ); return (0); } return (1); } #endif /* LZW_COMPAT */ /* * Decode a scanline and apply the predictor routine. */ static int LZWDecodePredRow(tif, op0, occ0, s) TIFF *tif; u_char *op0; int occ0; u_int s; { LZWDecodeState *sp = (LZWDecodeState *)tif->tif_data; assert(sp != NULL); assert(sp->dec_decode != NULL); if ((*sp->dec_decode)(tif, op0, occ0, s)) { (*sp->lzw_hordiff)((char *)op0, occ0, sp->lzw_stride); return (1); } else return (0); } /* * Decode a tile/strip and apply the predictor routine. * Note that horizontal differencing must be done on a * row-by-row basis. The width of a "row" has already * been calculated at pre-decode time according to the * strip/tile dimensions. */ static int LZWDecodePredTile(tif, op0, occ0, s) TIFF *tif; u_char *op0; int occ0; u_int s; { LZWDecodeState *sp = (LZWDecodeState *)tif->tif_data; int rowsize; assert(sp != NULL); assert(sp->dec_decode != NULL); if (!(*sp->dec_decode)(tif, op0, occ0, s)) return (0); rowsize = sp->lzw_rowsize; assert(rowsize > 0); while (occ0 > 0) { (*sp->lzw_hordiff)((char *)op0, rowsize, sp->lzw_stride); occ0 -= rowsize; op0 += rowsize; } return (1); } /* * LZW Encoding. */ static void DECLARE3(horizontalDifference8, register char*, cp, register int, cc, register int, stride ) { if (cc > stride) { cc -= stride; /* * Pipeline the most common cases. */ if (stride == 3) { int r1, g1, b1; int r2 = cp[0]; int g2 = cp[1]; int b2 = cp[2]; do { r1 = cp[3]; cp[3] = r1-r2; r2 = r1; g1 = cp[4]; cp[4] = g1-g2; g2 = g1; b1 = cp[5]; cp[5] = b1-b2; b2 = b1; cp += 3; } while ((cc -= 3) > 0); } else if (stride == 4) { int r1, g1, b1, a1; int r2 = cp[0]; int g2 = cp[1]; int b2 = cp[2]; int a2 = cp[3]; do { r1 = cp[4]; cp[4] = r1-r2; r2 = r1; g1 = cp[5]; cp[5] = g1-g2; g2 = g1; b1 = cp[6]; cp[6] = b1-b2; b2 = b1; a1 = cp[7]; cp[7] = a1-a2; a2 = a1; cp += 4; } while ((cc -= 4) > 0); } else { cp += cc - 1; do { REPEAT4(stride, cp[stride] -= cp[0]; cp--) } while ((cc -= stride) > 0); } } } static void DECLARE3(horizontalDifference16, char*, cp, int, cc, register int, stride ) { register short *wp = (short *)cp; register int wc = cc/2; if (wc > stride) { wc -= stride; wp += wc - 1; do { REPEAT4(stride, wp[stride] -= wp[0]; wp--) wc -= stride; } while (wc > 0); } } /* * Reset encoding state at the start of a strip. */ static int LZWPreEncode(tif) TIFF *tif; { register LZWEncodeState *sp = (LZWEncodeState *)tif->tif_data; if (sp == NULL) { tif->tif_data = malloc(sizeof (LZWEncodeState)); if (tif->tif_data == NULL) { TIFFError("LZWPreEncode", "No space for LZW state block"); return (0); } sp = (LZWEncodeState *)tif->tif_data; if (!LZWCheckPredictor(tif, &sp->base, horizontalDifference8, horizontalDifference16)) return (0); if (sp->lzw_hordiff != NULL) { tif->tif_encoderow = LZWEncodePredRow; tif->tif_encodestrip = LZWEncodePredTile; tif->tif_encodetile = LZWEncodePredTile; } } sp->lzw_nbits = BITS_MIN; sp->lzw_maxcode = MAXCODE(BITS_MIN); sp->lzw_free_ent = CODE_FIRST; sp->lzw_nextbits = 0; sp->lzw_nextdata = 0; sp->enc_checkpoint = CHECK_GAP; sp->enc_ratio = 0; sp->enc_incount = 0; sp->enc_outcount = 0; /* * The 4 here insures there is space for 2 max-sized * codes in LZWEncode and LZWPostDecode. */ sp->enc_rawlimit = tif->tif_rawdata + tif->tif_rawdatasize-1 - 4; cl_hash(sp); /* clear hash table */ sp->enc_oldcode = -1; /* generates CODE_CLEAR in LZWEncode */ return (1); } #define CALCRATIO(sp, rat) { \ if (incount > 0x007fffff) { /* NB: shift will overflow */\ rat = outcount >> 8; \ rat = (rat == 0 ? 0x7fffffff : incount/rat); \ } else \ rat = (incount<<8) / outcount; \ } #define PutNextCode(op, c) { \ nextdata = (nextdata << nbits) | c; \ nextbits += nbits; \ *op++ = nextdata >> (nextbits-8); \ nextbits -= 8; \ if (nextbits >= 8) { \ *op++ = nextdata >> (nextbits-8); \ nextbits -= 8; \ } \ outcount += nbits; \ } /* * Encode a chunk of pixels. * * Uses an open addressing double hashing (no chaining) on the * prefix code/next character combination. We do a variant of * Knuth's algorithm D (vol. 3, sec. 6.4) along with G. Knott's * relatively-prime secondary probe. Here, the modular division * first probe is gives way to a faster exclusive-or manipulation. * Also do block compression with an adaptive reset, whereby the * code table is cleared when the compression ratio decreases, * but after the table fills. The variable-length output codes * are re-sized at this point, and a CODE_CLEAR is generated * for the decoder. */ static int LZWEncode(tif, bp, cc, s) TIFF *tif; u_char *bp; int cc; u_int s; { static char module[] = "LZWEncode"; register LZWEncodeState *sp = (LZWEncodeState *)tif->tif_data; register long fcode; register hash_t *hp; register int h, c, ent, disp; long incount, outcount, checkpoint; long nextdata, nextbits; int free_ent, maxcode, nbits; char *op, *limit; if (sp == NULL) return (0); /* * Load local state. */ incount = sp->enc_incount; outcount = sp->enc_outcount; checkpoint = sp->enc_checkpoint; nextdata = sp->lzw_nextdata; nextbits = sp->lzw_nextbits; free_ent = sp->lzw_free_ent; maxcode = sp->lzw_maxcode; nbits = sp->lzw_nbits; op = tif->tif_rawcp; limit = sp->enc_rawlimit; ent = sp->enc_oldcode; if (ent == -1 && cc > 0) { /* * NB: This is safe because it can only happen * at the start of a strip where we know there * is space in the data buffer. */ PutNextCode(op, CODE_CLEAR); ent = *bp++; cc--; incount++; } while (cc > 0) { c = *bp++; cc--; incount++; fcode = ((long)c << BITS_MAX) + ent; h = (c << HSHIFT) ^ ent; /* xor hashing */ hp = &sp->enc_hashtab[h]; if (hp->hash == fcode) { ent = hp->code; continue; } if (hp->hash >= 0) { /* * Primary hash failed, check secondary hash. */ disp = HSIZE - h; if (h == 0) disp = 1; do { if ((hp -= disp) < sp->enc_hashtab) hp += HSIZE; if (hp->hash == fcode) { ent = hp->code; goto hit; } } while (hp->hash >= 0); } /* * New entry, emit code and add to table. */ /* * Verify there is space in the buffer for the code * and any potential Clear code that might be emitted * below. The value of limit is setup so that there * are at least 4 bytes free--room for 2 codes. */ if (op > limit) { tif->tif_rawcc = op - tif->tif_rawdata; TIFFFlushData1(tif); op = tif->tif_rawdata; } PutNextCode(op, ent); ent = c; hp->code = free_ent++; hp->hash = fcode; if (free_ent == CODE_MAX-1) { /* table is full, emit clear code and reset */ cl_hash(sp); sp->enc_ratio = 0; incount = 0; outcount = 0; free_ent = CODE_FIRST; PutNextCode(op, CODE_CLEAR); nbits = BITS_MIN; maxcode = MAXCODE(BITS_MIN); } else { /* * If the next entry is going to be too big for * the code size, then increase it, if possible. */ if (free_ent > maxcode) { nbits++; assert(nbits <= BITS_MAX); maxcode = MAXCODE(nbits); } else if (incount >= checkpoint) { long rat; /* * Check compression ratio and, if things seem * to be slipping, clear the hash table and * reset state. The compression ratio is a * 24+8-bit fractional number. */ checkpoint = incount+CHECK_GAP; CALCRATIO(sp, rat); if (rat <= sp->enc_ratio) { cl_hash(sp); sp->enc_ratio = 0; incount = 0; outcount = 0; free_ent = CODE_FIRST; PutNextCode(op, CODE_CLEAR); nbits = BITS_MIN; maxcode = MAXCODE(BITS_MIN); } else sp->enc_ratio = rat; } } hit: ; } /* * Restore global state. */ sp->enc_incount = incount; sp->enc_outcount = outcount; sp->enc_checkpoint = checkpoint; sp->enc_oldcode = ent; sp->lzw_nextdata = nextdata; sp->lzw_nextbits = nextbits; sp->lzw_free_ent = free_ent; sp->lzw_maxcode = maxcode; sp->lzw_nbits = nbits; /* XXX not needed if TIFFWriteScanline is patched properly */ tif->tif_rawcc = op - tif->tif_rawdata; tif->tif_rawcp = op; return (1); } static int LZWEncodePredRow(tif, bp, cc, s) TIFF *tif; u_char *bp; int cc; u_int s; { LZWEncodeState *sp = (LZWEncodeState *)tif->tif_data; assert(sp != NULL); assert(sp->lzw_hordiff != NULL); /* XXX horizontal differencing alters user's data XXX */ (*sp->lzw_hordiff)((char *)bp, cc, sp->lzw_stride); return (LZWEncode(tif, bp, cc, s)); } static int LZWEncodePredTile(tif, bp0, cc0, s) TIFF *tif; u_char *bp0; int cc0; u_int s; { LZWEncodeState *sp = (LZWEncodeState *)tif->tif_data; int cc = cc0, rowsize; u_char *bp = bp0; assert(sp != NULL); assert(sp->lzw_hordiff != NULL); rowsize = sp->lzw_rowsize; assert(rowsize > 0); while (cc > 0) { (*sp->lzw_hordiff)((char *)bp, rowsize, sp->lzw_stride); cc -= rowsize; bp += rowsize; } return (LZWEncode(tif, bp0, cc0, s)); } /* * Finish off an encoded strip by flushing the last * string and tacking on an End Of Information code. */ static int LZWPostEncode(tif) TIFF *tif; { register LZWEncodeState *sp = (LZWEncodeState *)tif->tif_data; char *op = tif->tif_rawcp; long nextbits = sp->lzw_nextbits; long nextdata = sp->lzw_nextdata; long outcount = sp->enc_outcount; int nbits = sp->lzw_nbits; if (op > sp->enc_rawlimit) { tif->tif_rawcc = op - tif->tif_rawdata; TIFFFlushData1(tif); op = tif->tif_rawdata; } if (sp->enc_oldcode != -1) { PutNextCode(op, sp->enc_oldcode); sp->enc_oldcode = -1; } PutNextCode(op, CODE_EOI); if (nextbits > 0) *op++ = nextdata << (8-nextbits); tif->tif_rawcc = op - tif->tif_rawdata; return (1); } /* * Reset encoding hash table. */ static void cl_hash(sp) LZWEncodeState *sp; { register hash_t *hp = &sp->enc_hashtab[HSIZE-1]; register long i = HSIZE-8; do { i -= 8; hp[-7].hash = -1; hp[-6].hash = -1; hp[-5].hash = -1; hp[-4].hash = -1; hp[-3].hash = -1; hp[-2].hash = -1; hp[-1].hash = -1; hp[ 0].hash = -1; hp -= 8; } while (i >= 0); for (i += 8; i > 0; i--, hp--) hp->hash = -1; } static int LZWCleanup(tif) TIFF *tif; { if (tif->tif_data) { free(tif->tif_data); tif->tif_data = NULL; } return 1; } /* * Copyright (c) 1985, 1986 The Regents of the University of California. * All rights reserved. * * This code is derived from software contributed to Berkeley by * James A. Woods, derived from original work by Spencer Thomas * and Joseph Orost. * * Redistribution and use in source and binary forms are permitted * provided that the above copyright notice and this paragraph are * duplicated in all such forms and that any documentation, * advertising materials, and other materials related to such * distribution and use acknowledge that the software was developed * by the University of California, Berkeley. The name of the * University may not be used to endorse or promote products derived * from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ neuron-7.6.3/src/lib/TIFF/tif_machdep.c000077500000000000000000000113151340731477100175440ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_machdep.c,v 1.2 1997/03/26 15:07:15 hines Exp"; #endif /* * Copyright (c) 1992 Sam Leffler * Copyright (c) 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library Machine Dependent Routines. */ #include "tiffioP.h" #ifdef tahoe typedef struct ieeedouble { u_long sign : 1, exp : 11, mant : 20; u_long mant2; } ieeedouble; typedef struct ieeefloat { u_long sign : 1, exp : 8, mant : 23; } ieeefloat; typedef struct { u_long sign : 1, exp : 8, mant : 23; u_long mant2; } nativedouble; typedef struct { u_long sign : 1, exp : 8, mant : 23; } nativefloat; /* * Beware, over/under-flow in conversions will * result in garbage values -- handling it would * require a subroutine call or lots more code. */ #define NATIVE2IEEEFLOAT(fp) { \ if ((fp)->native.exp) \ (fp)->ieee.exp = (fp)->native.exp - 129 + 127; /* alter bias */\ } #define IEEEFLOAT2NATIVE(fp) { \ if ((fp)->ieee.exp) \ (fp)->native.exp = (fp)->ieee.exp - 127 + 129; /* alter bias */\ } #define IEEEDOUBLE2NATIVE(dp) { \ if ((dp)->native.exp = (dp)->ieee.exp) \ (dp)->native.exp += -1023 + 129; \ (dp)->native.mant = ((dp)->ieee.mant<<3)|((dp)->native.mant2>>29); \ (dp)->native.mant2 <<= 3; \ } #endif /* tahoe */ #ifdef vax typedef struct ieeedouble { u_long mant : 20, exp : 11, sign : 1; u_long mant2; } ieeedouble; typedef struct ieeefloat { u_long mant : 23, exp : 8, sign : 1; } ieeefloat; typedef struct { u_long mant1 : 7, exp : 8, sign : 1, mant2 : 16; u_long mant3; } nativedouble; typedef struct { u_long mant1 : 7, exp : 8, sign : 1, mant2 : 16; } nativefloat; /* * Beware, these do not handle over/under-flow * during conversion from ieee to native format. */ #define NATIVE2IEEEFLOAT(fp) { \ float_t t; \ if (t.ieee.exp = (fp)->native.exp) \ t.ieee.exp += -129 + 127; \ t.ieee.sign = (fp)->native.sign; \ t.ieee.mant = ((fp)->native.mant1<<16)|(fp)->native.mant2; \ *(fp) = t; \ } #define IEEEFLOAT2NATIVE(fp) { \ float_t t; int v = (fp)->ieee.exp; \ if (v) v += -127 + 129; /* alter bias of exponent */\ t.native.exp = v; /* implicit truncation of exponent */\ t.native.sign = (fp)->ieee.sign; \ v = (fp)->ieee.mant; \ t.native.mant1 = v >> 16; \ t.native.mant2 = v;\ *(fp) = t; \ } #define IEEEDOUBLE2NATIVE(dp) { \ double_t t; int v = (dp)->ieee.exp; \ if (v) v += -1023 + 129; /* if can alter bias of exponent */\ t.native.exp = v; /* implicit truncation of exponent */\ v = (dp)->ieee.mant; \ t.native.sign = (dp)->ieee.sign; \ t.native.mant1 = v >> 16; \ t.native.mant2 = v;\ t.native.mant3 = (dp)->mant2; \ *(dp) = t; \ } #endif /* vax */ #if !HAVE_IEEEFP #if !defined(IEEEFLOAT2NATIVE) || !defined(NATIVE2IEEEFLOAT) "Help, you've configured the library to not have IEEE floating point,\ but not defined how to convert between IEEE and native formats!" #endif /* * These unions are used during floating point * conversions. The above macros define the * conversion operations. */ typedef union { ieeedouble ieee; nativedouble native; char b[8]; double d; } double_t; typedef union { ieeefloat ieee; nativefloat native; char b[4]; float f; } float_t; TIFFCvtIEEEFloatToNative(tif, n, f) TIFF *tif; u_int n; float *f; { float_t *fp = (float_t *)f; while (n-- > 0) { IEEEFLOAT2NATIVE(fp); fp++; } } TIFFCvtNativeToIEEEFloat(tif, n, f) TIFF *tif; u_int n; float *f; { float_t *fp = (float_t *)f; while (n-- > 0) { NATIVE2IEEEFLOAT(fp); fp++; } } #endif neuron-7.6.3/src/lib/TIFF/tif_next.c000077500000000000000000000074011340731477100171220ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_next.c,v 1.2 1997/03/26 15:07:16 hines Exp"; #endif /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * NeXT 2-bit Grey Scale Compression Algorithm Support */ #include "tiffioP.h" #if USE_PROTOTYPES static int NeXTDecode(TIFF *, u_char *, int, u_int); #else static int NeXTDecode(); #endif int TIFFInitNeXT(tif) TIFF *tif; { tif->tif_decoderow = NeXTDecode; tif->tif_decodestrip = NeXTDecode; tif->tif_decodetile = NeXTDecode; return (1); } #define SETPIXEL(op, v) { \ switch (npixels++ & 3) { \ case 0: op[0] = (v) << 6; break; \ case 1: op[0] |= (v) << 4; break; \ case 2: op[0] |= (v) << 2; break; \ case 3: *op++ |= (v); break; \ } \ } #define LITERALROW 0x00 #define LITERALSPAN 0x40 #define WHITE ((1<<2)-1) static int NeXTDecode(tif, buf, occ, s) TIFF *tif; u_char *buf; int occ; u_int s; { register u_char *bp, *op; register int cc, n; u_char *row; int scanline; /* * Each scanline is assumed to start off as all * white (we assume a PhotometricInterpretation * of ``min-is-black''). */ for (op = buf, cc = occ; cc-- > 0;) *op++ = 0xff; bp = (u_char *)tif->tif_rawcp; cc = tif->tif_rawcc; scanline = tif->tif_scanlinesize; for (row = buf; occ > 0; occ -= scanline, row += scanline) { n = *bp++, cc--; switch (n) { case LITERALROW: /* * The entire scanline is given as literal values. */ if (cc < scanline) goto bad; bcopy(bp, row, scanline); bp += scanline; cc -= scanline; break; case LITERALSPAN: { int off; /* * The scanline has a literal span * that begins at some offset. */ off = (bp[0] * 256) + bp[1]; n = (bp[2] * 256) + bp[3]; if (cc < 4+n) goto bad; bcopy(bp+4, row+off, n); bp += 4+n; cc -= 4+n; break; } default: { register int npixels = 0, grey; int imagewidth = tif->tif_dir.td_imagewidth; /* * The scanline is composed of a sequence * of constant color ``runs''. We shift * into ``run mode'' and interpret bytes * as codes of the form * until we've filled the scanline. */ op = row; for (;;) { grey = (n>>6) & 0x3; n &= 0x3f; while (n-- > 0) SETPIXEL(op, grey); if (npixels >= imagewidth) break; if (cc == 0) goto bad; n = *bp++, cc--; } break; } } } tif->tif_rawcp = (char *)bp; tif->tif_rawcc = cc; return (1); bad: TIFFError(tif->tif_name, "NeXTDecode: Not enough data for scanline %d", tif->tif_row); return (0); } neuron-7.6.3/src/lib/TIFF/tif_open.c000077500000000000000000000213111340731477100171010ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_open.c,v 1.2 1997/03/26 15:07:17 hines Exp"; #endif /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. */ #include #include #include "tiffioP.h" #include "prototypes.h" #if USE_PROTOTYPES extern int TIFFDefaultDirectory(TIFF*); #else extern int TIFFDefaultDirectory(); #endif static const long typemask[13] = { 0, /* TIFF_NOTYPE */ 0x000000ff, /* TIFF_BYTE */ 0xffffffff, /* TIFF_ASCII */ 0x0000ffff, /* TIFF_SHORT */ 0xffffffff, /* TIFF_LONG */ 0xffffffff, /* TIFF_RATIONAL */ 0x000000ff, /* TIFF_SBYTE */ 0x000000ff, /* TIFF_UNDEFINED */ 0x0000ffff, /* TIFF_SSHORT */ 0xffffffff, /* TIFF_SLONG */ 0xffffffff, /* TIFF_SRATIONAL */ 0xffffffff, /* TIFF_FLOAT */ 0xffffffff, /* TIFF_DOUBLE */ }; static const int bigTypeshift[13] = { 0, /* TIFF_NOTYPE */ 24, /* TIFF_BYTE */ 0, /* TIFF_ASCII */ 16, /* TIFF_SHORT */ 0, /* TIFF_LONG */ 0, /* TIFF_RATIONAL */ 16, /* TIFF_SBYTE */ 16, /* TIFF_UNDEFINED */ 24, /* TIFF_SSHORT */ 0, /* TIFF_SLONG */ 0, /* TIFF_SRATIONAL */ 0, /* TIFF_FLOAT */ 0, /* TIFF_DOUBLE */ }; static const int litTypeshift[13] = { 0, /* TIFF_NOTYPE */ 0, /* TIFF_BYTE */ 0, /* TIFF_ASCII */ 0, /* TIFF_SHORT */ 0, /* TIFF_LONG */ 0, /* TIFF_RATIONAL */ 0, /* TIFF_SBYTE */ 0, /* TIFF_UNDEFINED */ 0, /* TIFF_SSHORT */ 0, /* TIFF_SLONG */ 0, /* TIFF_SRATIONAL */ 0, /* TIFF_FLOAT */ 0, /* TIFF_DOUBLE */ }; /* * Initialize the bit fill order, the * shift & mask tables, and the byte * swapping state according to the file * contents and the machine architecture. */ static int DECLARE3(TIFFInitOrder, register TIFF*, tif, int, magic, int, bigendian) { /* XXX how can we deduce this dynamically? */ tif->tif_fillorder = FILLORDER_MSB2LSB; tif->tif_typemask = typemask; if (magic == TIFF_BIGENDIAN) { tif->tif_typeshift = bigTypeshift; if (!bigendian) tif->tif_flags |= TIFF_SWAB; } else { tif->tif_typeshift = litTypeshift; if (bigendian) tif->tif_flags |= TIFF_SWAB; } return 1; } static int DECLARE2(getMode, char*, mode, char*, module) { int m = -1; switch (mode[0]) { case 'r': m = O_RDONLY; if (mode[1] == '+') m = O_RDWR; break; case 'w': case 'a': m = O_RDWR|O_CREAT; if (mode[0] == 'w') m |= O_TRUNC; break; default: TIFFError(module, "\"%s\": Bad mode", mode); break; } return (m); } /* * Open a TIFF file for read/writing. */ TIFF * TIFFOpen(name, mode) char *name, *mode; { static char module[] = "TIFFOpen"; int m, fd; m = getMode(mode, module); if (m == -1) return ((TIFF *)0); fd = TIFFOpenFile(name, m, 0666); if (fd < 0) { TIFFError(module, "%s: Cannot open", name); return ((TIFF *)0); } return (TIFFFdOpen(fd, name, mode)); } /* * Open a TIFF file descriptor for read/writing. */ TIFF * TIFFFdOpen(fd, name, mode) int fd; char *name, *mode; { static char module[] = "TIFFFdOpen"; TIFF *tif; int m, bigendian; m = getMode(mode, module); if (m == -1) goto bad2; tif = (TIFF *)malloc(sizeof (TIFF) + strlen(name) + 1); if (tif == NULL) { TIFFError(module, "%s: Out of memory (TIFF structure)", name); goto bad2; } bzero((char *)tif, sizeof (*tif)); tif->tif_name = (char *)tif + sizeof (TIFF); strcpy(tif->tif_name, name); tif->tif_fd = fd; tif->tif_mode = m &~ (O_CREAT|O_TRUNC); tif->tif_curdir = -1; /* non-existent directory */ tif->tif_curoff = 0; tif->tif_curstrip = -1; /* invalid strip */ tif->tif_row = -1; /* read/write pre-increment */ { int one = 1; bigendian = (*(char *)&one == 0); } /* * Read in TIFF header. */ if (!ReadOK(fd, &tif->tif_header, sizeof (TIFFHeader))) { if (tif->tif_mode == O_RDONLY) { TIFFError(name, "Cannot read TIFF header"); goto bad; } /* * Setup header and write. */ tif->tif_header.tiff_magic = bigendian ? TIFF_BIGENDIAN : TIFF_LITTLEENDIAN; tif->tif_header.tiff_version = TIFF_VERSION; tif->tif_header.tiff_diroff = 0; /* filled in later */ if (!WriteOK(fd, &tif->tif_header, sizeof (TIFFHeader))) { TIFFError(name, "Error writing TIFF header"); goto bad; } /* * Setup the byte order handling. */ TIFFInitOrder(tif, tif->tif_header.tiff_magic, bigendian); /* * Setup default directory. */ if (!TIFFDefaultDirectory(tif)) goto bad; tif->tif_diroff = 0; return (tif); } /* * Setup the byte order handling. */ if (tif->tif_header.tiff_magic != TIFF_BIGENDIAN && tif->tif_header.tiff_magic != TIFF_LITTLEENDIAN) { TIFFError(name, "Not a TIFF file, bad magic number %d (0x%x)", tif->tif_header.tiff_magic, tif->tif_header.tiff_magic); goto bad; } TIFFInitOrder(tif, tif->tif_header.tiff_magic, bigendian); /* * Swap header if required. */ if (tif->tif_flags & TIFF_SWAB) { TIFFSwabShort(&tif->tif_header.tiff_version); TIFFSwabLong(&tif->tif_header.tiff_diroff); } /* * Now check version (if needed, it's been byte-swapped). * Note that this isn't actually a version number, it's a * magic number that doesn't change (stupid). */ if (tif->tif_header.tiff_version != TIFF_VERSION) { TIFFError(name, "Not a TIFF file, bad version number %d (0x%x)", tif->tif_header.tiff_version, tif->tif_header.tiff_version); goto bad; } tif->tif_flags |= TIFF_MYBUFFER; tif->tif_rawcp = tif->tif_rawdata = 0; tif->tif_rawdatasize = 0; /* * Setup initial directory. */ switch (mode[0]) { case 'r': tif->tif_nextdiroff = tif->tif_header.tiff_diroff; #ifdef MMAP_SUPPORT if (TIFFMapFileContents(fd, &tif->tif_base, &tif->tif_size)) tif->tif_flags |= TIFF_MAPPED; #endif if (TIFFReadDirectory(tif)) { tif->tif_rawcc = -1; tif->tif_flags |= TIFF_BUFFERSETUP; return (tif); } break; case 'a': /* * Don't append to file that has information * byte swapped -- we will write data that is * in the opposite order. */ if (tif->tif_flags & TIFF_SWAB) { TIFFError(name, "Cannot append to file that has opposite byte ordering"); goto bad; } /* * New directories are automatically append * to the end of the directory chain when they * are written out (see TIFFWriteDirectory). */ if (!TIFFDefaultDirectory(tif)) goto bad; return (tif); } bad: tif->tif_mode = O_RDONLY; /* XXX avoid flush */ TIFFClose(tif); return ((TIFF *)0); bad2: (void) close(fd); return ((TIFF *)0); } int TIFFScanlineSize(tif) TIFF *tif; { TIFFDirectory *td = &tif->tif_dir; long scanline; scanline = td->td_bitspersample * td->td_imagewidth; if (td->td_planarconfig == PLANARCONFIG_CONTIG) scanline *= td->td_samplesperpixel; return (howmany(scanline, 8)); } /* * Query functions to access private data. */ /* * Return open file's name. */ char * TIFFFileName(tif) TIFF *tif; { return (tif->tif_name); } /* * Return open file's I/O descriptor. */ int TIFFFileno(tif) TIFF *tif; { return (tif->tif_fd); } /* * Return read/write mode. */ int TIFFGetMode(tif) TIFF *tif; { return (tif->tif_mode); } /* * Return nonzero if file is organized in * tiles; zero if organized as strips. */ int TIFFIsTiled(tif) TIFF *tif; { return (isTiled(tif)); } /* * Return current row being read/written. */ long TIFFCurrentRow(tif) TIFF *tif; { return (tif->tif_row); } /* * Return index of the current directory. */ int TIFFCurrentDirectory(tif) TIFF *tif; { return (tif->tif_curdir); } /* * Return current strip. */ int TIFFCurrentStrip(tif) TIFF *tif; { return (tif->tif_curstrip); } /* * Return current tile. */ int TIFFCurrentTile(tif) TIFF *tif; { return (tif->tif_curtile); } neuron-7.6.3/src/lib/TIFF/tif_packbits.c000077500000000000000000000150031340731477100177410ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_packbits.c,v 1.2 1997/03/26 15:07:17 hines Exp"; #endif /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * PackBits Compression Algorithm Support */ #include "tiffioP.h" #include #include extern int TIFFFlushData1(TIFF *); #if USE_PROTOTYPES static int PackBitsPreEncode(TIFF *); static int PackBitsEncode(TIFF *, u_char *, int, u_int); static int PackBitsEncodeChunk(TIFF *, u_char *, int, u_int); static int PackBitsDecode(TIFF *, u_char *, int, u_int); #else static int PackBitsPreEncode(); static int PackBitsEncode(), PackBitsEncodeChunk(); static int PackBitsDecode(); #endif int TIFFInitPackBits(tif) TIFF *tif; { tif->tif_decoderow = PackBitsDecode; tif->tif_decodestrip = PackBitsDecode; tif->tif_decodetile = PackBitsDecode; tif->tif_preencode = PackBitsPreEncode; tif->tif_encoderow = PackBitsEncode; tif->tif_encodestrip = PackBitsEncodeChunk; tif->tif_encodetile = PackBitsEncodeChunk; return (1); } static int PackBitsPreEncode(tif) TIFF *tif; { /* * Calculate the scanline/tile-width size in bytes. */ if (isTiled(tif)) tif->tif_data = (char *) TIFFTileRowSize(tif); else tif->tif_data = (char *) ((long)TIFFScanlineSize(tif)); return (1); } /* * Encode a rectangular chunk of pixels. We break it up * into row-sized pieces to insure that encoded runs do * not span rows. Otherwise, there can be problems with * the decoder if data is read, for example, by scanlines * when it was encoded by strips. */ static int PackBitsEncodeChunk(tif, bp, cc, s) TIFF *tif; u_char *bp; int cc; u_int s; { int rowsize = (int) ((long)tif->tif_data); assert(rowsize > 0); while (cc > 0) { if (PackBitsEncode(tif, bp, rowsize, s) < 0) return (-1); bp += rowsize; cc -= rowsize; } return (1); } /* * Encode a run of pixels. */ static int PackBitsEncode(tif, bp, cc, s) TIFF *tif; u_char *bp; register int cc; u_int s; { register char *op, *lastliteral; register int n, b; enum { BASE, LITERAL, RUN, LITERAL_RUN } state; char *ep; int slop; op = tif->tif_rawcp; ep = tif->tif_rawdata + tif->tif_rawdatasize; state = BASE; lastliteral = 0; while (cc > 0) { /* * Find the longest string of identical bytes. */ b = *bp++, cc--, n = 1; for (; cc > 0 && b == *bp; cc--, bp++) n++; again: if (op + 2 >= ep) { /* insure space for new data */ /* * Be careful about writing the last * literal. Must write up to that point * and then copy the remainder to the * front of the buffer. */ if (state == LITERAL || state == LITERAL_RUN) { slop = op - lastliteral; tif->tif_rawcc += lastliteral - tif->tif_rawcp; if (!TIFFFlushData1(tif)) return (-1); op = tif->tif_rawcp; for (; slop-- > 0; *op++ = *lastliteral++) ; lastliteral = tif->tif_rawcp; } else { tif->tif_rawcc += op - tif->tif_rawcp; if (!TIFFFlushData1(tif)) return (-1); op = tif->tif_rawcp; } } switch (state) { case BASE: /* initial state, set run/literal */ if (n > 1) { state = RUN; if (n > 128) { *op++ = -127; *op++ = b; n -= 128; goto again; } *op++ = -(n-1); *op++ = b; } else { lastliteral = op; *op++ = 0; *op++ = b; state = LITERAL; } break; case LITERAL: /* last object was literal string */ if (n > 1) { state = LITERAL_RUN; if (n > 128) { *op++ = -127; *op++ = b; n -= 128; goto again; } *op++ = -(n-1); /* encode run */ *op++ = b; } else { /* extend literal */ if (++(*lastliteral) == 127) state = BASE; *op++ = b; } break; case RUN: /* last object was run */ if (n > 1) { if (n > 128) { *op++ = -127; *op++ = b; n -= 128; goto again; } *op++ = -(n-1); *op++ = b; } else { lastliteral = op; *op++ = 0; *op++ = b; state = LITERAL; } break; case LITERAL_RUN: /* literal followed by a run */ /* * Check to see if previous run should * be converted to a literal, in which * case we convert literal-run-literal * to a single literal. */ if (n == 1 && op[-2] == (char)-1 && *lastliteral < 126) { state = (((*lastliteral) += 2) == 127 ? BASE : LITERAL); op[-2] = op[-1]; /* replicate */ } else state = RUN; goto again; } } tif->tif_rawcc += op - tif->tif_rawcp; tif->tif_rawcp = op; return (1); } static int PackBitsDecode(tif, op, occ, s) TIFF *tif; register u_char *op; register int occ; u_int s; { register char *bp; register int n, b; register int cc; bp = tif->tif_rawcp; cc = tif->tif_rawcc; while (cc > 0 && occ > 0) { n = (int) *bp++; /* * Watch out for compilers that * don't sign extend chars... */ if (n >= 128) n -= 256; if (n < 0) { /* replicate next byte -n+1 times */ cc--; if (n == -128) /* nop */ continue; n = -n + 1; occ -= n; for (b = *bp++; n-- > 0;) *op++ = b; } else { /* copy next n+1 bytes literally */ bcopy(bp, op, ++n); op += n; occ -= n; bp += n; cc -= n; } } tif->tif_rawcp = bp; tif->tif_rawcc = cc; if (occ > 0) { TIFFError(tif->tif_name, "PackBitsDecode: Not enough data for scanline %d", tif->tif_row); return (0); } /* check for buffer overruns? */ return (1); } neuron-7.6.3/src/lib/TIFF/tif_print.c000077500000000000000000000415071340731477100173050ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_print.c,v 1.3 1997/03/31 16:45:22 hines Exp"; #endif /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * Directory Printing Support */ #include #include #include "tiffioP.h" #ifdef JPEG_SUPPORT static void JPEGPrintQTable(fd, tab) FILE *fd; u_char tab[64]; { int i, j; char *sep; fputc('\n', fd); for (i = 0; i < 8; i++) { sep = " "; for (j = 0; j < 8; j++) { fprintf(fd, "%s%2u", sep, tab[8*i+j]); sep = ", "; } fputc('\n', fd); } } static void JPEGPrintCTable(fd, tab) FILE *fd; u_char *tab; { int i, n, count; char *sep; fprintf(fd, "\n Bits:"); count = 0; for (i = 0; i < 16; i++) { fprintf(fd, " %u", tab[i]); count += tab[i]; } n = 0; for (; count > 0; count--) { if ((n % 8) == 0) { fputc('\n', fd); sep = " "; } fprintf(fd, "%s0x%02x", sep, tab[i++]); sep = ", "; n++; } if (n % 8) fputc('\n', fd); } #endif static const char *photoNames[] = { "min-is-white", /* PHOTOMETRIC_MINISWHITE */ "min-is-black", /* PHOTOMETRIC_MINISBLACK */ "RGB color", /* PHOTOMETRIC_RGB */ "palette color (RGB from colormap)", /* PHOTOMETRIC_PALETTE */ "transparency mask", /* PHOTOMETRIC_MASK */ "separated", /* PHOTOMETRIC_SEPARATED */ "YCbCr", /* PHOTOMETRIC_YCBCR */ "7 (0x7)", "CIE L*a*b*", /* PHOTOMETRIC_CIELAB */ }; #define NPHOTONAMES (sizeof (photoNames) / sizeof (photoNames[0])) static const char *orientNames[] = { "0 (0x0)", "row 0 top, col 0 lhs", /* ORIENTATION_TOPLEFT */ "row 0 top, col 0 rhs", /* ORIENTATION_TOPRIGHT */ "row 0 bottom, col 0 rhs", /* ORIENTATION_BOTRIGHT */ "row 0 bottom, col 0 lhs", /* ORIENTATION_BOTLEFT */ "row 0 lhs, col 0 top", /* ORIENTATION_LEFTTOP */ "row 0 rhs, col 0 top", /* ORIENTATION_RIGHTTOP */ "row 0 rhs, col 0 bottom", /* ORIENTATION_RIGHTBOT */ "row 0 lhs, col 0 bottom", /* ORIENTATION_LEFTBOT */ }; #define NORIENTNAMES (sizeof (orientNames) / sizeof (orientNames[0])) /* * Print the contents of the current directory * to the specified stdio file stream. */ void TIFFPrintDirectory(tif, fd, flags) TIFF *tif; FILE *fd; long flags; { register TIFFDirectory *td; char *sep; int i, j; long n; fprintf(fd, "TIFF Directory at offset 0x%lx\n", tif->tif_diroff); td = &tif->tif_dir; if (TIFFFieldSet(tif,FIELD_SUBFILETYPE)) { fprintf(fd, " Subfile Type:"); sep = " "; if (td->td_subfiletype & FILETYPE_REDUCEDIMAGE) { fprintf(fd, "%sreduced-resolution image", sep); sep = "/"; } if (td->td_subfiletype & FILETYPE_PAGE) { fprintf(fd, "%smulti-page document", sep); sep = "/"; } if (td->td_subfiletype & FILETYPE_MASK) fprintf(fd, "%stransparency mask", sep); fprintf(fd, " (%u = 0x%x)\n", td->td_subfiletype, td->td_subfiletype); } if (TIFFFieldSet(tif,FIELD_IMAGEDIMENSIONS)) { fprintf(fd, " Image Width: %lu Image Length: %lu", td->td_imagewidth, td->td_imagelength); if (TIFFFieldSet(tif,FIELD_IMAGEDEPTH)) fprintf(fd, " Image Depth: %lu", td->td_imagedepth); fprintf(fd, "\n"); } if (TIFFFieldSet(tif,FIELD_TILEDIMENSIONS)) { fprintf(fd, " Tile Width: %lu Tile Length: %lu", td->td_tilewidth, td->td_tilelength); if (TIFFFieldSet(tif,FIELD_TILEDEPTH)) fprintf(fd, " Tile Depth: %lu", td->td_tiledepth); fprintf(fd, "\n"); } if (TIFFFieldSet(tif,FIELD_RESOLUTION)) { fprintf(fd, " Resolution: %g, %g", td->td_xresolution, td->td_yresolution); if (TIFFFieldSet(tif,FIELD_RESOLUTIONUNIT)) { switch (td->td_resolutionunit) { case RESUNIT_NONE: fprintf(fd, " (unitless)"); break; case RESUNIT_INCH: fprintf(fd, " pixels/inch"); break; case RESUNIT_CENTIMETER: fprintf(fd, " pixels/cm"); break; default: fprintf(fd, " (unit %u = 0x%x)", td->td_resolutionunit, td->td_resolutionunit); break; } } fprintf(fd, "\n"); } if (TIFFFieldSet(tif,FIELD_POSITION)) fprintf(fd, " Position: %g, %g\n", td->td_xposition, td->td_yposition); if (TIFFFieldSet(tif,FIELD_BITSPERSAMPLE)) fprintf(fd, " Bits/Sample: %u\n", td->td_bitspersample); if (TIFFFieldSet(tif,FIELD_SAMPLEFORMAT)) { fprintf(fd, " Sample Format: "); switch (td->td_sampleformat) { case SAMPLEFORMAT_VOID: fprintf(fd, "void\n"); break; case SAMPLEFORMAT_INT: fprintf(fd, "signed integer\n"); break; case SAMPLEFORMAT_UINT: fprintf(fd, "unsigned integer\n"); break; case SAMPLEFORMAT_IEEEFP: fprintf(fd, "IEEE floating point\n"); break; default: fprintf(fd, "%u (0x%x)\n", td->td_sampleformat, td->td_sampleformat); break; } } if (TIFFFieldSet(tif,FIELD_COMPRESSION)) { fprintf(fd, " Compression Scheme: "); switch (td->td_compression) { case COMPRESSION_NONE: fprintf(fd, "none\n"); break; case COMPRESSION_CCITTRLE: fprintf(fd, "CCITT modified Huffman encoding\n"); break; case COMPRESSION_CCITTFAX3: fprintf(fd, "CCITT Group 3 facsimile encoding\n"); break; case COMPRESSION_CCITTFAX4: fprintf(fd, "CCITT Group 4 facsimile encoding\n"); break; case COMPRESSION_CCITTRLEW: fprintf(fd, "CCITT modified Huffman encoding %s\n", "w/ word alignment"); break; case COMPRESSION_PACKBITS: fprintf(fd, "Macintosh PackBits encoding\n"); break; case COMPRESSION_THUNDERSCAN: fprintf(fd, "ThunderScan 4-bit encoding\n"); break; case COMPRESSION_LZW: fprintf(fd, "Lempel-Ziv & Welch encoding\n"); break; case COMPRESSION_NEXT: fprintf(fd, "NeXT 2-bit encoding\n"); break; case COMPRESSION_JPEG: fprintf(fd, "JPEG encoding\n"); break; default: fprintf(fd, "%u (0x%x)\n", td->td_compression, td->td_compression); break; } } if (TIFFFieldSet(tif,FIELD_PHOTOMETRIC)) { fprintf(fd, " Photometric Interpretation: "); if (td->td_photometric < NPHOTONAMES) fprintf(fd, "%s\n", photoNames[td->td_photometric]); else fprintf(fd, "%u (0x%x)\n", td->td_photometric, td->td_photometric); } if (TIFFFieldSet(tif,FIELD_MATTEING)) fprintf(fd, " Matteing: %s\n", td->td_matteing ? "pre-multiplied with alpha channel" : "none"); #ifdef CMYK_SUPPORT if (TIFFFieldSet(tif,FIELD_INKSET)) { fprintf(fd, " Ink Set: "); switch (td->td_inkset) { case INKSET_CMYK: fprintf(fd, "CMYK\n"); break; default: fprintf(fd, "%u (0x%x)\n", td->td_inkset, td->td_inkset); break; } } if (TIFFFieldSet(tif,FIELD_INKNAMES)) { char *cp; fprintf(fd, " Ink Names: "); i = td->td_samplesperpixel; sep = ""; for (cp = td->td_inknames; i > 0; cp = strchr(cp, '\0')) { fprintf(fd, "%s%s", sep, cp); sep = ", "; } } if (TIFFFieldSet(tif,FIELD_DOTRANGE)) fprintf(fd, " Dot Range: %u-%u\n", td->td_dotrange[0], td->td_dotrange[1]); if (TIFFFieldSet(tif,FIELD_TARGETPRINTER)) fprintf(fd, " Target Printer: %s\n", td->td_targetprinter); #endif if (TIFFFieldSet(tif,FIELD_THRESHHOLDING)) { fprintf(fd, " Thresholding: "); switch (td->td_threshholding) { case THRESHHOLD_BILEVEL: fprintf(fd, "bilevel art scan\n"); break; case THRESHHOLD_HALFTONE: fprintf(fd, "halftone or dithered scan\n"); break; case THRESHHOLD_ERRORDIFFUSE: fprintf(fd, "error diffused\n"); break; default: fprintf(fd, "%u (0x%x)\n", td->td_threshholding, td->td_threshholding); break; } } if (TIFFFieldSet(tif,FIELD_FILLORDER)) { fprintf(fd, " FillOrder: "); switch (td->td_fillorder) { case FILLORDER_MSB2LSB: fprintf(fd, "msb-to-lsb\n"); break; case FILLORDER_LSB2MSB: fprintf(fd, "lsb-to-msb\n"); break; default: fprintf(fd, "%u (0x%x)\n", td->td_fillorder, td->td_fillorder); break; } } if (TIFFFieldSet(tif,FIELD_PREDICTOR)) { fprintf(fd, " Predictor: "); switch (td->td_predictor) { case 1: fprintf(fd, "none\n"); break; case 2: fprintf(fd, "horizontal differencing\n"); break; default: fprintf(fd, "%u (0x%x)\n", td->td_predictor, td->td_predictor); break; } } #ifdef YCBCR_SUPPORT if (TIFFFieldSet(tif,FIELD_YCBCRSUBSAMPLING)) fprintf(fd, " YCbCr Subsampling: %u, %u\n", td->td_ycbcrsubsampling[0], td->td_ycbcrsubsampling[1]); if (TIFFFieldSet(tif,FIELD_YCBCRPOSITIONING)) { fprintf(fd, " YCbCr Positioning: "); switch (td->td_ycbcrpositioning) { case YCBCRPOSITION_CENTERED: fprintf(fd, "centered\n"); break; case YCBCRPOSITION_COSITED: fprintf(fd, "cosited\n"); break; default: fprintf(fd, "%u (0x%x)\n", td->td_ycbcrpositioning, td->td_ycbcrpositioning); break; } } if (TIFFFieldSet(tif,FIELD_YCBCRCOEFFICIENTS)) fprintf(fd, " YCbCr Coefficients: %g, %g, %g\n", td->td_ycbcrcoeffs[0], td->td_ycbcrcoeffs[1], td->td_ycbcrcoeffs[2]); #endif #ifdef JPEG_SUPPORT if (TIFFFieldSet(tif,FIELD_JPEGPROC)) { fprintf(fd, " JPEG Processing Mode: "); switch (td->td_jpegproc) { case JPEGPROC_BASELINE: fprintf(fd, "baseline sequential algorithm\n"); break; case JPEGPROC_LOSSLESS: fprintf(fd, "lossless algorithm with Huffman coding\n"); break; default: fprintf(fd, "%u (0x%x)\n", td->td_jpegproc, td->td_jpegproc); break; } } if (TIFFFieldSet(tif,FIELD_JPEGRESTARTINTERVAL)) { fprintf(fd, " JPEG Restart Interval: "); if (td->td_jpegrestartinterval) fprintf(fd, "%u\n", td->td_jpegrestartinterval); else fprintf(fd, "(no restart markers)\n"); } if (TIFFFieldSet(tif,FIELD_JPEGQTABLES)) { fprintf(fd, " JPEG Quantization Tables: "); if (flags & TIFFPRINT_JPEGQTABLES) { for (i = 0; i < td->td_samplesperpixel; i++) JPEGPrintQTable(fd, td->td_qtab[i]); } else fprintf(fd, "(present)\n"); } if (TIFFFieldSet(tif,FIELD_JPEGDCTABLES)) { fprintf(fd, " JPEG DC Tables: "); if (flags & TIFFPRINT_JPEGDCTABLES) { for (i = 0; i < td->td_samplesperpixel; i++) JPEGPrintCTable(fd, td->td_dctab[i]); } else fprintf(fd, "(present)\n"); } if (TIFFFieldSet(tif,FIELD_JPEGACTABLES)) { fprintf(fd, " JPEG AC Tables: "); if (flags & TIFFPRINT_JPEGACTABLES) { for (i = 0; i < td->td_samplesperpixel; i++) JPEGPrintCTable(fd, td->td_actab[i]); } else fprintf(fd, "(present)\n"); } #endif if (TIFFFieldSet(tif,FIELD_HALFTONEHINTS)) fprintf(fd, " Halftone Hints: light %u dark %u\n", td->td_halftonehints[0], td->td_halftonehints[1]); if (TIFFFieldSet(tif,FIELD_ARTIST)) fprintf(fd, " Artist: \"%s\"\n", td->td_artist); if (TIFFFieldSet(tif,FIELD_DATETIME)) fprintf(fd, " Date & Time: \"%s\"\n", td->td_datetime); if (TIFFFieldSet(tif,FIELD_HOSTCOMPUTER)) fprintf(fd, " Host Computer: \"%s\"\n", td->td_hostcomputer); if (TIFFFieldSet(tif,FIELD_SOFTWARE)) fprintf(fd, " Software: \"%s\"\n", td->td_software); if (TIFFFieldSet(tif,FIELD_DOCUMENTNAME)) fprintf(fd, " Document Name: \"%s\"\n", td->td_documentname); if (TIFFFieldSet(tif,FIELD_IMAGEDESCRIPTION)) fprintf(fd, " Image Description: \"%s\"\n", td->td_imagedescription); if (TIFFFieldSet(tif,FIELD_MAKE)) fprintf(fd, " Make: \"%s\"\n", td->td_make); if (TIFFFieldSet(tif,FIELD_MODEL)) fprintf(fd, " Model: \"%s\"\n", td->td_model); if (TIFFFieldSet(tif,FIELD_ORIENTATION)) { fprintf(fd, " Orientation: "); if (td->td_orientation < NORIENTNAMES) fprintf(fd, "%s\n", orientNames[td->td_orientation]); else fprintf(fd, "%u (0x%x)\n", td->td_orientation, td->td_orientation); } if (TIFFFieldSet(tif,FIELD_SAMPLESPERPIXEL)) fprintf(fd, " Samples/Pixel: %u\n", td->td_samplesperpixel); if (TIFFFieldSet(tif,FIELD_ROWSPERSTRIP)) { fprintf(fd, " Rows/Strip: "); if (td->td_rowsperstrip == 0xffffffffL) fprintf(fd, "(infinite)\n"); else fprintf(fd, "%lu\n", td->td_rowsperstrip); } if (TIFFFieldSet(tif,FIELD_MINSAMPLEVALUE)) fprintf(fd, " Min Sample Value: %lu\n", td->td_minsamplevalue); if (TIFFFieldSet(tif,FIELD_MAXSAMPLEVALUE)) fprintf(fd, " Max Sample Value: %lu\n", td->td_maxsamplevalue); if (TIFFFieldSet(tif,FIELD_PLANARCONFIG)) { fprintf(fd, " Planar Configuration: "); switch (td->td_planarconfig) { case PLANARCONFIG_CONTIG: fprintf(fd, "single image plane\n"); break; case PLANARCONFIG_SEPARATE: fprintf(fd, "separate image planes\n"); break; default: fprintf(fd, "%u (0x%x)\n", td->td_planarconfig, td->td_planarconfig); break; } } if (TIFFFieldSet(tif,FIELD_PAGENAME)) fprintf(fd, " Page Name: \"%s\"\n", td->td_pagename); if (TIFFFieldSet(tif,FIELD_GROUP3OPTIONS)) { fprintf(fd, " Group 3 Options:"); sep = " "; if (td->td_group3options & GROUP3OPT_2DENCODING) fprintf(fd, "%s2-d encoding", sep), sep = "+"; if (td->td_group3options & GROUP3OPT_FILLBITS) fprintf(fd, "%sEOL padding", sep), sep = "+"; if (td->td_group3options & GROUP3OPT_UNCOMPRESSED) fprintf(fd, "%suncompressed data", sep); fprintf(fd, " (%lu = 0x%lx)\n", td->td_group3options, td->td_group3options); } if (TIFFFieldSet(tif,FIELD_CLEANFAXDATA)) { fprintf(fd, " Fax Data: "); switch (td->td_cleanfaxdata) { case CLEANFAXDATA_CLEAN: fprintf(fd, "clean\n"); break; case CLEANFAXDATA_REGENERATED: fprintf(fd, "receiver regenerated\n"); break; case CLEANFAXDATA_UNCLEAN: fprintf(fd, "uncorrected errors\n"); break; default: fprintf(fd, "(%u = 0x%x)\n", td->td_cleanfaxdata, td->td_cleanfaxdata); break; } } if (TIFFFieldSet(tif,FIELD_BADFAXLINES)) fprintf(fd, " Bad Fax Lines: %lu\n", td->td_badfaxlines); if (TIFFFieldSet(tif,FIELD_BADFAXRUN)) fprintf(fd, " Consecutive Bad Fax Lines: %u\n", td->td_badfaxrun); if (TIFFFieldSet(tif,FIELD_GROUP4OPTIONS)) { fprintf(fd, " Group 4 Options:"); if (td->td_group4options & GROUP4OPT_UNCOMPRESSED) fprintf(fd, "uncompressed data"); fprintf(fd, " (%lu = 0x%lx)\n", td->td_group4options, td->td_group4options); } if (TIFFFieldSet(tif,FIELD_PAGENUMBER)) fprintf(fd, " Page Number: %u-%u\n", td->td_pagenumber[0], td->td_pagenumber[1]); if (TIFFFieldSet(tif,FIELD_COLORMAP)) { fprintf(fd, " Color Map: "); if (flags & TIFFPRINT_COLORMAP) { fprintf(fd, "\n"); n = 1L<td_bitspersample; for (i = 0; i < n; i++) fprintf(fd, " %5d: %5u %5u %5u\n", i, td->td_colormap[0][i], td->td_colormap[1][i], td->td_colormap[2][i]); } else fprintf(fd, "(present)\n"); } #ifdef COLORIMETRY_SUPPORT if (TIFFFieldSet(tif,FIELD_WHITEPOINT)) fprintf(fd, " White Point: %g-%g\n", td->td_whitepoint[0], td->td_whitepoint[1]); if (TIFFFieldSet(tif,FIELD_PRIMARYCHROMAS)) fprintf(fd, " Primary Chromaticities: %g,%g %g,%g %g,%g\n", td->td_primarychromas[0], td->td_primarychromas[1], td->td_primarychromas[2], td->td_primarychromas[3], td->td_primarychromas[4], td->td_primarychromas[5]); if (TIFFFieldSet(tif,FIELD_REFBLACKWHITE)) { fprintf(fd, " Reference Black/White:\n"); for (i = 0; i < td->td_samplesperpixel; i++) fprintf(fd, " %2d: %5g %5g\n", i, td->td_refblackwhite[2*i+0], td->td_refblackwhite[2*i+1]); } if (TIFFFieldSet(tif,FIELD_TRANSFERFUNCTION)) { fprintf(fd, " Transfer Function: "); if (flags & TIFFPRINT_CURVES) { fprintf(fd, "\n"); n = 1L<td_bitspersample; for (i = 0; i < n; i++) { fprintf(fd, " %2d: %5u", i, td->td_transferfunction[0][i]); for (j = 1; j < td->td_samplesperpixel; j++) fprintf(fd, " %5u", td->td_transferfunction[j][i]); putc('\n', fd); } } else fprintf(fd, "(present)\n"); } #endif if ((flags & TIFFPRINT_STRIPS) && TIFFFieldSet(tif,FIELD_STRIPOFFSETS)) { fprintf(fd, " %lu %s:\n", td->td_nstrips, isTiled(tif) ? "Tiles" : "Strips"); for (i = 0; i < td->td_nstrips; i++) fprintf(fd, " %3d: [%8lu, %8lu]\n", i, td->td_stripoffset[i], td->td_stripbytecount[i]); } } neuron-7.6.3/src/lib/TIFF/tif_read.c000077500000000000000000000374611340731477100170700ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_read.c,v 1.2 1997/03/26 15:07:19 hines Exp"; #endif /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * Scanline-oriented Read Support */ #include #include #include "tiffioP.h" #if USE_PROTOTYPES static int TIFFSeek(TIFF *, u_int, u_int); static int TIFFReadRawStrip1(TIFF *, u_int, u_char *, u_int, char []); static int TIFFReadRawTile1(TIFF *, u_int, u_char *, u_int, char []); static int TIFFFillStrip(TIFF *, u_int); static int TIFFFillTile(TIFF *, u_int); static int TIFFStartStrip(TIFF *, u_int); static int TIFFStartTile(TIFF *, u_int); static int TIFFCheckRead(TIFF *, int); #else static int TIFFSeek(); static int TIFFReadRawStrip1(); static int TIFFReadRawTile1(); static int TIFFFillStrip(); static int TIFFFillTile(); static int TIFFStartStrip(); static int TIFFStartTile(); static int TIFFCheckRead(); #endif /*VARARGS3*/ int TIFFReadScanline(tif, buf, row, sample) register TIFF *tif; u_char *buf; u_int row, sample; { int e; if (!TIFFCheckRead(tif, 0)) return (-1); if ((e = TIFFSeek(tif, row, sample))) { /* * Decompress desired row into user buffer. */ e = (*tif->tif_decoderow)(tif, buf, tif->tif_scanlinesize, sample); tif->tif_row++; } return (e ? 1 : -1); } /* * Seek to a random row+sample in a file. */ static /*VARARGS2*/ int TIFFSeek(tif, row, sample) register TIFF *tif; u_int row, sample; { register TIFFDirectory *td = &tif->tif_dir; int strip; if (row >= td->td_imagelength) { /* out of range */ TIFFError(tif->tif_name, "%d: Row out of range, max %d", row, td->td_imagelength); return (0); } if (td->td_planarconfig == PLANARCONFIG_SEPARATE) { if (sample >= td->td_samplesperpixel) { TIFFError(tif->tif_name, "%d: Sample out of range, max %d", sample, td->td_samplesperpixel); return (0); } strip = sample*td->td_stripsperimage + row/td->td_rowsperstrip; } else strip = row / td->td_rowsperstrip; if (strip != tif->tif_curstrip) { /* different strip, refill */ if (!TIFFFillStrip(tif, strip)) return (0); } else if (row < tif->tif_row) { /* * Moving backwards within the same strip: backup * to the start and then decode forward (below). * * NB: If you're planning on lots of random access within a * strip, it's better to just read and decode the entire * strip, and then access the decoded data in a random fashion. */ if (!TIFFStartStrip(tif, strip)) return (0); } if (row != tif->tif_row) { if (tif->tif_seek) { /* * Seek forward to the desired row. */ if (!(*tif->tif_seek)(tif, row - tif->tif_row)) return (0); tif->tif_row = row; } else { TIFFError(tif->tif_name, "Compression algorithm does not support random access"); return (0); } } return (1); } /* * Read a strip of data and decompress the specified * amount into the user-supplied buffer. */ int TIFFReadEncodedStrip(tif, strip, buf, size) TIFF *tif; u_int strip; u_char *buf; u_int size; { TIFFDirectory *td = &tif->tif_dir; u_int stripsize = TIFFStripSize(tif); if (!TIFFCheckRead(tif, 0)) return (-1); if (strip >= td->td_nstrips) { TIFFError(tif->tif_name, "%d: Strip out of range, max %d", strip, td->td_nstrips); return (-1); } /* * Calculate the strip size according to the number of * rows in the strip (check for truncated last strip). */ if (size == (u_int)-1) size = stripsize; else if (size > stripsize) size = stripsize; return (TIFFFillStrip(tif, strip) && (*tif->tif_decodestrip)(tif, buf, size, strip / td->td_stripsperimage) ? size : -1); } /* * Read a strip of data from the file. */ int TIFFReadRawStrip(tif, strip, buf, size) TIFF *tif; u_int strip; u_char *buf; u_int size; { static char module[] = "TIFFReadRawStrip"; TIFFDirectory *td = &tif->tif_dir; u_long bytecount; if (!TIFFCheckRead(tif, 0)) return (-1); if (strip >= td->td_nstrips) { TIFFError(tif->tif_name, "%d: Strip out of range, max %d", strip, td->td_nstrips); return (-1); } bytecount = td->td_stripbytecount[strip]; if (size != (u_int)-1 && size < bytecount) bytecount = size; return (TIFFReadRawStrip1(tif, strip, buf, bytecount, module)); } static int TIFFReadRawStrip1(tif, strip, buf, size, module) TIFF *tif; u_int strip; u_char *buf; u_int size; char module[]; { TIFFDirectory *td = &tif->tif_dir; if (!isMapped(tif)) { if (!SeekOK(tif->tif_fd, td->td_stripoffset[strip])) { TIFFError(module, "%s: Seek error at scanline %d, strip %d", tif->tif_name, tif->tif_row, strip); return (-1); } if (!ReadOK(tif->tif_fd, buf, size)) { TIFFError(module, "%s: Read error at scanline %d", tif->tif_name, tif->tif_row); return (-1); } #ifdef MMAP_SUPPORT } else { if (td->td_stripoffset[strip] + size > tif->tif_size) { TIFFError(module, "%s: Seek error at scanline %d, strip %d", tif->tif_name, tif->tif_row, strip); return (-1); } bcopy(tif->tif_base + td->td_stripoffset[strip], buf, size); #endif } return (size); } /* * Read the specified strip and setup for decoding. * The data buffer is expanded, as necessary, to * hold the strip's data. */ static int TIFFFillStrip(tif, strip) TIFF *tif; u_int strip; { static char module[] = "TIFFFillStrip"; TIFFDirectory *td = &tif->tif_dir; u_long bytecount; bytecount = td->td_stripbytecount[strip]; #ifdef MMAP_SUPPORT if (isMapped(tif) && (td->td_fillorder == tif->tif_fillorder || (tif->tif_flags & TIFF_NOBITREV))) { /* * The image is mapped into memory and we either don't * need to flip bits or the compression routine is going * to handle this operation itself. In this case, avoid * copying the raw data and instead just reference the * data from the memory mapped file image. This assumes * that the decompression routines do not modify the * contents of the raw data buffer (if they try to, * the application will get a fault since the file is * mapped read-only). */ if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata) free(tif->tif_rawdata); tif->tif_flags &= ~TIFF_MYBUFFER; if (td->td_stripoffset[strip] + bytecount > tif->tif_size) { /* * This error message might seem strange, but it's * what would happen if a read were done instead. */ TIFFError(module, "%s: Read error on strip %d", tif->tif_name, strip); tif->tif_curstrip = -1; /* unknown state */ return (0); } tif->tif_rawdatasize = bytecount; tif->tif_rawdata = tif->tif_base + td->td_stripoffset[strip]; } else { #endif /* * Expand raw data buffer, if needed, to * hold data strip coming from file * (perhaps should set upper bound on * the size of a buffer we'll use?). */ if (bytecount > tif->tif_rawdatasize) { tif->tif_curstrip = -1; /* unknown state */ if ((tif->tif_flags & TIFF_MYBUFFER) == 0) { TIFFError(module, "%s: Data buffer too small to hold strip %d", tif->tif_name, strip); return (0); } if (!TIFFReadBufferSetup(tif, 0, roundup(bytecount, 1024))) return (0); } if (TIFFReadRawStrip1(tif, strip, (u_char *)tif->tif_rawdata, bytecount, module) != bytecount) return (0); if (td->td_fillorder != tif->tif_fillorder && (tif->tif_flags & TIFF_NOBITREV) == 0) TIFFReverseBits((u_char *)tif->tif_rawdata, bytecount); #ifdef MMAP_SUPPORT } #endif return (TIFFStartStrip(tif, strip)); } /* * Tile-oriented Read Support * Contributed by Nancy Cam (Silicon Graphics). */ /* * Read and decompress a tile of data. The * tile is selected by the (x,y,z,s) coordinates. */ int TIFFReadTile(tif, buf, x, y, z, s) TIFF *tif; u_char *buf; u_long x, y, z; u_int s; { u_int tile; if (!TIFFCheckRead(tif, 1) || !TIFFCheckTile(tif, x, y, z, s)) return (-1); tile = TIFFComputeTile(tif, x, y, z, s); if (tile >= tif->tif_dir.td_nstrips) { TIFFError(tif->tif_name, "%d: Tile out of range, max %d", tile, tif->tif_dir.td_nstrips); return (-1); } return (TIFFFillTile(tif, tile) && (*tif->tif_decodetile)(tif, buf, tif->tif_tilesize, s) ? tif->tif_tilesize : -1); } /* * Read a tile of data and decompress the specified * amount into the user-supplied buffer. */ int TIFFReadEncodedTile(tif, tile, buf, size) TIFF *tif; u_int tile; u_char *buf; u_int size; { TIFFDirectory *td = &tif->tif_dir; int tilesize = tif->tif_tilesize; if (!TIFFCheckRead(tif, 1)) return (-1); if (tile >= td->td_nstrips) { TIFFError(tif->tif_name, "%d: Tile out of range, max %d", tile, td->td_nstrips); return (-1); } if (size == (u_int)-1) size = tilesize; else if (size > tilesize ) size = tilesize; return (TIFFFillTile(tif, tile) && (*tif->tif_decodetile)(tif, buf, size, tile/td->td_stripsperimage) ? size : -1); } /* * Read a tile of data from the file. */ int TIFFReadRawTile(tif, tile, buf, size) TIFF *tif; u_int tile; u_char *buf; u_int size; { static char module[] = "TIFFReadRawTile"; TIFFDirectory *td = &tif->tif_dir; u_long bytecount; if (!TIFFCheckRead(tif, 1)) return (-1); if (tile >= td->td_nstrips) { TIFFError(tif->tif_name, "%d: Tile out of range, max %d", tile, td->td_nstrips); return (-1); } bytecount = td->td_stripbytecount[tile]; if (size != (u_int)-1 && size < bytecount) bytecount = size; return (TIFFReadRawTile1(tif, tile, buf, bytecount, module)); } static int TIFFReadRawTile1(tif, tile, buf, size, module) TIFF *tif; u_int tile; u_char *buf; u_int size; char module[]; { TIFFDirectory *td = &tif->tif_dir; if (!isMapped(tif)) { if (!SeekOK(tif->tif_fd, td->td_stripoffset[tile])) { TIFFError(module, "%s: Seek error at row %d, col %d, tile %d", tif->tif_name, tif->tif_row, tif->tif_col, tile); return (-1); } if (!ReadOK(tif->tif_fd, buf, size)) { TIFFError(module, "%s: Read error at row %d, col %d", tif->tif_name, tif->tif_row, tif->tif_col); return (-1); } #ifdef MMAP_SUPPORT } else { if (td->td_stripoffset[tile] + size > tif->tif_size) { TIFFError(module, "%s: Seek error at row %d, col %d, tile %d", tif->tif_name, tif->tif_row, tif->tif_col, tile); return (-1); } bcopy(tif->tif_base + td->td_stripoffset[tile], buf, size); #endif } return (size); } /* * Read the specified tile and setup for decoding. * The data buffer is expanded, as necessary, to * hold the tile's data. */ static int TIFFFillTile(tif, tile) TIFF *tif; u_int tile; { static char module[] = "TIFFFillTile"; TIFFDirectory *td = &tif->tif_dir; u_long bytecount; bytecount = td->td_stripbytecount[tile]; #ifdef MMAP_SUPPORT if (isMapped(tif) && (td->td_fillorder == tif->tif_fillorder || (tif->tif_flags & TIFF_NOBITREV))) { /* * The image is mapped into memory and we either don't * need to flip bits or the compression routine is going * to handle this operation itself. In this case, avoid * copying the raw data and instead just reference the * data from the memory mapped file image. This assumes * that the decompression routines do not modify the * contents of the raw data buffer (if they try to, * the application will get a fault since the file is * mapped read-only). */ if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata) free(tif->tif_rawdata); tif->tif_flags &= ~TIFF_MYBUFFER; if (td->td_stripoffset[tile] + bytecount > tif->tif_size) { tif->tif_curtile = -1; /* unknown state */ return (0); } tif->tif_rawdatasize = bytecount; tif->tif_rawdata = tif->tif_base + td->td_stripoffset[tile]; } else { #endif /* * Expand raw data buffer, if needed, to * hold data tile coming from file * (perhaps should set upper bound on * the size of a buffer we'll use?). */ if (bytecount > tif->tif_rawdatasize) { tif->tif_curtile = -1; /* unknown state */ if ((tif->tif_flags & TIFF_MYBUFFER) == 0) { TIFFError(module, "%s: Data buffer too small to hold tile %d", tif->tif_name, tile); return (0); } if (!TIFFReadBufferSetup(tif, 0, roundup(bytecount, 1024))) return (0); } if (TIFFReadRawTile1(tif, tile, (u_char *)tif->tif_rawdata, bytecount, module) != bytecount) return (0); if (td->td_fillorder != tif->tif_fillorder && (tif->tif_flags & TIFF_NOBITREV) == 0) TIFFReverseBits((u_char *)tif->tif_rawdata, bytecount); #ifdef MMAP_SUPPORT } #endif return (TIFFStartTile(tif, tile)); } /* * Setup the raw data buffer in preparation for * reading a strip of raw data. If the buffer * is specified as zero, then a buffer of appropriate * size is allocated by the library. Otherwise, * the client must guarantee that the buffer is * large enough to hold any individual strip of * raw data. */ int TIFFReadBufferSetup(tif, bp, size) TIFF *tif; char *bp; u_int size; { static char module[] = "TIFFReadBufferSetup"; if (tif->tif_rawdata) { if (tif->tif_flags & TIFF_MYBUFFER) free(tif->tif_rawdata); tif->tif_rawdata = NULL; } if (bp) { tif->tif_rawdatasize = size; tif->tif_rawdata = bp; tif->tif_flags &= ~TIFF_MYBUFFER; } else { tif->tif_rawdatasize = roundup(size, 1024); tif->tif_rawdata = malloc(tif->tif_rawdatasize); tif->tif_flags |= TIFF_MYBUFFER; } if (tif->tif_rawdata == NULL) { TIFFError(module, "%s: No space for data buffer at scanline %d", tif->tif_name, tif->tif_row); tif->tif_rawdatasize = 0; return (0); } return (1); } /* * Set state to appear as if a * strip has just been read in. */ static int TIFFStartStrip(tif, strip) register TIFF *tif; u_int strip; { TIFFDirectory *td = &tif->tif_dir; tif->tif_curstrip = strip; tif->tif_row = (strip % td->td_stripsperimage) * td->td_rowsperstrip; tif->tif_rawcp = tif->tif_rawdata; tif->tif_rawcc = td->td_stripbytecount[strip]; return (tif->tif_predecode == NULL || (*tif->tif_predecode)(tif)); } /* * Set state to appear as if a * tile has just been read in. */ static int TIFFStartTile(tif, tile) register TIFF *tif; u_int tile; { TIFFDirectory *td = &tif->tif_dir; tif->tif_curtile = tile; tif->tif_row = (tile % howmany(td->td_imagewidth, td->td_tilewidth)) * td->td_tilelength; tif->tif_col = (tile % howmany(td->td_imagelength, td->td_tilelength)) * td->td_tilewidth; tif->tif_rawcp = tif->tif_rawdata; tif->tif_rawcc = td->td_stripbytecount[tile]; return (tif->tif_predecode == NULL || (*tif->tif_predecode)(tif)); } static int TIFFCheckRead(tif, tiles) TIFF *tif; int tiles; { if (tif->tif_mode == O_WRONLY) { TIFFError(tif->tif_name, "File not open for reading"); return (0); } if (tiles ^ isTiled(tif)) { TIFFError(tif->tif_name, tiles ? "Can not read tiles from a stripped image" : "Can not read scanlines from a tiled image"); return (0); } return (1); } neuron-7.6.3/src/lib/TIFF/tif_strip.c000077500000000000000000000067461340731477100173200ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_strip.c,v 1.2 1997/03/26 15:07:20 hines Exp"; #endif /* * Copyright (c) 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * Strip-organized Image Support Routines. */ #include "tiffioP.h" /* * Compute which strip a (row,sample) value is in. */ u_int TIFFComputeStrip(tif, row, sample) TIFF *tif; u_long row; u_int sample; { TIFFDirectory *td = &tif->tif_dir; u_int strip; strip = row / td->td_rowsperstrip; if (td->td_planarconfig == PLANARCONFIG_SEPARATE) { if (sample >= td->td_samplesperpixel) { TIFFError(tif->tif_name, "%d: Sample out of range, max %d", sample, td->td_samplesperpixel); return (0); } strip += sample*td->td_stripsperimage; } return (strip); } /* * Compute how many strips are in an image. */ u_int TIFFNumberOfStrips(tif) TIFF *tif; { TIFFDirectory *td = &tif->tif_dir; return (td->td_rowsperstrip == 0xffffffff ? (td->td_imagelength != 0 ? 1 : 0) : howmany(td->td_imagelength, td->td_rowsperstrip)); } /* * Compute the # bytes in a variable height, row-aligned strip. */ u_long TIFFVStripSize(tif, nrows) TIFF *tif; u_long nrows; { TIFFDirectory *td = &tif->tif_dir; if (nrows == (u_long)-1) nrows = td->td_imagelength; #ifdef YCBCR_SUPPORT if (td->td_planarconfig == PLANARCONFIG_CONTIG && td->td_photometric == PHOTOMETRIC_YCBCR) { /* * Packed YCbCr data contain one Cb+Cr for every * HorizontalSampling*VerticalSampling Y values. * Must also roundup width and height when calculating * since images that are not a multiple of the * horizontal/vertical subsampling area include * YCbCr data for the extended image. */ u_long w = roundup(td->td_imagewidth, td->td_ycbcrsubsampling[0]); u_long scanline = howmany(w*td->td_bitspersample, 8); u_long samplingarea = td->td_ycbcrsubsampling[0]*td->td_ycbcrsubsampling[1]; nrows = roundup(nrows, td->td_ycbcrsubsampling[1]); /* NB: don't need howmany here 'cuz everything is rounded */ return (nrows*scanline + 2*(nrows*scanline / samplingarea)); } else #endif return (nrows * TIFFScanlineSize(tif)); } /* * Compute the # bytes in a (row-aligned) strip. */ u_long TIFFStripSize(tif) TIFF *tif; { return (TIFFVStripSize(tif, tif->tif_dir.td_rowsperstrip)); } neuron-7.6.3/src/lib/TIFF/tif_swab.c000077500000000000000000000156531340731477100171100ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_swab.c,v 1.2 1997/03/26 15:07:20 hines Exp"; #endif /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library Bit & Byte Swapping Support. * * XXX We assume short = 16-bits and long = 32-bits XXX */ #include "tiffioP.h" #ifndef TIFFSwabShort int TIFFSwabShort(wp) unsigned short *wp; { register unsigned char *cp = (unsigned char *)wp; int t; t = cp[1]; cp[1] = cp[0]; cp[0] = t; return 1; } #endif #ifndef TIFFSwabLong int TIFFSwabLong(lp) unsigned long *lp; { register unsigned char *cp = (unsigned char *)lp; int t; t = cp[3]; cp[3] = cp[0]; cp[0] = t; t = cp[2]; cp[2] = cp[1]; cp[1] = t; return 1; } #endif #ifndef TIFFSwabArrayOfShort int TIFFSwabArrayOfShort(wp, n) unsigned short *wp; register int n; { register unsigned char *cp; register int t; /* XXX unroll loop some */ while (n-- > 0) { cp = (unsigned char *)wp; t = cp[1]; cp[1] = cp[0]; cp[0] = t; wp++; } return 1; } #endif #ifndef TIFFSwabArrayOfLong int TIFFSwabArrayOfLong(lp, n) register unsigned long *lp; register int n; { register unsigned char *cp; register int t; /* XXX unroll loop some */ while (n-- > 0) { cp = (unsigned char *)lp; t = cp[3]; cp[3] = cp[0]; cp[0] = t; t = cp[2]; cp[2] = cp[1]; cp[1] = t; lp++; } return 1; } #endif /* * Bit reversal tables. TIFFBitRevTable[] gives * the bit reversed value of . Used in various * places in the library when the FillOrder requires * bit reversal of byte values (e.g. CCITT Fax 3 * encoding/decoding). TIFFNoBitRevTable is provided * for algorithms that want an equivalent table that * do not reverse bit values. */ #if defined(__STDC__) || defined(__EXTENDED__) || USE_CONST const unsigned char TIFFBitRevTable[256] = { #else unsigned char TIFFBitRevTable[256] = { #endif 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff }; #if defined(__STDC__) || defined(__EXTENDED__) || USE_CONST const unsigned char TIFFNoBitRevTable[256] = { #else unsigned char TIFFNoBitRevTable[256] = { #endif 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, }; int TIFFReverseBits(cp, n) register unsigned char *cp; register int n; { for (; n > 8; n -= 8) { cp[0] = TIFFBitRevTable[cp[0]]; cp[1] = TIFFBitRevTable[cp[1]]; cp[2] = TIFFBitRevTable[cp[2]]; cp[3] = TIFFBitRevTable[cp[3]]; cp[4] = TIFFBitRevTable[cp[4]]; cp[5] = TIFFBitRevTable[cp[5]]; cp[6] = TIFFBitRevTable[cp[6]]; cp[7] = TIFFBitRevTable[cp[7]]; cp += 8; } while (n-- > 0) *cp = TIFFBitRevTable[*cp], cp++; return 1; } neuron-7.6.3/src/lib/TIFF/tif_thunder.c000077500000000000000000000113341340731477100176150ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_thunder.c,v 1.2 1997/03/26 15:07:21 hines Exp"; #endif /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * ThunderScan 4-bit Compression Algorithm Support */ #include "tiffioP.h" /* * ThunderScan uses an encoding scheme designed for * 4-bit pixel values. Data is encoded in bytes, with * each byte split into a 2-bit code word and a 6-bit * data value. The encoding gives raw data, runs of * pixels, or pixel values encoded as a delta from the * previous pixel value. For the latter, either 2-bit * or 3-bit delta values are used, with the deltas packed * into a single byte. */ #define THUNDER_DATA 0x3f /* mask for 6-bit data */ #define THUNDER_CODE 0xc0 /* mask for 2-bit code word */ /* code values */ #define THUNDER_RUN 0x00 /* run of pixels w/ encoded count */ #define THUNDER_2BITDELTAS 0x40 /* 3 pixels w/ encoded 2-bit deltas */ #define DELTA2_SKIP 2 /* skip code for 2-bit deltas */ #define THUNDER_3BITDELTAS 0x80 /* 2 pixels w/ encoded 3-bit deltas */ #define DELTA3_SKIP 4 /* skip code for 3-bit deltas */ #define THUNDER_RAW 0xc0 /* raw data encoded */ static const int twobitdeltas[4] = { 0, 1, 0, -1 }; static const int threebitdeltas[8] = { 0, 1, 2, 3, 0, -3, -2, -1 }; #define SETPIXEL(op, v) { \ lastpixel = (v) & 0xf; \ if (npixels++ & 1) \ *op++ |= lastpixel; \ else \ op[0] = lastpixel << 4; \ } static int ThunderDecode(tif, op, maxpixels) TIFF *tif; register u_char *op; int maxpixels; { register u_char *bp; register int n, cc, lastpixel, npixels, delta; bp = (u_char *)tif->tif_rawcp; cc = tif->tif_rawcc; lastpixel = npixels = 0; while (cc > 0 && npixels < maxpixels) { n = *bp++, cc--; switch (n & THUNDER_CODE) { case THUNDER_RUN: /* pixel run */ /* * Replicate the last pixel n times, * where n is the lower-order 6 bits. */ if (npixels & 1) { op[0] |= lastpixel; lastpixel = *op++; npixels++; n--; } else lastpixel |= lastpixel << 4; npixels += n; for (; n > 0; n -= 2) *op++ = lastpixel; if (n == -1) *--op &= 0xf0; lastpixel &= 0xf; break; case THUNDER_2BITDELTAS: /* 2-bit deltas */ if ((delta = ((n >> 4) & 3)) != DELTA2_SKIP) SETPIXEL(op, lastpixel + twobitdeltas[delta]); if ((delta = ((n >> 2) & 3)) != DELTA2_SKIP) SETPIXEL(op, lastpixel + twobitdeltas[delta]); if ((delta = (n & 3)) != DELTA2_SKIP) SETPIXEL(op, lastpixel + twobitdeltas[delta]); break; case THUNDER_3BITDELTAS: /* 3-bit deltas */ if ((delta = ((n >> 3) & 7)) != DELTA3_SKIP) SETPIXEL(op, lastpixel + threebitdeltas[delta]); if ((delta = (n & 7)) != DELTA3_SKIP) SETPIXEL(op, lastpixel + threebitdeltas[delta]); break; case THUNDER_RAW: /* raw data */ SETPIXEL(op, n); break; } } tif->tif_rawcp = (char *)bp; tif->tif_rawcc = cc; if (npixels != maxpixels) { TIFFError(tif->tif_name, "ThunderDecode: %s data at scanline %d (%d != %d)", npixels < maxpixels ? "Not enough" : "Too much", tif->tif_row, npixels, maxpixels); return (0); } return (1); } static int ThunderDecodeRow(tif, buf, occ, s) TIFF *tif; u_char *buf; int occ; u_int s; { u_char *row = buf; while (occ > 0) { if (!ThunderDecode(tif, row, tif->tif_dir.td_imagewidth)) return (0); occ -= tif->tif_scanlinesize; row += tif->tif_scanlinesize; } return (1); } int TIFFInitThunderScan(tif) TIFF *tif; { tif->tif_decoderow = ThunderDecodeRow; tif->tif_decodestrip = ThunderDecodeRow; return (1); } neuron-7.6.3/src/lib/TIFF/tif_tile.c000077500000000000000000000125601340731477100171030ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_tile.c,v 1.2 1997/03/26 15:07:22 hines Exp"; #endif /* * Copyright (c) 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * Tiled Image Support Routines. */ #include "tiffioP.h" /* * Compute which tile an (x,y,z,s) value is in. */ u_int TIFFComputeTile(tif, x, y, s, z) TIFF *tif; u_long x, y, z; u_int s; { TIFFDirectory *td = &tif->tif_dir; u_long dx = td->td_tilewidth; u_long dy = td->td_tilelength; u_long dz = td->td_tiledepth; u_int tile = 1; if (td->td_imagedepth == 1) z = 0; if (dx == (u_long) -1) dx = td->td_imagewidth; if (dy == (u_long) -1) dy = td->td_imagelength; if (dz == (u_long) -1) dz = td->td_imagedepth; if (dx != 0 && dy != 0 && dz != 0) { u_int xpt = howmany(td->td_imagewidth, dx); u_int ypt = howmany(td->td_imagelength, dy); u_int zpt = howmany(td->td_imagedepth, dz); if (td->td_planarconfig == PLANARCONFIG_SEPARATE) tile = (xpt*ypt*zpt)*s + (xpt*ypt)*(z/dz) + xpt*(y/dy) + x/dx; else tile = (xpt*ypt)*(z/dz) + xpt*(y/dy) + x/dx + s; } return (tile); } /* * Check an (x,y,z,s) coordinate * against the image bounds. */ int TIFFCheckTile(tif, x, y, z, s) TIFF *tif; u_long x, y, z; u_int s; { TIFFDirectory *td = &tif->tif_dir; if (x >= td->td_imagewidth) { TIFFError(tif->tif_name, "Col %d out of range, max %d", x, td->td_imagewidth); return (0); } if (y >= td->td_imagelength) { TIFFError(tif->tif_name, "Row %d out of range, max %d", y, td->td_imagelength); return (0); } if (z >= td->td_imagedepth) { TIFFError(tif->tif_name, "Depth %d out of range, max %d", z, td->td_imagedepth); return (0); } if (td->td_planarconfig == PLANARCONFIG_SEPARATE && s >= td->td_samplesperpixel) { TIFFError(tif->tif_name, "Sample %d out of range, max %d", s, td->td_samplesperpixel); return (0); } return (1); } /* * Compute how many tiles are in an image. */ u_int TIFFNumberOfTiles(tif) TIFF *tif; { TIFFDirectory *td = &tif->tif_dir; u_long dx = td->td_tilewidth; u_long dy = td->td_tilelength; u_long dz = td->td_tiledepth; u_int ntiles; if (dx == (u_long) -1) dx = td->td_imagewidth; if (dy == (u_long) -1) dy = td->td_imagelength; if (dz == (u_long) -1) dz = td->td_imagedepth; ntiles = (dx != 0 && dy != 0 && dz != 0) ? (howmany(td->td_imagewidth, dx) * howmany(td->td_imagelength, dy) * howmany(td->td_imagedepth, dz)) : 0; return (ntiles); } /* * Compute the # bytes in each row of a tile. */ u_long TIFFTileRowSize(tif) TIFF *tif; { TIFFDirectory *td = &tif->tif_dir; u_long rowsize; if (td->td_tilelength == 0 || td->td_tilewidth == 0) return (0); rowsize = td->td_bitspersample * td->td_tilewidth; if (td->td_planarconfig == PLANARCONFIG_CONTIG) rowsize *= td->td_samplesperpixel; return (howmany(rowsize, 8)); } /* * Compute the # bytes in a variable length, row-aligned tile. */ u_long TIFFVTileSize(tif, nrows) TIFF *tif; u_long nrows; { TIFFDirectory *td = &tif->tif_dir; u_long tilesize; if (td->td_tilelength == 0 || td->td_tilewidth == 0 || td->td_tiledepth == 0) return (0); #ifdef YCBCR_SUPPORT if (td->td_planarconfig == PLANARCONFIG_CONTIG && td->td_photometric == PHOTOMETRIC_YCBCR) { /* * Packed YCbCr data contain one Cb+Cr for every * HorizontalSampling*VerticalSampling Y values. * Must also roundup width and height when calculating * since images that are not a multiple of the * horizontal/vertical subsampling area include * YCbCr data for the extended image. */ u_long w = roundup(td->td_tilewidth, td->td_ycbcrsubsampling[0]); u_long rowsize = howmany(w*td->td_bitspersample, 8); u_long samplingarea = td->td_ycbcrsubsampling[0]*td->td_ycbcrsubsampling[1]; nrows = roundup(nrows, td->td_ycbcrsubsampling[1]); /* NB: don't need howmany here 'cuz everything is rounded */ tilesize = nrows*rowsize + 2*(nrows*rowsize / samplingarea); } else #endif tilesize = nrows * TIFFTileRowSize(tif); return (tilesize * td->td_tiledepth); } /* * Compute the # bytes in a row-aligned tile. */ u_long TIFFTileSize(tif) TIFF *tif; { return (TIFFVTileSize(tif, tif->tif_dir.td_tilelength)); } neuron-7.6.3/src/lib/TIFF/tif_version.c000077500000000000000000000026501340731477100176320ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1992 Sam Leffler * Copyright (c) 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "tiffcompat.h" const char TIFFVersion[] = "\ LIBTIFF, Version 3.0\n\ Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler\n\ Copyright (c) 1991, 1992 Silicon Graphics, Inc.\ "; neuron-7.6.3/src/lib/TIFF/tif_warning.c000077500000000000000000000042761340731477100176200ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_warning.c,v 1.2 1997/03/26 15:07:23 hines Exp"; #endif /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. */ #include "tiffioP.h" #include "prototypes.h" #include static void DECLARE3(defaultHandler, char*, module, char*, fmt, va_list, ap) { if (module != NULL) fprintf(stderr, "%s: ", module); fprintf(stderr, "Warning, "); vfprintf(stderr, fmt, ap); fprintf(stderr, ".\n"); } static TIFFErrorHandler _warningHandler = defaultHandler; TIFFErrorHandler DECLARE1(TIFFSetWarningHandler, TIFFErrorHandler, handler) { TIFFErrorHandler prev = _warningHandler; _warningHandler = handler; return (prev); } void #if USE_PROTOTYPES TIFFWarning(char *module, char *fmt, ...) #else /*VARARGS2*/ TIFFWarning(module, fmt, va_alist) char *module; char *fmt; va_dcl #endif { if (_warningHandler) { va_list ap; VA_START(ap, fmt); (*_warningHandler)(module, fmt, ap); va_end(ap); } } neuron-7.6.3/src/lib/TIFF/tif_write.c000077500000000000000000000416071340731477100173040ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif #ifndef lint static char rcsid[] = "/local/src/master/iv/src/lib/TIFF/tif_write.c,v 1.2 1997/03/26 15:07:23 hines Exp"; #endif /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library. * * Scanline-oriented Write Support */ #include #include #include "tiffioP.h" #include #include #define STRIPINCR 20 /* expansion factor on strip array */ #if USE_PROTOTYPES static int TIFFWriteCheck(TIFF *, int, char []); static int TIFFBufferSetup(TIFF *, char []); static int TIFFGrowStrips(TIFF *, int, char []); static int TIFFAppendToStrip(TIFF *, u_int, u_char *, u_int); #else static int TIFFWriteCheck(); static int TIFFBufferSetup(); static int TIFFGrowStrips(); static int TIFFAppendToStrip(); #endif /*VARARGS3*/ int TIFFWriteScanline(tif, buf, row, sample) register TIFF *tif; u_char *buf; u_int row, sample; { static char module[] = "TIFFWriteScanline"; register TIFFDirectory *td; int strip, status, imagegrew = 0; if (!TIFFWriteCheck(tif, 0, module)) return (-1); /* * Handle delayed allocation of data buffer. This * permits it to be sized more intelligently (using * directory information). */ if ((tif->tif_flags & TIFF_BUFFERSETUP) == 0) { if (!TIFFBufferSetup(tif, module)) return (-1); tif->tif_flags |= TIFF_BUFFERSETUP; } td = &tif->tif_dir; /* * Extend image length if needed * (but only for PlanarConfig=1). */ if (row >= td->td_imagelength) { /* extend image */ if (td->td_planarconfig == PLANARCONFIG_SEPARATE) { TIFFError(tif->tif_name, "Can not change \"ImageLength\" when using separate planes"); return (-1); } td->td_imagelength = row+1; imagegrew = 1; } /* * Calculate strip and check for crossings. */ if (td->td_planarconfig == PLANARCONFIG_SEPARATE) { if (sample >= td->td_samplesperpixel) { TIFFError(tif->tif_name, "%d: Sample out of range, max %d", sample, td->td_samplesperpixel); return (-1); } strip = sample*td->td_stripsperimage + row/td->td_rowsperstrip; } else strip = row / td->td_rowsperstrip; if (strip != tif->tif_curstrip) { /* * Changing strips -- flush any data present. */ if (tif->tif_rawcc > 0 && !TIFFFlushData(tif)) return (-1); tif->tif_curstrip = strip; /* * Watch out for a growing image. The value of * strips/image will initially be 1 (since it * can't be deduced until the imagelength is known). */ if (strip >= td->td_stripsperimage && imagegrew) td->td_stripsperimage = howmany(td->td_imagelength, td->td_rowsperstrip); tif->tif_row = (strip % td->td_stripsperimage) * td->td_rowsperstrip; if (tif->tif_preencode && !(*tif->tif_preencode)(tif)) return (-1); tif->tif_flags |= TIFF_POSTENCODE; } /* * Check strip array to make sure there's space. * We don't support dynamically growing files that * have data organized in separate bitplanes because * it's too painful. In that case we require that * the imagelength be set properly before the first * write (so that the strips array will be fully * allocated above). */ if (strip >= td->td_nstrips && !TIFFGrowStrips(tif, 1, module)) return (-1); /* * Ensure the write is either sequential or at the * beginning of a strip (or that we can randomly * access the data -- i.e. no encoding). */ if (row != tif->tif_row) { if (tif->tif_seek) { if (row < tif->tif_row) { /* * Moving backwards within the same strip: * backup to the start and then decode * forward (below). */ tif->tif_row = (strip % td->td_stripsperimage) * td->td_rowsperstrip; tif->tif_rawcp = tif->tif_rawdata; } /* * Seek forward to the desired row. */ if (!(*tif->tif_seek)(tif, row - tif->tif_row)) return (-1); tif->tif_row = row; } else { TIFFError(tif->tif_name, "Compression algorithm does not support random access"); return (-1); } } status = (*tif->tif_encoderow)(tif, buf, tif->tif_scanlinesize, sample); tif->tif_row++; return (status); } /* * Encode the supplied data and write it to the * specified strip. There must be space for the * data; we don't check if strips overlap! * * NB: Image length must be setup before writing; this * interface does not support automatically growing * the image on each write (as TIFFWriteScanline does). */ int TIFFWriteEncodedStrip(tif, strip, data, cc) TIFF *tif; u_int strip; u_char *data; u_int cc; { static char module[] = "TIFFWriteEncodedStrip"; TIFFDirectory *td = &tif->tif_dir; if (!TIFFWriteCheck(tif, 0, module)) return (-1); if (strip >= td->td_nstrips) { TIFFError(module, "%s: Strip %d out of range, max %d", tif->tif_name, strip, td->td_nstrips); return (-1); } /* * Handle delayed allocation of data buffer. This * permits it to be sized according to the directory * info. */ if ((tif->tif_flags & TIFF_BUFFERSETUP) == 0) { if (!TIFFBufferSetup(tif, module)) return (-1); tif->tif_flags |= TIFF_BUFFERSETUP; } tif->tif_curstrip = strip; tif->tif_flags &= ~TIFF_POSTENCODE; if (tif->tif_preencode && !(*tif->tif_preencode)(tif)) return (-1); if (!(*tif->tif_encodestrip)(tif, data, cc, strip / td->td_stripsperimage)) return (0); if (tif->tif_postencode && !(*tif->tif_postencode)(tif)) return (-1); if (td->td_fillorder != tif->tif_fillorder && (tif->tif_flags & TIFF_NOBITREV) == 0) TIFFReverseBits((u_char *)tif->tif_rawdata, tif->tif_rawcc); if (tif->tif_rawcc > 0 && !TIFFAppendToStrip(tif, strip, (u_char *)tif->tif_rawdata, tif->tif_rawcc)) return (-1); tif->tif_rawcc = 0; tif->tif_rawcp = tif->tif_rawdata; return (cc); } /* * Write the supplied data to the specified strip. * There must be space for the data; we don't check * if strips overlap! * * NB: Image length must be setup before writing; this * interface does not support automatically growing * the image on each write (as TIFFWriteScanline does). */ int TIFFWriteRawStrip(tif, strip, data, cc) TIFF *tif; u_int strip; u_char *data; u_int cc; { static char module[] = "TIFFWriteRawStrip"; if (!TIFFWriteCheck(tif, 0, module)) return (-1); if (strip >= tif->tif_dir.td_nstrips) { TIFFError(module, "%s: Strip %d out of range, max %d", tif->tif_name, strip, tif->tif_dir.td_nstrips); return (-1); } return (TIFFAppendToStrip(tif, strip, data, cc) ? cc : -1); } /* * Write and compress a tile of data. The * tile is selected by the (x,y,z,s) coordinates. */ int TIFFWriteTile(tif, buf, x, y, z, s) TIFF *tif; u_char *buf; u_long x, y, z; u_int s; { if (!TIFFCheckTile(tif, x, y, z, s)) return (-1); /* * NB: A tile size of -1 is used instead of tif_tilesize knowing * that TIFFWriteEncodedTile will clamp this to the tile size. * This is done because the tile size may not be defined until * after the output buffer is setup in TIFFBufferSetup. */ return (TIFFWriteEncodedTile(tif, TIFFComputeTile(tif, x, y, z, s), buf, (u_int)-1)); } /* * Encode the supplied data and write it to the * specified tile. There must be space for the * data. The function clamps individual writes * to a tile to the tile size, but does not (and * can not) check that multiple writes to the same * tile do not write more than tile size data. * * NB: Image length must be setup before writing; this * interface does not support automatically growing * the image on each write (as TIFFWriteScanline does). */ int TIFFWriteEncodedTile(tif, tile, data, cc) TIFF *tif; u_int tile; u_char *data; u_int cc; { static char module[] = "TIFFWriteEncodedTile"; TIFFDirectory *td; if (!TIFFWriteCheck(tif, 1, module)) return (-1); td = &tif->tif_dir; if (tile >= td->td_nstrips) { TIFFError(module, "%s: Tile %d out of range, max %d", tif->tif_name, tile, td->td_nstrips); return (-1); } /* * Handle delayed allocation of data buffer. This * permits it to be sized more intelligently (using * directory information). */ if ((tif->tif_flags & TIFF_BUFFERSETUP) == 0) { if (!TIFFBufferSetup(tif, module)) return (-1); tif->tif_flags |= TIFF_BUFFERSETUP; } tif->tif_curtile = tile; /* * Compute tiles per row & per column to compute * current row and column */ tif->tif_row = (tile % howmany(td->td_imagelength, td->td_tilelength)) * td->td_tilelength; tif->tif_col = (tile % howmany(td->td_imagewidth, td->td_tilewidth)) * td->td_tilewidth; tif->tif_flags &= ~TIFF_POSTENCODE; if (tif->tif_preencode && !(*tif->tif_preencode)(tif)) return (-1); /* * Clamp write amount to the tile size. This is mostly * done so that callers can pass in some large number * (e.g. -1) and have the tile size used instead. */ if (cc > tif->tif_tilesize) cc = tif->tif_tilesize; if (!(*tif->tif_encodetile)(tif, data, cc, tile/td->td_stripsperimage)) return (0); if (tif->tif_postencode && !(*tif->tif_postencode)(tif)) return (-1); if (td->td_fillorder != tif->tif_fillorder && (tif->tif_flags & TIFF_NOBITREV) == 0) TIFFReverseBits((u_char *)tif->tif_rawdata, tif->tif_rawcc); if (tif->tif_rawcc > 0 && !TIFFAppendToStrip(tif, tile, (u_char *)tif->tif_rawdata, tif->tif_rawcc)) return (-1); tif->tif_rawcc = 0; tif->tif_rawcp = tif->tif_rawdata; return (cc); } /* * Write the supplied data to the specified strip. * There must be space for the data; we don't check * if strips overlap! * * NB: Image length must be setup before writing; this * interface does not support automatically growing * the image on each write (as TIFFWriteScanline does). */ int TIFFWriteRawTile(tif, tile, data, cc) TIFF *tif; u_int tile; u_char *data; u_int cc; { static char module[] = "TIFFWriteRawTile"; if (!TIFFWriteCheck(tif, 1, module)) return (-1); if (tile >= tif->tif_dir.td_nstrips) { TIFFError(module, "%s: Tile %d out of range, max %d", tif->tif_name, tile, tif->tif_dir.td_nstrips); return (-1); } return (TIFFAppendToStrip(tif, tile, data, cc) ? cc : -1); } static int TIFFSetupStrips(tif) TIFF *tif; { #define isUnspecified(td, v) \ (td->v == 0xffffffff || (td)->td_imagelength == 0) register TIFFDirectory *td = &tif->tif_dir; if (!isTiled(tif)) td->td_stripsperimage = isUnspecified(td, td_rowsperstrip) ? 1 : howmany(td->td_imagelength, td->td_rowsperstrip); else td->td_stripsperimage = isUnspecified(td, td_tilelength) ? 1 : TIFFNumberOfTiles(tif); td->td_nstrips = td->td_stripsperimage; if (td->td_planarconfig == PLANARCONFIG_SEPARATE) td->td_nstrips *= td->td_samplesperpixel; td->td_stripoffset = (u_long *) malloc(td->td_nstrips * sizeof (u_long)); td->td_stripbytecount = (u_long *) malloc(td->td_nstrips * sizeof (u_long)); if (td->td_stripoffset == NULL || td->td_stripbytecount == NULL) return (0); /* * Place data at the end-of-file * (by setting offsets to zero). */ bzero((char *)td->td_stripoffset, td->td_nstrips * sizeof (u_long)); bzero((char *)td->td_stripbytecount, td->td_nstrips * sizeof (u_long)); TIFFSetFieldBit(tif, FIELD_STRIPOFFSETS); TIFFSetFieldBit(tif, FIELD_STRIPBYTECOUNTS); return (1); #undef isUnspecified } /* * Verify file is writable and that the directory * information is setup properly. In doing the latter * we also "freeze" the state of the directory so * that important information is not changed. */ static int TIFFWriteCheck(tif, tiles, module) register TIFF *tif; int tiles; char module[]; { if (tif->tif_mode == O_RDONLY) { TIFFError(module, "%s: File not open for writing", tif->tif_name); return (0); } if (tiles ^ isTiled(tif)) { TIFFError(tif->tif_name, tiles ? "Can not write tiles to a stripped image" : "Can not write scanlines to a tiled image"); return (0); } /* * On the first write verify all the required information * has been setup and initialize any data structures that * had to wait until directory information was set. * Note that a lot of our work is assumed to remain valid * because we disallow any of the important parameters * from changing after we start writing (i.e. once * TIFF_BEENWRITING is set, TIFFSetField will only allow * the image's length to be changed). */ if ((tif->tif_flags & TIFF_BEENWRITING) == 0) { if (!TIFFFieldSet(tif, FIELD_IMAGEDIMENSIONS)) { TIFFError(module, "%s: Must set \"ImageWidth\" before writing data", tif->tif_name); return (0); } if (!TIFFFieldSet(tif, FIELD_PLANARCONFIG)) { TIFFError(module, "%s: Must set \"PlanarConfiguration\" before writing data", tif->tif_name); return (0); } if (tif->tif_dir.td_stripoffset == NULL && !TIFFSetupStrips(tif)) { tif->tif_dir.td_nstrips = 0; TIFFError(module, "%s: No space for %s arrays", tif->tif_name, isTiled(tif) ? "tile" : "strip"); return (0); } tif->tif_flags |= TIFF_BEENWRITING; } return (1); } /* * Setup the raw data buffer used for encoding. */ static int TIFFBufferSetup(tif, module) register TIFF *tif; char module[]; { int size; if (isTiled(tif)) tif->tif_tilesize = size = TIFFTileSize(tif); else tif->tif_scanlinesize = size = TIFFScanlineSize(tif); /* * Make raw data buffer at least 8K */ if (size < 8*1024) size = 8*1024; tif->tif_rawdata = malloc(size); if (tif->tif_rawdata == NULL) { TIFFError(module, "%s: No space for output buffer", tif->tif_name); return (0); } tif->tif_rawdatasize = size; tif->tif_rawcc = 0; tif->tif_rawcp = tif->tif_rawdata; return (1); } /* * Grow the strip data structures by delta strips. */ static int TIFFGrowStrips(tif, delta, module) TIFF *tif; int delta; char module[]; { TIFFDirectory *td = &tif->tif_dir; assert(td->td_planarconfig == PLANARCONFIG_CONTIG); td->td_stripoffset = (u_long *)realloc(td->td_stripoffset, (td->td_nstrips + delta) * sizeof (u_long)); td->td_stripbytecount = (u_long *)realloc(td->td_stripbytecount, (td->td_nstrips + delta) * sizeof (u_long)); if (td->td_stripoffset == NULL || td->td_stripbytecount == NULL) { td->td_nstrips = 0; TIFFError(module, "%s: No space to expand strip arrays", tif->tif_name); return (0); } bzero(td->td_stripoffset+td->td_nstrips, delta*sizeof (u_long)); bzero(td->td_stripbytecount+td->td_nstrips, delta*sizeof (u_long)); td->td_nstrips += delta; return (1); } /* * Append the data to the specified strip. * * NB: We don't check that there's space in the * file (i.e. that strips do not overlap). */ static int TIFFAppendToStrip(tif, strip, data, cc) TIFF *tif; u_int strip; u_char *data; u_int cc; { TIFFDirectory *td = &tif->tif_dir; static char module[] = "TIFFAppendToStrip"; if (td->td_stripoffset[strip] == 0 || tif->tif_curoff == 0) { /* * No current offset, set the current strip. */ if (td->td_stripoffset[strip] != 0) { if (!SeekOK(tif->tif_fd, td->td_stripoffset[strip])) { TIFFError(module, "%s: Seek error at scanline %d", tif->tif_name, tif->tif_row); return (0); } } else td->td_stripoffset[strip] = lseek(tif->tif_fd, 0L, L_XTND); tif->tif_curoff = td->td_stripoffset[strip]; } if (!WriteOK(tif->tif_fd, data, cc)) { TIFFError(module, "%s: Write error at scanline %d", tif->tif_name, tif->tif_row); return (0); } tif->tif_curoff += cc; td->td_stripbytecount[strip] += cc; return (1); } /* * Internal version of TIFFFlushData that can be * called by ``encodestrip routines'' w/o concern * for infinite recursion. */ int TIFFFlushData1(tif) register TIFF *tif; { if (tif->tif_rawcc > 0) { if (tif->tif_dir.td_fillorder != tif->tif_fillorder && (tif->tif_flags & TIFF_NOBITREV) == 0) TIFFReverseBits((u_char *)tif->tif_rawdata, tif->tif_rawcc); if (!TIFFAppendToStrip(tif, isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip, (u_char *)tif->tif_rawdata, tif->tif_rawcc)) return (0); tif->tif_rawcc = 0; tif->tif_rawcp = tif->tif_rawdata; } return (1); } neuron-7.6.3/src/lib/TIFF/tiffcompat.h000077500000000000000000000135541340731477100174510ustar00rootroot00000000000000/* /local/src/master/iv/src/lib/TIFF/tiffcompat.h,v 1.4 1999/08/11 19:43:02 hines Exp */ /* * Copyright (c) 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _COMPAT_ #define _COMPAT_ /* * This file contains a hodgepodge of definitions and * declarations that are needed to provide compatibility * between the native system and the base UNIX implementation * that the library assumes (~4BSD). In particular, you * can override the standard i/o interface (read/write/lseek) * by redefining the ReadOK/WriteOK/SeekOK macros to your * liking. * * NB: This file is a mess. */ /* warnings about incompatible implicit definitions*/ #include #if HAVE_STRING_H #include #endif #if HAVE_STRINGS_H #include /* eg. bcopy */ #endif #if (defined(__STDC__) || defined(__EXTENDED__)) && !defined(USE_PROTOTYPES) #define USE_PROTOTYPES 1 #define USE_CONST 1 #endif #if !USE_CONST && !defined(const) #define const #endif #ifdef THINK_C #include #include #endif #if USE_PROTOTYPES #include #endif #ifndef THINK_C #include #endif #ifdef VMS #include #include #else #include #endif #if defined(THINK_C) || defined(applec) #include #endif /* * Workarounds for BSD lseek definitions. */ #if defined(SYSV) || defined(VMS) #if defined(SYSV) #include #endif #define L_SET SEEK_SET #define L_INCR SEEK_CUR #define L_XTND SEEK_END #endif #ifndef L_SET #define L_SET 0 #define L_INCR 1 #define L_XTND 2 #endif /* * SVID workarounds for BSD bit * string manipulation routines. */ #if defined(SYSV) || defined(THINK_C) || defined(applec) || defined(VMS) #define bzero(dst,len) memset((char *)dst, 0, len) #define bcopy(src,dst,len) memcpy((char *)dst, (char *)src, len) #define bcmp(src, dst, len) memcmp((char *)dst, (char *)src, len) #endif /* * The BSD typedefs are used throughout the library. * If your system doesn't have them in , * then define BSDTYPES in your Makefile. */ #ifdef BSDTYPES typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; #endif /* * Return an open file descriptor or -1. */ #if defined(applec) || defined(THINK_C) #define TIFFOpenFile(name, mode, prot) open(name, mode) #else #if defined(MSDOS) #define TIFFOpenFile(name, mode, prot) open(name, mode|O_BINARY, prot) #else #define TIFFOpenFile(name, mode, prot) open(name, mode, prot) #endif #endif /* * Return the size in bytes of the file * associated with the supplied file descriptor. */ #if USE_PROTOTYPES extern long TIFFGetFileSize(int fd); #else extern long TIFFGetFileSize(); #endif #ifdef MMAP_SUPPORT /* * Mapped file support. * * TIFFMapFileContents must map the entire file into * memory and return the address of the mapped * region and the size of the mapped region. * TIFFUnmapFileContents does the inverse operation. */ #if USE_PROTOTYPES extern int TIFFMapFileContents(int fd, char **paddr, long *psize); extern void TIFFUnmapFileContents(char *addr, long size); #else extern int TIFFMapFileContents(); extern void TIFFUnmapFileContents(); #endif #endif /* * Mac workaround to handle the file * extension semantics of lseek. */ #ifdef applec #define lseek mpw_lseek extern long mpw_lseek(int, long, int); #else #if 0 && !defined(SVR4) && !defined(FreeBSD) extern long lseek(); #endif #endif /* * Default Read/Seek/Write definitions. */ #ifndef ReadOK #define ReadOK(fd, buf, size) (read(fd, (char *)buf, size) == size) #endif #ifndef SeekOK #define SeekOK(fd, off) (lseek(fd, (long)off, L_SET) == (long)off) #endif #ifndef WriteOK #define WriteOK(fd, buf, size) (write(fd, (char *)buf, size) == size) #endif #if defined(HAVE_STDLIB_H) #include #else /* ! HAVE_STDLIB_H */ #if defined(__MACH__) || defined(THINK_C) extern void *malloc(size_t size); extern void *realloc(void *ptr, size_t size); #else /* !__MACH__ && !THINK_C */ #if defined(MSDOS) #include #else /* !MSDOS */ #if defined(_IBMR2) #include #else /* !_IBMR2 */ extern char *malloc(); extern char *realloc(); #endif /* _IBMR2 */ #endif /* !MSDOS */ #endif /* !__MACH__ */ #endif /* !HAVE_STDLIB_H */ /* * dblparam_t is the type that a double precision * floating point value will have on the parameter * stack (when coerced by the compiler). */ #ifdef applec typedef extended dblparam_t; #else typedef double dblparam_t; #endif /* * Varargs parameter list handling...YECH!!!! */ #if defined(__STDC__) && !defined(USE_VARARGS) #define USE_VARARGS 0 #endif #if defined(USE_VARARGS) #if USE_VARARGS #include #define VA_START(ap, parmN) va_start(ap) #else #include #define VA_START(ap, parmN) va_start(ap, parmN) #endif #endif /* defined(USE_VARARGS) */ #endif /* _COMPAT_ */ neuron-7.6.3/src/lib/TIFF/tiffioP.h000077500000000000000000000267551340731477100167240ustar00rootroot00000000000000/* /local/src/master/iv/src/lib/TIFF/tiffioP.h,v 1.2 1997/03/26 15:07:25 hines Exp */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler * Copyright (c) 1991, 1992 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _TIFFIOP_ #define _TIFFIOP_ /* * ``Library-private'' definitions. */ #include #include "tiffcompat.h" #include "tiff.h" /* * Internal format of a TIFF directory entry. */ typedef struct { u_long td_fieldsset[2]; /* bit vector of fields that are set */ u_long td_imagewidth, td_imagelength, td_imagedepth; u_long td_tilewidth, td_tilelength, td_tiledepth; u_short td_subfiletype; u_short td_bitspersample; u_short td_sampleformat; u_short td_compression; u_short td_photometric; u_short td_threshholding; u_short td_fillorder; u_short td_orientation; u_short td_samplesperpixel; u_short td_predictor; u_long td_rowsperstrip; u_long td_minsamplevalue, td_maxsamplevalue; /* XXX */ float td_xresolution, td_yresolution; u_short td_resolutionunit; u_short td_planarconfig; float td_xposition, td_yposition; u_long td_group3options; u_long td_group4options; u_short td_pagenumber[2]; u_short td_matteing; u_short td_cleanfaxdata; u_short td_badfaxrun; u_long td_badfaxlines; u_short *td_colormap[3]; u_short td_halftonehints[2]; char *td_documentname; char *td_artist; char *td_datetime; char *td_hostcomputer; char *td_imagedescription; char *td_make; char *td_model; char *td_software; char *td_pagename; u_long td_stripsperimage; u_long td_nstrips; /* size of offset & bytecount arrays */ u_long *td_stripoffset; u_long *td_stripbytecount; #ifdef YCBCR_SUPPORT float *td_ycbcrcoeffs; u_short td_ycbcrsubsampling[2]; u_short td_ycbcrpositioning; #endif #ifdef JPEG_SUPPORT u_short td_jpegproc; u_short td_jpegrestartinterval; u_char **td_qtab; u_char **td_dctab; u_char **td_actab; #endif #ifdef COLORIMETRY_SUPPORT float *td_whitepoint; float *td_primarychromas; float *td_refblackwhite; u_short *td_transferfunction[4]; #endif #ifdef CMYK_SUPPORT u_short td_inkset; u_short td_dotrange[2]; char *td_inknames; char *td_targetprinter; #endif } TIFFDirectory; /* * Field flags used to indicate fields that have * been set in a directory, and to reference fields * when manipulating a directory. */ /* multi-entry fields */ #define FIELD_IMAGEDIMENSIONS 0 #define FIELD_TILEDIMENSIONS 1 #define FIELD_CELLDIMENSIONS 2 /* XXX */ #define FIELD_RESOLUTION 3 #define FIELD_POSITION 4 /* single-entry fields */ #define FIELD_SUBFILETYPE 5 #define FIELD_BITSPERSAMPLE 6 #define FIELD_COMPRESSION 7 #define FIELD_PHOTOMETRIC 8 #define FIELD_THRESHHOLDING 9 #define FIELD_FILLORDER 10 #define FIELD_DOCUMENTNAME 11 #define FIELD_IMAGEDESCRIPTION 12 #define FIELD_MAKE 13 #define FIELD_MODEL 14 #define FIELD_ORIENTATION 15 #define FIELD_SAMPLESPERPIXEL 16 #define FIELD_ROWSPERSTRIP 17 #define FIELD_MINSAMPLEVALUE 18 #define FIELD_MAXSAMPLEVALUE 19 #define FIELD_PLANARCONFIG 20 #define FIELD_PAGENAME 21 #define FIELD_GROUP3OPTIONS 22 #define FIELD_GROUP4OPTIONS 23 #define FIELD_RESOLUTIONUNIT 24 #define FIELD_PAGENUMBER 25 #define FIELD_STRIPBYTECOUNTS 26 #define FIELD_STRIPOFFSETS 27 #define FIELD_COLORMAP 28 #define FIELD_PREDICTOR 29 #define FIELD_ARTIST 30 #define FIELD_DATETIME 31 #define FIELD_HOSTCOMPUTER 32 #define FIELD_SOFTWARE 33 #define FIELD_MATTEING 34 #define FIELD_BADFAXLINES 35 #define FIELD_CLEANFAXDATA 36 #define FIELD_BADFAXRUN 37 #define FIELD_SAMPLEFORMAT 38 #define FIELD_SMINSAMPLEVALUE 39 #define FIELD_SMAXSAMPLEVALUE 40 #define FIELD_IMAGEDEPTH 41 #define FIELD_TILEDEPTH 42 #define FIELD_HALFTONEHINTS 43 #ifdef YCBCR_SUPPORT #define FIELD_YCBCRCOEFFICIENTS 44 #define FIELD_YCBCRSUBSAMPLING 45 #define FIELD_YCBCRPOSITIONING 46 #endif #ifdef JPEG_SUPPORT #define FIELD_JPEGPROC 47 #define FIELD_JPEGRESTARTINTERVAL 48 #define FIELD_JPEGQTABLES 49 #define FIELD_JPEGDCTABLES 50 #define FIELD_JPEGACTABLES 51 #endif #ifdef COLORIMETRY_SUPPORT #define FIELD_REFBLACKWHITE 52 #define FIELD_WHITEPOINT 53 #define FIELD_PRIMARYCHROMAS 54 #define FIELD_TRANSFERFUNCTION 55 #endif #ifdef CMYK_SUPPORT #define FIELD_INKSET 56 #define FIELD_INKNAMES 57 #define FIELD_DOTRANGE 58 #define FIELD_TARGETPRINTER 59 #endif #define FIELD_LAST 59 #define TIFFExtractData(tif, type, v) \ ((tif)->tif_header.tiff_magic == TIFF_BIGENDIAN ? \ ((v) >> (tif)->tif_typeshift[type]) & (tif)->tif_typemask[type] : \ (v) & (tif)->tif_typemask[type]) #define TIFFInsertData(tif, type, v) \ ((tif)->tif_header.tiff_magic == TIFF_BIGENDIAN ? \ ((v) & (tif)->tif_typemask[type]) << (tif)->tif_typeshift[type] : \ (v) & (tif)->tif_typemask[type]) typedef struct { u_short field_tag; /* field's tag */ short field_readcount; /* read count (-1 for unknown) */ short field_writecount; /* write count (-1 for unknown) */ TIFFDataType field_type; /* type of associated data */ u_short field_bit; /* bit in fieldsset bit vector */ u_short field_oktochange; /* if true, can change while writing */ char *field_name; /* ASCII name */ } TIFFFieldInfo; #define FIELD_IGNORE ((u_short)-1) /* tags processed but ignored */ #define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */ #define TIFF_VARIABLE -1 /* marker for variable length tags */ #define TIFF_SPP -2 /* marker for SamplesPerPixel tags */ extern const TIFFFieldInfo tiffFieldInfo[];/* table of field descriptors */ extern const int tiffDataWidth[]; /* table of tag datatype widths */ #define BITn(n) (((unsigned)1L)<<((n)&0x1f)) #define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n)/32]) #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field)) #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field)) #define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field)) #define FieldSet(fields, f) (fields[(f)/32] & BITn(f)) #define ResetFieldBit(fields, f) (fields[(f)/32] &= ~BITn(f)) struct tiff { char *tif_name; /* name of open file */ short tif_fd; /* open file descriptor */ short tif_mode; /* open mode (O_*) */ char tif_fillorder; /* natural bit fill order for machine */ char tif_options; /* compression-specific options */ short tif_flags; #define TIFF_DIRTYHEADER 0x1 /* header must be written on close */ #define TIFF_DIRTYDIRECT 0x2 /* current directory must be written */ #define TIFF_BUFFERSETUP 0x4 /* data buffers setup */ #define TIFF_BEENWRITING 0x8 /* written 1+ scanlines to file */ #define TIFF_SWAB 0x10 /* byte swap file information */ #define TIFF_NOBITREV 0x20 /* inhibit bit reversal logic */ #define TIFF_MYBUFFER 0x40 /* my raw data buffer; free on close */ #define TIFF_ISTILED 0x80 /* file is tile, not strip- based */ #define TIFF_MAPPED 0x100 /* file is mapped into memory */ #define TIFF_POSTENCODE 0x200 /* need call to postencode routine */ long tif_diroff; /* file offset of current directory */ long tif_nextdiroff; /* file offset of following directory */ TIFFDirectory tif_dir; /* internal rep of current directory */ TIFFHeader tif_header; /* file's header block */ int const *tif_typeshift; /* data type shift counts */ long const *tif_typemask; /* data type masks */ long tif_row; /* current scanline */ int tif_curdir; /* current directory (index) */ int tif_curstrip; /* current strip for read/write */ long tif_curoff; /* current offset for read/write */ /* tiling support */ long tif_col; /* current column (offset by row too) */ int tif_curtile; /* current tile for read/write */ long tif_tilesize; /* # of bytes in a tile */ /* compression scheme hooks */ int (*tif_predecode)(); /* pre row/strip/tile decoding */ int (*tif_preencode)(); /* pre row/strip/tile encoding */ int (*tif_postencode)(); /* post row/strip/tile encoding */ int (*tif_decoderow)(); /* scanline decoding routine */ int (*tif_encoderow)(); /* scanline encoding routine */ int (*tif_decodestrip)(); /* strip decoding routine */ int (*tif_encodestrip)(); /* strip encoding routine */ int (*tif_decodetile)(); /* tile decoding routine */ int (*tif_encodetile)(); /* tile encoding routine */ int (*tif_close)(); /* cleanup-on-close routine */ int (*tif_seek)(); /* position within a strip routine */ int (*tif_cleanup)(); /* routine called to cleanup state */ char *tif_data; /* compression scheme private data */ /* input/output buffering */ int tif_scanlinesize; /* # of bytes in a scanline */ int tif_scanlineskew; /* scanline skew for reading strips */ char *tif_rawdata; /* raw data buffer */ long tif_rawdatasize; /* # of bytes in raw data buffer */ char *tif_rawcp; /* current spot in raw buffer */ long tif_rawcc; /* bytes unread from raw buffer */ #ifdef MMAP_SUPPORT char* tif_base; /* base of mapped file */ long tif_size; /* size of mapped file region (bytes) */ #endif }; #define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0) #ifdef MMAP_SUPPORT #define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0) #else #define isMapped(tif) 0 /* force dead code */ #endif /* generic option bit names */ #define TIFF_OPT0 0x1 #define TIFF_OPT1 0x2 #define TIFF_OPT2 0x4 #define TIFF_OPT3 0x8 #define TIFF_OPT4 0x10 #define TIFF_OPT5 0x20 #define TIFF_OPT6 0x40 #define TIFF_OPT7 0x80 #include "tiffio.h" /* NB: the u_int casts are to silence certain ANSI-C compilers */ #ifdef howmany #undef howmany #endif #define howmany(x, y) ((((u_int)(x))+(((u_int)(y))-1))/((u_int)(y))) #ifdef roundup #undef roundup #endif #define roundup(x, y) (howmany(x,y)*((u_int)(y))) #if defined(c_plusplus) || defined(__cplusplus) || defined(__STDC__) || USE_PROTOTYPES #if defined(__cplusplus) extern "C" { #endif extern TIFFFieldInfo const *TIFFFindFieldInfo(u_short, TIFFDataType); extern TIFFFieldInfo const *TIFFFieldWithTag(u_short); extern void _TIFFgetfield(TIFFDirectory*, int, ...); extern int TIFFNoRowEncode(TIFF*, u_char*, int, u_int); extern int TIFFNoStripEncode(TIFF*, u_char*, int, u_int); extern int TIFFNoTileEncode(TIFF*, u_char*, int, u_int); extern int TIFFNoRowDecode(TIFF*, u_char*, int, u_int); extern int TIFFNoStripDecode(TIFF*, u_char*, int, u_int); extern int TIFFNoTileDecode(TIFF*, u_char*, int, u_int); #if defined(__cplusplus) } #endif #else extern TIFFFieldInfo const *TIFFFindFieldInfo(); extern TIFFFieldInfo const *TIFFFieldWithTag(); extern void _TIFFgetfield(); extern int TIFFNoRowEncode(); extern int TIFFNoStripEncode(); extern int TIFFNoTileEncode(); extern int TIFFNoRowDecode(); extern int TIFFNoStripDecode(); extern int TIFFNoTileDecode(); #endif #endif /* _TIFFIOP_ */ neuron-7.6.3/src/lib/Unidraw/000077500000000000000000000000001340731477100160125ustar00rootroot00000000000000neuron-7.6.3/src/lib/Unidraw/align.cpp000066400000000000000000000130511340731477100176100ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Alignment command implmentation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ ClassId AlignCmd::GetClassId () { return ALIGN_CMD; } bool AlignCmd::IsA (ClassId id) { return ALIGN_CMD == id || Command::IsA(id); } AlignCmd::AlignCmd (ControlInfo* c, Alignment a1, Alignment a2) : Command(c) { _align1 = a1; _align2 = a2; } AlignCmd::AlignCmd (Editor* ed, Alignment a1, Alignment a2) : Command(ed) { _align1 = a1; _align2 = a2; } Command* AlignCmd::Copy () { Command* copy = new AlignCmd(CopyControlInfo(), _align1, _align2); InitCopy(copy); return copy; } GraphicComp* AlignCmd::GetReference (GraphicComp* grcomp) { Clipboard* cb = GetClipboard(); Iterator i; cb->SetComp(grcomp, i); cb->Prev(i); if (cb->GetComp(i) == nil) { cb->First(i); } return cb->GetComp(i); } void AlignCmd::GetAlignment (Alignment& a1, Alignment& a2) { a1 = _align1; a2 = _align2; } void AlignCmd::Read (istream& in) { Command::Read(in); unsigned int align1, align2; in >> align1 >> align2; _align1 = align1; _align2 = align2; } void AlignCmd::Write (ostream& out) { Command::Write(out); out << _align1 << " " << _align2 << " "; } /*****************************************************************************/ ClassId AlignToGridCmd::GetClassId () { return ALIGNTOGRID_CMD; } bool AlignToGridCmd::IsA (ClassId id) { return ALIGNTOGRID_CMD == id || Command::IsA(id); } AlignToGridCmd::AlignToGridCmd (ControlInfo* c) : Command(c) { } AlignToGridCmd::AlignToGridCmd (Editor* ed) : Command(ed) { } Command* AlignToGridCmd::Copy () { Command* copy = new AlignToGridCmd(CopyControlInfo()); InitCopy(copy); return copy; } void AlignToGridCmd::Execute () { Selection* s = _editor->GetSelection(); if (!s->IsEmpty()) { Clipboard* cb = GetClipboard(); Iterator i; if (cb == nil) { for (s->First(i); !s->Done(i); s->Next(i)) { s->GetView(i)->Interpret(this); } SetClipboard(cb = new Clipboard); cb->Init(s); } else { for (cb->First(i); !cb->Done(i); cb->Next(i)) { Move(cb->GetComp(i)); } } unidraw->Update(); } } void AlignToGridCmd::Unexecute () { Clipboard* cb = GetClipboard(); if (cb != nil) { Iterator i; for (cb->Last(i); !cb->Done(i); cb->Prev(i)) { Unmove(cb->GetComp(i)); } unidraw->Update(); } } void AlignToGridCmd::Align (GraphicView* gv, float refx, float refy) { MoveData* md = (MoveData*) Recall(gv->GetGraphicComp()); if (md == nil) { Viewer* v = gv->GetViewer(); Grid* grid = (v == nil) ? nil : v->GetGrid(); if (grid == nil) { return; } Graphic* g = gv->GetGraphic(); Transformer t; g->Parent()->TotalTransformation(t); t.Invert(); Coord cx = iv26_round(refx); Coord cy = iv26_round(refy); grid->Constrain(cx, cy); float dx, dy, trefx, trefy; t.Transform(float(cx), float(cy), dx, dy); t.Transform(refx, refy, trefx, trefy); dx -= trefx; dy -= trefy; Store(gv->GetGraphicComp(), new MoveData(dx, dy)); } Move(gv->GetGraphicComp()); } void AlignToGridCmd::Unalign (GraphicView* gv) { Unmove(gv->GetGraphicComp());} void AlignToGridCmd::Move (GraphicComp* gc) { MoveData* md = (MoveData*) Recall(gc); if (md != nil) { MoveCmd movement(GetEditor(), md->_dx, md->_dy); gc->Interpret(&movement); } } void AlignToGridCmd::Unmove (GraphicComp* gc) { MoveData* md = (MoveData*) Recall(gc); if (md != nil) { MoveCmd movement(GetEditor(), md->_dx, md->_dy); gc->Uninterpret(&movement); } } neuron-7.6.3/src/lib/Unidraw/brushcmd.cpp000066400000000000000000000045301340731477100203270ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Brush command implmentation. */ #include #include #include #include #include #include #include /*****************************************************************************/ ClassId BrushCmd::GetClassId () { return BRUSH_CMD; } bool BrushCmd::IsA (ClassId id) { return BRUSH_CMD == id || Command::IsA(id); } BrushCmd::BrushCmd (ControlInfo* c, PSBrush* b) : Command(c) { _br = b; } BrushCmd::BrushCmd (Editor* ed, PSBrush* b) : Command(ed) { _br = b; } Command* BrushCmd::Copy () { Command* copy = new BrushCmd(CopyControlInfo(), GetBrush()); InitCopy(copy); return copy; } void BrushCmd::Execute () { BrushVar* brVar = (BrushVar*) GetEditor()->GetState("BrushVar"); if (brVar != nil) { brVar->SetBrush(GetBrush()); } Command::Execute(); } void BrushCmd::Read (istream& in) { Command::Read(in); _br = unidraw->GetCatalog()->ReadBrush(in); } void BrushCmd::Write (ostream& out) { Command::Write(out); unidraw->GetCatalog()->WriteBrush(GetBrush(), out); } neuron-7.6.3/src/lib/Unidraw/catalog.cpp000066400000000000000000001447411340731477100201430ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Catalog implementation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_OSFCN_H #include #endif #include #include #include #if !defined(HAVE_SSTREAM) #include #endif #if HAVE_UNISTD_H #include #endif #include #ifdef __DECCXX extern "C" { extern int access(char*, int); extern int unlink(char*); } #endif /*****************************************************************************/ static const int nograylevel = -1; static const int hex_encode = 6; static const int hex_gray_encode = 2; static char buf[CHARBUFSIZE]; static const unsigned int color_base = 255; // 2^color_depth - 1 static char hexcharmap[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; static unsigned int hexintmap[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static const char* HexEncode ( ColorIntensity ir, ColorIntensity ig, ColorIntensity ib ) { unsigned int r = iv26_round(ir * color_base); unsigned int g = iv26_round(ig * color_base); unsigned int b = iv26_round(ib * color_base); static char enc[hex_encode+1]; enc[hex_encode] = '\0'; enc[0] = hexcharmap[r >> 4 & 0xf]; enc[1] = hexcharmap[r & 0xf]; enc[2] = hexcharmap[g >> 4 & 0xf]; enc[3] = hexcharmap[g & 0xf]; enc[4] = hexcharmap[b >> 4 & 0xf]; enc[5] = hexcharmap[b & 0xf]; return enc; } static void HexDecode ( const char* enc, ColorIntensity& ir, ColorIntensity& ig, ColorIntensity& ib ) { unsigned int r, g, b; r = hexintmap[enc[0]] << 4; r |= hexintmap[enc[1]]; g = hexintmap[enc[2]] << 4; g |= hexintmap[enc[3]]; b = hexintmap[enc[4]] << 4; b |= hexintmap[enc[5]]; ir = float(r) / float(color_base); ig = float(g) / float(color_base); ib = float(b) / float(color_base); } static const char* HexGrayEncode ( ColorIntensity ir, ColorIntensity ig, ColorIntensity ib ) { ColorIntensity igray = 0.30 * ir + 0.59 * ig + 0.11 * ib; unsigned int gray = iv26_round(igray * color_base); static char enc[hex_gray_encode+1]; enc[hex_gray_encode] = '\0'; enc[0] = hexcharmap[gray >> 4 & 0xf]; enc[1] = hexcharmap[gray & 0xf]; return enc; } static void HexGrayDecode (const char* enc, ColorIntensity& ig) { unsigned int g; g = hexintmap[enc[0]] << 4; g |= hexintmap[enc[1]]; ig = float(g) / float(color_base); } /*****************************************************************************/ class NameMapElem : public UMapElem { public: NameMapElem(void*, const char*); virtual ~NameMapElem(); virtual void* id(); virtual void* tag(); private: void Init(void*, const char*); private: void* _object; char* _string; }; void NameMapElem::Init (void* object, const char* string) { _object = object; _string = strnew(string); } NameMapElem::NameMapElem (void* object, const char* string) { Init(object, string); } NameMapElem::~NameMapElem () { delete [] _string; } void* NameMapElem::id () { return _object; } void* NameMapElem::tag () { return (void*) _string; } /*****************************************************************************/ class NameMap : public UMap { public: NameMap(); void Register(void* obj, const char* name); void Unregister(void* obj); void Unregister(const char* name); void* GetObject(const char*); const char* GetName(void* obj); protected: virtual UMapElem* FindTag(void*); }; NameMap::NameMap () { } void NameMap::Register (void* object, const char* name) { UMap::Register(new NameMapElem(object, name)); } void NameMap::Unregister (void* object) { UMapElem* elem = FindId(object); if (elem != nil) { UMap::Unregister(elem); delete elem; } } void NameMap::Unregister (const char* name) { UMapElem* elem = FindTag((void*) name); if (elem != nil) { UMap::Unregister(elem); delete elem; } } void* NameMap::GetObject (const char* name) { UMapElem* elem = FindTag((void*) name); return (elem == nil) ? nil : elem->id(); } const char* NameMap::GetName (void* object) { UMapElem* elem = FindId(object); return (elem == nil) ? nil : (char*) elem->tag(); } UMapElem* NameMap::FindTag (void* tag) { const char* string = (char*) tag; for (int i = 0; i < _elems.Count(); ++i) { const char* elemString = (char*) Elem(i)->tag(); if (strcmp(string, elemString) == 0) { return (UMapElem*) _elems[i]; } } return nil; } /*****************************************************************************/ inline PSBrush* getbr (UList* u) { return (PSBrush*) (*u)(); } inline PSColor* getcolor (UList* u) { return (PSColor*) (*u)(); } inline PSFont* getfont (UList* u) { return (PSFont*) (*u)(); } inline PSPattern* getpat (UList* u) { return (PSPattern*) (*u)(); } Catalog::Catalog (const char* domainName, Creator* creator, float version) { _name = strnew(domainName); _creator = creator; _version = version; _brs = new UList; _colors = new UList; _fonts = new UList; _pats = new UList; _curMap = nil; _substMap = new ObjectMap(nil, COMPONENT); _clipboard = new Clipboard; #if defined(__xlC__) || defined(__GNUG__) || defined(__PGIC__) _tmpfile = nil; #endif _edInfoMap = new NameMap; _compMap = new NameMap; _cmdMap = new NameMap; _toolMap = new NameMap; } void Catalog::Init (World* w) { _world = w; const char* fg = GetAttribute("foreground"); const char* bg = GetAttribute("background"); const char* font = GetAttribute("font"); pssingle = FindBrush(0xffff, 0); psnonebr = FindNoneBrush(); psblack = FindColor((fg == nil) ? "Black" : fg); pswhite = FindColor((bg == nil) ? "White" : bg); psstdfont = FindFont((font == nil) ? "fixed" : font, "fixed", "12"); pssolid = FindGrayLevel(0.0); psclear = FindGrayLevel(1.0); psnonepat = FindNonePattern(); stdgraphic = new FullGraphic; stdgraphic->FillBg(true); stdgraphic->SetColors(psblack, pswhite); stdgraphic->SetPattern(pssolid); stdgraphic->SetBrush(pssingle); stdgraphic->SetFont(psstdfont); } static void deleteBrushes (UList* brs) { while (!brs->IsEmpty()) { UList* u = brs->First(); brs->Remove(u); PSBrush* br = getbr(u); Unref(br); } } static void deleteColors (UList* colors) { while (!colors->IsEmpty()) { UList* u = colors->First(); colors->Remove(u); PSColor* color = getcolor(u); Unref(color); } } static void deleteFonts (UList* fonts) { while (!fonts->IsEmpty()) { UList* u = fonts->First(); fonts->Remove(u); PSFont* font = getfont(u); Unref(font); } } static void deletePatterns (UList* pats) { while (!pats->IsEmpty()) { UList* u = pats->First(); pats->Remove(u); PSPattern* pat = getpat(u); Unref(pat); } } Catalog::~Catalog () { deleteBrushes(_brs); deleteColors(_colors); deleteFonts(_fonts); deletePatterns(_pats); delete [] _name; delete _brs; delete _colors; delete _fonts; delete _pats; delete _substMap; delete _edInfoMap; delete _compMap; delete _cmdMap; delete _toolMap; _clipboard->DeleteComps(); delete _clipboard; #if defined(__xlC__) || defined(__GNUG__) || defined(__PGIC__) if (_tmpfile != nil) { unlink(_tmpfile); delete _tmpfile; } #endif } bool Catalog::Save (EditorInfo* edInfo, const char* name) { filebuf fbuf; bool ok = fbuf.open((char*) name, IOS_OUT) != 0; if (ok) { ostream out(&fbuf); WriteEditorInfo(edInfo, out); ok = out.good(); if (ok) { _edInfoMap->Unregister(name); _edInfoMap->Register(edInfo, name); } } return ok; } bool Catalog::Save (Component* comp, const char* name) { ObjectMap* prevMap = _curMap; ObjectMap objmap(comp, COMPONENT); _curMap = &objmap; bool ok = FileSave((void*) comp, COMPONENT, name); if (ok) { _compMap->Unregister(name); _compMap->Register(comp, name); } _curMap = prevMap; return ok; } bool Catalog::Save (Command* cmd, const char* name) { ObjectMap* prevMap = _curMap; ObjectMap objmap(cmd, COMMAND); _curMap = &objmap; bool ok = FileSave((void*) cmd, COMMAND, name); if (ok) { _cmdMap->Unregister(name); _cmdMap->Register(cmd, name); } _curMap = prevMap; return ok; } bool Catalog::Save (Tool* tool, const char* name) { ObjectMap* prevMap = _curMap; ObjectMap objmap(tool, TOOL); _curMap = &objmap; bool ok = FileSave((void*) tool, TOOL, name); _curMap = prevMap; if (ok) { _toolMap->Unregister(name); _toolMap->Register(tool, name); } return ok; } bool Catalog::Retrieve (const char* name, EditorInfo*& edInfo) { bool ok = true; edInfo = (EditorInfo*) _edInfoMap->GetObject(name); if (edInfo == nil) { filebuf fbuf; ok = fbuf.open((char*) name, IOS_IN) != 0; if (ok) { istream in(&fbuf); edInfo = ReadEditorInfo(in); ok = !in.bad(); if (ok) { _edInfoMap->Unregister(name); _edInfoMap->Register(edInfo, name); } } } return ok; } bool Catalog::Retrieve (const char* name, Component*& comp) { bool ok = true; comp = (Component*) _compMap->GetObject(name); if (comp == nil) { ObjectMap* prevMap = _curMap; ObjectMap objmap(comp, COMPONENT); _curMap = &objmap; ok = FileRetrieve(name, (void*&) comp); if (ok) { _compMap->Unregister(name); _compMap->Register(comp, name); } _curMap = prevMap; } return ok; } bool Catalog::Retrieve (const char* name, Command*& cmd) { bool ok = true; cmd = (Command*) _cmdMap->GetObject(name); if (cmd == nil) { ObjectMap* prevMap = _curMap; ObjectMap objmap(cmd, COMMAND); _curMap = &objmap; ok = FileRetrieve(name, (void*&) cmd); if (ok) { _cmdMap->Unregister(name); _cmdMap->Register(cmd, name); } _curMap = prevMap; } return ok; } bool Catalog::Retrieve (const char* name, Tool*& tool) { bool ok = true; tool = (Tool*) _toolMap->GetObject(name); if (tool == nil) { ObjectMap* prevMap = _curMap; ObjectMap objmap(tool, TOOL); _curMap = &objmap; ok = FileRetrieve(name, (void*&) tool); if (ok) { _toolMap->Unregister(name); _toolMap->Register(tool, name); } _curMap = prevMap; } return ok; } bool Catalog::Valid (const char* name, EditorInfo*& obj) { obj = (EditorInfo*) _edInfoMap->GetObject(name); return obj != nil; } bool Catalog::Valid (const char* name, Component*& obj) { obj = (Component*) _compMap->GetObject(name); return obj != nil; } bool Catalog::Valid (const char* name, Command*& obj) { obj = (Command*) _cmdMap->GetObject(name); return obj != nil; } bool Catalog::Valid (const char* name, Tool*& obj) { obj = (Tool*) _toolMap->GetObject(name); return obj != nil; } void Catalog::Forget (void* object, const char* name, NameMap* map) { if (name == nil) { map->Unregister(object); } else { map->Unregister(name); } _substMap->Unregister(object); } void Catalog::Forget (EditorInfo* edInfo, const char* name) { Forget(edInfo, name, _edInfoMap); } void Catalog::Forget (Component* comp, const char* name) { Forget(comp, name, _compMap); } void Catalog::Forget (Command* cmd, const char* name) { Forget(cmd, name, _cmdMap); } void Catalog::Forget (Tool* tool, const char* name) { Forget(tool, name, _toolMap); } Component* Catalog::Copy (Component* comp) { return (Component*) CopyObject(comp, COMPONENT); } Command* Catalog::Copy (Command* cmd) { return (Command*) CopyObject(cmd, COMMAND); } Tool* Catalog::Copy (Tool* tool) { return (Tool*) CopyObject(tool, TOOL); } void Catalog::SetClipboard (Clipboard* o) { _clipboard = o; } void Catalog::SetEditorInfo (EditorInfo* o) { _edInfo = o; } const char* Catalog::GetName (EditorInfo* edInfo) { return _edInfoMap->GetName(edInfo); } const char* Catalog::GetName (Component* comp) { return _compMap->GetName(comp); } const char* Catalog::GetName (Command* cmd) { return _cmdMap->GetName(cmd); } const char* Catalog::GetName (Tool* tool) { return _toolMap->GetName(tool); } void* Catalog::ReadObject (istream& in) { void* obj = nil; int inst_id; ClassId subst_id; const char* delim_ptr; char delim[CHARBUFSIZE]; ClassId classId = ReadClassId(in, inst_id, subst_id, delim_ptr); if (subst_id != UNDEFINED_CLASS) { strcpy(delim, delim_ptr); } if (classId != UNDEFINED_CLASS) { if (_curMap != nil && inst_id) { obj = _curMap->GetObject(inst_id); if (obj == nil) { obj = _creator->Create(classId, in, _curMap, inst_id); } } else { obj = _creator->Create(classId, in); } } if (FileVersion() >= UV_ORIGINAL && subst_id != UNDEFINED_CLASS) { if (obj == nil) { obj = ReadSubstObject(in, inst_id, classId, subst_id, delim); } else { in >> buf; } } return obj; } void* Catalog::ReadSubstObject ( istream& in, int inst_id, ClassId orig_id, ClassId subst_id, const char* delim ) { void* obj = _creator->Create(subst_id, in, _curMap, inst_id); if (inst_id == _curMap->GetId(obj)) { UArray* extra_data = new UArray(64); ReadExtraData(in, delim, extra_data); _substMap->Register(obj, inst_id, orig_id, delim, extra_data); } return obj; } static bool FoundDelim (const char* delim, UArray& data) { int n_delim = strlen(delim); int n_data = data.Count(); bool found = n_data >= n_delim; if (found) { int j = n_data - n_delim; for (int i = 0; i < n_delim; ++i, ++j) { char c = (long) data[j]; if (delim[i] != c) { found = false; break; } } } return found; } void Catalog::ReadExtraData ( istream& in, const char* delim, UArray* extra_data ) { for (int i = 0; !in.eof() && !FoundDelim(delim, *extra_data); ++i) { char c; in.get(c); extra_data->Insert((void*) (long) c, i); } } extern char* iv_mytmpnam(char*); void* Catalog::CopyObject (void* obj, ClassId base_id) { void* copy = nil; ObjectMap* prev_subst_map = _substMap; // no substitution magic for ObjectMap empty_subst_map(obj, base_id); // copies _substMap = &empty_subst_map; #if defined(__xlC__) || defined(__GNUG__) || defined(__PGIC__) filebuf obuf, ibuf; ObjectMap* prevMap = _curMap; char* prevTmp = _tmpfile; static int stackLvl; if (_tmpfile == nil || ++stackLvl > 1) { // _tmpfile = tempnam("/tmp", ".udcp"); _tmpfile = iv_mytmpnam(NULL); } bool ok = obuf.open(_tmpfile, IOS_OUT) != 0; if (ok) { ObjectMap omap(obj, base_id); ostream out(&obuf); _curMap = &omap; ok = SaveObject(obj, base_id, out); out.flush(); obuf.close(); } if (ok) { ObjectMap imap(copy, base_id); istream in(&ibuf); _curMap = &imap; ok = ibuf.open(_tmpfile, IOS_IN) != 0 && RetrieveObject(in, copy); } if (!ok) { cerr << "Unidraw error: couldn't copy object (/tmp unwritable?)\n"; } if (--stackLvl > 0 || !ok) { prevTmp = (_tmpfile == prevTmp) ? nil : prevTmp; delete _tmpfile; _tmpfile = prevTmp; } _curMap = prevMap; #else ObjectMap* prevMap = _curMap; ObjectMap omap(obj, base_id), imap(copy, base_id); strstream inout; _curMap = &omap; bool ok = SaveObject(obj, base_id, inout); if (ok) { _curMap = &imap; ok = RetrieveObject(inout, copy); } if (!ok) { cerr << "Unidraw error: couldn't copy object\n"; } _curMap = prevMap; #endif _substMap = prev_subst_map; return copy; } Component* Catalog::ReadComponent (istream& in) { return (Component*) ReadObject(in); } Command* Catalog::ReadCommand (istream& in) { return (Command*) ReadObject(in); } Tool* Catalog::ReadTool (istream& in) { return (Tool*) ReadObject(in); } StateVar* Catalog::ReadStateVar (istream& in) { return (StateVar*) ReadObject(in); } TransferFunct* Catalog::ReadTransferFunct (istream& in) { return (TransferFunct*) ReadObject(in); } void Catalog::WriteComponent (Component* comp, ostream& out){ WriteObject(comp, COMPONENT, out); } void Catalog::WriteCommand (Command* cmd, ostream& out) { WriteObject(cmd, COMMAND, out); } void Catalog::WriteTool (Tool* tool, ostream& out) { WriteObject(tool, TOOL, out); } void Catalog::WriteStateVar (StateVar* stateVar, ostream& out) { WriteObject(stateVar, STATE_VAR, out); } void Catalog::WriteTransferFunct (TransferFunct* transfn, ostream& out) { WriteObject(transfn, TRANSFER_FUNCT, out); } static ClassId Narrow (void* obj, ClassId base_id) { switch (base_id) { case COMPONENT: return ((Component*) obj)->GetClassId(); case COMMAND: return ((Command*) obj)->GetClassId(); case TOOL: return ((Tool*) obj)->GetClassId(); case STATE_VAR: return ((StateVar*) obj)->GetClassId(); case TRANSFER_FUNCT: return ((TransferFunct*) obj)->GetClassId(); default: return UNDEFINED_CLASS; } } static ClassId NarrowSubst (void* obj, ClassId base_id, const char*& delim) { switch (base_id) { case COMPONENT: return ((Component*) obj)->GetSubstId(delim); case COMMAND: return ((Command*) obj)->GetSubstId(delim); case TOOL: return ((Tool*) obj)->GetSubstId(delim); case STATE_VAR: return ((StateVar*) obj)->GetSubstId(delim); case TRANSFER_FUNCT: return ((TransferFunct*) obj)->GetSubstId(delim); default: return UNDEFINED_CLASS; } } void Catalog::WriteIt (void* obj, ClassId base_id, ostream& out) { switch (base_id) { case COMPONENT: ((Component*) obj)->Write(out); break; case COMMAND: ((Command*) obj)->Write(out); break; case TOOL: ((Tool*) obj)->Write(out); break; case STATE_VAR: ((StateVar*) obj)->Write(out); break; case TRANSFER_FUNCT: ((TransferFunct*) obj)->Write(out); break; } UArray* extra_data = _substMap->GetExtraData(obj); if (extra_data == nil) { const char* delim; if (NarrowSubst(obj, base_id, delim) != UNDEFINED_CLASS) { out << delim; } } else { for (int i = 0; i < extra_data->Count(); ++i) { char c = (long) (*extra_data)[i]; out << c; } } } void Catalog::WriteObject (void* obj, ClassId base_id, ostream& out) { if (obj == nil) { WriteClassId(UNDEFINED_CLASS, out); } else if (_curMap == nil) { WriteClassId(obj, base_id, out); WriteIt(obj, base_id, out); } else { int id = _curMap->GetId(obj); if (id) { WriteClassId(obj, base_id, out, id); } else { id = (long) obj; _curMap->Register(obj, id); WriteClassId(obj, base_id, out, id); WriteIt(obj, base_id, out); } } } bool Catalog::SaveObject (void* obj, ClassId base_id, ostream& out) { WriteVersion(_version, out); WriteObject(obj, base_id, out); csolver->Write(out); return out.good(); } bool Catalog::RetrieveObject (istream& in, void*& obj) { _fileVersion = ReadVersion(in); obj = ReadObject(in); csolver->Read(in); return in.good(); } bool Catalog::FileSave (void* obj, ClassId base_id, const char* name) { filebuf fbuf; bool ok = fbuf.open((char*) name, IOS_OUT) != 0; if (ok) { ostream out(&fbuf); ok = SaveObject(obj, base_id, out); } return ok; } bool Catalog::FileRetrieve (const char* name, void*& obj) { filebuf fbuf; bool ok = fbuf.open((char*) name, IOS_IN) != 0; if (ok) { istream in(&fbuf); ok = RetrieveObject(in, obj); } return ok; } bool Catalog::Exists (const char* path) { /* cast workaround for DEC C++ prototype bug */ return access((char*)path, F_OK) >= 0; } bool Catalog::Writable (const char* path) { /* cast workaround for DEC C++ prototype bug */ return access((char*)path, W_OK) >= 0; } const char* Catalog::GetAttribute (const char* a) { return _world->GetAttribute(a); } const char* Catalog::Name (const char* name, int index) { sprintf(buf, "%s%d", name, index); return buf; } int Catalog::GetToken (istream& in, char* buf, int size) { int count = 0; for (int i = 0; i < size && !in.eof(); ++i) { in.get(buf[i]); ++count; if (isspace(buf[i])) { break; } } return count; } void Catalog::Skip (istream& in) { int len = strlen(MARK); while (GetToken(in, buf, CHARBUFSIZE) != 0) { if (strncmp(buf, MARK, len) == 0) { break; } } } void Catalog::Mark (ostream& out) { out << "\n" << MARK << " "; } float Catalog::ReadVersion (istream& in) { float version; Skip(in); in >> buf >> version; return version; } void Catalog::WriteVersion (float version, ostream& out) { out << MARK << " Unidraw " << version << " "; } ClassId Catalog::ReadClassId ( istream& in, int& id, ClassId& subst_id, const char*& delim ) { long classId; Skip(in); if (FileVersion() < UV_ORIGINAL) { in >> classId >> id; subst_id = UNDEFINED_CLASS; } else { long sid; in >> classId >> id >> sid; subst_id = (ClassId) sid; if (subst_id != UNDEFINED_CLASS) { in >> buf; delim = buf; } } return (ClassId) classId; } void Catalog::WriteClassId ( ClassId classId, ostream& out, int inst_id, ClassId subst_id, const char* delim ) { Mark(out); out << classId << " " << inst_id << " " << subst_id << " "; if (subst_id != UNDEFINED_CLASS) { out << delim << " "; } } void Catalog::WriteClassId ( void* obj, ClassId base_id, ostream& out, int inst_id ) { ClassId orig_id = _substMap->GetOrigClassId(obj); const char* delim; ClassId subst_id; if (orig_id == UNDEFINED_CLASS) { // wasn't an unknown class orig_id = Narrow(obj, base_id); subst_id = NarrowSubst(obj, base_id, delim); } else { subst_id = Narrow(obj, base_id); delim = _substMap->GetDelim(obj); } WriteClassId(orig_id, out, inst_id, subst_id, delim); } int Catalog::ReadBgFilled (istream& in) { int bgFilled; Skip(in); in >> bgFilled; return bgFilled; } void Catalog::WriteBgFilled (bool bgFilled, ostream& out) { Mark(out); out << (bgFilled ? 1 : 0) << " "; } Transformer* Catalog::ReadTransformer (istream& in) { Transformer* t = nil; char lookahead; Skip(in); in >> buf; if (buf[0] == 't') { in >> lookahead; if (lookahead != '~') { in.putback(lookahead); float a00, a01, a10, a11, a20, a21; in >> a00 >> a01 >> a10 >> a11 >> a20 >> a21; t = new Transformer(a00, a01, a10, a11, a20, a21); } } return t; } void Catalog::WriteTransformer (Transformer* t, ostream& out) { Mark(out); out << "t "; if (t == nil) { out << "~ "; } else { float a00, a01, a10, a11, a20, a21; t->GetEntries(a00, a01, a10, a11, a20, a21); out << a00 << " " << a01 << " " << a10 << " "; out << a11 << " " << a20 << " " << a21 << " "; } } void Catalog::WriteBrush (PSBrush* brush, ostream& out) { Mark(out); out << "b "; if (brush == nil) { out << "~ "; } else if (brush->None()) { out << "n "; } else { int p = brush->GetLinePattern(); int w = brush->Width(); out << p << " " << w << " "; } } PSBrush* Catalog::ReadBrush (istream& in) { PSBrush* brush = nil; Skip(in); in >> buf; if (buf[0] == 'b') { char lookahead = '~'; bool defined = true; bool none = false; int p = 0; int w = 0; in >> lookahead; switch (lookahead) { case '~': defined = false; break; case 'n': none = true; break; default: in.putback(lookahead); in >> p >> w; break; } if (defined && in.good()) { if (none) { brush = FindNoneBrush(); } else { brush = FindBrush(p, w); } } } return brush; } PSBrush* Catalog::FindNoneBrush () { PSBrush* brush = nil; for (UList* u = _brs->First(); u != _brs->End(); u = u->Next()) { brush = getbr(u); if (brush->None()) { return brush; } } brush = new PSBrush; Ref(brush); _brs->Append(new UList(brush)); return brush; } PSBrush* Catalog::FindBrush (int p, int w) { PSBrush* brush = nil; for (UList* u = _brs->First(); u != _brs->End(); u = u->Next()) { brush = getbr(u); if ( !brush->None() && brush->GetLinePattern() == p && brush->Width() == w ) { return brush; } } brush = new PSBrush(p, w); Ref(brush); _brs->Append(new UList(brush)); return brush; } PSBrush* Catalog::ReadBrush (const char* n, int index) { const char* def = GetAttribute(Name(n, index)); if (def == nil) { return nil; } char* definition = strnew(def); // some sscanfs write to their format... PSBrush* br = nil; int p, w; bool none = (definition[0] == 'n' || definition[0] == 'N'); if (none) { br = FindNoneBrush(); } else if (sscanf(definition, "%x %d", &p, &w) == 2) { br = FindBrush(p, w); } delete [] definition; return br; } void Catalog::WriteColor (PSColor* color, ostream& out) { Mark(out); out << "c "; if (color == nil) { out << "~ "; } else { const char* name = color->GetName(); out << name << " "; if (strcmp(name, "white") == 0 || strcmp(name, "White") == 0) { out << "1 1 1 "; } else { ColorIntensity r, g, b; color->GetIntensities(r, g, b); out << r << " " << g << " " << b << " "; } } } PSColor* Catalog::ReadColor (istream& in) { PSColor* color = nil; Skip(in); in >> buf; if (buf[0] == 'c') { char lookahead = '~'; bool defined = true; char name[CHARBUFSIZE]; ColorIntensity r = 0, g = 0, b = 0; in >> lookahead; if (lookahead == '~') { defined = false; } else { in.putback(lookahead); in >> name >> r >> g >> b; } if (defined && in.good()) { int ir = iv26_round(r * float(0xffff)); int ig = iv26_round(g * float(0xffff)); int ib = iv26_round(b * float(0xffff)); color = FindColor(name, ir, ig, ib); } } return color; } PSColor* Catalog::FindColor (const char* name, int ir, int ig, int ib) { PSColor* color = nil; for (UList* u = _colors->First(); u != _colors->End(); u = u->Next()) { color = getcolor(u); if (strcmp(color->GetName(), name) == 0) { return color; } } ColorIntensity r, g, b; if (!Color::find(World::current()->display(), name, r, g, b)) { r = float(ir) / float(0xffff); g = float(ig) / float(0xffff); b = float(ib) / float(0xffff); } color = new PSColor(r, g, b, name); Ref(color); _colors->Append(new UList(color)); return color; } PSColor* Catalog::ReadColor (const char* n, int index) { const char* def = GetAttribute(Name(n, index)); if (def == nil) { return nil; } char* definition = strnew(def); // some sscanfs write to their format... PSColor* color = nil; char name[CHARBUFSIZE]; int r = 0, g = 0, b = 0; if (sscanf(definition, "%s %d %d %d", name, &r, &g, &b) == 4) { color = FindColor(name, r, g, b); } else if (sscanf(definition, "%s", name) == 1) { color = FindColor(name); } delete [] definition; return color; } void Catalog::WriteFont (PSFont* font, ostream& out) { Mark(out); out << "f "; if (font == nil) { out << "~ "; } else { const char* name = font->GetName(); const char* pf = font->GetPrintFont(); const char* ps = font->GetPrintSize(); out << name << " /" << pf << " " << ps << " "; } } static void ReadName (istream& in, char* buf) { for (int i = 0; in.good(); ++i) { in >> buf[i]; if (buf[i] == '/') { in.putback(buf[i]); buf[i] = '\0'; break; } } } PSFont* Catalog::ReadFont (istream& in) { PSFont* font = nil; Skip(in); in >> buf; if (buf[0] == 'f') { char lookahead = '~'; bool defined = true; char name[CHARBUFSIZE]; char printfont[CHARBUFSIZE]; char printsize[CHARBUFSIZE]; in >> lookahead; if (lookahead == '~') { defined = false; } else { in.putback(lookahead); ReadName(in, name); in >> printfont; in >> printsize; } if (defined && in.good()) { font = FindFont(name, &printfont[1], printsize); } } return font; } PSFont* Catalog::FindFont (const char* name, const char* pf, const char* ps) { PSFont* font = nil; for (UList* u = _fonts->First(); u != _fonts->End(); u = u->Next()) { font = getfont(u); if ( strcmp(font->GetPrintFont(), pf) == 0 && strcmp(font->GetPrintSize(), ps) == 0 ) { return font; } } if (Font::exists(World::current()->display(), name)) { font = new PSFont(name, pf, ps); } else { fprintf(stderr, "invalid font name %s, ", name); fprintf(stderr, "substituting fixed font\n"); font = new PSFont("fixed", pf, ps); } Ref(font); _fonts->Append(new UList(font)); return font; } static void NoTrailingSpace (char* string) { char* spc = &string[strlen(string)]; do { *spc = '\0'; } while (spc > string && isspace(*--spc)); } static char* LastWord (char* string) { NoTrailingSpace(string); char* spc = &string[strlen(string)]; while (spc > string && !isspace(*--spc)); return (spc == string) ? spc : spc+1; } PSFont* Catalog::ReadFont (const char* n, int index) { const char* def = GetAttribute(Name(n, index)); if (def == nil) { return nil; } char* definition = strnew(def); PSFont* font = nil; char pf[CHARBUFSIZE]; char ps[CHARBUFSIZE]; char* last_word = LastWord(definition); if (last_word >= definition) { strcpy(ps, last_word); *last_word = '\0'; last_word = LastWord(definition); if (last_word >= definition) { strcpy(pf, last_word); *last_word = '\0'; NoTrailingSpace(definition); font = FindFont(definition, pf, ps); } } delete [] definition; return font; } static int CalcBitmap (float graylevel) { static const int SHADES = 17; static int shades[SHADES] = { 0xffff, 0xefff, 0xefbf, 0xafbf, 0xafaf, 0xadaf, 0xada7, 0xa5a7, 0xa5a5, 0x85a5, 0x8525, 0x0525, 0x0505, 0x0405, 0x0401, 0x0001, 0x0000 }; return shades[iv26_round(graylevel * (SHADES - 1))]; } static const int* ExpandToFullSize (const int* orig_data, int size) { static int data[patternHeight]; Memory::copy(orig_data, data, patternHeight*sizeof(int)); if (size == 1) { int seed = data[0]; for (int i = 0; i < 4; i++) { data[i] = (seed & 0xf000) >> 12; data[i] |= data[i] << 4; data[i] |= data[i] << 8; data[i+4] = data[i]; data[i+8] = data[i]; data[i+12] = data[i]; seed <<= 4; } } else if (size == 8) { for (int i = 0; i < 8; i++) { data[i] &= 0xff; data[i] |= data[i] << 8; data[i+8] = data[i]; } } else if (size == patternHeight) { const unsigned int patternWidthMask = ~(~(0u) << patternWidth); for (int i = 0; i < patternHeight; i++) { data[i] &= patternWidthMask; } } else { fprintf(stderr, "invalid size passed to ExpandToFullSize\n"); } return data; } void Catalog::WritePattern (PSPattern* pattern, ostream& out) { Mark(out); out << "p "; if (pattern == nil) { out << "~ "; } else if (pattern->None()) { out << "n "; } else if (pattern->GetSize() > 0) { const int* data = pattern->GetData(); int size = pattern->GetSize(); out << "< "; if (size <= 8) { for (int i = 0; i < 8; i++) { sprintf(buf, "%02x", data[i] & 0xff); out << buf << " "; } } else { for (int i = 0; i < patternHeight; i++) { sprintf(buf, "%0*x", patternWidth/4, data[i]); out << buf << " "; } } out << "> " << nograylevel << " "; } else { float graylevel = pattern->GetGrayLevel(); out << graylevel << " "; } } PSPattern* Catalog::ReadPattern (istream& in) { PSPattern* pattern = nil; Skip(in); in >> buf; if (buf[0] == 'p') { char lookahead = '~'; bool defined = true; bool none = false; float graylevel = 0; int data[patternHeight]; int size = 0; in >> lookahead; switch (lookahead) { case '~': defined = false; break; case 'n': none = true; break; case '<': graylevel = nograylevel; break; default: in.putback(lookahead); break; } if (defined && !none && graylevel != nograylevel) { in >> graylevel; } else if (graylevel == nograylevel) { int i; for (i = 0; in >> buf && i < patternHeight; i++) { if (buf[0] == '>' || sscanf(buf, "%x", &data[i]) != 1) { break; } } if (buf[0] == '>') { size = i; } else { defined = false; } } if (defined && in.good()) { if (none) { pattern = FindNonePattern(); } else if (graylevel != nograylevel) { pattern = FindGrayLevel(graylevel); } else { pattern = FindPattern(data, size); } } } return pattern; } PSPattern* Catalog::FindNonePattern () { PSPattern* pattern = nil; for (UList* u = _pats->First(); u != _pats->End(); u = u->Next()) { pattern = getpat(u); if (pattern->None()) { return pattern; } } pattern = new PSPattern; Ref(pattern); _pats->Append(new UList(pattern)); return pattern; } PSPattern* Catalog::FindGrayLevel (float graylevel) { PSPattern* pattern = nil; for (UList* u = _pats->First(); u != _pats->End(); u = u->Next()) { pattern = getpat(u); if (pattern->GetGrayLevel() == graylevel) { return pattern; } } int shade = CalcBitmap(graylevel); pattern = new PSPattern(shade, graylevel); Ref(pattern); _pats->Append(new UList(pattern)); return pattern; } PSPattern* Catalog::FindPattern (int orig_data[patternHeight], int size) { PSPattern* pattern = nil; const int* data = ExpandToFullSize(orig_data, size); for (UList* u = _pats->First(); u != _pats->End(); u = u->Next()) { pattern = getpat(u); if (pattern->GetSize() != 0) { const int* cmpdata = pattern->GetData(); if (!Memory::compare(data, cmpdata, patternHeight * sizeof(int))) { return pattern; } } } pattern = new PSPattern(data, size); Ref(pattern); _pats->Append(new UList(pattern)); return pattern; } PSPattern* Catalog::ReadPattern (const char* n, int index) { const char* def = GetAttribute(Name(n, index)); if (def == nil) { return nil; } char* definition = strnew(def); // some sscanfs write to their format... PSPattern* pat = nil; bool none = (definition[0] == 'n' || definition[0] == 'N'); if (none) { pat = FindNonePattern(); } else { if (strchr(definition, '.') != nil) { float graylevel; if (sscanf(definition, "%f", &graylevel) == 1) { pat = FindGrayLevel(graylevel); } } else { #if defined(HAVE_SSTREAM) istringstream in(definition); #else istrstream in(definition, strlen(definition) + 1); #endif int data[patternHeight]; int i; for (i = 0; in >> buf && i < patternHeight; i++) { if (sscanf(buf, "%x", &data[i]) != 1) { break; } } if (i == 1 || i == 8 || i == patternHeight) { pat = FindPattern(data, i); } } } delete [] definition; return pat; } inline void GetString (char* string, int count, istream& in) { for (char* p = string; p < &string[count]; in.get(*p++)); } char* Catalog::ReadString (istream& in) { int count; char quotes; char* string = nil; Skip(in); in >> count; if (count >= 0) { in >> quotes; string = new char[count+1]; GetString(string, count, in); in >> quotes; string[count] = '\0'; } return string; } void Catalog::WriteString (const char* string, ostream& out) { Mark(out); if (string == nil) { out << -1; } else { out << strlen(string) << "\"" << string << "\""; } } Bitmap* Catalog::ReadBitmap (istream& in) { Skip(in); Coord w, h; in >> w >> h; Bitmap* bitmap = new Bitmap((void*) nil, w, h); ReadBitmapData(bitmap, in); return bitmap; } void Catalog::ReadBitmapData (Bitmap* bitmap, istream& in) { Coord w = bitmap->Width(); Coord h = bitmap->Height(); for (int j = h-1; j >= 0; --j) { Skip(in); for (int k = 0; k < w; k += 4) { char hexchar; in >> hexchar; unsigned int val = hexintmap[hexchar]; int i = k; if (i < w) bitmap->poke(val & 0x8, i++, j); if (i < w) bitmap->poke(val & 0x4, i++, j); if (i < w) bitmap->poke(val & 0x2, i++, j); if (i < w) bitmap->poke(val & 0x1, i, j); } } bitmap->flush(); } void Catalog::WriteBitmap (Bitmap* bitmap, ostream& out) { Mark(out); Coord w = bitmap->Width(); Coord h = bitmap->Height(); out << w << " " << h; WriteBitmapData(bitmap, out); } void Catalog::WriteBitmapData (Bitmap* bitmap, ostream& out) { Coord w = bitmap->Width(); Coord h = bitmap->Height(); for (int j = h-1; j >= 0; --j) { Mark(out); int nybbles = 0; for (int k = 0; k < w; k += 4) { unsigned int bits = 0; for (int i = k; i < k+4 && k < w; ++i) { unsigned int val = bitmap->peek(i, j); int pos = 3 - i % 4; bits |= val << pos; } out << hexcharmap[bits]; ++nybbles; } if (nybbles%2 != 0) { out << '0'; } } } Raster* Catalog::ReadGraymap (istream& in) { Skip(in); Coord w, h; in >> w >> h; Raster* raster = new Raster(w, h); ReadGraymapData(raster, in); return raster; } void Catalog::ReadGraymapData (Raster* raster, istream& in) { Coord w = raster->Width(); Coord h = raster->Height(); ColorIntensity g; char enc[hex_gray_encode+1]; enc[hex_gray_encode] = '\0'; for (int j = h-1; j >= 0; --j) { Skip(in); for (int i = 0; i < w; ++i) { in.get(enc, hex_gray_encode+1); HexGrayDecode(enc, g); raster->poke(i, j, g, g, g, 1); } } raster->flush(); } void Catalog::WriteGraymap (Raster* raster, ostream& out) { Mark(out); Coord w = raster->Width(); Coord h = raster->Height(); out << w << " " << h; WriteGraymapData(raster, out); } void Catalog::WriteGraymapData (Raster* raster, ostream& out) { Coord w = raster->Width(); Coord h = raster->Height(); ColorIntensity r, g, b; float alpha; for (int j = h-1; j >= 0; --j) { Mark(out); for (int i = 0; i < w; ++i) { raster->peek(i, j, r, g, b, alpha); out << HexGrayEncode(r, g, b); } } } Raster* Catalog::ReadRaster (istream& in) { Skip(in); Coord w, h; in >> w >> h; Raster* raster = new Raster(w, h); ReadRasterData(raster, in); return raster; } void Catalog::ReadRasterData (Raster* raster, istream& in) { Coord w = raster->Width(); Coord h = raster->Height(); ColorIntensity r, g, b; char enc[hex_encode+1]; enc[hex_encode] = '\0'; for (int j = h-1; j >= 0; --j) { Skip(in); for (int i = 0; i < w; ++i) { in.get(enc, hex_encode+1); HexDecode(enc, r, g, b); raster->poke(i, j, r, g, b, 1); } } raster->flush(); } void Catalog::WriteRaster (Raster* raster, ostream& out) { Mark(out); Coord w = raster->Width(); Coord h = raster->Height(); out << w << " " << h; WriteRasterData(raster, out); } void Catalog::WriteRasterData (Raster* raster, ostream& out) { Coord w = raster->Width(); Coord h = raster->Height(); ColorIntensity r, g, b; float alpha; for (int j = h-1; j >= 0; --j) { Mark(out); for (int i = 0; i < w; ++i) { raster->peek(i, j, r, g, b, alpha); out << HexEncode(r, g, b); } } } ControlInfo* Catalog::ReadControlInfo (istream& in) { ControlInfo* ctrlInfo = nil; Skip(in); in >> buf; if (buf[0] == 'i') { char lookahead = '~'; in >> lookahead; if (lookahead != '~') { in.putback(lookahead); GraphicComp* label = (GraphicComp*) ReadComponent(in); char* klbl = ReadString(in); char* kcode = ReadString(in); ctrlInfo = new ControlInfo(label, klbl, kcode); delete klbl; delete kcode; } } return ctrlInfo; } void Catalog::WriteControlInfo (ControlInfo* ctrlInfo, ostream& out) { Mark(out); out << "i "; if (ctrlInfo == nil) { out << "~ "; } else { WriteComponent(ctrlInfo->GetLabel(), out); WriteString(ctrlInfo->GetKeyLabel(), out); WriteString(ctrlInfo->GetKeyCode(), out); } } EditorInfo* Catalog::ReadEditorInfo (istream& in) { EditorInfo* edInfo = new EditorInfo; char string[CHARBUFSIZE]; char name[CHARBUFSIZE]; char info[CHARBUFSIZE]; char newline; /* extra "&& in.good()" is for libg++ */ while (!in.eof() && in.good()) { *string = '\0'; in.get(string, CHARBUFSIZE); in.get(newline); int argc = sscanf(string, "%s %s", name, info); if (argc > 0 && *name == '#') { // comment; do nothing } else if (argc == 1) { edInfo->Register(name); } else if (argc == 2) { edInfo->Register(name, info); } } return edInfo; } void Catalog::WriteEditorInfo (EditorInfo* edInfo, ostream& out) { for (int i = 0; i < edInfo->Count(); ++i) { out << edInfo->GetName(i) << " " << edInfo->GetInfo(i) << "\n"; } } void Catalog::Register (EditorInfo* o, const char* name) { _edInfoMap->Register(o, name); } void Catalog::Register (Component* o, const char* name) { _compMap->Register(o, name); } void Catalog::Register (Command* o, const char* name) { _cmdMap->Register(o, name); } void Catalog::Register (Tool* o, const char* name) { _toolMap->Register(o, name); } /*****************************************************************************/ class VoidIntElem : public UMapElem { public: VoidIntElem(void*, int); virtual void* id(); virtual void* tag(); private: void* _object; int _id; }; VoidIntElem::VoidIntElem (void* object, int id) { _object = object; _id = id; } void* VoidIntElem::id () { return _object; } void* VoidIntElem::tag () { return (void*)long(_id); } /*****************************************************************************/ class ObjectMapElem : public UHashElem { public: ObjectMapElem(VoidIntElem*); ObjectMapElem( VoidIntElem*, ClassId orig_id, const char* delim, UArray* extra_data ); virtual ~ObjectMapElem(); void* GetObject(); long GetId(); ClassId GetOrigClassId(); const char* GetDelim(); UArray* GetExtraData(); public: VoidIntElem* _elem; private: ClassId _orig_id; char* _delim; UArray* _extra_data; }; ObjectMapElem::ObjectMapElem (VoidIntElem* elem) { _elem = elem; _orig_id = UNDEFINED_CLASS; _delim = nil; _extra_data = nil; } ObjectMapElem::ObjectMapElem ( VoidIntElem* elem, ClassId orig_id, const char* delim, UArray* extra_data ) { _elem = elem; _orig_id = orig_id; _delim = strnew(delim); _extra_data = extra_data; } ObjectMapElem::~ObjectMapElem () { delete [] _delim; delete _extra_data; } inline void* ObjectMapElem::GetObject () { return _elem->id(); } inline long ObjectMapElem::GetId () { return (long) _elem->tag(); } inline ClassId ObjectMapElem::GetOrigClassId () { return _orig_id; } inline const char* ObjectMapElem::GetDelim () { return _delim; } inline UArray* ObjectMapElem::GetExtraData () { return _extra_data; } /*****************************************************************************/ static const int SLOTS = 1000; /*****************************************************************************/ inline ObjectMapElem* ObjectMap::Find (void* obj) { return (ObjectMapElem*) _objKeys.Find(obj); } inline ObjectMapElem* ObjectMap::Find (int id) { return (ObjectMapElem*) _idKeys.Find((void*) long(id)); } ObjectMap::ObjectMap ( void* client, ClassId id ) : _objKeys(SLOTS), _idKeys(SLOTS) { _client = client; _id = id; } void ObjectMap::Register (void* obj, int id) { VoidIntElem* elem = new VoidIntElem(obj, id); UMap::Register(elem); ObjectMapElem* objElem = new ObjectMapElem(elem); ObjectMapElem* idElem = new ObjectMapElem(elem); _objKeys.Register(obj, objElem); _idKeys.Register((void*) long(id), idElem); } void ObjectMap::Register ( void* obj, int id, ClassId orig_id, const char* delim, UArray* extra_data ) { VoidIntElem* elem = new VoidIntElem(obj, id); UMap::Register(elem); ObjectMapElem* objElem = new ObjectMapElem( elem, orig_id, delim, extra_data ); ObjectMapElem* idElem = new ObjectMapElem(elem); _objKeys.Register(obj, objElem); _idKeys.Register((void*) long(id), idElem); } void ObjectMap::Unregister (void* obj) { ObjectMapElem* objElem = Find(obj); if (objElem != nil) { _idKeys.Unregister((void*) objElem->GetId()); _objKeys.Unregister(obj); } } void ObjectMap::Unregister (int id) { ObjectMapElem* idElem = Find(id); if (idElem != nil) { _objKeys.Unregister(idElem->GetObject()); _idKeys.Unregister((void*) long(id)); } } void* ObjectMap::GetClient () { return _client; } ClassId ObjectMap::GetClientId () { return _id; } void* ObjectMap::GetObject (int id) { ObjectMapElem* idElem = Find(id); return (idElem == nil) ? nil : idElem->GetObject(); } int ObjectMap::GetId (void* obj) { ObjectMapElem* objElem = Find(obj); return (objElem == nil) ? nil : objElem->GetId(); } ClassId ObjectMap::GetOrigClassId (void* obj) { ObjectMapElem* objElem = Find(obj); return (objElem == nil) ? UNDEFINED_CLASS : objElem->GetOrigClassId(); } const char* ObjectMap::GetDelim (void* obj) { ObjectMapElem* objElem = Find(obj); return (objElem == nil) ? nil : objElem->GetDelim(); } UArray* ObjectMap::GetExtraData (void* obj) { ObjectMapElem* objElem = Find(obj); return (objElem == nil) ? nil : objElem->GetExtraData(); } neuron-7.6.3/src/lib/Unidraw/catcmds.cpp000066400000000000000000000444021340731477100201400ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of cataloging commands. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_OSFCN_H #include #endif #include #include #include /*****************************************************************************/ static void UpdateCompNameVars () { Iterator i; for (unidraw->First(i); !unidraw->Done(i); unidraw->Next(i)) { Editor* ed = unidraw->GetEditor(i); CompNameVar* compNameVar = (CompNameVar*) ed->GetState("CompNameVar"); if (compNameVar != nil) compNameVar->UpdateName(); } } static bool Writable (Component* comp) { Catalog* catalog = unidraw->GetCatalog(); const char* name = catalog->GetName(comp); return name == nil || (catalog->Exists(name) && catalog->Writable(name)); } static bool OnlyOneEditorOf (Component* c) { Component* comp = c->GetRoot(); Iterator i; int count = 0; for (unidraw->First(i); !unidraw->Done(i) && count < 2; unidraw->Next(i)) { Component* test_comp = unidraw->GetEditor(i)->GetComponent(); if (test_comp != nil && test_comp->GetRoot() == comp) { ++count; } } return count == 1; } static bool ReadyToClose (Editor* ed) { ModifStatusVar* mv = (ModifStatusVar*) ed->GetState("ModifStatusVar"); if (mv != nil && Writable(mv->GetComponent()) && mv->GetModifStatus()) { ConfirmDialog dialog("Save changes?"); ed->InsertDialog(&dialog); char resp = dialog.Confirm(); ed->RemoveDialog(&dialog); if (resp == '\007') { return false; // confirm dialog aborted } else if (resp == 'y') { SaveCompCmd saveComp(ed); saveComp.Execute(); if (mv->GetModifStatus()) { return false; // save dialog was aborted } } } return true; } /*****************************************************************************/ ClassId NewCompCmd::GetClassId () { return NEWCOMP_CMD; } bool NewCompCmd::IsA (ClassId id) { return NEWCOMP_CMD == id || Command::IsA(id); } NewCompCmd::NewCompCmd (ControlInfo* c, Component* p) : Command(c) { prototype_ = p; } NewCompCmd::NewCompCmd (Editor* ed, Component* p) : Command(ed) { prototype_ = p; } NewCompCmd::~NewCompCmd () { delete prototype_; } Command* NewCompCmd::Copy () { Command* copy = new NewCompCmd(CopyControlInfo(), prototype_->Copy()); InitCopy(copy); return copy; } void NewCompCmd::Execute () { Editor* ed = GetEditor(); Component* orig = ed->GetComponent(); Component* comp = prototype_->Copy(); CompNameVar* compNameVar = (CompNameVar*) ed->GetState("CompNameVar"); ModifStatusVar* modifVar = (ModifStatusVar*)ed->GetState("ModifStatusVar"); if (OnlyOneEditorOf(orig) && !ReadyToClose(ed)) { return; } if (compNameVar != nil) compNameVar->SetComponent(comp); if (modifVar != nil) modifVar->SetComponent(comp); ed->SetComponent(comp); ed->Update(); if (orig != nil && unidraw->FindAny(orig) == nil) { Component* root = orig->GetRoot(); delete root; } } bool NewCompCmd::Reversible () { return false; } void NewCompCmd::Read (istream& in) { Command::Read(in); prototype_ = unidraw->GetCatalog()->ReadComponent(in); } void NewCompCmd::Write (ostream& out) { Command::Write(out); unidraw->GetCatalog()->WriteComponent(prototype_, out); } /*****************************************************************************/ ClassId RevertCmd::GetClassId () { return REVERT_CMD; } bool RevertCmd::IsA (ClassId id) { return REVERT_CMD == id || Command::IsA(id); } RevertCmd::RevertCmd (ControlInfo* c) : Command(c) { } RevertCmd::RevertCmd (Editor* ed) : Command(ed) { } Command* RevertCmd::Copy () { Command* copy = new RevertCmd(CopyControlInfo()); InitCopy(copy); return copy; } void RevertCmd::Execute () { Editor* ed = GetEditor(); Component* comp = ed->GetComponent(); Catalog* catalog = unidraw->GetCatalog(); const char* name = catalog->GetName(comp); ModifStatusVar* mv = (ModifStatusVar*) ed->GetState("ModifStatusVar"); if (name != nil && (mv == nil || mv->GetModifStatus())) { char buf[CHARBUFSIZE]; strcpy(buf, name); ConfirmDialog dialog("Really revert to last version saved?"); ed->InsertDialog(&dialog); char confirmation = dialog.Confirm(); ed->RemoveDialog(&dialog); if (confirmation == 'y') { Component* orig = comp; catalog->Forget(orig); if (unidraw->GetCatalog()->Retrieve(buf, comp)) { ed->SetComponent(comp); unidraw->CloseDependents(orig); unidraw->Update(); CompNameVar* cv = (CompNameVar*) ed->GetState("CompNameVar"); if (cv != nil) cv->SetComponent(comp); if (mv != nil) mv->SetComponent(comp); Component* root = orig->GetRoot(); delete root; } else { ConfirmDialog dialog( "Couldn't revert! (File nonexistent?)", "Save changes?" ); ed->InsertDialog(&dialog); char confirmation = dialog.Confirm(); ed->RemoveDialog(&dialog); UpdateCompNameVars(); if (mv != nil) mv->Notify(); if (confirmation == 'y') { SaveCompAsCmd saveCompAs(ed); saveCompAs.Execute(); } } } } } bool RevertCmd::Reversible () { return false; } /*****************************************************************************/ ClassId ViewCompCmd::GetClassId () { return VIEWCOMP_CMD; } bool ViewCompCmd::IsA (ClassId id) { return VIEWCOMP_CMD == id || Command::IsA(id); } ViewCompCmd::ViewCompCmd (ControlInfo* c, FileChooser* fc) : Command(c) { chooser_ = fc; Resource::ref(chooser_); } ViewCompCmd::ViewCompCmd (Editor* ed, FileChooser* fc) : Command(ed) { chooser_ = fc; Resource::ref(chooser_); } ViewCompCmd::~ViewCompCmd () { Resource::unref(chooser_); } Command* ViewCompCmd::Copy () { Command* copy = new ViewCompCmd(CopyControlInfo()); InitCopy(copy); return copy; } void ViewCompCmd::Execute () { Editor* ed = GetEditor(); if (OnlyOneEditorOf(ed->GetComponent()) && !ReadyToClose(ed)) { return; } Style* style; bool reset_caption = false; if (chooser_ == nil) { style = new Style(Session::instance()->style()); chooser_ = DialogKit::instance()->file_chooser(".", style); Resource::ref(chooser_); char buf[CHARBUFSIZE]; const char* domain = unidraw->GetCatalog()->GetAttribute("domain"); domain = (domain == nil) ? "component" : domain; sprintf(buf, "Select a %s to open:", domain); style->attribute("caption", ""); style->attribute("subcaption", buf); } else { style = chooser_->style(); } while (chooser_->post_for(ed->GetWindow())) { const String* s = chooser_->selected(); NullTerminatedString ns(*s); const char* name = ns.string(); Catalog* catalog = unidraw->GetCatalog(); GraphicComp* comp; if (catalog->Retrieve(name, (Component*&) comp)) { ModifStatusVar* modif = (ModifStatusVar*) ed->GetState( "ModifStatusVar" ); Component* orig = ed->GetComponent(); ed->SetComponent(comp); unidraw->Update(); StateVar* sv = ed->GetState("CompNameVar"); CompNameVar* cnv = (CompNameVar*) sv; if (cnv != nil) cnv->SetComponent(comp); if (modif != nil) modif->SetComponent(comp); if (orig != nil && unidraw->FindAny(orig) == nil) { Component* root = orig->GetRoot(); delete root; } break; } else { style->attribute("caption", "Open failed!"); reset_caption = true; } } if (reset_caption) { style->attribute("caption", ""); } } bool ViewCompCmd::Reversible () { return false; } /*****************************************************************************/ ClassId SaveCompCmd::GetClassId () { return SAVECOMP_CMD; } bool SaveCompCmd::IsA (ClassId id) { return SAVECOMP_CMD == id || Command::IsA(id); } SaveCompCmd::SaveCompCmd (ControlInfo* c) : Command(c) { } SaveCompCmd::SaveCompCmd (Editor* ed) : Command(ed) { } Command* SaveCompCmd::Copy () { Command* copy = new SaveCompCmd(CopyControlInfo()); InitCopy(copy); return copy; } void SaveCompCmd::Execute () { Editor* ed = GetEditor(); ModifStatusVar* modifVar = (ModifStatusVar*)ed->GetState("ModifStatusVar"); CompNameVar* compNameVar = (CompNameVar*) ed->GetState("CompNameVar"); const char* name = (compNameVar == nil) ? nil : compNameVar->GetName(); if (name == nil) { SaveCompAsCmd saveCompAs(ed); saveCompAs.Execute(); } else if (modifVar == nil || modifVar->GetModifStatus()) { Catalog* catalog = unidraw->GetCatalog(); Component* comp; if (catalog->Retrieve(name, comp) && catalog->Save(comp, name)) { if (modifVar != nil) modifVar->SetModifStatus(false); unidraw->ClearHistory(comp); } else { char title[CHARBUFSIZE]; const char* reason = !Writable(comp) ? "(File not writable.)" : ""; sprintf(title, "Couldn't save! %s", reason); char subtitle[CHARBUFSIZE]; const char* domain = unidraw->GetCatalog()->GetAttribute("domain"); domain = (domain == nil) ? "component" : domain; sprintf(subtitle, "Save this %s as:", domain); Style* s = new Style(Session::instance()->style()); s->attribute("caption", title); s->attribute("subcaption", subtitle); s->attribute("open", "Save"); /* BUG: style s is never used!!!! */ SaveCompAsCmd saveCompAs(ed); saveCompAs.Execute(); } } } bool SaveCompCmd::Reversible () { return false; } /*****************************************************************************/ ClassId SaveCompAsCmd::GetClassId () { return SAVECOMPAS_CMD; } bool SaveCompAsCmd::IsA (ClassId id) { return SAVECOMPAS_CMD == id || Command::IsA(id); } SaveCompAsCmd::SaveCompAsCmd (ControlInfo* c, FileChooser* fc) : Command(c) { chooser_ = fc; Resource::ref(chooser_); } SaveCompAsCmd::SaveCompAsCmd (Editor* ed, FileChooser* fc) : Command(ed) { chooser_ = fc; Resource::ref(chooser_); } SaveCompAsCmd::~SaveCompAsCmd () { Resource::unref(chooser_); } Command* SaveCompAsCmd::Copy () { Command* copy = new SaveCompAsCmd(CopyControlInfo()); InitCopy(copy); return copy; } void SaveCompAsCmd::Execute () { Editor* ed = GetEditor(); char buf[CHARBUFSIZE]; const char* domain = unidraw->GetCatalog()->GetAttribute("domain"); domain = (domain == nil) ? "component" : domain; sprintf(buf, "Save this %s as:", domain); bool reset_caption = false; Style* style = new Style(Session::instance()->style()); style->attribute("subcaption", buf); style->attribute("open", "Save"); if (chooser_ == nil) { chooser_ = DialogKit::instance()->file_chooser(".", style); Resource::ref(chooser_); } while (chooser_->post_for(ed->GetWindow())) { const String* str = chooser_->selected(); NullTerminatedString ns(*str); const char* name = ns.string(); Catalog* catalog = unidraw->GetCatalog(); bool ok = true; if (catalog->Exists(name) && catalog->Writable(name)) { char buf[CHARBUFSIZE]; sprintf(buf, "\"%s\" already exists.", name); ConfirmDialog dialog(buf, "Overwrite?"); ed->InsertDialog(&dialog); char confirmation = dialog.Confirm(); ed->RemoveDialog(&dialog); if (confirmation == 'n') { ok = false; } else if (confirmation != 'y') { break; } } if (ok) { CompNameVar* cnv = (CompNameVar*) ed->GetState("CompNameVar"); const char* oldname = (cnv == nil) ? nil : cnv->GetName(); Component* comp = ed->GetComponent(); if (catalog->Exists(name) && !catalog->Writable(name)) { style->attribute( "caption", "Couldn't save! (File not writable.)" ); } else { if (oldname == nil) { comp = comp->GetRoot(); } else { catalog->Retrieve(oldname, comp); catalog->Forget(comp); } StateVar* sv = ed->GetState("ModifStatusVar"); ModifStatusVar* mv = (ModifStatusVar*) sv; if (catalog->Save(comp, name)) { if (mv != nil) mv->SetModifStatus(false); unidraw->ClearHistory(comp); UpdateCompNameVars(); break; } else { if (mv != nil) mv->Notify(); UpdateCompNameVars(); style->attribute("caption", "Couldn't save!"); reset_caption = true; } } } } if (reset_caption) { style->attribute("caption", ""); } } bool SaveCompAsCmd::Reversible () { return false; } /*****************************************************************************/ ClassId PrintCmd::GetClassId () { return PRINT_CMD; } bool PrintCmd::IsA (ClassId id) { return PRINT_CMD == id || Command::IsA(id); } PrintCmd::PrintCmd (ControlInfo* c, PrintDialog* pd) : Command(c) { _dialog = pd; } PrintCmd::PrintCmd (Editor* ed, PrintDialog* pd) : Command(ed) { _dialog = pd; } PrintCmd::~PrintCmd () { delete _dialog; } Command* PrintCmd::Copy () { Command* copy = new PrintCmd(CopyControlInfo()); InitCopy(copy); return copy; } // avoid warning: the use of `tmpnam' is dangerous, better use `mkstemp' // free the reurn char* iv_mytmpnam(char*) { static char name[20]; strcpy(name, "/tmp/XXXXXX"); int fd = mkstemp(name); if (fd >= 0) { close(fd); } return name; } void PrintCmd::Execute () { GraphicComp* comps = GetGraphicComp(); bool ok; if (_dialog == nil) { _dialog = new PrintDialog; } do { _editor->InsertDialog(_dialog); bool accepted = _dialog->Accept(); _editor->RemoveDialog(_dialog); if (!accepted) { break; } filebuf fbuf; char* tmpfilename; if (_dialog->ToPrinter()) { tmpfilename = iv_mytmpnam(nil); ok = fbuf.open(tmpfilename, IOS_OUT) != 0; } else { ok = fbuf.open((char*) _dialog->Choice(), IOS_OUT) != 0; } if (ok) { ostream out(&fbuf); ExternView* ev = (ExternView*) comps->Create(POSTSCRIPT_VIEW); comps->Attach(ev); ev->Update(); ok = ev->Emit(out); out.flush(); delete ev; if (_dialog->ToPrinter()) { ok = print(_dialog->Choice(), tmpfilename) == 0; } } if (!ok) { _dialog->SetTitle("Couldn't print!"); } } while (!ok); _dialog->SetTitle(""); } int PrintCmd::print (const char* print_cmd, const char* file) { char cmd[CHARBUFSIZE]; sprintf(cmd, "%s %s", print_cmd, file); return system(cmd); } bool PrintCmd::Reversible () { return false; } /*****************************************************************************/ ClassId QuitCmd::GetClassId () { return QUIT_CMD; } bool QuitCmd::IsA (ClassId id) { return QUIT_CMD == id || Command::IsA(id);} QuitCmd::QuitCmd (ControlInfo* c) : Command(c) { } QuitCmd::QuitCmd (Editor* ed) : Command(ed) { } Command* QuitCmd::Copy () { Command* copy = new QuitCmd(CopyControlInfo()); InitCopy(copy); return copy; } void QuitCmd::Execute () { Editor* ed = GetEditor(); if (ReadyToClose(ed)) { Component* comp = ed->GetComponent(); if (comp == nil) { unidraw->Close(ed); } else { unidraw->CloseDependents(comp->GetRoot()); } Iterator i; for (;;) { unidraw->First(i); if (unidraw->Done(i)) { break; } ed = unidraw->GetEditor(i); if (ReadyToClose(ed)) { comp = ed->GetComponent(); if (comp == nil) { unidraw->Close(ed); } else { unidraw->CloseDependents(comp->GetRoot()); } } else { return; } } unidraw->Quit(); } } bool QuitCmd::Reversible () { return false; } neuron-7.6.3/src/lib/Unidraw/cglue.cpp000066400000000000000000000063671340731477100176310ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * CGlue implementation. */ #include #include #include /*****************************************************************************/ CGlue::CGlue ( float hnat, float vnat, float hshr, float hstr, float vshr, float vstr, float hshrlim, float hstrlim, float vshrlim, float vstrlim ) { _width = hnat; _height = vnat; _hshrink = hshr; _hstretch = hstr; _vshrink = vshr; _vstretch = vstr; _hshrlim = hshrlim; _hstrlim = hstrlim; _vshrlim = vshrlim; _vstrlim = vstrlim; } CGlue::CGlue (const Shape& s) { _width = s.width; _height = s.height; _hshrink = _hshrlim = s.hshrink; _hstretch = _hstrlim = s.hstretch; _vshrink = _vshrlim = s.vshrink; _vstretch = _vstrlim = s.vstretch; } CGlue* CGlue::Copy () { return new CGlue( _width, _height, _hshrink, _hstretch, _vshrink,_vstretch, _hshrlim, _hstrlim, _vshrlim, _vstrlim ); } inline bool SignsDiffer (float f1, float f2) { return (f1 < 0 && f2 >= 0) || (f1 >= 0 && f2 < 0); } void CGlue::Interpose (CGlue* g) { if (g != nil) { if (SignsDiffer(_width, g->_width)) { _hshrink += g->_hstretch; _hstretch += g->_hshrink; _hshrlim += g->_hstrlim; _hstrlim += g->_hshrlim; } else { _hshrink += g->_hshrink; _hstretch += g->_hstretch; _hshrlim += g->_hshrlim; _hstrlim += g->_hstrlim; } if (SignsDiffer(_height, g->_height)) { _vshrink += g->_vstretch; _vstretch += g->_vshrink; _vshrlim += g->_vstrlim; _vstrlim += g->_vshrlim; } else { _vshrink += g->_vshrink; _vstretch += g->_vstretch; _vshrlim += g->_vshrlim; _vstrlim += g->_vstrlim; } _width += g->_width; _height += g->_height; } } void CGlue::Rigid () { _hshrink = _hstretch = _vshrink = _vstretch = 0; _hshrlim = _hstrlim = _vshrlim = _vstrlim = 0; } neuron-7.6.3/src/lib/Unidraw/clipboard.cpp000066400000000000000000000102541340731477100204570ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of Clipboard class. */ #include #include #include #include #include #include #include #include /*****************************************************************************/ Clipboard::Clipboard (GraphicComp* comp) { _comps = new UList; if (comp != nil) { _comps->Append(new UList(comp)); } } Clipboard* Clipboard::Copy () { Clipboard* cbnew = new Clipboard; Iterator i; for (First(i); !Done(i); Next(i)) { cbnew->Append(GetComp(i)); } return cbnew; } Clipboard* Clipboard::DeepCopy () { Clipboard* cbnew = new Clipboard; Iterator i; for (First(i); !Done(i); Next(i)) { cbnew->Append((GraphicComp*) GetComp(i)->Copy()); } return cbnew; } void Clipboard::Init (Selection* s) { Iterator i; Clear(); for (s->First(i); !s->Done(i); s->Next(i)) { Append(s->GetView(i)->GetGraphicComp()); } } void Clipboard::CopyInit (Selection* s) { Iterator i; Clear(); for (s->First(i); !s->Done(i); s->Next(i)) { Append((GraphicComp*) s->GetView(i)->GetGraphicComp()->Copy()); } } void Clipboard::Clear () { delete _comps; _comps = new UList; } void Clipboard::DeleteComps () { Iterator i; for (First(i); !Done(i); Next(i)) { GraphicComp* comp = GetComp(i); delete comp; } } UList* Clipboard::Elem (Iterator i) { return (UList*) i.GetValue(); } void Clipboard::First (Iterator& i) { i.SetValue(_comps->First()); } void Clipboard::Last (Iterator& i) { i.SetValue(_comps->Last()); } void Clipboard::Next (Iterator& i) { i.SetValue(Elem(i)->Next()); } void Clipboard::Prev (Iterator& i) { i.SetValue(Elem(i)->Prev()); } bool Clipboard::Done (Iterator i) { return Elem(i) == _comps->End(); } GraphicComp* Clipboard::Comp (UList* r) { return (GraphicComp*) (*r)(); } GraphicComp* Clipboard::GetComp (Iterator i) { return Comp(Elem(i)); } void Clipboard::SetComp (GraphicComp* gc, Iterator& i) { i.SetValue(_comps->Find(gc)); } bool Clipboard::Includes (GraphicComp* gc) { Iterator i; for (First(i); !Done(i); Next(i)) { if (GetComp(i) == gc) { return true; } } return false; } void Clipboard::Append (GraphicComp* comp) { _comps->Append(new UList(comp));} void Clipboard::Prepend (GraphicComp* comp) {_comps->Prepend(new UList(comp));} void Clipboard::InsertBefore (Iterator i, GraphicComp* comp) { Elem(i)->Append(new UList(comp)); } void Clipboard::InsertAfter (Iterator i, GraphicComp* comp) { Elem(i)->Prepend(new UList(comp)); } void Clipboard::Remove (Iterator& i) { UList* doomed = Elem(i); Next(i); _comps->Remove(doomed); delete doomed; } void Clipboard::Remove (GraphicComp* comp) { _comps->Delete(comp); } Clipboard::~Clipboard () { delete _comps; } bool Clipboard::IsEmpty () { return _comps->IsEmpty(); } neuron-7.6.3/src/lib/Unidraw/colorcmd.cpp000066400000000000000000000052741340731477100203300ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Color command implementation. */ #include #include #include #include #include #include #include /*****************************************************************************/ ClassId ColorCmd::GetClassId () { return COLOR_CMD; } bool ColorCmd::IsA (ClassId id) {return COLOR_CMD==id || Command::IsA(id);} ColorCmd::ColorCmd (ControlInfo* c, PSColor* fg, PSColor* bg) : Command(c) { _fg = fg; _bg = bg; } ColorCmd::ColorCmd (Editor* ed, PSColor* fg, PSColor* bg) : Command(ed) { _fg = fg; _bg = bg; } Command* ColorCmd::Copy () { Command* copy = new ColorCmd(CopyControlInfo(), GetFgColor(),GetBgColor()); InitCopy(copy); return copy; } void ColorCmd::Execute () { ColorVar* colorVar = (ColorVar*) GetEditor()->GetState("ColorVar"); if (colorVar != nil) { PSColor* fg = (_fg == nil) ? colorVar->GetFgColor() : _fg; PSColor* bg = (_bg == nil) ? colorVar->GetBgColor() : _bg; colorVar->SetColors(fg, bg); } Command::Execute(); } void ColorCmd::Read (istream& in) { Command::Read(in); Catalog* catalog = unidraw->GetCatalog(); _fg = catalog->ReadColor(in); _bg = catalog->ReadColor(in); } void ColorCmd::Write (ostream& out) { Command::Write(out); Catalog* catalog = unidraw->GetCatalog(); catalog->WriteColor(GetFgColor(), out); catalog->WriteColor(GetBgColor(), out); } neuron-7.6.3/src/lib/Unidraw/command.cpp000066400000000000000000000171161340731477100201420ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Command implemementation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ static const int DATACACHE_SIZE = 255; /*****************************************************************************/ class DataElem : public UHashElem { public: DataElem(Data*, Component*); DataElem(DataElem*); virtual ~DataElem(); Data* data(); Component* comp(); void data(Data*); void comp(Component*); private: Data* _data; Component* _comp; }; DataElem::DataElem (Data* d, Component* c) { _data = d; _data->Reference(); _comp = c; } DataElem::DataElem (DataElem* de) { _data = de->_data; _data->Reference(); _comp = de->_comp; } DataElem::~DataElem () { Unref(_data); } inline Data* DataElem::data () { return _data; } inline Component* DataElem::comp () { return _comp; } inline void DataElem::data (Data* d) { Unref(_data); _data = d; _data->Reference(); } inline void DataElem::comp (Component* c) { _comp = c; } /*****************************************************************************/ class DataCache : public UHashTable { public: DataCache(); DataElem* GetData(Iterator); DataElem* Find(Component*); }; DataCache::DataCache () : UHashTable(DATACACHE_SIZE) { } DataElem* DataCache::GetData (Iterator i) { return (DataElem*) GetElem(i); } DataElem* DataCache::Find (Component* comp) { return (DataElem*) UHashTable::Find(comp); } /*****************************************************************************/ ClassId Command::GetClassId () { return COMMAND; } ClassId Command::GetSubstId (const char*&) { return UNDEFINED_CLASS; } bool Command::IsA (ClassId id) { return COMMAND == id; } Command::Command (ControlInfo* m, Clipboard* cb) { Command::SetControlInfo(m); _editor = nil; _clipboard = cb; _cache = nil; } Command::Command (Editor* ed, Clipboard* cb) { _ctrlInfo = nil; _editor = ed; _clipboard = cb; _cache = nil; } Command::~Command () { if (_ctrlInfo != nil) { delete _ctrlInfo; } if (_clipboard != nil) { delete _clipboard; } delete _cache; unidraw->GetCatalog()->Forget(this); } DataCache* Command::CopyData () { DataCache* copy = new DataCache; if (_cache != nil) { Iterator i; for (_cache->First(i); !_cache->Done(i); _cache->Next(i)) { DataElem* de = _cache->GetData(i); copy->Register(de->comp(), new DataElem(de)); } } return copy; } void Command::SetData (DataCache* dc) { _cache = dc; } void Command::InitCopy (Command* cmd) { cmd->SetEditor(GetEditor()); cmd->SetData(CopyData()); cmd->SetClipboard(CopyClipboard()); } Command* Command::Copy () { Command* copy = new Command(CopyControlInfo()); InitCopy(copy); return copy; } void Command::Read (istream& in) { SetControlInfo(unidraw->GetCatalog()->ReadControlInfo(in)); } void Command::Write (ostream& out) { unidraw->GetCatalog()->WriteControlInfo(GetControlInfo(), out); } void Command::SetControlInfo (ControlInfo* m) { _ctrlInfo = m; if (m != nil) m->SetOwner(this); } void Command::First (Iterator&) { } void Command::Last (Iterator&) { } void Command::Next (Iterator&) { } void Command::Prev (Iterator&) { } bool Command::Done (Iterator&) { return true; } void Command::SetEditor (Editor* ed) { _editor = ed; } void Command::SetClipboard (Clipboard* cb) { _clipboard = cb; } ControlInfo* Command::GetControlInfo () { return _ctrlInfo; } Editor* Command::GetEditor () { return _editor; } Clipboard* Command::GetClipboard () { return _clipboard; } void Command::Store (Component* comp, Data* data) { if (_cache == nil) { _cache = new DataCache; } DataElem* existing = _cache->Find(comp); if (existing == nil) { _cache->Register(comp, new DataElem(data, comp)); } else { existing->data(data); } } Data* Command::Recall (Component* comp) { Data* data = nil; if (_cache != nil) { DataElem* de = _cache->Find(comp); data = (de == nil) ? nil : de->data(); } return data; } GraphicComp* Command::GetGraphicComp () { Component* comp = _editor->GetComponent(); if (comp == nil) { Clipboard* cb = GetClipboard(); Iterator i; if (cb != nil && !cb->IsEmpty()) { cb->First(i); comp = cb->GetComp(i)->GetParent(); } } return ( comp != nil && comp->IsA(GRAPHIC_COMP) ) ? (GraphicComp*) comp : nil; } void Command::Execute () { Selection* s = _editor->GetSelection(); Clipboard* cb = GetClipboard(); if (!s->IsEmpty() || (cb != nil && !cb->IsEmpty())) { Iterator i; if (cb == nil) { SetClipboard(cb = new Clipboard); cb->Init(s); } for (cb->First(i); !cb->Done(i); cb->Next(i)) { cb->GetComp(i)->Interpret(this); } unidraw->Update(); } } void Command::Unexecute () { Clipboard* cb = GetClipboard(); if (cb != nil) { Iterator i; for (cb->Last(i); !cb->Done(i); cb->Prev(i)) { cb->GetComp(i)->Uninterpret(this); } unidraw->Update(); } } bool Command::Reversible () { bool reversible = true; Clipboard* cb = GetClipboard(); if (cb == nil) { Editor* ed = GetEditor(); Selection* s = (ed == nil) ? nil : ed->GetSelection(); reversible = (s == nil) || !s->IsEmpty(); } else { reversible = !cb->IsEmpty(); } return reversible; } void Command::Log () { unidraw->Log(this); } ControlInfo* Command::CopyControlInfo () { ControlInfo* ci = GetControlInfo(); return (ci == nil) ? nil : ci->Copy(); } Clipboard* Command::CopyClipboard () { Clipboard* cb = GetClipboard(); return (cb == nil) ? nil : cb->Copy(); } Clipboard* Command::DeepCopyClipboard () { Clipboard* cb = GetClipboard(); return (cb == nil) ? nil : cb->DeepCopy(); } neuron-7.6.3/src/lib/Unidraw/component.cpp000066400000000000000000000067641340731477100205350ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of Component class. */ #include #include #include #include #include #include #include #include #include /*****************************************************************************/ ClassId Component::GetClassId () { return COMPONENT; } ClassId Component::GetSubstId (const char*&) { return UNDEFINED_CLASS; } bool Component::IsA (ClassId id) { return COMPONENT == id; } Component::Component () { _views = new UList; } Component* Component::Copy () { return nil; } void Component::Read (istream&) { } void Component::Write (ostream&) { } void Component::Update () { } StateVar* Component::GetState (const char*) { return nil; } TransferFunct* Component::GetTransferFunct() { return nil; } Component::~Component () { UList* cur = _views->First(); while (cur != _views->End()) { Detach(View(cur)); cur = _views->First(); } delete _views; unidraw->GetCatalog()->Forget(this); unidraw->ClearHistory(this); } void Component::Attach (ComponentView* view) { _views->Prepend(new UList(view)); view->SetSubject(this); } void Component::Detach (ComponentView* view) { _views->Delete(view); view->SetSubject(nil); } ComponentView* Component::Create (ClassId viewId) { ClassId gv = Combine(GetClassId(), viewId); return (ComponentView*) unidraw->GetCatalog()->GetCreator()->Create(gv); } ComponentView* Component::View (UList* r) { return (ComponentView*) (*r)(); } void Component::Notify () { for (UList* u = _views->First(); u != _views->End(); u = u->Next()) { View(u)->Update(); } } void Component::Interpret (Command*) { } void Component::Uninterpret (Command*) { } Component* Component::GetParent () { return nil; } void Component::SetParent (Component*, Component*) { } void Component::First (Iterator&) { } void Component::Last (Iterator&) { } void Component::Next (Iterator&) { } void Component::Prev (Iterator&) { } bool Component::Done (Iterator) { return true; } Component* Component::GetRoot () { Component* cur, *parent = this; do { cur = parent; parent = cur->GetParent(); } while (parent != nil); return cur; } neuron-7.6.3/src/lib/Unidraw/compview.cpp000066400000000000000000000047651340731477100203630ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * ComponentView implementation. */ #include #include #include #include #include /*****************************************************************************/ ClassId ComponentView::GetClassId () { return COMPONENT_VIEW; } bool ComponentView::IsA (ClassId id) { return COMPONENT_VIEW == id; } ComponentView::ComponentView (Component* subj) { _subject = subj; if (subj != nil) { subj->Attach(this); } } ComponentView::~ComponentView () { Component* subj = GetSubject(); if (subj != nil) { subj->Detach(this); } } void ComponentView::Update () { } void ComponentView::Interpret (Command* c) { GetSubject()->Interpret(c); } void ComponentView::Uninterpret (Command* c) { GetSubject()->Uninterpret(c); } ComponentView* ComponentView::GetParent () { return nil; } void ComponentView::SetSubject (Component* c) { _subject = c; } void ComponentView::SetParent (ComponentView*, ComponentView*) { } void ComponentView::First (Iterator&) { } void ComponentView::Last (Iterator&) { } void ComponentView::Next (Iterator&) { } void ComponentView::Prev (Iterator&) { } bool ComponentView::Done (Iterator) { return true; } Component* ComponentView::GetSubject () { return _subject; } neuron-7.6.3/src/lib/Unidraw/connect.cpp000066400000000000000000000045771340731477100201640ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Connect tool definitions. */ #include #include #include #include #include #include #include #include /*****************************************************************************/ ConnectTool::ConnectTool (ControlInfo* m) : Tool(m) { } ClassId ConnectTool::GetClassId () { return CONNECT_TOOL; } bool ConnectTool::IsA (ClassId id) { return CONNECT_TOOL == id || Tool::IsA(id); } Tool* ConnectTool::Copy () { return new ConnectTool(CopyControlInfo()); } Manipulator* ConnectTool::CreateManipulator ( Viewer* v, Event& e, Transformer* rel ) { GraphicView* views = v->GetGraphicView(); Selection* s = v->GetSelection(); Manipulator* m = nil; _source = views->ConnectorIntersecting( e.x-SLOP, e.y-SLOP, e.x+SLOP, e.y+SLOP ); if (_source == nil) { s->Clear(); } else { m = _source->CreateManipulator(v, e, rel, this); } return m; } Command* ConnectTool::InterpretManipulator (Manipulator* m) { return (_source == nil) ? nil : _source->InterpretManipulator(m); } neuron-7.6.3/src/lib/Unidraw/connector.cpp000066400000000000000000000153321340731477100205140ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of Connectors. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ class _CSData : public Data { public: _CSData(CSolverState*); virtual ~_CSData(); public: CSolverState* _state; }; _CSData::_CSData (CSolverState* state) { _state = state; } _CSData::~_CSData () { delete _state; } /*****************************************************************************/ ClassId Connector::GetClassId () { return CONNECTOR; } bool Connector::IsA (ClassId id) { return CONNECTOR == id || GraphicComp::IsA(id); } Connector::Connector (Graphic* g) : GraphicComp(g) { _cnxns = new UList; _stateVar = nil; _transMethod = InOut; _csinfo = nil; } Connector::~Connector () { DisconnectAll(); delete _cnxns; } void Connector::Interpret (Command* cmd) { if (cmd->IsA(DELETE_CMD) || cmd->IsA(CUT_CMD)) { _CSData* data = new _CSData(csolver->GetState(this)); cmd->Store((Component*) _cnxns, data); DisconnectAll(); } GraphicComp::Interpret(cmd); } void Connector::Uninterpret (Command* cmd) { if (cmd->IsA(DELETE_CMD) || cmd->IsA(CUT_CMD)) { _CSData* data = (_CSData*) cmd->Recall((Component*) _cnxns); if (data->_state != nil) { csolver->SetState(data->_state); } } GraphicComp::Uninterpret(cmd); } void Connector::Read (istream& in) { GraphicComp::Read(in); Catalog* catalog = unidraw->GetCatalog(); int transMethod; in >> transMethod; _transMethod = TransMethod(transMethod); _stateVar = catalog->ReadStateVar(in); } void Connector::Write (ostream& out) { GraphicComp::Write(out); int transMethod = _transMethod; out << transMethod << " "; unidraw->GetCatalog()->WriteStateVar(_stateVar, out); csolver->Wrote(this); } void Connector::Connect (Connector* c, CGlue*) { if (c != this) { _cnxns->Append(new UList(c)); ConnectMe(c); } } void Connector::Disconnect (Connector* c) { csolver->Disconnect(this, c); _cnxns->Delete(c); DisconnectMe(c); } Connector* Connector::Conn (UList* r) { return (Connector*) (*r)(); } void Connector::DisconnectAll () { csolver->Disconnect(this); while (!_cnxns->IsEmpty()) { UList* r = _cnxns->First(); Connector* conn = Conn(r); DisconnectMe(conn); _cnxns->Remove(r); delete r; } } bool Connector::ConnectedTo (Connector* c) { return _cnxns->Find(c) != nil;} void Connector::ConnectMe (Connector* c) { c->_cnxns->Append(new UList(this));} void Connector::DisconnectMe (Connector* c) { c->_cnxns->Delete(this); } void Connector::GetCenter (float& x, float& y) {GetGraphic()->GetCenter(x, y);} void Connector::SetBinding (StateVar* s) { if (_stateVar != s) { if (_stateVar != nil) { _stateVar->SetBinding(nil); } _stateVar = s; _stateVar->SetBinding(this); } } StateVar* Connector::GetBinding () { return _stateVar; } void Connector::SetTransMethod (TransMethod tm) { _transMethod = tm; } TransMethod Connector::GetTransMethod () { return _transMethod; } void Connector::Transmit (Path* path) { if (path == nil) { Path newPath; Retransmit(&newPath); } else { Retransmit(path); } } void Connector::Retransmit (Path* path) { if (path->Visited(this)) { return; } bool forking = _cnxns->First() != _cnxns->Last(); // fork if > 1 cnxn path->Visit(this); for (UList* u = _cnxns->First(); u != _cnxns->End(); u = u->Next()) { Connector* peer = Conn(u); if (!path->Visited(peer)) { if (forking) { Path fork(path); Retransmit(peer, &fork); } else { Retransmit(peer, path); } } } } void Connector::Retransmit (Connector* peer, Path* path) { if (Transferable(peer)) { Component* parent = peer->GetParent(); TransferFunct* transfn = parent->GetTransferFunct(); if (transfn != nil) { transfn->Evaluate(path); } parent->Update(); peer->Retransmit(path); } } bool Connector::Transferable (Connector* peer) { bool transferable = false; StateVar* myVar = GetBinding(); StateVar* peerVar = peer->GetBinding(); if (myVar != nil && peerVar != nil) { TransMethod myTrans = GetTransMethod(); TransMethod peerTrans = peer->GetTransMethod(); transferable = (myTrans == Out || myTrans == InOut) && (peerTrans == In || peerTrans == InOut); if (transferable) { *peerVar = *myVar; } } return transferable; } /*****************************************************************************/ Connector* ConnectorView::GetConnector () { return (Connector*) GetSubject(); } ConnectorView::ConnectorView (Connector* subj) : GraphicView(subj) { } ClassId ConnectorView::GetClassId () { return CONNECTOR_VIEW; } bool ConnectorView::IsA (ClassId id) { return CONNECTOR_VIEW == id || GraphicView::IsA(id); } neuron-7.6.3/src/lib/Unidraw/creator.cpp000077500000000000000000000233731340731477100201700ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Object creator class implementation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ Creator::Creator () { } void* Creator::Create (ClassId id, istream& in, ObjectMap* objmap, int objid) { switch (id) { case ALIGN_CMD: CREATE(AlignCmd, in, objmap, objid); case ALIGNTOGRID_CMD: CREATE(AlignToGridCmd, in, objmap, objid); case BACK_CMD: CREATE(BackCmd, in, objmap, objid); case BRUSH_CMD: CREATE(BrushCmd, in, objmap, objid); case BRUSH_VAR: CREATE(BrushVar, in, objmap, objid); case CENTER_CMD: CREATE(CenterCmd, in, objmap, objid); case CLOSEDSPLINE_COMP: CREATE(ClosedSplineComp, in, objmap, objid); case CLOSEEDITOR_CMD: CREATE(CloseEditorCmd, in, objmap, objid); case COLOR_CMD: CREATE(ColorCmd, in, objmap, objid); case COMPNAME_VAR: CREATE(CompNameVar, in, objmap, objid); case CONNECT_CMD: CREATE(ConnectCmd, in, objmap, objid); case CONNECT_TOOL: CREATE(ConnectTool, in, objmap, objid); case COPY_CMD: CREATE(CopyCmd, in, objmap, objid); case CUT_CMD: CREATE(CutCmd, in, objmap, objid); case DELETE_CMD: CREATE(DeleteCmd, in, objmap, objid); case DUP_CMD: CREATE(DupCmd, in, objmap, objid); case ELLIPSE_COMP: CREATE(EllipseComp, in, objmap, objid); case FONT_CMD: CREATE(FontCmd, in, objmap, objid); case FONT_VAR: CREATE(FontVar, in, objmap, objid); case FRONT_CMD: CREATE(FrontCmd, in, objmap, objid); case GRAPHIC_COMPS: CREATE(GraphicComps, in, objmap, objid); case GRAPHIC_COMP_TOOL: CREATE(GraphicCompTool, in, objmap, objid); case GRAVITY_CMD: CREATE(GravityCmd, in, objmap, objid); case GRAVITY_VAR: CREATE(GravityVar, in, objmap, objid); case GRID_CMD: CREATE(GridCmd, in, objmap, objid); case GRIDSPACING_CMD: CREATE(GridSpacingCmd, in, objmap, objid); case GROUP_CMD: CREATE(GroupCmd, in, objmap, objid); case HSLOT_COMP: CREATE(HSlotComp, in, objmap, objid); case IMPORT_CMD: CREATE(ImportCmd, in, objmap, objid); case LINE_COMP: CREATE(LineComp, in, objmap, objid); case LINK_COMP: CREATE(LinkComp, in, objmap, objid); case MACRO_CMD: CREATE(MacroCmd, in, objmap, objid); case MAGNIFY_TOOL: CREATE(MagnifyTool, in, objmap, objid); case MAGNIF_VAR: CREATE(MagnifVar, in, objmap, objid); case MOBILITY_CMD: CREATE(MobilityCmd, in, objmap, objid); case MODIFSTATUS_VAR: CREATE(ModifStatusVar, in, objmap, objid); case MOVE_CMD: CREATE(MoveCmd, in, objmap, objid); case MOVE_TOOL: CREATE(MoveTool, in, objmap, objid); case MULTILINE_COMP: CREATE(MultiLineComp, in, objmap, objid); case NAME_VAR: CREATE(NameVar, in, objmap, objid); case NEWCOMP_CMD: CREATE(NewCompCmd, in, objmap, objid); case NOP_CMD: CREATE(NOPCmd, in, objmap, objid); case NORMSIZE_CMD: CREATE(NormSizeCmd, in, objmap, objid); case ORIENTATION_CMD: CREATE(OrientationCmd, in, objmap, objid); case PASTE_CMD: CREATE(PasteCmd, in, objmap, objid); case PATTERN_CMD: CREATE(PatternCmd, in, objmap, objid); case PATTERN_VAR: CREATE(PatternVar, in, objmap, objid); case PAD_COMP: CREATE(PadComp, in, objmap, objid); case PIN_COMP: CREATE(PinComp, in, objmap, objid); case POLYGON_COMP: CREATE(PolygonComp, in, objmap, objid); case PRINT_CMD: CREATE(PrintCmd, in, objmap, objid); case QUIT_CMD: CREATE(QuitCmd, in, objmap, objid); case RASTER_COMP: CREATE(RasterComp, in, objmap, objid); case RECT_COMP: CREATE(RectComp, in, objmap, objid); case REDO_CMD: CREATE(RedoCmd, in, objmap, objid); case REDTOFIT_CMD: CREATE(RedToFitCmd, in, objmap, objid); case REPLACE_CMD: CREATE(ReplaceCmd, in, objmap, objid); case RESHAPE_TOOL: CREATE(ReshapeTool, in, objmap, objid); case REVERT_CMD: CREATE(RevertCmd, in, objmap, objid); case ROTATE_CMD: CREATE(RotateCmd, in, objmap, objid); case ROTATE_TOOL: CREATE(RotateTool, in, objmap, objid); case SAVECOMPAS_CMD: CREATE(SaveCompAsCmd, in, objmap, objid); case SAVECOMP_CMD: CREATE(SaveCompCmd, in, objmap, objid); case SCALE_CMD: CREATE(ScaleCmd, in, objmap, objid); case SCALE_TOOL: CREATE(ScaleTool, in, objmap, objid); case SELECT_TOOL: CREATE(SelectTool, in, objmap, objid); case SLCTALL_CMD: CREATE(SlctAllCmd, in, objmap, objid); case SPLINE_COMP: CREATE(SplineComp, in, objmap, objid); case STENCIL_COMP: CREATE(StencilComp, in, objmap, objid); case STRETCH_TOOL: CREATE(StretchTool, in, objmap, objid); case TEXT_COMP: CREATE(TextComp, in, objmap, objid); case TF_DIRECT: CREATE(TF_Direct, in, objmap, objid); case UNDO_CMD: CREATE(UndoCmd, in, objmap, objid); case UNGROUP_CMD: CREATE(UngroupCmd, in, objmap, objid); case VIEWCOMP_CMD: CREATE(ViewCompCmd, in, objmap, objid); case VSLOT_COMP: CREATE(VSlotComp, in, objmap, objid); default: return nil; } } void* Creator::Create (ClassId id) { if (id == CLOSEDSPLINE_VIEW) return new ClosedSplineView; if (id == ELLIPSE_VIEW) return new EllipseView; if (id == GRAPHIC_VIEWS) return new GraphicViews; if (id == HSLOT_VIEW) return new HSlotView; if (id == LINE_VIEW) return new LineView; if (id == LINK_VIEW) return new LinkView; if (id == MULTILINE_VIEW) return new MultiLineView; if (id == PAD_VIEW) return new PadView; if (id == PIN_VIEW) return new PinView; if (id == POLYGON_VIEW) return new PolygonView; if (id == POSTSCRIPT_VIEWS) return new PostScriptViews; if (id == PS_CLOSEDSPLINE) return new PSClosedSpline; if (id == PS_ELLIPSE) return new PSEllipse; if (id == PS_HSLOT) return new PSSlot; if (id == PS_LINE) return new PSLine; if (id == PS_LINK) return new PSLink; if (id == PS_MULTILINE) return new PSMultiLine; if (id == PS_PAD) return new PSPad; if (id == PS_PIN) return new PSPin; if (id == PS_POLYGON) return new PSPolygon; if (id == PS_RASTER) return new PSRaster; if (id == PS_RECT) return new PSRect; if (id == PS_SLOT) return new PSSlot; if (id == PS_SPLINE) return new PSSpline; if (id == PS_STENCIL) return new PSStencil; if (id == PS_TEXT) return new PSText; if (id == PS_VSLOT) return new PSSlot; if (id == RASTER_VIEW) return new RasterView; if (id == RECT_VIEW) return new RectView; if (id == SPLINE_VIEW) return new SplineView; if (id == STENCIL_VIEW) return new StencilView; if (id == TEXT_VIEW) return new TextView; if (id == VSLOT_VIEW) return new VSlotView; return nil; } neuron-7.6.3/src/lib/Unidraw/csolver.cpp000066400000000000000000001504331340731477100202010ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * CSolver implementation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ class CSGlue { public: CSGlue( float nat = 0, float shr = 0, float str = 0, float shrlim = hfil, float strlim = hfil ); CSGlue(CSGlue*); CSGlue* Series(CSGlue*); /* series combination */ CSGlue* Parallel(CSGlue*); /* parallel combination */ CSGlue* a_Y(CSGlue* b, CSGlue* c); /* Y combination ("this" is a) */ CSGlue* b_Y(CSGlue* b, CSGlue* c); /* Y combination ("this" is a) */ CSGlue* c_Y(CSGlue* b, CSGlue* c); /* Y combination ("this" is a) */ void Limit(float&); void Reverse(); void Print(); public: float _natural, _shrink, _stretch, _shrlim, _strlim; }; CSGlue::CSGlue (float nat, float shr, float str, float shrlim, float strlim) { _natural = nat; _shrink = shr; _stretch = str; _shrlim = shrlim; _strlim = strlim; } CSGlue::CSGlue (CSGlue* glue) { _natural = glue->_natural; _shrink = glue->_shrink; _stretch = glue->_stretch; _shrlim = glue->_shrlim; _strlim = glue->_strlim; } void CSGlue::Print () { cout << "CSGlue " << (long) this << ":\n"; cout << "nat/shr/str: "; cout << _natural << "/" << _shrink << "/" << _stretch << "\n"; cout << "shrlim/strlim: "; cout << _shrlim << "/" << _strlim << "\n"; } CSGlue* CSGlue::Series (CSGlue* g) { CSGlue* combo = new CSGlue(_natural, _shrink, _stretch, _shrlim, _strlim); combo->_natural += g->_natural; combo->_stretch += g->_stretch; combo->_shrink += g->_shrink; combo->_strlim += g->_strlim; combo->_shrlim += g->_shrlim; return combo; } CSGlue* CSGlue::Parallel (CSGlue* g) { CSGlue* combo = new CSGlue; combo->_natural = max(_natural, g->_natural); combo->_stretch = min(_stretch, g->_stretch); combo->_shrink = min(_shrink, g->_shrink); combo->_strlim = min(_strlim, g->_strlim); combo->_shrlim = min(_shrlim, g->_shrlim); return combo; } CSGlue* CSGlue::a_Y (CSGlue* b, CSGlue* c) { CSGlue* combo = new CSGlue; combo->_natural = _natural + b->_natural; combo->_stretch = min(_stretch + b->_stretch, c->_stretch); combo->_shrink = min(_shrink + b->_shrink, c->_shrink); combo->_strlim = _strlim + b->_strlim; combo->_shrlim = _shrlim + b->_shrlim; return combo; } CSGlue* CSGlue::b_Y (CSGlue* b, CSGlue* c) { CSGlue* combo = new CSGlue; combo->_natural = c->_natural - b->_natural; combo->_stretch = min(b->_stretch + c->_stretch, _stretch); combo->_shrink = min(b->_shrink + c->_shrink, _shrink); combo->_strlim = c->_strlim - b->_strlim; combo->_shrlim = c->_shrlim - b->_shrlim; return combo; } CSGlue* CSGlue::c_Y (CSGlue* b, CSGlue* c) { CSGlue* combo = new CSGlue; combo->_natural = _natural + c->_natural; combo->_stretch = min(_stretch + c->_stretch, b->_stretch); combo->_shrink = min(_shrink + c->_shrink, b->_shrink); combo->_strlim = _strlim + c->_strlim; combo->_shrlim = _shrlim + c->_shrlim; return combo; } void CSGlue::Limit (float& deform) { deform = min(max(-_shrlim, deform), _strlim); } void CSGlue::Reverse () { _natural = -_natural; float tmp = _stretch; _stretch = _shrink; _shrink = tmp; tmp = _strlim; _strlim = _shrlim; _shrlim = tmp; } /*************************************************************************/ class CCnxn { public: CCnxn(Connector* lb = nil, Connector* rt = nil, CSGlue* = nil); virtual ~CCnxn(); void Print(); void ApplyToSeries(CCnxn*, CCnxn*); void ApplyToParallel(CCnxn*, CCnxn*); void ApplyToY(CCnxn* eqb, CCnxn* eqc, CCnxn* ca, CCnxn* cb, CCnxn* cc); void ApplyNatural(); void Limit(); void Reverse(); bool IsFixed(); bool Contains(Connector*); virtual float GetCenter(Connector*); virtual CCnxn* Copy(); void Read(istream&); void Write(ostream&); public: Connector* _lbConn, *_rtConn; CSGlue* _glue; float _pos, _deform; }; inline void CCnxn::Limit () { _glue->Limit(_deform); } CCnxn* CCnxn::Copy () { CCnxn* copy = new CCnxn(_lbConn, _rtConn, new CSGlue(_glue)); copy->_pos = _pos; copy->_deform = _deform; return copy; } void CCnxn::Print () { cout << "Cnxn " << (long) this << ":\n"; cout << "lb/rt: " << (long) _lbConn << "/" << (long) _rtConn << "\n"; cout << "pos/deform: " << _pos << "/" << _deform << "\n"; _glue->Print(); } CCnxn::CCnxn (Connector* lb, Connector* rt, CSGlue* g) { _lbConn = lb; _rtConn = rt; _glue = g; _pos = _deform = 0; } CCnxn::~CCnxn () { delete _glue; } void CCnxn::ApplyToSeries (CCnxn* ca, CCnxn* cb) { float d = _glue->_natural + _deform - ca->_glue->_natural - cb->_glue->_natural; float sa, sb; if (d < 0) { sa = ca->_glue->_shrink; sb = cb->_glue->_shrink; } else { sa = ca->_glue->_stretch; sb = cb->_glue->_stretch; } if (sa == 0 && sb == 0) { ca->_deform = 0; } else { ca->_deform = _deform * sa / (sa + sb); } ca->Limit(); cb->_deform = _deform - ca->_deform; cb->Limit(); ca->_deform = _deform - cb->_deform; ca->Limit(); ca->_pos = _pos; cb->_pos = ca->_pos + ca->_glue->_natural + ca->_deform; } void CCnxn::ApplyToParallel (CCnxn* ca, CCnxn* cb) { ca->_pos = cb->_pos = _pos; ca->_deform = _glue->_natural + _deform - ca->_glue->_natural; cb->_deform = _glue->_natural + _deform - cb->_glue->_natural; ca->Limit(); cb->Limit(); } void CCnxn::ApplyToY (CCnxn*, CCnxn* eqc, CCnxn* ca, CCnxn* cb, CCnxn* cc) { float d = _glue->_natural + _deform - ca->_glue->_natural - cb->_glue->_natural; float sa, sb; if (d < 0) { sa = ca->_glue->_shrink; sb = cb->_glue->_shrink; } else { sa = ca->_glue->_stretch; sb = cb->_glue->_stretch; } if (sa == 0 && sb == 0) { ca->_deform = 0; } else { ca->_deform = _deform * sa / (sa + sb); } ca->Limit(); cb->_deform = _deform - ca->_deform; cb->Limit(); ca->_deform = _deform - cb->_deform; ca->Limit(); cc->_deform = eqc->_deform - ca->_deform; cc->Limit(); ca->_deform = eqc->_deform - cc->_deform; ca->Limit(); cb->_deform = _deform - ca->_deform; cb->Limit(); ca->_pos = _pos; cb->_pos = cc->_pos = ca->_pos + ca->_glue->_natural + ca->_deform; } void CCnxn::ApplyNatural () { if (IsFixed()) { _pos = GetCenter(_lbConn); _deform = GetCenter(_rtConn) - _pos - _glue->_natural; } else { _deform = 0; if (_rtConn->GetMobility() == Fixed) { _pos = GetCenter(_rtConn) - _glue->_natural; } else { _pos = GetCenter(_lbConn); } } } void CCnxn::Reverse () { Connector* tmp = _lbConn; _lbConn = _rtConn; _rtConn = tmp; _pos += _glue->_natural + _deform; _deform = -_deform; _glue->Reverse(); } bool CCnxn::IsFixed () { return _lbConn->GetMobility() == Fixed && _rtConn->GetMobility() == Fixed; } bool CCnxn::Contains (Connector* c) { return _lbConn == c || _rtConn == c; } float CCnxn::GetCenter (Connector*) { return 0; } void CCnxn::Read (istream& in) { Catalog* cat = unidraw->GetCatalog(); cat->Skip(in); _glue = new CSGlue; in >> _pos >> _deform; in >> _glue->_natural >> _glue->_shrink >> _glue->_stretch; in >> _glue->_shrlim >> _glue->_strlim; _lbConn = (Connector*) cat->ReadComponent(in); _rtConn = (Connector*) cat->ReadComponent(in); } void CCnxn::Write (ostream& out) { Catalog* cat = unidraw->GetCatalog(); cat->Mark(out); out << _pos << " " << _deform << " "; out << _glue->_natural << " "; out << _glue->_shrink << " "; out << _glue->_stretch << " "; out << _glue->_shrlim << " "; out << _glue->_strlim << " "; cat->WriteComponent(_lbConn, out); cat->WriteComponent(_rtConn, out); } /*************************************************************************/ class HCnxn : public CCnxn { public: HCnxn(Connector* lb, Connector* rt, CSGlue*); virtual float GetCenter(Connector*); virtual CCnxn* Copy(); }; HCnxn::HCnxn (Connector* lb, Connector* rt, CSGlue* g) : CCnxn(lb, rt, g) { } float HCnxn::GetCenter (Connector* c) { float cx, cy; c->GetCenter(cx, cy); return cx; } CCnxn* HCnxn::Copy () { CCnxn* copy = new HCnxn(_lbConn, _rtConn, new CSGlue(_glue)); copy->_pos = _pos; copy->_deform = _deform; return copy; } /*************************************************************************/ class VCnxn : public CCnxn { public: VCnxn(Connector* lb, Connector* rt, CSGlue*); virtual float GetCenter(Connector*); virtual CCnxn* Copy(); }; VCnxn::VCnxn (Connector* lb, Connector* rt, CSGlue* g) : CCnxn(lb, rt, g) { } float VCnxn::GetCenter (Connector* c) { float cx, cy; c->GetCenter(cx, cy); return cy; } CCnxn* VCnxn::Copy () { CCnxn* copy = new VCnxn(_lbConn, _rtConn, new CSGlue(_glue)); copy->_pos = _pos; copy->_deform = _deform; return copy; } /*************************************************************************/ class CNet : public UList { public: void Print(); void Append(CNet*); void Remove(CNet*); CNet* Find(CCnxn*); CNet* First(); CNet* Last(); CNet* End(); CNet* Next(); bool IsEmpty(); CCnxn* Cnxn(); virtual CCnxn* CreateCnxn( Connector* lb = nil, Connector* rt = nil, CSGlue* = nil ); virtual CNet* CreateNetwork(CCnxn* = nil); bool Includes(Connector*); bool IsDegenerate(); protected: CNet(CCnxn* = nil); }; CNet::CNet (CCnxn* c) : UList(c) { } inline CCnxn* CNet::Cnxn () { return (CCnxn*) _object; } inline CNet* CNet::First () { return (CNet*) UList::First(); } inline CNet* CNet::Last () { return (CNet*) UList::Last(); } inline CNet* CNet::End () { return (CNet*) UList::End(); } inline CNet* CNet::Next () { return (CNet*) UList::Next(); } inline bool CNet::IsEmpty () { return UList::IsEmpty(); } inline CNet* CNet::Find (CCnxn* cnxn) { return (CNet*) UList::Find(cnxn); } inline bool CNet::IsDegenerate () { return First() == Last(); } void CNet::Print () { for (CNet* nw = First(); nw != End(); nw = nw->Next()) { nw->Cnxn()->Print(); cout << "\n"; } cout.flush(); } CCnxn* CNet::CreateCnxn (Connector*, Connector*, CSGlue*) { return nil; } CNet* CNet::CreateNetwork (CCnxn*) { return nil; } void CNet::Append (CNet* nw) { UList::Append(nw); } void CNet::Remove (CNet* nw) { UList::Remove(nw); } bool CNet::Includes (Connector* c) { for (CNet* nw = First(); nw != End(); nw = nw->Next()) { CCnxn* cnxn = nw->Cnxn(); if (cnxn->_lbConn == c || cnxn->_rtConn == c) { return true; } } return false; } /*************************************************************************/ class HNet : public CNet { public: HNet(CCnxn* = nil); virtual CCnxn* CreateCnxn( Connector* lb = nil, Connector* rt = nil, CSGlue* = nil ); virtual CNet* CreateNetwork(CCnxn* = nil); }; HNet::HNet (CCnxn* c) : CNet(c) { } CNet* HNet::CreateNetwork (CCnxn* c) { return new HNet(c); } CCnxn* HNet::CreateCnxn (Connector* lb, Connector* rt, CSGlue* g) { return new HCnxn(lb, rt, g); } /*************************************************************************/ class VNet : public CNet { public: VNet(CCnxn* = nil); virtual CCnxn* CreateCnxn( Connector* lb = nil, Connector* rt = nil, CSGlue* = nil ); virtual CNet* CreateNetwork(CCnxn* = nil); }; VNet::VNet (CCnxn* c) : CNet(c) { } CNet* VNet::CreateNetwork (CCnxn* c) { return new VNet(c); } CCnxn* VNet::CreateCnxn (Connector* lb, Connector* rt, CSGlue* g) { return new VCnxn(lb, rt, g); } /*****************************************************************************/ static const int SLOTS = 1000; /*****************************************************************************/ class CCnxn_HashElem : public UHashElem { public: CCnxn_HashElem(Connector* = nil, CCnxn* = nil); Connector* GetConn(); CCnxn* GetCnxn(); void SetCnxn(CCnxn*); private: CCnxn* _cnxn; }; CCnxn_HashElem::CCnxn_HashElem (Connector* c, CCnxn* cnxn) : UHashElem(c) { _cnxn = cnxn; } inline Connector* CCnxn_HashElem::GetConn () { return (Connector*) GetKey(); } inline CCnxn* CCnxn_HashElem::GetCnxn () { return _cnxn; } inline void CCnxn_HashElem::SetCnxn (CCnxn* cnxn) { _cnxn = cnxn; } /*****************************************************************************/ class CU_HashElem : public UHashElem { public: CU_HashElem(Component* = nil, float = 0, float = 0); Component* GetComp(); float GetX(); float GetY(); void SetX(float); void SetY(float); private: float _px, _py; }; CU_HashElem::CU_HashElem (Component* c, float px, float py) : UHashElem(c) { _px = px; _py = py; } inline Component* CU_HashElem::GetComp () { return (Component*) GetKey(); } inline float CU_HashElem::GetX () { return _px; } inline float CU_HashElem::GetY () { return _py; } inline void CU_HashElem::SetX (float px) { _px = px; } inline void CU_HashElem::SetY (float py) { _py = py; } /*****************************************************************************/ class CS_HashTable : public UHashTable { public: virtual ~CS_HashTable(); void First(Iterator&); void Next(Iterator&); bool Done(Iterator); void Remove(Iterator&); UHashElem* GetElem(Iterator); virtual void Register(void* key, UHashElem* = nil); protected: CS_HashTable(); UList* ULElem(Iterator); UHashElem* Elem(UList*); private: UList* _elems; }; UHashElem* CS_HashTable::Elem (UList* r) { return (UHashElem*) (*r)(); } UList* CS_HashTable::ULElem (Iterator i) { return (UList*) i.GetValue(); } bool CS_HashTable::Done (Iterator i) { return ULElem(i) == _elems->End(); } void CS_HashTable::First (Iterator& i) { i.SetValue(_elems->First()); } void CS_HashTable::Next (Iterator& i) { i.SetValue(ULElem(i)->Next()); } UHashElem* CS_HashTable::GetElem (Iterator i) { return Elem(ULElem(i)); } void CS_HashTable::Remove (Iterator& i) { UList* doomed = ULElem(i); Next(i); _elems->Remove(doomed); delete doomed; } CS_HashTable::CS_HashTable () : UHashTable(SLOTS) { _elems = new UList; } CS_HashTable::~CS_HashTable () { delete _elems; } void CS_HashTable::Register (void* key, UHashElem* elem) { UHashTable::Register(key, elem); elem = (elem == nil) ? Find(key) : elem; _elems->Append(new UList(elem)); } /*****************************************************************************/ class CCnxn_HashTable : public CS_HashTable { public: CCnxn_HashTable(); CCnxn_HashElem* GetElem(Iterator); CCnxn_HashElem* Find(Connector*); protected: virtual UHashElem* CreateElem(); }; CCnxn_HashTable::CCnxn_HashTable () { } UHashElem* CCnxn_HashTable::CreateElem () { return new CCnxn_HashElem; } CCnxn_HashElem* CCnxn_HashTable::Find (Connector* c) { return (CCnxn_HashElem*) CS_HashTable::Find(c); } CCnxn_HashElem* CCnxn_HashTable::GetElem (Iterator i) { return (CCnxn_HashElem*) CS_HashTable::GetElem(i); } /*****************************************************************************/ class CU_HashTable : public CS_HashTable { public: CU_HashTable(); CU_HashElem* GetElem(Iterator); CU_HashElem* Find(Component*); protected: virtual UHashElem* CreateElem(); }; CU_HashTable::CU_HashTable () { } UHashElem* CU_HashTable::CreateElem () { return new CU_HashElem; } CU_HashElem* CU_HashTable::Find (Component* c) { return (CU_HashElem*) CS_HashTable::Find(c); } CU_HashElem* CU_HashTable::GetElem (Iterator i) { return (CU_HashElem*) CS_HashTable::GetElem(i); } /*************************************************************************/ class CUpdater { public: CUpdater(); void AddHCnxn(CCnxn*); void AddVCnxn(CCnxn*); void Update(); private: void AddCnxn(Connector*, CCnxn*, Orientation); void UpdateCnxns(); void UpdateParents(); float Position(Connector*, CCnxn*); void CalcTranslation(Connector*, float, float, float&, float&); private: CU_HashTable _hash; }; CUpdater::CUpdater () { } void CUpdater::AddHCnxn (CCnxn* cnxn) { AddCnxn(cnxn->_lbConn, cnxn, Horizontal); AddCnxn(cnxn->_rtConn, cnxn, Horizontal); } void CUpdater::AddVCnxn (CCnxn* cnxn) { AddCnxn(cnxn->_lbConn, cnxn, Vertical); AddCnxn(cnxn->_rtConn, cnxn, Vertical); } void CUpdater::Update () { UpdateCnxns(); UpdateParents(); } void CUpdater::AddCnxn (Connector* c, CCnxn* cnxn, Orientation orient) { if (c->GetMobility() != Fixed) { CU_HashElem* elem = _hash.Find(c); if (elem == nil) { elem = new CU_HashElem; _hash.Register(c, elem); } if (orient == Horizontal) { elem->SetX(Position(c, cnxn)); } else { elem->SetY(Position(c, cnxn)); } } } void CUpdater::CalcTranslation ( Connector* c, float px, float py, float& dx, float& dy ) { const float thresh = .0001; float cx, cy, ox, oy; Transformer rel; c->GetGraphic()->Parent()->TotalTransformation(rel); c->GetCenter(cx, cy); rel.InvTransform(0., 0., ox, oy); rel.InvTransform(px - cx, py - cy, dx, dy); dx -= ox; dy -= oy; dx = (fabs(dx) < thresh) ? 0 : dx; dy = (fabs(dy) < thresh) ? 0 : dy; } void CUpdater::UpdateCnxns () { float dx, dy; Iterator i; _hash.First(i); while (!_hash.Done(i)) { CU_HashElem* elem = _hash.GetElem(i); CalcTranslation( (Connector*) elem->GetComp(), elem->GetX(), elem->GetY(), dx, dy ); if (dx == 0 && dy == 0) { _hash.Remove(i); } else { _hash.Next(i); MoveCmd move((Editor*) nil, dx, dy); elem->GetComp()->Interpret(&move); } } } void CUpdater::UpdateParents () { Iterator i; CU_HashTable parents; for (_hash.First(i); !_hash.Done(i); _hash.Next(i)) { Component* parent = _hash.GetElem(i)->GetComp()->GetParent(); if (parents.Find(parent) == nil) { parents.Register(parent); } } for (parents.First(i); !parents.Done(i); parents.Next(i)) { parents.GetElem(i)->GetComp()->Update(); } } float CUpdater::Position (Connector* c, CCnxn* cnxn) { if (c == cnxn->_lbConn) { return cnxn->_pos; } else { // c == cnxn->_rtConn return cnxn->_pos + cnxn->_glue->_natural + cnxn->_deform; } } /*****************************************************************************/ class PeerInfo { public: PeerInfo(Connector* = nil, int = 1); public: Connector* _peer; int _ncnxns; }; PeerInfo::PeerInfo (Connector* peer, int ncnxns) { _peer = peer; _ncnxns = ncnxns; } /*****************************************************************************/ class ConnInfo { // horiz/vert info stored in CSolverInfo public: ConnInfo(CNet* nw = nil); ~ConnInfo(); void Include(Connector*); void Exclude(Connector*); void First(Iterator&); void Next(Iterator&); bool Done(Iterator); void Append(Connector*); void Remove(Iterator&); PeerInfo* GetInfo(Iterator); Connector* FindParallelPeer(); CNet* GetNetwork(); void SetNetwork(CNet*); int NumPeers(); int NumParallels(); private: PeerInfo* Info(UList*); UList* Elem(Iterator); private: CNet* _net; // connector's network UList* _peers; // list of PeerInfos int _npeers; int _nparallels; // tot # of peers connected in parallel }; inline PeerInfo* ConnInfo::Info (UList* u) { return (PeerInfo*) (*u)(); } inline UList* ConnInfo::Elem (Iterator i) { return (UList*) i.GetValue(); } inline void ConnInfo::First (Iterator& i) { i.SetValue(_peers->First()); } inline void ConnInfo::Next (Iterator& i) { i.SetValue(Elem(i)->Next()); } inline bool ConnInfo::Done (Iterator i) { return Elem(i) == _peers->End(); } inline PeerInfo* ConnInfo::GetInfo (Iterator i) { return Info(Elem(i)); } inline CNet* ConnInfo::GetNetwork () { return _net; } inline void ConnInfo::SetNetwork (CNet* nw) { _net = nw; } inline int ConnInfo::NumPeers () { return _npeers; } inline int ConnInfo::NumParallels () { return _nparallels; } void ConnInfo::Append (Connector* peer) { _peers->Append(new UList(new PeerInfo(peer))); ++_npeers; } void ConnInfo::Remove (Iterator& i) { UList* doomed = Elem(i); Next(i); _peers->Remove(doomed); delete doomed; --_npeers; } ConnInfo::ConnInfo (CNet* nw) { _net = nw; _peers = new UList; _npeers = _nparallels = 0; } ConnInfo::~ConnInfo () { while (!_peers->IsEmpty()) { UList* u = _peers->First(); _peers->Remove(u); PeerInfo* info = Info(u); delete info; delete u; } delete _peers; } void ConnInfo::Include (Connector* peer) { Iterator i; for (First(i); !Done(i); Next(i)) { PeerInfo* info = GetInfo(i); if (info->_peer == peer) { ++info->_ncnxns; ++_nparallels; return; } } Append(peer); } void ConnInfo::Exclude (Connector* peer) { Iterator i; for (First(i); !Done(i); Next(i)) { PeerInfo* info = GetInfo(i); if (info->_peer == peer) { if (info->_ncnxns > 1) { --info->_ncnxns; --_nparallels; } else { delete info; Remove(i); } break; } } } Connector* ConnInfo::FindParallelPeer () { Iterator i; for (First(i); !Done(i); Next(i)) { PeerInfo* info = GetInfo(i); if (info->_ncnxns > 1) { return info->_peer; } } return nil; } /*****************************************************************************/ class CSolverInfo { /* info stored in each connector */ public: CSolverInfo(); ~CSolverInfo(); public: ConnInfo* _hinfo, *_vinfo; }; CSolverInfo::CSolverInfo () { _hinfo = new ConnInfo; _vinfo = new ConnInfo; } CSolverInfo::~CSolverInfo () { delete _hinfo; delete _vinfo; } /*************************************************************************/ CSolverState::CSolverState (CCnxn* cnxn, Orientation orient) { _cnxn = cnxn; _orient = orient; _next = nil; } CSolverState::~CSolverState () { delete _cnxn; delete _next; } inline CSolverState* CSolverState::First () { return _next; } inline CSolverState* CSolverState::Next () { return _next; } void CSolverState::Append (CSolverState* state) { state->_next = _next; _next = state; } /*************************************************************************/ inline CNet* CSolver::Network (UList* u) { return (CNet*) (*u)(); } void CSolver::Print () { CNet* hnet = Network(_hnets->Last()); hnet->Print(); cout << "----------------\n\n"; cout.flush(); } CSolver::CSolver () { _hnets = new UList; _vnets = new UList; _hwritten = new CCnxn_HashTable; _vwritten = new CCnxn_HashTable; } CSolver::~CSolver () { DestroyCnxns(); delete _hnets; delete _vnets; delete _hwritten; delete _vwritten; } void CSolver::Connect (Connector* c1, Connector* c2, CGlue* g) { if (c1 != c2) { CSGlue* gh, *gv; if (g == nil) { gh = new CSGlue; gv = new CSGlue; } else { gh = new CSGlue( g->_width, g->_hshrink, g->_hstretch, g->_hshrlim, g->_hstrlim ); gv = new CSGlue( g->_height, g->_vshrink, g->_vstretch, g->_vshrlim, g->_vstrlim ); } UpdateInfo(new HCnxn(c1, c2, gh), Horizontal); UpdateInfo(new VCnxn(c1, c2, gv), Vertical); } } void CSolver::DestroyCnxns () { UList* hu, *vu; for ( hu = _hnets->First(), vu = _vnets->First(); hu != _hnets->End(); hu = hu->Next(), vu = vu->Next() ) { DestroyCnxns(Network(hu)); DestroyCnxns(Network(vu)); } } void CSolver::DestroyCnxns (CNet* nets) { for (CNet* nw = nets->First(); nw != nets->End(); nw = nw->Next()) { CCnxn* cnxn = nw->Cnxn(); CSolverInfo* lbinfo = cnxn->_lbConn->_csinfo; CSolverInfo* rtinfo = cnxn->_rtConn->_csinfo; delete lbinfo; delete rtinfo; cnxn->_lbConn->_csinfo = nil; cnxn->_rtConn->_csinfo = nil; } } void CSolver::Solve () { SolveAll(_hnets, Horizontal); SolveAll(_vnets, Vertical); Update(); } void CSolver::SolveAll (UList* nets, Orientation orient) { for (UList* u = nets->First(); u != nets->End(); u = u->Next()) { Solve(Network(u), orient); } } void CSolver::Solve (CNet* net, Orientation orient) { CNet* nwa, *nwb, *nwc, *eqa, *eqb, *eqc; Connector* c1, *c2; bool rva, rvb, rvc; if (net->IsDegenerate()) { DefaultPosition(net); } else if (FoundFixed(net, nwa)) { SubstFixedEquiv(net, nwa, eqa, orient); Solve(net, orient); ReplaceFixed(net, nwa, eqa, orient); } else if (FoundSeries(net, nwa, nwb, orient)) { SubstSeriesEquiv(net, nwa, nwb, eqa, rva, rvb, orient); Solve(net, orient); ReplaceSeries(net, nwa, nwb, eqa, rva, rvb, orient); } else if (FoundParallel(net, nwa, nwb, orient)) { SubstParallelEquiv(net, nwa, nwb, eqa, rva, orient); Solve(net, orient); ReplaceParallel(net, nwa, nwb, eqa, rva, orient); } else if (FoundY(net, nwa, nwb, nwc, orient)) { SubstYEquiv(net, nwa, nwb, nwc, eqa, eqb, eqc, rva, rvb, rvc, orient); Solve(net, orient); ReplaceY(net, nwa, nwb, nwc, eqa, eqb, eqc, rva, rvb, rvc, orient); } else if (Found2Fixed(net, c1, c2)) { SubstPseudoFixed(net, c1, c2, eqa, orient); Solve(net, orient); ReplacePseudoFixed(net, c1, c2, eqa, orient); } else { DefaultPosition(net); } } void CSolver::Update () { CUpdater cupdater; UList* hu, *vu; for ( hu = _hnets->First(), vu = _vnets->First(); hu != _hnets->End(); hu = hu->Next(), vu = vu->Next() ) { CNet* hcl = Network(hu); CNet* vcl = Network(vu); CNet* nw; for (nw = hcl->First(); nw != hcl->End(); nw = nw->Next()) { cupdater.AddHCnxn(nw->Cnxn()); } for (nw = vcl->First(); nw != vcl->End(); nw = nw->Next()) { cupdater.AddVCnxn(nw->Cnxn()); } } cupdater.Update(); } void CSolver::InitInfo (Connector* conn) { if (conn->_csinfo == nil) { conn->_csinfo = new CSolverInfo; } } void CSolver::UpdateInfo (CCnxn* cnxn, Orientation orient) { Connector* lb = cnxn->_lbConn; Connector* rt = cnxn->_rtConn; InitInfo(lb); InitInfo(rt); ConnInfo* lbinfo, *rtinfo; UList* nets; if (orient == Horizontal) { lbinfo = lb->_csinfo->_hinfo; rtinfo = rt->_csinfo->_hinfo; nets = _hnets; } else { lbinfo = lb->_csinfo->_vinfo; rtinfo = rt->_csinfo->_vinfo; nets = _vnets; } UpdateInfo(cnxn, lbinfo, rtinfo, nets); } void CSolver::UpdateInfo ( CCnxn* cnxn, ConnInfo* lbinfo, ConnInfo* rtinfo, UList* nets ) { if (lbinfo->GetNetwork() == nil) { if (rtinfo->GetNetwork() == nil) { // create new nw, add it to nets CreateNetwork(cnxn, lbinfo, rtinfo, nets); } else { // add cnxn to rtConn's nw CNet* nw = rtinfo->GetNetwork(); lbinfo->SetNetwork(nw); nw->Append(nw->CreateNetwork(cnxn)); } } else if (rtinfo->GetNetwork() == nil) { // add cnxn to lbConn's nw CNet* nw = lbinfo->GetNetwork(); rtinfo->SetNetwork(nw); nw->Append(nw->CreateNetwork(cnxn)); } else if (lbinfo->GetNetwork() != rtinfo->GetNetwork()) { CNet* nw = lbinfo->GetNetwork(); // merge their nets MergeNetworks(nw, rtinfo->GetNetwork(), nets); nw->Append(nw->CreateNetwork(cnxn)); } else { // add cnxn to their nw CNet* nw = lbinfo->GetNetwork(); nw->Append(nw->CreateNetwork(cnxn)); } lbinfo->Include(cnxn->_rtConn); rtinfo->Include(cnxn->_lbConn); } void CSolver::CreateNetwork ( CCnxn* cnxn, ConnInfo* lbinfo, ConnInfo* rtinfo, UList* nets ) { CNet* nw = (nets == _hnets) ? (CNet*) new HNet : (CNet*) new VNet; lbinfo->SetNetwork(nw); rtinfo->SetNetwork(nw); nw->Append(nw->CreateNetwork(cnxn)); nets->Append(new UList(nw)); } void CSolver::MergeNetworks (CNet* merge, CNet* doomed, UList* nets) { if (nets == _hnets) { while (!doomed->IsEmpty()) { CNet* nw = doomed->First(); doomed->Remove(nw); merge->Append(nw); CCnxn* cnxn = nw->Cnxn(); cnxn->_lbConn->_csinfo->_hinfo->SetNetwork(merge); cnxn->_rtConn->_csinfo->_hinfo->SetNetwork(merge); } } else { while (!doomed->IsEmpty()) { CNet* nw = doomed->First(); doomed->Remove(nw); merge->Append(nw); CCnxn* cnxn = nw->Cnxn(); cnxn->_lbConn->_csinfo->_vinfo->SetNetwork(merge); cnxn->_rtConn->_csinfo->_vinfo->SetNetwork(merge); } } nets->Delete(doomed); delete doomed; } void CSolver::Disconnect (Connector* c) { CSolverInfo* csinfo = c->_csinfo; if (csinfo != nil) { DeleteCnxnsTo(c, csinfo->_hinfo->GetNetwork(), _hnets); DeleteCnxnsTo(c, csinfo->_vinfo->GetNetwork(), _vnets); DeletePeerInfo(c, csinfo->_hinfo); DeletePeerInfo(c, csinfo->_vinfo); delete csinfo; c->_csinfo = nil; } } void CSolver::DeleteCnxnsTo (Connector* c, CNet* net, UList* nets) { CNet* next; if (net != nil) { for (CNet* nw = net->First(); nw != net->End(); nw = next) { CCnxn* cnxn = nw->Cnxn(); next = nw->Next(); if (cnxn->Contains(c)) { net->Remove(nw); delete cnxn; delete nw; } } if (net->IsEmpty()) { nets->Delete(net); delete net; } } } void CSolver::Disconnect (Connector* c1, Connector* c2) { CSolverInfo* csinfo1 = c1->_csinfo; CSolverInfo* csinfo2 = c2->_csinfo; if (csinfo1 != nil && csinfo2 != nil) { CNet* hnw = csinfo1->_hinfo->GetNetwork(); CNet* vnw = csinfo1->_vinfo->GetNetwork(); DeleteCnxnsBetween(c1, c2, hnw); DeleteCnxnsBetween(c1, c2, vnw); DeletePeerInfo(c1, csinfo1->_hinfo, c2); DeletePeerInfo(c1, csinfo1->_vinfo, c2); bool bothEmpty = hnw->IsEmpty() && vnw->IsEmpty(); if (bothEmpty || hnw->IsEmpty()) { _hnets->Delete(hnw); delete hnw; } if (bothEmpty || vnw->IsEmpty()) { _vnets->Delete(vnw); delete vnw; } if (bothEmpty) { delete csinfo1; delete csinfo2; c1->_csinfo = nil; c2->_csinfo = nil; } } } void CSolver::DeleteCnxnsBetween (Connector* c1, Connector* c2, CNet* net) { CNet* next; if (net != nil) { for (CNet* nw = net->First(); nw != net->End(); nw = next) { CCnxn* cnxn = nw->Cnxn(); next = nw->Next(); if (cnxn->Contains(c1) && cnxn->Contains(c2)) { net->Remove(nw); delete cnxn; delete nw; } } } } void CSolver::DeletePeerInfo (Connector* c, ConnInfo* info) { Iterator i; for (info->First(i); !info->Done(i); info->First(i)) { DeletePeerInfo(c, info, info->GetInfo(i)->_peer); } } void CSolver::DeletePeerInfo (Connector* c, ConnInfo* info, Connector* peer) { info->Exclude(peer); ConnInfo* pci; if (info == c->_csinfo->_hinfo) { pci = peer->_csinfo->_hinfo; } else { pci = peer->_csinfo->_vinfo; } pci->Exclude(c); if (pci->NumPeers() == 0) { pci->SetNetwork(nil); } if (info->NumPeers() == 0) { info->SetNetwork(nil); } } CSolverState* CSolver::GetState (Connector* c) { CSolverInfo* csinfo = c->_csinfo; CSolverState* state = nil; if (csinfo != nil) { state = new CSolverState; GetState(c, csinfo->_hinfo, Horizontal, state); GetState(c, csinfo->_vinfo, Vertical, state); } return state; } void CSolver::GetState ( Connector* c, ConnInfo* info, Orientation orient, CSolverState* state ) { CNet* net = info->GetNetwork(); if (net != nil) { for (CNet* nw = net->First(); nw != net->End(); nw = nw->Next()) { CCnxn* cnxn = nw->Cnxn(); if (cnxn->Contains(c)) { state->Append(new CSolverState(cnxn->Copy(), orient)); } } } } void CSolver::SetState (CSolverState* state) { for (CSolverState* s = state->First(); s != nil; s = s->Next()) { UpdateInfo(s->_cnxn->Copy(), s->_orient); Connector* lbConn = s->_cnxn->_lbConn; Connector* rtConn = s->_cnxn->_rtConn; if (!lbConn->ConnectedTo(rtConn)) { lbConn->Connector::Connect(rtConn); } } } void CSolver::Wrote (Connector* c) { if (c->_csinfo != nil) { Wrote(c, c->_csinfo->_hinfo->GetNetwork(), _hwritten); Wrote(c, c->_csinfo->_vinfo->GetNetwork(), _vwritten); } } void CSolver::Wrote (Connector* c, CNet* nw, CCnxn_HashTable* written) { if (nw != nil && written->Find(c) == nil) { for (CNet* n = nw->First(); n != nw->End(); n = n->Next()) { CCnxn* cnxn = n->Cnxn(); Connector* lbConn = cnxn->_lbConn; Connector* rtConn = cnxn->_rtConn; if ( (lbConn == c && written->Find(rtConn) == nil) || (rtConn == c && written->Find(lbConn) == nil) ) { CCnxn_HashElem* elem = new CCnxn_HashElem; elem->SetCnxn(cnxn); written->Register(c, elem); } else if (lbConn == c || rtConn == c) { written->Register(c); } } } } void CSolver::InitConnectors (CNet* hnw, CNet* vnw) { CCnxn* hcnxn, *vcnxn; CNet* h = hnw->First(); CNet* v = vnw->First(); for (;;) { if (h == hnw->End()) { if (v == vnw->End()) { break; } else { vcnxn = v->Cnxn(); v = v->Next(); UpdateInfo(vcnxn, Vertical); } } else { hcnxn = h->Cnxn(); h = h->Next(); if (v != vnw->End()) { vcnxn = v->Cnxn(); v = v->Next(); UpdateInfo(vcnxn, Vertical); } UpdateInfo(hcnxn, Horizontal); } } } void CSolver::ReadConnectors (istream& in, CNet* nw) { unidraw->GetCatalog()->Skip(in); int count; in >> count; for (int i = 0; i < count; ++i) { CCnxn* cnxn = nw->CreateCnxn(); cnxn->Read(in); nw->Append(nw->CreateNetwork(cnxn)); Connector* lbConn = cnxn->_lbConn; Connector* rtConn = cnxn->_rtConn; if (!lbConn->ConnectedTo(rtConn)) { lbConn->Connector::Connect(rtConn); } } } void CSolver::WriteConnectors (ostream& out, CCnxn_HashTable* written) { unidraw->GetCatalog()->Mark(out); Iterator i; int count = 0; for (written->First(i); !written->Done(i); written->Next(i)) { CCnxn* cnxn = written->GetElem(i)->GetCnxn(); if (cnxn != nil) { Connector* lbConn = cnxn->_lbConn; Connector* rtConn = cnxn->_rtConn; if (written->Find(lbConn) != nil && written->Find(rtConn) != nil) { ++count; } } } out << count << " "; for (written->First(i); !written->Done(i); written->Next(i)) { CCnxn* cnxn = written->GetElem(i)->GetCnxn(); if (cnxn != nil) { Connector* lbConn = cnxn->_lbConn; Connector* rtConn = cnxn->_rtConn; if (written->Find(lbConn) != nil && written->Find(rtConn) != nil) { cnxn->Write(out); } } } } void CSolver::Read (istream& in) { HNet hnet; VNet vnet; ReadConnectors(in, &hnet); ReadConnectors(in, &vnet); InitConnectors(&hnet, &vnet); } void CSolver::Write (ostream& out) { WriteConnectors(out, _hwritten); WriteConnectors(out, _vwritten); delete _hwritten; delete _vwritten; _hwritten = new CCnxn_HashTable; _vwritten = new CCnxn_HashTable; } bool CSolver::FoundFixed (CNet* net, CNet*& nw) { for (nw = net->First(); nw != net->End(); nw = nw->Next()) { if (nw->Cnxn()->IsFixed()) { return true; } } return false; } inline Connector* Shared (CCnxn* c1, CCnxn* c2) { if (c1->_lbConn == c2->_lbConn || c1->_lbConn == c2->_rtConn) { return c1->_lbConn; } else { return c1->_rtConn; } } inline bool IsCrossover (CCnxn* c1, CCnxn* c2) { return c1->_lbConn == c2->_rtConn && c1->_rtConn == c2->_lbConn; } ConnInfo* CSolver::Info (Connector* c, Orientation orient) { return (orient == Horizontal) ? c->_csinfo->_hinfo : c->_csinfo->_vinfo; } static Connector* FindFixed (CNet*& nw, CNet* end) { for (nw = nw->Next(); nw != end; nw = nw->Next()) { CCnxn* c = nw->Cnxn(); if (c->_lbConn->GetMobility() == Fixed) { return c->_lbConn; } else if (c->_rtConn->GetMobility() == Fixed) { return c->_rtConn; } } return nil; } static CNet* FindSeries (Connector* conn, CNet* begin, CNet* end) { for (CNet* nw = begin; nw != end; nw = nw->Next()) { if (nw->Cnxn()->Contains(conn)) { return nw; } } return nil; // shouldn't happen } static void FindParallel ( Connector* conn, ConnInfo* info, CNet* begin, CNet* end, CNet*& nwa, CNet*& nwb ) { Connector* peer = info->FindParallelPeer(); for (nwa = begin; nwa != end; nwa = nwa->Next()) { CCnxn* test = nwa->Cnxn(); if (test->Contains(conn) && test->Contains(peer)) { for (nwb = nwa->Next(); nwb != end; nwb = nwb->Next()) { test = nwb->Cnxn(); if (test->Contains(conn) && test->Contains(peer)) { return; } } } } } static void FindY ( Connector* conn, CNet* begin, CNet* end, CNet*& nwb, CNet*& nwc ) { for (nwb = begin; nwb != end; nwb = nwb->Next()) { if (nwb->Cnxn()->Contains(conn)) { for (nwc = nwb->Next(); nwc != end; nwc = nwc->Next()) { if (nwc->Cnxn()->Contains(conn)) { return; } } } } } bool CSolver::Found2Fixed (CNet* net, Connector*& c1, Connector*& c2) { CNet* cur = net, *end = net->End(); c1 = FindFixed(cur, end); if (c1 == nil) { return false; } do { c2 = FindFixed(cur, end); } while (c2 != nil && c2 == c1); return c2 != nil; } bool CSolver::FoundSeries ( CNet* net, CNet*& nwa, CNet*& nwb, Orientation orient ) { for (nwa = net->First(); nwa != net->End(); nwa = nwa->Next()) { CCnxn* cnxn = nwa->Cnxn(); ConnInfo* lbinfo = Info(cnxn->_lbConn, orient); ConnInfo* rtinfo = Info(cnxn->_rtConn, orient); if ( lbinfo->NumPeers() == 2 && lbinfo->NumParallels() == 0 && cnxn->_lbConn->GetMobility() != Fixed ) { nwb = FindSeries(cnxn->_lbConn, nwa->Next(), net->End()); return true; } if ( rtinfo->NumPeers() == 2 && rtinfo->NumParallels() == 0 && cnxn->_rtConn->GetMobility() != Fixed ) { nwb = FindSeries(cnxn->_rtConn, nwa->Next(), net->End()); return true; } } return false; } bool CSolver::FoundParallel ( CNet* net, CNet*& nwa, CNet*& nwb, Orientation orient ) { for (nwa = net->First(); nwa != net->End(); nwa = nwa->Next()) { CCnxn* cnxn = nwa->Cnxn(); ConnInfo* lbinfo = Info(cnxn->_lbConn, orient); ConnInfo* rtinfo = Info(cnxn->_rtConn, orient); if (lbinfo->NumParallels() > 0) { FindParallel(cnxn->_lbConn, lbinfo, nwa, net->End(), nwa, nwb); return true; } if (rtinfo->NumParallels() > 0) { FindParallel(cnxn->_rtConn, rtinfo, nwa, net->End(), nwa, nwb); return true; } } return false; } bool CSolver::FoundY ( CNet* net, CNet*& nwa, CNet*& nwb, CNet*& nwc, Orientation orient ) { for (nwa = net->First(); nwa != net->End(); nwa = nwa->Next()) { CCnxn* cnxn = nwa->Cnxn(); ConnInfo* lbinfo = Info(cnxn->_lbConn, orient); ConnInfo* rtinfo = Info(cnxn->_rtConn, orient); if ( lbinfo->NumPeers() == 3 && lbinfo->NumParallels() == 0 && cnxn->_lbConn->GetMobility() != Fixed ) { FindY(cnxn->_lbConn, nwa->Next(), net->End(), nwb, nwc); return true; } if ( rtinfo->NumPeers() == 3 && rtinfo->NumParallels() == 0 && cnxn->_rtConn->GetMobility() != Fixed ) { FindY(cnxn->_rtConn, nwa->Next(), net->End(), nwb, nwc); return true; } } return false; } void CSolver::SubstFixedEquiv ( CNet* net, CNet* nw, CNet*& next, Orientation orient ) { next = nw->Next(); net->Remove(nw); SubstFixedInfo(nw, orient); } void CSolver::SubstSeriesEquiv ( CNet* net, CNet* nwa, CNet* nwb, CNet*& equiv, bool& rva, bool& rvb, Orientation orient ) { CCnxn* ca = nwa->Cnxn(); CCnxn* cb = nwb->Cnxn(); Connector* shared = Shared(ca, cb); if ((rva = (shared == ca->_lbConn))) ca->Reverse(); if ((rvb = (shared == cb->_rtConn))) cb->Reverse(); equiv = net->CreateNetwork( net->CreateCnxn( ca->_lbConn, cb->_rtConn, ca->_glue->Series(cb->_glue) ) ); nwa->Append(equiv); net->Remove(nwa); net->Remove(nwb); SubstSeriesInfo(nwa, nwb, orient); } void CSolver::SubstParallelEquiv ( CNet* net, CNet* nwa, CNet* nwb, CNet*& equiv, bool& reversed, Orientation orient ) { CCnxn* ca = nwa->Cnxn(); CCnxn* cb = nwb->Cnxn(); reversed = IsCrossover(ca, cb); if (reversed) { ca->Reverse(); } equiv = net->CreateNetwork( net->CreateCnxn( ca->_lbConn, cb->_rtConn, ca->_glue->Parallel(cb->_glue) ) ); nwa->Append(equiv); net->Remove(nwa); net->Remove(nwb); SubstParallelInfo(nwa, orient); } void CSolver::SubstYEquiv ( CNet* net, CNet* nwa, CNet* nwb, CNet* nwc, CNet*& nweqa, CNet*& nweqb, CNet*& nweqc, bool& rva, bool& rvb, bool& rvc, Orientation orient ) { CCnxn* ca = nwa->Cnxn(); CCnxn* cb = nwb->Cnxn(); CCnxn* cc = nwc->Cnxn(); Connector* shared = Shared(ca, cb); if ((rva = (shared == ca->_lbConn))) ca->Reverse(); if ((rvb = (shared == cb->_rtConn))) cb->Reverse(); if ((rvc = (shared == cc->_rtConn))) cc->Reverse(); nweqa = net->CreateNetwork( net->CreateCnxn( ca->_lbConn, cb->_rtConn, ca->_glue->a_Y(cb->_glue, cc->_glue) ) ); nweqb = net->CreateNetwork( net->CreateCnxn( cb->_rtConn, cc->_rtConn, ca->_glue->b_Y(cb->_glue, cc->_glue) ) ); nweqc = net->CreateNetwork( net->CreateCnxn( ca->_lbConn, cc->_rtConn, ca->_glue->c_Y(cb->_glue, cc->_glue) ) ); nwa->Append(nweqa); nwb->Append(nweqb); nwc->Append(nweqc); net->Remove(nwa); net->Remove(nwb); net->Remove(nwc); SubstYInfo(nwa, nwb, nwc, orient); } void CSolver::SubstPseudoFixed ( CNet* net, Connector* c1, Connector* c2, CNet*& equiv, Orientation orient ) { float cx1, cy1, cx2, cy2; c1->GetCenter(cx1, cy1); c2->GetCenter(cx2, cy2); float nat = (orient == Horizontal) ? (cx2 - cx1) : (cy2 - cy1); equiv = net->CreateNetwork( net->CreateCnxn(c1, c2, new CSGlue(nat, 0, 0, 0, 0)) ); net->Append(equiv); SubstPseudoFixedInfo(equiv, orient); c2->SetMobility(Floating); } void CSolver::ReplaceFixed ( CNet*, CNet* nw, CNet*& next, Orientation orient ) { ReplaceFixedInfo(nw, orient); nw->Cnxn()->ApplyNatural(); next->Append(nw); } void CSolver::ReplaceSeries ( CNet* net, CNet* nwa, CNet* nwb, CNet*& equiv, bool rva, bool rvb, Orientation orient ) { CCnxn* ca = nwa->Cnxn(); CCnxn* cb = nwb->Cnxn(); CCnxn* eq = equiv->Cnxn(); ReplaceSeriesInfo(nwa, nwb, orient); eq->ApplyToSeries(ca, cb); equiv->Append(nwa); equiv->Append(nwb); net->Remove(equiv); delete eq; delete equiv; equiv = nil; if (rva) ca->Reverse(); if (rvb) cb->Reverse(); } void CSolver::ReplaceParallel ( CNet* net, CNet* nwa, CNet* nwb, CNet*& equiv, bool reversed, Orientation orient ) { CCnxn* ca = nwa->Cnxn(); CCnxn* cb = nwb->Cnxn(); CCnxn* eq = equiv->Cnxn(); ReplaceParallelInfo(nwa, orient); eq->ApplyToParallel(ca, cb); equiv->Append(nwa); equiv->Append(nwb); net->Remove(equiv); delete eq; delete equiv; equiv = nil; if (reversed) ca->Reverse(); } void CSolver::ReplaceY ( CNet* net, CNet* nwa, CNet* nwb, CNet* nwc, CNet*& nweqa, CNet*& nweqb, CNet*& nweqc, bool rva, bool rvb, bool rvc, Orientation orient ) { CCnxn* ca = nwa->Cnxn(); CCnxn* cb = nwb->Cnxn(); CCnxn* cc = nwc->Cnxn(); CCnxn* eqa = nweqa->Cnxn(); CCnxn* eqb = nweqb->Cnxn(); CCnxn* eqc = nweqc->Cnxn(); ReplaceYInfo(nwa, nwb, nwc, orient); eqa->ApplyToY(eqb, eqc, ca, cb, cc); nweqa->Append(nwa); nweqb->Append(nwb); nweqc->Append(nwc); net->Remove(nweqa); net->Remove(nweqb); net->Remove(nweqc); delete eqa; delete eqb; delete eqc; delete nweqa; delete nweqb; delete nweqc; nweqa = nweqb = nweqc = nil; if (rva) ca->Reverse(); if (rvb) cb->Reverse(); if (rvc) cc->Reverse(); } void CSolver::ReplacePseudoFixed ( CNet* net, Connector*, Connector* c2, CNet*& equiv, Orientation orient ) { CCnxn* eq = equiv->Cnxn(); ReplacePseudoFixedInfo(equiv, orient); net->Remove(equiv); delete eq; delete equiv; equiv = nil; c2->SetMobility(Fixed); } void CSolver::DefaultPosition (CNet* net) { for (CNet* nw = net->First(); nw != net->End(); nw = nw->Next()) { nw->Cnxn()->ApplyNatural(); } } void CSolver::SubstFixedInfo (CNet* nwa, Orientation orient) { CCnxn* cnxn = nwa->Cnxn(); ConnInfo* lbinfo = Info(cnxn->_lbConn, orient); ConnInfo* rtinfo = Info(cnxn->_rtConn, orient); lbinfo->Exclude(cnxn->_rtConn); rtinfo->Exclude(cnxn->_lbConn); } void CSolver::SubstSeriesInfo (CNet* nwa, CNet* nwb, Orientation orient) { CCnxn* ca = nwa->Cnxn(); CCnxn* cb = nwb->Cnxn(); Connector* shared = Shared(ca, cb); Connector* conna = (ca->_lbConn == shared) ? ca->_rtConn : ca->_lbConn; Connector* connb = (cb->_lbConn == shared) ? cb->_rtConn : cb->_lbConn; ConnInfo* infoa = Info(conna, orient); ConnInfo* infob = Info(connb, orient); infoa->Include(connb); infob->Include(conna); infoa->Exclude(shared); infob->Exclude(shared); } void CSolver::SubstParallelInfo (CNet* nwa, Orientation orient) { CCnxn* cnxn = nwa->Cnxn(); ConnInfo* lbinfo = Info(cnxn->_lbConn, orient); ConnInfo* rtinfo = Info(cnxn->_rtConn, orient); lbinfo->Exclude(cnxn->_rtConn); rtinfo->Exclude(cnxn->_lbConn); } void CSolver::SubstYInfo (CNet* nwa, CNet* nwb, CNet* nwc, Orientation orient){ CCnxn* ca = nwa->Cnxn(); CCnxn* cb = nwb->Cnxn(); CCnxn* cc = nwc->Cnxn(); Connector* shared = Shared(ca, cb); Connector* conna = (ca->_lbConn == shared) ? ca->_rtConn : ca->_lbConn; Connector* connb = (cb->_lbConn == shared) ? cb->_rtConn : cb->_lbConn; Connector* connc = (cc->_lbConn == shared) ? cc->_rtConn : cc->_lbConn; ConnInfo* infoa = Info(conna, orient); ConnInfo* infob = Info(connb, orient); ConnInfo* infoc = Info(connc, orient); infoa->Include(connb); infoa->Include(connc); infob->Include(conna); infob->Include(connc); infoc->Include(conna); infoc->Include(connb); infoa->Exclude(shared); infob->Exclude(shared); infoc->Exclude(shared); } void CSolver::SubstPseudoFixedInfo (CNet* nwa, Orientation orient) { CCnxn* cnxn = nwa->Cnxn(); ConnInfo* lbinfo = Info(cnxn->_lbConn, orient); ConnInfo* rtinfo = Info(cnxn->_rtConn, orient); lbinfo->Include(cnxn->_rtConn); rtinfo->Include(cnxn->_lbConn); } void CSolver::ReplaceFixedInfo (CNet* nwa, Orientation orient) { CCnxn* cnxn = nwa->Cnxn(); ConnInfo* lbinfo = Info(cnxn->_lbConn, orient); ConnInfo* rtinfo = Info(cnxn->_rtConn, orient); lbinfo->Include(cnxn->_rtConn); rtinfo->Include(cnxn->_lbConn); } void CSolver::ReplaceSeriesInfo (CNet* nwa, CNet* nwb, Orientation orient) { CCnxn* ca = nwa->Cnxn(); CCnxn* cb = nwb->Cnxn(); Connector* shared = Shared(ca, cb); Connector* conna = (ca->_lbConn == shared) ? ca->_rtConn : ca->_lbConn; Connector* connb = (cb->_lbConn == shared) ? cb->_rtConn : cb->_lbConn; ConnInfo* infoa = Info(conna, orient); ConnInfo* infob = Info(connb, orient); infoa->Include(shared); infob->Include(shared); infoa->Exclude(connb); infob->Exclude(conna); } void CSolver::ReplaceParallelInfo (CNet* nwa, Orientation orient) { CCnxn* cnxn = nwa->Cnxn(); ConnInfo* lbinfo = Info(cnxn->_lbConn, orient); ConnInfo* rtinfo = Info(cnxn->_rtConn, orient); lbinfo->Include(cnxn->_rtConn); rtinfo->Include(cnxn->_lbConn); } void CSolver::ReplaceYInfo ( CNet* nwa, CNet* nwb, CNet* nwc, Orientation orient ) { CCnxn* ca = nwa->Cnxn(); CCnxn* cb = nwb->Cnxn(); CCnxn* cc = nwc->Cnxn(); Connector* shared = Shared(ca, cb); Connector* conna = (ca->_lbConn == shared) ? ca->_rtConn : ca->_lbConn; Connector* connb = (cb->_lbConn == shared) ? cb->_rtConn : cb->_lbConn; Connector* connc = (cc->_lbConn == shared) ? cc->_rtConn : cc->_lbConn; ConnInfo* infoa = Info(conna, orient); ConnInfo* infob = Info(connb, orient); ConnInfo* infoc = Info(connc, orient); infoa->Include(shared); infob->Include(shared); infoc->Include(shared); infoa->Exclude(connb); infoa->Exclude(connc); infob->Exclude(conna); infob->Exclude(connc); infoc->Exclude(conna); infoc->Exclude(connb); } void CSolver::ReplacePseudoFixedInfo (CNet* nwa, Orientation orient) { CCnxn* cnxn = nwa->Cnxn(); ConnInfo* lbinfo = Info(cnxn->_lbConn, orient); ConnInfo* rtinfo = Info(cnxn->_rtConn, orient); lbinfo->Exclude(cnxn->_rtConn); rtinfo->Exclude(cnxn->_lbConn); } neuron-7.6.3/src/lib/Unidraw/ctrlinfo.cpp000077500000000000000000000052241340731477100203440ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * ControlInfo implementation. */ #include #include #include #include #include #include /*****************************************************************************/ void ControlInfo::Init (const char* kl, const char* kc, void* o) { _label = nil; _keyLabel = strnew(kl); _keyCode = strnew(kc); _owner = o; } ControlInfo::ControlInfo ( GraphicComp* label, const char* kl, const char* kc, void* o ) { Init(kl, kc, o); _label = label; } ControlInfo::ControlInfo ( const char* lbl, const char* kl, const char* kc, void* o ) { Init(kl, kc, o); SetLabel(lbl); } ControlInfo* ControlInfo::Copy () { return new ControlInfo( (GraphicComp*) _label->Copy(), _keyLabel, _keyCode, _owner ); } ControlInfo::~ControlInfo () { if (_label != nil) { delete _label; } delete [] _keyLabel; delete [] _keyCode; } void ControlInfo::SetLabel (GraphicComp* g) { if (_label != nil) { delete _label; } _label = g; } void ControlInfo::SetLabel (const char* s) { if (_label != nil) { delete _label; } _label = new TextComp(new TextGraphic(s, stdgraphic)); } void ControlInfo::SetKeyLabel (const char* kl) { delete [] _keyLabel; _keyLabel = strnew(kl); } void ControlInfo::SetKeyCode (const char* kc) { delete [] _keyCode; _keyCode = strnew(kc); } neuron-7.6.3/src/lib/Unidraw/damage.cpp000066400000000000000000000134341340731477100177410ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Damage class implementation. * (Enhanced by Ian Daniel , May, 1991.) */ #include #include #include #include #include #include #include #include #include /*****************************************************************************/ Damage::Damage (Canvas* c, Painter* p, Graphic* g) { _areas = new UList; _additions = new UList; _canvas = c; _output = p; Ref(_output); _graphic = g; } Damage::~Damage () { Unref(_output); DeleteAreas(); delete _additions; } int Damage::Area (BoxObj& b) { return (b._right - b._left) * (b._top - b._bottom); } void Damage::DrawAreas () { BoxObj visible(0, 0, _canvas->Width() - 1, _canvas->Height() - 1); BoxObj b, *a; Iterator i; for (FirstArea(i); !Done(i); Next(i)) { a = GetArea(i); b = *a - visible; _output->ClearRect(_canvas, b._left, b._bottom, b._right, b._top); _graphic->DrawClipped(_canvas, b._left, b._bottom, b._right, b._top); } } void Damage::DrawAdditions () { Coord xmax = _canvas->Width() - 1; Coord ymax = _canvas->Height() - 1; Iterator i; for (FirstAddition(i); !Done(i); Next(i)) { GetAddition(i)->Draw(_canvas, 0, 0, xmax, ymax); } } void Damage::Merge (BoxObj& newb) { BoxObj* a1, *a2; int newArea, area1, area2, diff1, diff2, diff3, maximum; Iterator i; FirstArea(i); a1 = GetArea(i); Next(i); a2 = GetArea(i); BoxObj merge1(*a1 + newb); BoxObj merge2(*a2 + newb); BoxObj merge3(*a1 + *a2); newArea = Area(newb); area1 = Area(*a1); area2 = Area(*a2); diff1 = area1 + newArea - Area(merge1); diff2 = area2 + newArea - Area(merge2); diff3 = area1 + area2 - Area(merge3); maximum = max(max(diff1, diff2), diff3); if (maximum == diff1) { if (a2->Intersects(merge1)) { *a1 = merge1 + *a2; DeleteArea(a2); } else { *a1 = merge1; } } else if (maximum == diff2) { if (a1->Intersects(merge2)) { *a2 = merge2 + *a1; DeleteArea(a1); } else { *a2 = merge2; } } else { if (newb.Intersects(merge3)) { *a1 = merge3 + newb; DeleteArea(a2); } else { *a1 = merge3; *a2 = newb; } } } void Damage::Added (Graphic* g) { _additions->Append(new UList(g)); } bool Damage::Incurred () { return !_areas->IsEmpty() || !_additions->IsEmpty(); } void Damage::Incur (Graphic* g) { BoxObj box; g->GetBox(box); Incur(box); } void Damage::Incur (Coord l, Coord b, Coord r, Coord t) { BoxObj box(l, b, r, t); Incur(box); } void Damage::Incur (BoxObj& newb) { BoxObj* b; Iterator i; if (_areas->IsEmpty()) { _areas->Prepend(new UList(new BoxObj(&newb))); } else if (_areas->First() == _areas->Last()) { FirstArea(i); b = GetArea(i); if (newb.Intersects(*b)) { if (!newb.Within(*b)) { *b = *b + newb; } } else { _areas->Prepend(new UList(new BoxObj(&newb))); } } else { Merge(newb); } } void Damage::Repair () { DrawAreas(); DrawAdditions(); Reset(); } void Damage::Reset () { DeleteAreas(); _areas = new UList; delete _additions; _additions = new UList; } void Damage::SetCanvas (Canvas* c) { _canvas = c; } void Damage::SetPainter (Painter* p) { Unref(_output); _output = p; Ref(_output); } void Damage::SetGraphic (Graphic* gr) { _graphic = gr; } Canvas* Damage::GetCanvas () { return _canvas; } Painter* Damage::GetPainter () { return _output; } Graphic* Damage::GetGraphic () { return _graphic; } BoxObj* Damage::GetArea (Iterator i) { UList* area = Elem(i); return (BoxObj*) (*area) (); } Graphic* Damage::GetAddition (Iterator i) { UList* addition = Elem(i); return (Graphic*) (*addition) (); } void Damage::FirstArea (Iterator& i) { i.SetValue(_areas->First()); } void Damage::FirstAddition (Iterator& i) { i.SetValue(_additions->First()); } void Damage::Next (Iterator& i) { i.SetValue(Elem(i)->Next()); } bool Damage::Done (Iterator i) { UList* u = Elem(i); return u == _areas->End() || u == _additions->End(); } UList* Damage::Elem (Iterator i) { return (UList*) i.GetValue(); } void Damage::DeleteArea (BoxObj* area) { delete area; _areas->Delete(area); } void Damage::DeleteAreas () { Iterator i; for (FirstArea(i); !Done(i); Next(i)) { delete GetArea(i); } delete _areas; } neuron-7.6.3/src/lib/Unidraw/data.cpp000077500000000000000000000025501340731477100174340ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Data object implemementation. */ #include /*****************************************************************************/ Data::Data () { } neuron-7.6.3/src/lib/Unidraw/datas.cpp000077500000000000000000000042521340731477100176200ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implemementation of Data subclasses. */ #include #include #include /*****************************************************************************/ VoidData::VoidData (void* v) { _void = v; } /*****************************************************************************/ ColorData::ColorData (PSColor* fg, PSColor* bg) { _fg = fg; _bg = bg; } /*****************************************************************************/ MoveData::MoveData (float dx, float dy) { _dx = dx; _dy = dy; } /*****************************************************************************/ GSData::GSData (Graphic* g) { _gs = new FullGraphic(g); } GSData::~GSData () { delete _gs; } /*****************************************************************************/ MobilityData::MobilityData (Mobility m, Graphic* g) { _mobility = m; _gs = new FullGraphic(g); } MobilityData::~MobilityData () { delete _gs; } neuron-7.6.3/src/lib/Unidraw/dialogs.cpp000066400000000000000000000342011340731477100201400ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of various dialog boxes. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ static void ChangeMsg (const char* name, MarginFrame* frame) { Interactor* msg; if (*name == '\0') { msg = new VGlue(0, 0); } else { msg = new Message(name); } frame->Insert(msg); frame->Change(msg); } /*****************************************************************************/ BasicDialog::BasicDialog ( ButtonState* bs, const char* t, const char* subt, Alignment a ) : Dialog(bs, nil, a) { Init(t, subt); } BasicDialog::BasicDialog ( const char* c, ButtonState* bs, const char* t, const char* subt,Alignment a ) : Dialog(c, bs, nil, a) { Init(t, subt); } void BasicDialog::Init (const char* t, const char* subt) { if (*t == '\0') { _title = new MarginFrame(new VGlue(0, 0)); } else { _title = new MarginFrame(new Message(t)); } if (*subt == '\0') { _subtitle = new MarginFrame(new VGlue(0, 0)); } else { _subtitle = new MarginFrame(new Message(subt)); } } void BasicDialog::SetTitle (const char* name) { ChangeMsg(name, _title); } void BasicDialog::SetSubtitle (const char* name) { ChangeMsg(name, _subtitle); } void BasicDialog::Forward (Event& e) { if (IsAChild(e.target)) { e.target->Handle(e); } else if (e.eventType ==KeyEvent) { Handle(e); } } bool BasicDialog::IsAChild (Interactor* i) { Scene* parent1 = i->Parent(); while (parent1 != nil) { if (parent1 == this) { return true; } parent1 = parent1->Parent(); } return false; } /*****************************************************************************/ AcknowledgeDialog::AcknowledgeDialog ( const char* title, const char* subtitle ) : BasicDialog(new ButtonState, title, subtitle) { Insert(Interior()); input = new Sensor(noEvents); input->Catch(KeyEvent); } void AcknowledgeDialog::Acknowledge () { Event e; int v = 0; state->SetValue(v); do { Read(e); if (e.eventType == KeyEvent) { state->SetValue(e.keystring[0]); } else { Forward(e); } state->GetValue(v); } while (v == 0); } Interactor* AcknowledgeDialog::Interior () { const int space = iv26_round(.5*cm); return new MarginFrame( new VBox( new HBox(_title, new HGlue), new HBox(_subtitle, new HGlue), new VGlue(space), new HBox( new HGlue, new PushButton(" OK ", state, 1), new HGlue ) ), space, space/2, 0 ); } /*****************************************************************************/ ConfirmDialog::ConfirmDialog ( const char* title, const char* subtitle ) : BasicDialog(new ButtonState, title, subtitle) { Insert(Interior()); input = new Sensor(noEvents); input->Catch(KeyEvent); } inline bool Confirmed (int v) { return v == 'y' || v == 'n' || v == '\007'; } char ConfirmDialog::Confirm () { Event e; int v = 0; state->SetValue(v); do { Read(e); if (e.eventType == KeyEvent) { state->SetValue(e.keystring[0]); } else { Forward(e); } state->GetValue(v); } while (!Confirmed(v)); return v; } Interactor* ConfirmDialog::Interior () { const int space = iv26_round(.5*cm); return new MarginFrame( new VBox( new HBox(_title, new HGlue), new HBox(_subtitle, new HGlue), new VGlue(space), new HBox( new HGlue, new PushButton(" Yes ", state, 'y'), new HGlue(space, 0), new PushButton(" No ", state, 'n'), new HGlue(space, 0), new PushButton("Cancel", state, '\007'), new HGlue ) ), space, space/2, 0 ); } /*****************************************************************************/ UChooser::UChooser ( const char* t, const char* subt, const char* acceptLabel, const char* samp ) : StringChooser(new ButtonState, 10, 24, "") { Init(t, subt); Insert(Interior(acceptLabel)); _sedit->Message(samp); } UChooser::UChooser ( ButtonState* bs, int r, int c, Alignment a ) : StringChooser(bs, a) { StringChooser::Init(new StringEditor(bs, ""), new StringBrowser(bs, r, c)); } void UChooser::Init (const char* t, const char* subt) { if (*t == '\0') { _title = new MarginFrame(new VGlue(0, 0)); } else { _title = new MarginFrame(new class Message(t)); } if (*subt == '\0') { _subtitle = new MarginFrame(new VGlue(0, 0)); } else { _subtitle = new MarginFrame(new class Message(subt)); } } void UChooser::Clear () { _browser->Clear(); } void UChooser::Include (const char* s) { _browser->Insert(s, Position(s)); } void UChooser::Exclude (const char* s) { _browser->Remove(_browser->Index(s)); } void UChooser::SetTitle (const char* name) { ChangeMsg(name, _title); } void UChooser::SetSubtitle (const char* name) { ChangeMsg(name, _subtitle); } int UChooser::Position (const char* s) { int i; for (i = 0; i < _browser->Count(); ++i) { if (strcmp(s, _browser->String(i)) < 0) { break; } } return i; } void UChooser::Reconfig () { StringChooser::Reconfig(); shape->hstretch = shape->vstretch = 0; } Interactor* UChooser::AddScroller (Interactor* i) { return new HBox( new MarginFrame(i, 2), new VBorder, new VBox( new UpMover(i, 1), new HBorder, new VScroller(i), new HBorder, new DownMover(i, 1) ) ); } Interactor* UChooser::Interior (const char* acptlbl) { const int space = iv26_round(.5*cm); VBox* titleblock = new VBox( new HBox(_title, new HGlue), new HBox(_subtitle, new HGlue) ); return new MarginFrame( new VBox( titleblock, new VGlue(space, 0), new Frame(new MarginFrame(_sedit, 2)), new VGlue(space, 0), new Frame(AddScroller(_browser)), new VGlue(space, 0), new HBox( new VGlue(space, 0), new HGlue, new PushButton("Cancel", state, '\007'), new HGlue(space, 0), new PushButton(acptlbl, state, '\r') ) ), space, space/2, 0 ); } /*****************************************************************************/ class PrintBS : public ButtonState { public: PrintBS(PrintDialog*, bool); virtual void Notify(); private: PrintDialog* _dialog; }; PrintBS::PrintBS (PrintDialog* pd, bool v) : ButtonState(v) { _dialog = pd; } void PrintBS::Notify () { ButtonState::Notify(); _dialog->ToPrinter(long(value)); } /*****************************************************************************/ static const char* DefaultPrintCmd () { static char buf[CHARBUFSIZE]; const char* print_cmd = getenv("PRINT_CMD"); if (print_cmd == nil) { const char* printer_name = getenv("PRINTER"); if (printer_name == nil) { printer_name = ""; } sprintf(buf, "lpr -P%s", printer_name); print_cmd = buf; } return print_cmd; } PrintDialog::PrintDialog (bool to_printer) : FileChooser( new ButtonState, ".", 10, 24, Center ) { _last_print_cmd = strnew(DefaultPrintCmd()); _last_file_name = strnew(""); _to_printer = -1; _dest = new PrintBS(this, to_printer); FileChooser::Init("", "Generate PostScript and"); Insert(Interior()); ToPrinter(to_printer); } PrintDialog::~PrintDialog () { delete [] _last_print_cmd; delete [] _last_file_name; } void PrintDialog::ToPrinter (bool to_printer) { if (to_printer != _to_printer) { _to_printer = to_printer; if (to_printer) { delete [] _last_file_name; _last_file_name = strnew(Choice()); browser()->Clear(); PrintDialog::Message(_last_print_cmd); } else { delete [] _last_print_cmd; _last_print_cmd = strnew(Choice()); browser()->Update(); PrintDialog::Message(_last_file_name); } SelectMessage(); } } bool PrintDialog::ToPrinter () { return _to_printer; } void PrintDialog::UpdateEditor () { if (!ToPrinter()) { FileChooser::UpdateEditor(); } } void PrintDialog::UpdateBrowser () { if (!ToPrinter()) { FileChooser::UpdateBrowser(); } } Interactor* PrintDialog::Interior () { const int space = iv26_round(.5*cm); VBox* titleblock = new VBox( new HBox(title, new HGlue), new HBox(subtitle, new HGlue) ); return new MarginFrame( new VBox( titleblock, new HBox( new HGlue(space, 0), new VBox( new VGlue(space/3, 0), new RadioButton( "send to printer via a command, or ", _dest, true ), new VGlue(space/3, 0), #if 1 || defined(__DECCXX) || defined(AIXV3) /* is passing an const unsigned 0 ambiguous here? */ new RadioButton("save in file:", _dest, int(false)) #else new RadioButton("save in file:", _dest, false) #endif ) ), new VGlue(space, 0), new VBox( new Frame(new MarginFrame(_sedit, 2)), new VGlue(space, 0), new Frame(AddScroller(browser())), new VGlue(space, 0) ), new HBox( new HGlue, new PushButton("Cancel", state, '\007'), new HGlue(space, 0), new PushButton(" OK ", state, '\r') ) ), space, space/2, 0 ); } /*****************************************************************************/ GridDialog::GridDialog () : BasicDialog( new ButtonState, "", "Enter X and Y grid spacing:" ) { _medit = new MatchEditor(state, "9999999999999999999"); _medit->Message(""); _medit->Match("%f %f"); _units = new ButtonState('p'); input = new Sensor; input->Catch(KeyEvent); Insert(Interior()); SelectMessage(); } void GridDialog::Handle (Event& e) { if (e.eventType == KeyEvent) { _medit->Handle(e); } } bool GridDialog::Accept () { Event e; int v = 0; state->SetValue(0); _medit->Edit(); state->GetValue(v); while (v == 0) { Read(e); Forward(e); state->GetValue(v); } return v == '\r'; } void GridDialog::SelectMessage () { _medit->Select(0, strlen(_medit->Text())); } Interactor* GridDialog::Interior () { const int space = iv26_round(.5*cm); VBox* titleblock = new VBox( new HBox(_title, new HGlue), new HBox(_subtitle, new HGlue) ); HBox* rbuttons = new HBox( new RadioButton("Pixels", _units, 'p'), new HGlue(space, 0), new RadioButton("Points", _units, 'o'), new HGlue(space, 0), new RadioButton("Centimeters", _units, 'c'), new HGlue(space, 0), new RadioButton("Inches", _units, 'i') ); rbuttons->Insert(new HGlue); return new MarginFrame( new VBox( titleblock, new VGlue(space), new Frame(new MarginFrame(_medit, 2)), new VGlue(space/2, 0), rbuttons, new VGlue(space), new HBox( new HGlue, new PushButton("Cancel", state, '\007'), new HGlue(space, 0), new PushButton(" OK ", state, '\r') ) ), space, space/2, 0 ); } void GridDialog::GetValues (float& xincr, float& yincr) { char spacing[CHARBUFSIZE]; strcpy(spacing, _medit->Text()); int args = sscanf(spacing, "%f %f", &xincr, &yincr); if (args == 0) { xincr = yincr = 0.0; } else { if (args == 1) { yincr = xincr; } int unit; _units->GetValue(unit); switch (unit) { case 'i': xincr *= inches; yincr *= inches; break; case 'o': xincr *= points; yincr *= points; break; case 'c': xincr *= cm; yincr *= cm; break; } } } neuron-7.6.3/src/lib/Unidraw/edit.cpp000066400000000000000000000277171340731477100174610ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of editing commands. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ ClassId UndoCmd::GetClassId () { return UNDO_CMD; } bool UndoCmd::IsA (ClassId id) { return UNDO_CMD == id || Command::IsA(id);} UndoCmd::UndoCmd (ControlInfo* c) : Command(c) { } UndoCmd::UndoCmd (Editor* ed) : Command(ed) { } Command* UndoCmd::Copy () { Command* copy = new UndoCmd(CopyControlInfo()); InitCopy(copy); return copy; } void UndoCmd::Execute () { unidraw->Undo(GetEditor()->GetComponent()); } bool UndoCmd::Reversible () { return false; } /*****************************************************************************/ ClassId RedoCmd::GetClassId () { return REDO_CMD; } bool RedoCmd::IsA (ClassId id) { return REDO_CMD == id || Command::IsA(id);} RedoCmd::RedoCmd (ControlInfo* c) : Command(c) { } RedoCmd::RedoCmd (Editor* ed) : Command(ed) { } Command* RedoCmd::Copy () { Command* copy = new RedoCmd(CopyControlInfo()); InitCopy(copy); return copy; } void RedoCmd::Execute () { unidraw->Redo(GetEditor()->GetComponent()); } bool RedoCmd::Reversible () { return false; } /*****************************************************************************/ ClassId CutCmd::GetClassId () { return CUT_CMD; } bool CutCmd::IsA (ClassId id) { return CUT_CMD == id || Command::IsA(id); } CutCmd::CutCmd (ControlInfo* c, Clipboard* cb) : Command(c, cb) { _executed = false; } CutCmd::CutCmd (Editor* ed, Clipboard* cb) : Command(ed, cb) { _executed = false; } CutCmd::~CutCmd () { if (_clipboard != nil && _executed) { _clipboard->DeleteComps(); } } Command* CutCmd::Copy () { Command* copy = new CutCmd(CopyControlInfo()); InitCopy(copy); return copy; } void CutCmd::Execute () { GetEditor()->GetComponent()->Interpret(this); _executed = true; } void CutCmd::Unexecute () { GetEditor()->GetComponent()->Uninterpret(this); _executed = false; } /*****************************************************************************/ ClassId CopyCmd::GetClassId () { return COPY_CMD; } bool CopyCmd::IsA (ClassId id) { return COPY_CMD == id || Command::IsA(id);} CopyCmd::CopyCmd (ControlInfo* c, Clipboard* cb) : Command(c, cb) { } CopyCmd::CopyCmd (Editor* ed, Clipboard* cb) : Command(ed, cb) { } CopyCmd::~CopyCmd () { if (_clipboard != nil) { _clipboard->DeleteComps(); } } Command* CopyCmd::Copy () { Command* copy = new CopyCmd(CopyControlInfo()); InitCopy(copy); return copy; } void CopyCmd::Execute () { Editor* editor = GetEditor(); Selection* s = editor->GetSelection(); if (!s->IsEmpty()) { Clipboard* cb = GetClipboard(); cb = (cb == nil) ? unidraw->GetCatalog()->GetClipboard() : cb; GraphicView* views = editor->GetViewer()->GetGraphicView(); s->Sort(views); cb->DeleteComps(); cb->CopyInit(s); } } bool CopyCmd::Reversible () { return false; } /*****************************************************************************/ ClassId PasteCmd::GetClassId () { return PASTE_CMD; } bool PasteCmd::IsA (ClassId id) { return PASTE_CMD==id || Command::IsA(id);} PasteCmd::PasteCmd (ControlInfo* c, Clipboard* cb) : Command(c, cb) { _executed = false; } PasteCmd::PasteCmd (Editor* ed, Clipboard* cb) : Command(ed, cb) { _executed = false; } PasteCmd::~PasteCmd () { if (_clipboard != nil && !_executed) { _clipboard->DeleteComps(); } } Command* PasteCmd::Copy () { Command* copy = new PasteCmd(CopyControlInfo(), DeepCopyClipboard()); InitCopy(copy); return copy; } void PasteCmd::Execute () { GetEditor()->GetComponent()->Interpret(this); _executed = true; } void PasteCmd::Unexecute () { GetEditor()->GetComponent()->Uninterpret(this); _executed = false; } bool PasteCmd::Reversible () { Clipboard* cb = GetClipboard(); Clipboard* globalcb = unidraw->GetCatalog()->GetClipboard(); return (cb != nil && !cb->IsEmpty()) || !globalcb->IsEmpty(); } /*****************************************************************************/ ClassId ReplaceCmd::GetClassId () { return REPLACE_CMD; } bool ReplaceCmd::IsA (ClassId id) { return REPLACE_CMD == id || MacroCmd::IsA(id); } ReplaceCmd::ReplaceCmd (ControlInfo* c, GraphicComp* gc) : MacroCmd(c) { Init(gc); } ReplaceCmd::ReplaceCmd (Editor* ed, GraphicComp* gc) : MacroCmd(ed) { Init(gc); } void ReplaceCmd::Init (GraphicComp* gc) { if (gc != nil) { Append( new DeleteCmd(GetEditor()), new PasteCmd(GetEditor(), new Clipboard(gc)) ); } } Command* ReplaceCmd::Copy () { Command* copy = new ReplaceCmd(CopyControlInfo(), GetReplacement()); InitCopy(copy); return copy; } GraphicComp* ReplaceCmd::GetReplacement () { GraphicComp* repl = nil; Iterator i; Last(i); if (!Done(i)) { Clipboard* cb = GetCommand(i)->GetClipboard(); cb->First(i); repl = cb->GetComp(i); } return repl; } /*****************************************************************************/ ClassId DupCmd::GetClassId () { return DUP_CMD; } bool DupCmd::IsA (ClassId id) { return DUP_CMD == id || Command::IsA(id); } DupCmd::DupCmd (ControlInfo* c, Clipboard* cb) : Command(c, cb) { _executed = false; } DupCmd::DupCmd (Editor* ed, Clipboard* cb) : Command(ed, cb) { _executed = false; } DupCmd::~DupCmd () { if (_clipboard != nil && !_executed) { _clipboard->DeleteComps(); } } Command* DupCmd::Copy () { Command* copy = new DupCmd(CopyControlInfo(), GetClipboard()); InitCopy(copy); return copy; } void DupCmd::Execute () { GetEditor()->GetComponent()->Interpret(this); _executed = true; } void DupCmd::Unexecute () { GetEditor()->GetComponent()->Uninterpret(this); _executed = false; } /*****************************************************************************/ ClassId DeleteCmd::GetClassId () { return DELETE_CMD; } bool DeleteCmd::IsA (ClassId id) { return DELETE_CMD == id || Command::IsA(id); } DeleteCmd::DeleteCmd (ControlInfo* c, Clipboard* cb) : Command(c,cb) { _executed = false; } DeleteCmd::DeleteCmd (Editor* ed, Clipboard* cb) : Command(ed, cb) { _executed = false; } DeleteCmd::~DeleteCmd () { if (_clipboard != nil && _executed) { _clipboard->DeleteComps(); } } Command* DeleteCmd::Copy () { Command* copy = new DeleteCmd(CopyControlInfo()); InitCopy(copy); return copy; } void DeleteCmd::Execute () { GetEditor()->GetComponent()->Interpret(this); _executed = true; } void DeleteCmd::Unexecute () { GetEditor()->GetComponent()->Uninterpret(this); _executed = false; } /*****************************************************************************/ ClassId SlctAllCmd::GetClassId () { return SLCTALL_CMD; } bool SlctAllCmd::IsA (ClassId id) { return SLCTALL_CMD == id || Command::IsA(id); } SlctAllCmd::SlctAllCmd (ControlInfo* c) : Command(c) { } SlctAllCmd::SlctAllCmd (Editor* ed) : Command(ed) { } Command* SlctAllCmd::Copy () { Command* copy = new SlctAllCmd(CopyControlInfo()); InitCopy(copy); return copy; } void SlctAllCmd::Execute () { Editor* editor = GetEditor(); Selection* newSel = new Selection; Selection* s; Viewer* viewer; s = editor->GetSelection(); delete s; for (int i = 0; (viewer = editor->GetViewer(i)) != nil; ++i) { s = viewer->GetGraphicView()->SelectAll(); newSel->Merge(s); delete s; } editor->SetSelection(newSel); newSel->Update(); } bool SlctAllCmd::Reversible () { return false; } /*****************************************************************************/ ClassId ConnectCmd::GetClassId () { return CONNECT_CMD; } bool ConnectCmd::IsA (ClassId id) { return CONNECT_CMD == id || Command::IsA(id); } ConnectCmd::ConnectCmd ( ControlInfo* c, Connector* s, Connector* t ) : Command(c) { _source = s; _target = t; } ConnectCmd::ConnectCmd (Editor* ed, Connector* s, Connector* t) : Command(ed) { _source = s; _target = t; } Command* ConnectCmd::Copy () { Connector* s, *t; GetConnectors(s, t); Command* copy = new ConnectCmd(CopyControlInfo(), s, t); InitCopy(copy); return copy; } void ConnectCmd::Execute () { Mobility s_m = _source->GetMobility(); Graphic* s_gs = _source->GetGraphic(); Graphic* t_gs = _target->GetGraphic(); Store(_source, new MobilityData(s_m, s_gs)); Store(_target, new GSData(t_gs)); _source->SetMobility(Floating); _source->Connect(_target); unidraw->Update(); } void ConnectCmd::Unexecute () { MobilityData* md = (MobilityData*) Recall(_source); GSData* gsd = (GSData*) Recall(_target); _source->SetMobility(md->_mobility); _source->Disconnect(_target); *_source->GetGraphic() = *md->_gs; _source->Notify(); *_target->GetGraphic() = *gsd->_gs; _target->Notify(); unidraw->Update(); } bool ConnectCmd::Reversible () { return true; } void ConnectCmd::GetConnectors (Connector*& s, Connector*& t) { s = _source; t = _target; } void ConnectCmd::Read (istream& in) { Command::Read(in); Catalog* catalog = unidraw->GetCatalog(); _source = (Connector*) catalog->ReadComponent(in); _target = (Connector*) catalog->ReadComponent(in); } void ConnectCmd::Write (ostream& out) { Command::Write(out); Catalog* catalog = unidraw->GetCatalog(); catalog->WriteComponent(_source, out); catalog->WriteComponent(_target, out); } /*****************************************************************************/ ClassId MobilityCmd::GetClassId () { return MOBILITY_CMD; } bool MobilityCmd::IsA (ClassId id) { return MOBILITY_CMD == id || Command::IsA(id); } MobilityCmd::MobilityCmd (ControlInfo* c, Mobility m) : Command(c) { _mobility = m; } MobilityCmd::MobilityCmd (Editor* ed, Mobility m) : Command(ed) { _mobility = m; } Command* MobilityCmd::Copy () { Command* copy = new MobilityCmd(CopyControlInfo(), GetMobility()); InitCopy(copy); return copy; } Mobility MobilityCmd::GetMobility () { return _mobility; } void MobilityCmd::Read (istream& in) { Command::Read(in); int mobility; in >> mobility; _mobility = Mobility(mobility); } void MobilityCmd::Write (ostream& out) { Command::Write(out); int mobility = _mobility; out << mobility << " "; } neuron-7.6.3/src/lib/Unidraw/editor.cpp000066400000000000000000000112501340731477100200030ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Unidraw class implementation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include declarePtrList(EditorImpl,TransientWindow) implementPtrList(EditorImpl,TransientWindow) /*****************************************************************************/ static void DetachComponentViews (Editor* ed) { int i = 0; Viewer* viewer; Component* comp = ed->GetComponent(); if (comp != nil) { while ((viewer = ed->GetViewer(i++)) != nil) { GraphicView* gv = viewer->GetGraphicView(); comp->Detach(gv); } } } /*****************************************************************************/ Editor::Editor() : InputHandler(nil, new Style(Session::instance()->style())) { _window = nil; _impl = new EditorImpl; } Editor::~Editor () { for (ListItr(EditorImpl) i(*_impl); i.more(); i.next()) { TransientWindow* t = i.cur(); delete t; } delete _impl; } Component* Editor::GetComponent () { return nil; } Viewer* Editor::GetViewer (int) { return nil; } KeyMap* Editor::GetKeyMap () { return nil; } Tool* Editor::GetCurTool () { return nil; } Selection* Editor::GetSelection () { return nil; } StateVar* Editor::GetState (const char*) { return nil; } void Editor::SetComponent (Component*) { } void Editor::SetViewer (Viewer*, int) { } void Editor::SetCurTool (Tool*) { } void Editor::SetKeyMap (KeyMap*) { } void Editor::SetSelection (Selection*) { } void Editor::Open () { } void Editor::Close () { Selection* s = GetSelection(); if (s != nil) { s->Clear(); } DetachComponentViews(this); } void Editor::Insert(Interactor* i) { body(new Target(i, TargetPrimitiveHit)); } void Editor::SetClassName(const char* s) { style()->alias(s); } void Editor::SetInstance(const char* s) { style()->name(s); } void Editor::keystroke(const Event& e) { char buf[100]; int n = e.mapkey(buf, sizeof(buf) - 1); if (n > 0) { buf[n] = '\0'; GetKeyMap()->Execute(buf); } } void Editor::InsertDialog (Glyph* g) { ManagedWindow* w = GetWindow(); if (w != nil) w->deiconify(); TransientWindow* dialog = nil; for (ListItr(EditorImpl) i(*_impl); i.more(); i.next()) { TransientWindow* t = i.cur(); if (t->glyph() == g) { dialog = t; break; } } if (dialog == nil) { dialog = new TransientWindow(g); _impl->prepend(dialog); } dialog->transient_for(w); dialog->place( w->left() + w->width() * 0.5, w->bottom() + w->height() * 0.5 ); dialog->align(0.5, 0.5); dialog->map(); } void Editor::RemoveDialog (Glyph* g) { for (ListUpdater(EditorImpl) i(*_impl); i.more(); i.next()) { TransientWindow* t = i.cur(); if (t->glyph() == g) { t->unmap(); i.remove_cur(); delete t; break; } } } void Editor::Update () { Viewer* v; for (int i = 0; (v = GetViewer(i)) != nil; ++i) { v->Update(); } } bool Editor::DependsOn (Component* parent) { Component* child = GetComponent(); while (child != nil) { if (parent == child) { return true; } child = child->GetParent(); } return false; } neuron-7.6.3/src/lib/Unidraw/editorinfo.cpp000066400000000000000000000072751340731477100206730ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * EditorInfo implementation. */ #include #include #include #include #include #include #include /*****************************************************************************/ class StringStringElem : public UMapElem { public: StringStringElem(const char* idstring, const char* tagstring); virtual ~StringStringElem(); virtual void* id(); virtual void* tag(); private: char* _idstring; char* _tagstring; }; StringStringElem::StringStringElem (const char* id, const char* tag) { _idstring = strnew(id); _tagstring = strnew(tag); } StringStringElem::~StringStringElem () { delete [] _idstring; delete [] _tagstring; } void* StringStringElem::id () { return _idstring; } void* StringStringElem::tag () { return _tagstring; } /*****************************************************************************/ EditorInfo::EditorInfo () { } EditorInfo::~EditorInfo () { unidraw->GetCatalog()->Forget(this); } void EditorInfo::Register (const char* name, const char* info) { UMap::Register(new StringStringElem(name, info)); } void EditorInfo::UnregisterName (const char* name) { UMapElem* elem = FindId((void*) name); if (elem != nil) { UMap::Unregister(elem); delete elem; } } void EditorInfo::UnregisterInfo (const char* info) { UMapElem* elem = FindTag((void*) info); if (elem != nil) { UMap::Unregister(elem); delete elem; } } bool EditorInfo::Registered (const char* name) { return FindId((void*) name) != nil; } const char* EditorInfo::GetName (const char* info) { UMapElem* elem = FindTag((void*) info); return (elem == nil) ? nil : (char*) elem->id(); } const char* EditorInfo::GetName (int index) { return (char*) Elem(index)->id(); } const char* EditorInfo::GetInfo (const char* name) { UMapElem* elem = FindId((void*) name); return (elem == nil) ? nil : (char*) elem->tag(); } const char* EditorInfo::GetInfo (int index) { return (char*) Elem(index)->tag(); } UMapElem* EditorInfo::FindId (void* id) { for (int i = 0; i < _elems.Count(); ++i) { if (strcmp(GetName(i), (char*) id) == 0) { return (UMapElem*) _elems[i]; } } return nil; } UMapElem* EditorInfo::FindTag (void* tag) { for (int i = 0; i < _elems.Count(); ++i) { if (strcmp(GetInfo(i), (char*) tag) == 0) { return (UMapElem*) _elems[i]; } } return nil; } neuron-7.6.3/src/lib/Unidraw/ellipse.cpp000066400000000000000000000160661340731477100201640ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Ellipse component definitions. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ ClassId EllipseComp::GetClassId () { return ELLIPSE_COMP; } bool EllipseComp::IsA (ClassId id) { return ELLIPSE_COMP == id || GraphicComp::IsA(id); } Component* EllipseComp::Copy () { return new EllipseComp((SF_Ellipse*) GetGraphic()->Copy()); } EllipseComp::EllipseComp (SF_Ellipse* graphic) : GraphicComp(graphic) { } SF_Ellipse* EllipseComp::GetEllipse () { return (SF_Ellipse*) GetGraphic(); } void EllipseComp::Read (istream& in) { GraphicComp::Read(in); Coord x0, y0; int r1, r2; in >> x0 >> y0 >> r1 >> r2; SF_Ellipse* ellipse = new SF_Ellipse(x0, y0, r1, r2); ellipse->FillBg(ReadBgFilled(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); ellipse->SetColors(fg, bg); ellipse->SetBrush(ReadBrush(in)); ellipse->SetPattern(ReadPattern(in)); Transformer* t = ReadTransformer(in); ellipse->SetTransformer(t); Unref(t); SetGraphic(ellipse); } void EllipseComp::Write (ostream& out) { GraphicComp::Write(out); SF_Ellipse* ellipse = GetEllipse(); Coord x0, y0; int r1, r2; ellipse->GetOriginal(x0, y0, r1, r2); out << x0 << " " << y0 << " " << r1 << " " << r2 << " "; WriteBgFilled(ellipse->BgFilled(), out); WriteColor(ellipse->GetFgColor(), out); WriteColor(ellipse->GetBgColor(), out); WriteBrush(ellipse->GetBrush(), out); WritePattern(ellipse->GetPattern(), out); WriteTransformer(ellipse->GetTransformer(), out); } /*****************************************************************************/ EllipseComp* EllipseView::GetEllipseComp () { return (EllipseComp*) GetSubject(); } ClassId EllipseView::GetClassId () { return ELLIPSE_VIEW; } bool EllipseView::IsA (ClassId id) { return ELLIPSE_VIEW == id || GraphicView::IsA(id); } EllipseView::EllipseView (EllipseComp* subj) : GraphicView(subj) { } void EllipseView::Interpret (Command* cmd) { if (cmd->IsA(ALIGNTOGRID_CMD)) { float cx, cy; GetGraphic()->GetCenter(cx, cy); ((AlignToGridCmd*) cmd)->Align(this, cx, cy); } else { GraphicView::Interpret(cmd); } } void EllipseView::Update () { Graphic* ellipse = GetGraphic(); IncurDamage(ellipse); *ellipse = *GetEllipseComp()->GetGraphic(); IncurDamage(ellipse); EraseHandles(); } Manipulator* EllipseView::CreateManipulator ( Viewer* v, Event& e, Transformer* rel, Tool* tool ) { Rubberband* rub = nil; Manipulator* m = nil; if (tool->IsA(GRAPHIC_COMP_TOOL)) { v->Constrain(e.x, e.y); rub = new RubberEllipse(nil, nil, e.x, e.y, e.x, e.y); m = new DragManip( v, rub, rel, tool, DragConstraint(XYEqual | Gravity) ); } else { m = GraphicView::CreateManipulator(v, e, rel, tool); } return m; } Command* EllipseView::InterpretManipulator (Manipulator* m) { DragManip* dm = (DragManip*) m; Editor* ed = dm->GetViewer()->GetEditor(); Tool* tool = dm->GetTool(); Transformer* rel = dm->GetTransformer(); Command* cmd = nil; if (tool->IsA(GRAPHIC_COMP_TOOL)) { RubberEllipse* re = (RubberEllipse*) dm->GetRubberband(); Coord x, y, dummy1, dummy2; re->GetCurrent(x, y, dummy1, dummy2); if (dummy1 != x || dummy2 != y) { BrushVar* brVar = (BrushVar*) ed->GetState("BrushVar"); PatternVar* patVar = (PatternVar*) ed->GetState("PatternVar"); ColorVar* colVar = (ColorVar*) ed->GetState("ColorVar"); Coord xr, yr; re->CurrentRadii(xr, yr); if (rel != nil) { rel = new Transformer(rel); rel->Invert(); } Graphic* pg = GetGraphicComp()->GetGraphic(); SF_Ellipse* ellipse = new SF_Ellipse(x, y, xr, yr, pg); if (brVar != nil) ellipse->SetBrush(brVar->GetBrush()); if (patVar != nil) ellipse->SetPattern(patVar->GetPattern()); if (colVar != nil) { ellipse->SetColors(colVar->GetFgColor(), colVar->GetBgColor()); } ellipse->SetTransformer(rel); Unref(rel); cmd = new PasteCmd(ed, new Clipboard(new EllipseComp(ellipse))); } } else { cmd = GraphicView::InterpretManipulator(m); } return cmd; } Graphic* EllipseView::GetGraphic () { Graphic* graphic = GraphicView::GetGraphic(); if (graphic == nil) { EllipseComp* ellipseComp = GetEllipseComp(); graphic = ellipseComp->GetGraphic()->Copy(); SetGraphic(graphic); } return graphic; } /*****************************************************************************/ PSEllipse::PSEllipse (EllipseComp* subj) : PostScriptView(subj) { } ClassId PSEllipse::GetClassId () { return PS_ELLIPSE; } bool PSEllipse::IsA (ClassId id) { return PS_ELLIPSE == id || PostScriptView::IsA(id); } bool PSEllipse::Definition (ostream& out) { Coord x0, y0; int rx, ry; EllipseComp* comp = (EllipseComp*) GetSubject(); comp->GetEllipse()->GetOriginal(x0, y0, rx, ry); out << "Begin " << MARK << " Elli\n"; MinGS(out); out << MARK << "\n"; out << x0 << " " << y0 << " " << rx << " " << ry << " Elli\n"; out << "End\n\n"; return out.good(); } neuron-7.6.3/src/lib/Unidraw/ellipses.cpp000066400000000000000000000231671340731477100203470ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of Ellipses and Circles, objects derived from Graphic. */ #include #include #include #include #include #include /*****************************************************************************/ Coord Ellipse::_x[8]; Coord Ellipse::_y[8]; void Ellipse::GetOriginal (Coord& x0, Coord& y0, int& r1, int& r2) { x0 = _x0; y0 = _y0; r1 = _r1; r2 = _r2; } Ellipse::Ellipse ( Coord x0, Coord y0, int r1, int r2, Graphic* gr ) : Graphic(gr) { _x0 = x0; _y0 = y0; _r1 = r1; _r2 = r2; } void Ellipse::s_getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { float width, dummy1, dummy2, bx0, by0, bx1, by1; width = float(gs->GetBrush()->Width()); tol = (width > 1) ? width/2 : 0; bx0 = float(_x0 - _r1); by0 = float(_y0 - _r2); bx1 = float(_x0 + _r1); by1 = float(_y0 + _r2); transformRect(bx0, by0, bx1, by1, l, b, dummy1, dummy2, gs); transform(float(_x0), float(_y0), cx, cy, gs); } void Ellipse::f_getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { float bx0, by0, bx1, by1, dummy1, dummy2; tol = 0; bx0 = float(_x0 - _r1); by0 = float(_y0 - _r2); bx1 = float(_x0 + _r1); by1 = float(_y0 + _r2); transformRect(bx0, by0, bx1, by1, l, b, dummy1, dummy2, gs); transform(float(_x0), float(_y0), cx, cy, gs); } bool Ellipse::s_contains (PointObj& po, Graphic* gs) { PointObj pt (&po); invTransform(pt._x, pt._y, gs); return ( square(_r2)*square(pt._x - _x0) + square(_r1)*square(pt._y - _y0) - square(_r1*_r2) == 0 ); } bool Ellipse::f_contains (PointObj& po, Graphic* gs) { PointObj pt (&po); invTransform(pt._x, pt._y, gs); return ( square(_r2)*square(pt._x - _x0) + square(_r1)*square(pt._y - _y0) - square(_r1*_r2) ) <= 0; } bool Ellipse::s_intersects (BoxObj& userb, Graphic* gs) { BoxObj b; getBox(b, gs); if (b.Intersects(userb)) { Transformer* t = gs->GetTransformer(); MultiLineObj ml; CalcControlPts(t); ml.ClosedSplineToPolygon(_x, _y, 8); return ml.Intersects(userb); } return false; } bool Ellipse::f_intersects (BoxObj& userb, Graphic* gs) { BoxObj b; getBox(b, gs); if (b.Intersects(userb)) { Transformer* t = gs->GetTransformer(); FillPolygonObj fp; CalcControlPts(t); fp.ClosedSplineToPolygon(_x, _y, 8); return fp.Intersects(userb); } return false; } static const float axis = 0.42; static const float seen = 1.025; void Ellipse::CalcControlPts (Transformer* t) { if (t == nil) { Coord px1, py1, px2, py2; px1 = iv26_round(float(_r1)*axis); py1 = iv26_round(float(_r2)*axis); px2 = iv26_round(float(_r1)*seen); py2 = iv26_round(float(_r2)*seen); _x[0] = _x0 + px1; _y[0] = _y0 + py2; _x[1] = _x0 - px1; _y[1] = _y[0]; _x[2] = _x0 - px2; _y[2] = _y0 + py1; _x[3] = _x[2]; _y[3] = _y0 - py1; _x[4] = _x[1]; _y[4] = _y0 - py2; _x[5] = _x[0]; _y[5] = _y[4]; _x[6] = _x0 + px2; _y[6] = _y[3]; _x[7] = _x[6]; _y[7] = _y[2]; } else { float fx1, fy1, fx2, fy2, tx[8], ty[8], tmpx, tmpy; fx1 = float(_r1)*axis; fy1 = float(_r2)*axis; fx2 = float(_r1)*seen; fy2 = float(_r2)*seen; tx[0] = _x0 + fx1; ty[0] = _y0 + fy2; tx[1] = _x0 - fx1; ty[1] = ty[0]; tx[2] = _x0 - fx2; ty[2] = _y0 + fy1; tx[3] = tx[2]; ty[3] = _y0 - fy1; tx[4] = tx[1]; ty[4] = _y0 - fy2; tx[5] = tx[0]; ty[5] = ty[4]; tx[6] = _x0 + fx2; ty[6] = ty[3]; tx[7] = tx[6]; ty[7] = ty[2]; for (int i = 0; i < 8; ++i) { t->Transform(tx[i], ty[i], tmpx, tmpy); _x[i] = iv26_round(tmpx); _y[i] = iv26_round(tmpy); } } } /*****************************************************************************/ S_Ellipse::S_Ellipse ( Coord x0, Coord y0, int r1, int r2, Graphic* gr ) : Ellipse(x0, y0, r1, r2, gr) { _br = nil; if (gr != nil) { S_Ellipse::SetBrush(gr->GetBrush()); } } S_Ellipse::~S_Ellipse () { Unref(_br); } void S_Ellipse::SetBrush (PSBrush* br) { if (_br != br) { Ref(br); Unref(_br); _br = br; invalidateCaches(); } } PSBrush* S_Ellipse::GetBrush () { return _br; } Graphic* S_Ellipse::Copy () { return new S_Ellipse(_x0, _y0, _r1, _r2, this); } void S_Ellipse::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { s_getExtent(l, b, cx, cy, tol, gs); } bool S_Ellipse::contains (PointObj& po, Graphic* gs) { return s_contains(po, gs); } bool S_Ellipse::intersects (BoxObj& userb, Graphic* gs) { return s_intersects(userb, gs); } void S_Ellipse::draw (Canvas *c, Graphic* gs) { if (!gs->GetBrush()->None()) { update(gs); _p->Ellipse(c, _x0, _y0, _r1, _r2); } } /*****************************************************************************/ F_Ellipse::F_Ellipse ( Coord x0, Coord y0, int r1, int r2, Graphic* gr ) : Ellipse(x0, y0, r1, r2, gr) { _pat = nil; if (gr != nil) { F_Ellipse::SetPattern(gr->GetPattern()); } } F_Ellipse::~F_Ellipse () { Unref(_pat); } void F_Ellipse::SetPattern (PSPattern* pat) { Ref(pat); Unref(_pat); _pat = pat; } PSPattern* F_Ellipse::GetPattern () { return _pat; } Graphic* F_Ellipse::Copy () { return new F_Ellipse(_x0, _y0, _r1, _r2, this); } void F_Ellipse::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { f_getExtent(l, b, cx, cy, tol, gs); } bool F_Ellipse::contains (PointObj& po, Graphic* gs) { return !gs->GetPattern()->None() && f_contains(po, gs); } bool F_Ellipse::intersects (BoxObj& userb, Graphic* gs) { return !gs->GetPattern()->None() && f_intersects(userb, gs); } void F_Ellipse::draw (Canvas* c, Graphic* gs) { if (!gs->GetPattern()->None()) { update(gs); _p->FillEllipse(c, _x0, _y0, _r1, _r2); } } /*****************************************************************************/ SF_Ellipse::SF_Ellipse ( Coord x0, Coord y0, int r1, int r2, Graphic* gr ) : Ellipse(x0, y0, r1, r2, gr) { _br = nil; _pat = nil; if (gr != nil) { SF_Ellipse::SetBrush(gr->GetBrush()); SF_Ellipse::SetPattern(gr->GetPattern()); } } SF_Ellipse::~SF_Ellipse () { Unref(_br); Unref(_pat); } void SF_Ellipse::SetBrush (PSBrush* br) { if (_br != br) { Ref(br); Unref(_br); _br = br; invalidateCaches(); } } PSBrush* SF_Ellipse::GetBrush () { return _br; } void SF_Ellipse::SetPattern (PSPattern* pat) { Ref(pat); Unref(_pat); _pat = pat; } PSPattern* SF_Ellipse::GetPattern () { return _pat; } Graphic* SF_Ellipse::Copy () { return new SF_Ellipse(_x0, _y0, _r1, _r2,this);} void SF_Ellipse::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { s_getExtent(l, b, cx, cy, tol, gs); } bool SF_Ellipse::contains (PointObj& po, Graphic* gs) { return (!gs->GetPattern()->None() && f_contains(po, gs)) || s_contains(po, gs); } bool SF_Ellipse::intersects (BoxObj& userb, Graphic* gs) { return (!gs->GetPattern()->None() && f_intersects(userb, gs)) || s_intersects(userb, gs); } void SF_Ellipse::draw (Canvas* c, Graphic* gs) { update(gs); if (!gs->GetPattern()->None()) { _p->FillEllipse(c, _x0, _y0, _r1, _r2); } if (!gs->GetBrush()->None()) { _p->Ellipse(c, _x0, _y0, _r1, _r2); } } /****************************************************************************/ S_Circle::S_Circle ( Coord x0, Coord y0, int radius, Graphic* gr ) : S_Ellipse(x0, y0, radius, radius, gr) { } Graphic* S_Circle::Copy () { return new S_Circle(_x0, _y0, _r1, this); } /*****************************************************************************/ F_Circle::F_Circle ( Coord x0, Coord y0, int radius, Graphic* gr ) : F_Ellipse(x0, y0, radius, radius, gr) { } Graphic* F_Circle::Copy () { return new F_Circle(_x0, _y0, _r1, this); } /*****************************************************************************/ SF_Circle::SF_Circle ( Coord x0, Coord y0, int radius, Graphic* gr ) : SF_Ellipse(x0, y0, radius, radius, gr) { } Graphic* SF_Circle::Copy () { return new SF_Circle(_x0, _y0, _r1, this); } neuron-7.6.3/src/lib/Unidraw/externview.cpp000066400000000000000000000063531340731477100207250ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * ExternView implementation. */ #include #include #include /*****************************************************************************/ ClassId ExternView::GetClassId () { return EXTERN_VIEW; } bool ExternView::IsA (ClassId id) { return EXTERN_VIEW == id || ComponentView::IsA(id); } ExternView::ExternView (Component* subj) : ComponentView(subj) { } bool ExternView::Emit (ostream& out) { return Definition(out); } bool ExternView::Definition (ostream&) { return true; } ExternView* ExternView::GetView (Iterator) { return nil; } void ExternView::SetView (ExternView*, Iterator&) { } /*****************************************************************************/ ClassId PreorderView::GetClassId () { return PREORDER_VIEW; } bool PreorderView::IsA (ClassId id) { return PREORDER_VIEW == id || ExternView::IsA(id); } PreorderView::PreorderView (Component* subj) : ExternView(subj) { } bool PreorderView::Definition (ostream& out) { Iterator i; bool ok = true; for (First(i); ok && !Done(i); Next(i)) { ok = GetView(i)->Definition(out); } return ok; } /*****************************************************************************/ ClassId InorderView::GetClassId () { return INORDER_VIEW; } bool InorderView::IsA (ClassId id) { return INORDER_VIEW == id || ExternView::IsA(id); } InorderView::InorderView (Component* subj) : ExternView(subj) { } bool InorderView::Definition (ostream&) { bool ok = true; // unimplemented return ok; } /*****************************************************************************/ ClassId PostorderView::GetClassId () { return POSTORDER_VIEW; } bool PostorderView::IsA (ClassId id) { return POSTORDER_VIEW == id || ExternView::IsA(id); } PostorderView::PostorderView (Component* subj) : ExternView(subj) { } bool PostorderView::Definition (ostream& out) { Iterator i; bool ok = true; for (Last(i); ok && !Done(i); Prev(i)) { ok = GetView(i)->Definition(out); } return ok; } neuron-7.6.3/src/lib/Unidraw/font.cpp000066400000000000000000000044501340731477100174670ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Font command implementation. */ #include #include #include #include #include #include /*****************************************************************************/ ClassId FontCmd::GetClassId () { return FONT_CMD; } bool FontCmd::IsA (ClassId id) { return FONT_CMD == id || Command::IsA(id); } FontCmd::FontCmd (ControlInfo* c, PSFont* f) : Command(c) {_font = f; } FontCmd::FontCmd (Editor* ed, PSFont* f) : Command(ed) { _font = f; } Command* FontCmd::Copy () { Command* copy = new FontCmd(CopyControlInfo(), GetFont()); InitCopy(copy); return copy; } void FontCmd::Execute () { FontVar* _fontVar = (FontVar*) GetEditor()->GetState("FontVar"); if (_fontVar != nil) { _fontVar->SetFont(GetFont()); } Command::Execute(); } void FontCmd::Read (istream& in) { Command::Read(in); _font = unidraw->GetCatalog()->ReadFont(in); } void FontCmd::Write (ostream& out) { Command::Write(out); unidraw->GetCatalog()->WriteFont(GetFont(), out); } neuron-7.6.3/src/lib/Unidraw/geomobjs.cpp000066400000000000000000000403451340731477100203310ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of geometrical objects used by Graphic. */ #include #include #include #include #include /*****************************************************************************/ static const int NUMPOINTS = 200; // must be > 1 static const double SMOOTHNESS = 1.0; static int mlsize = 0; static int mlcount = 0; static Coord* mlx, *mly; /*****************************************************************************/ PointObj::PointObj (Coord x, Coord y) { _x = x; _y = y; } PointObj::PointObj (PointObj* p) { _x = p->_x; _y = p->_y; } float PointObj::Distance (PointObj& p) { return sqrt(float(square(_x - p._x) + square(_y - p._y))); } /*****************************************************************************/ LineObj::LineObj (Coord x0, Coord y0, Coord x1, Coord y1) { _p1._x = x0; _p1._y = y0; _p2._x = x1; _p2._y = y1; } LineObj::LineObj (LineObj* l) { _p1._x = l->_p1._x; _p1._y = l->_p1._y; _p2._x = l->_p2._x; _p2._y = l->_p2._y; } bool LineObj::Contains (PointObj& p) { return (p._x >= min(_p1._x, _p2._x)) && (p._x <= max(_p1._x, _p2._x)) && (p._y >= min(_p1._y, _p2._y)) && (p._y <= max(_p1._y, _p2._y)) && ( (p._y - _p1._y)*(_p2._x - _p1._x) - (_p2._y - _p1._y)*(p._x - _p1._x) ) == 0; } inline int signum (int a) { if (a < 0) { return -1; } else if (a > 0) { return 1; } else { return 0; } } int LineObj::Same (PointObj& p1, PointObj& p2) { Coord dx, dx1, dx2; Coord dy, dy1, dy2; dx = _p2._x - _p1._x; dy = _p2._y - _p1._y; dx1 = p1._x - _p1._x; dy1 = p1._y - _p1._y; dx2 = p2._x - _p2._x; dy2 = p2._y - _p2._y; return signum(dx*dy1 - dy*dx1) * signum(dx*dy2 - dy*dx2); } bool LineObj::Intersects (LineObj& l) { // from Sedgewick, p. 313 BoxObj b1 (_p1._x, _p1._y, _p2._x, _p2._y); BoxObj b2 (l._p1._x, l._p1._y, l._p2._x, l._p2._y); return b1.Intersects(b2) && Same(l._p1, l._p2) <= 0 && l.Same(_p1, _p2) <= 0; } /*****************************************************************************/ BoxObj::BoxObj (Coord x0, Coord y0, Coord x1, Coord y1) { _left = min(x0, x1); _bottom = min(y0, y1); _right = max(x0, x1); _top = max(y0, y1); } BoxObj::BoxObj (BoxObj* b) { _left = b->_left; _bottom = b->_bottom; _right = b->_right; _top = b->_top; } bool BoxObj::Contains (PointObj& p) { return (p._x >= _left) && (p._x <= _right) && (p._y >= _bottom) && (p._y <= _top); } bool BoxObj::Intersects (BoxObj& b) { return ( (_left <= b._right) && (b._left <= _right) && (_bottom <= b._top) && (b._bottom <= _top) ); } bool BoxObj::Intersects (LineObj& l) { Coord x1 = min(l._p1._x, l._p2._x); Coord x2 = max(l._p1._x, l._p2._x); Coord y1 = min(l._p1._y, l._p2._y); Coord y2 = max(l._p1._y, l._p2._y); BoxObj lbox(x1, y1, x2, y2); bool intersects = false; if (Intersects(lbox)) { intersects = Contains(l._p1) || Contains(l._p2); if (!intersects) { LineObj l0 (_left, _bottom, _right, _bottom); LineObj l1 (_right, _bottom, _right, _top); LineObj l2 (_right, _top, _left, _top); LineObj l3 (_left, _top, _left, _bottom); intersects = l.Intersects(l0) || l.Intersects(l1) || l.Intersects(l2) || l.Intersects(l3); } } return intersects; } BoxObj BoxObj::operator- (BoxObj& b) { BoxObj i; if (Intersects(b)) { i._left = max(_left, b._left); i._bottom = max(_bottom, b._bottom); i._right = min(_right, b._right); i._top = min(_top, b._top); } return i; } BoxObj BoxObj::operator+ (BoxObj& b) { BoxObj m; m._left = min(_left, b._left); m._bottom = min(_bottom, b._bottom); m._right = max(_right, b._right); m._top = max(_top, b._top); return m; } bool BoxObj::Within (BoxObj& b) { return ( (_left >= b._left) && (_bottom >= b._bottom) && (_right <= b._right) && (_top <= b._top) ); } /*****************************************************************************/ MultiLineObj::MultiLineObj (Coord* x, Coord* y, int count) { _x = x; _y = y; _count = count; } void MultiLineObj::GrowBuf () { Coord* newx, *newy; int newsize; if (mlsize == 0) { mlsize = NUMPOINTS; mlx = new Coord[NUMPOINTS]; mly = new Coord[NUMPOINTS]; } else { newsize = mlsize * 2; newx = new Coord[newsize]; newy = new Coord[newsize]; Memory::copy(mlx, newx, newsize * sizeof(Coord)); Memory::copy(mly, newy, newsize * sizeof(Coord)); delete mlx; delete mly; mlx = newx; mly = newy; mlsize = newsize; } } bool MultiLineObj::CanApproxWithLine ( double x0, double y0, double x2, double y2, double x3, double y3 ) { double triangleArea, sideSquared, dx, dy; triangleArea = x0*y2 - x2*y0 + x2*y3 - x3*y2 + x3*y0 - x0*y3; triangleArea *= triangleArea; // actually 4 times the area dx = x3 - x0; dy = y3 - y0; sideSquared = dx*dx + dy*dy; return triangleArea <= SMOOTHNESS * sideSquared; } void MultiLineObj::AddLine (double x0, double y0, double x1, double y1) { if (mlcount >= mlsize) { GrowBuf(); } if (mlcount == 0) { mlx[mlcount] = iv26_round(x0); mly[mlcount] = iv26_round(y0); ++mlcount; } mlx[mlcount] = iv26_round(x1); mly[mlcount] = iv26_round(y1); ++mlcount; } void MultiLineObj::AddBezierArc ( double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3 ) { double midx01, midx12, midx23, midlsegx, midrsegx, cx, midy01, midy12, midy23, midlsegy, midrsegy, cy; Midpoint(x0, y0, x1, y1, midx01, midy01); Midpoint(x1, y1, x2, y2, midx12, midy12); Midpoint(x2, y2, x3, y3, midx23, midy23); Midpoint(midx01, midy01, midx12, midy12, midlsegx, midlsegy); Midpoint(midx12, midy12, midx23, midy23, midrsegx, midrsegy); Midpoint(midlsegx, midlsegy, midrsegx, midrsegy, cx, cy); if (CanApproxWithLine(x0, y0, midlsegx, midlsegy, cx, cy)) { AddLine(x0, y0, cx, cy); } else if ( (midx01 != x1) || (midy01 != y1) || (midlsegx != x2) || (midlsegy != y2) || (cx != x3) || (cy != y3) ) { AddBezierArc(x0, y0, midx01, midy01, midlsegx, midlsegy, cx, cy); } if (CanApproxWithLine(cx, cy, midx23, midy23, x3, y3)) { AddLine(cx, cy, x3, y3); } else if ( (cx != x0) || (cy != y0) || (midrsegx != x1) || (midrsegy != y1) || (midx23 != x2) || (midy23 != y2) ) { AddBezierArc(cx, cy, midrsegx, midrsegy, midx23, midy23, x3, y3); } } void MultiLineObj::CalcSection ( Coord cminus1x, Coord cminus1y, Coord cx, Coord cy, Coord cplus1x, Coord cplus1y, Coord cplus2x, Coord cplus2y ) { double p0x, p1x, p2x, p3x, tempx, p0y, p1y, p2y, p3y, tempy; ThirdPoint( double(cx), double(cy), double(cplus1x), double(cplus1y), p1x, p1y ); ThirdPoint( double(cplus1x), double(cplus1y), double(cx), double(cy), p2x, p2y ); ThirdPoint( double(cx), double(cy), double(cminus1x), double(cminus1y), tempx, tempy ); Midpoint(tempx, tempy, p1x, p1y, p0x, p0y); ThirdPoint( double(cplus1x), double(cplus1y), double(cplus2x), double(cplus2y), tempx, tempy ); Midpoint(tempx, tempy, p2x, p2y, p3x, p3y); AddBezierArc(p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y); } void MultiLineObj::SplineToMultiLine (Coord* cpx, Coord* cpy, int cpcount) { register int cpi; if (cpcount < 3) { _x = cpx; _y = cpy; _count = cpcount; } else { mlcount = 0; CalcSection( cpx[0], cpy[0], cpx[0], cpy[0], cpx[0], cpy[0], cpx[1], cpy[1] ); CalcSection( cpx[0], cpy[0], cpx[0], cpy[0], cpx[1], cpy[1], cpx[2], cpy[2] ); for (cpi = 1; cpi < cpcount - 2; ++cpi) { CalcSection( cpx[cpi - 1], cpy[cpi - 1], cpx[cpi], cpy[cpi], cpx[cpi + 1], cpy[cpi + 1], cpx[cpi + 2], cpy[cpi + 2] ); } CalcSection( cpx[cpi - 1], cpy[cpi - 1], cpx[cpi], cpy[cpi], cpx[cpi + 1], cpy[cpi + 1], cpx[cpi + 1], cpy[cpi + 1] ); CalcSection( cpx[cpi], cpy[cpi], cpx[cpi + 1], cpy[cpi + 1], cpx[cpi + 1], cpy[cpi + 1], cpx[cpi + 1], cpy[cpi + 1] ); _x = mlx; _y = mly; _count = mlcount; } } void MultiLineObj::ClosedSplineToPolygon (Coord* cpx, Coord* cpy, int cpcount){ register int cpi; if (cpcount < 3) { _x = cpx; _y = cpy; _count = cpcount; } else { mlcount = 0; CalcSection( cpx[cpcount - 1], cpy[cpcount - 1], cpx[0], cpy[0], cpx[1], cpy[1], cpx[2], cpy[2] ); for (cpi = 1; cpi < cpcount - 2; ++cpi) { CalcSection( cpx[cpi - 1], cpy[cpi - 1], cpx[cpi], cpy[cpi], cpx[cpi + 1], cpy[cpi + 1], cpx[cpi + 2], cpy[cpi + 2] ); } CalcSection( cpx[cpi - 1], cpy[cpi - 1], cpx[cpi], cpy[cpi], cpx[cpi + 1], cpy[cpi + 1], cpx[0], cpy[0] ); CalcSection( cpx[cpi], cpy[cpi], cpx[cpi + 1], cpy[cpi + 1], cpx[0], cpy[0], cpx[1], cpy[1] ); _x = mlx; _y = mly; _count = mlcount; } } void MultiLineObj::GetBox (BoxObj& b) { b._left = b._right = _x[0]; b._bottom = b._top = _y[0]; for (int i = 1; i < _count; ++i) { b._left = min(b._left, _x[i]); b._bottom = min(b._bottom, _y[i]); b._right = max(b._right, _x[i]); b._top = max(b._top, _y[i]); } } bool MultiLineObj::Contains (PointObj& p) { register int i; BoxObj b; GetBox(b); if (b.Contains(p)) { for (i = 1; i < _count; ++i) { LineObj l (_x[i-1], _y[i-1], _x[i], _y[i]); if (l.Contains(p)) { return true; } } } return false; } bool MultiLineObj::Intersects (LineObj& l) { register int i; BoxObj b; GetBox(b); if (b.Intersects(l)) { for (i = 1; i < _count; ++i) { LineObj test(_x[i-1], _y[i-1], _x[i], _y[i]); if (l.Intersects(test)) { return true; } } } return false; } bool MultiLineObj::Intersects (BoxObj& userb) { register int i; BoxObj b; GetBox(b); if (b.Intersects(userb)) { for (i = 1; i < _count; ++i) { LineObj test(_x[i-1], _y[i-1], _x[i], _y[i]); if (userb.Intersects(test)) { return true; } } } return false; } bool MultiLineObj::Within (BoxObj& userb) { BoxObj b; GetBox(b); return b.Within(userb); } /*****************************************************************************/ FillPolygonObj::FillPolygonObj ( Coord* x, Coord* y, int n ) : MultiLineObj(x, y, n) { _normCount = 0; _normx = _normy = nil; } FillPolygonObj::~FillPolygonObj () { delete _normx; delete _normy; } static int LowestLeft (Coord* x, Coord* y, int count) { register int i; int lowestLeft = 0; Coord lx = *x; Coord ly = *y; for (i = 1; i < count; ++i) { if (y[i] < ly || (y[i] == ly && x[i] < lx)) { lowestLeft = i; lx = x[i]; ly = y[i]; } } return lowestLeft; } void FillPolygonObj::Normalize () { if (_count != 0) { register int i, newcount = 1; int lowestLeft, limit = _count; if (*_x == _x[_count - 1] && *_y == _y[_count - 1]) { --limit; } lowestLeft = LowestLeft(_x, _y, limit); _normCount = limit + 2; _normx = new Coord[_normCount]; _normy = new Coord[_normCount]; for (i = lowestLeft; i < limit; ++i, ++newcount) { _normx[newcount] = _x[i]; _normy[newcount] = _y[i]; } for (i = 0; i < lowestLeft; ++i, ++newcount) { _normx[newcount] = _x[i]; _normy[newcount] = _y[i]; } _normx[newcount] = _normx[1]; _normy[newcount] = _normy[1]; --newcount; _normx[0] = _normx[newcount]; _normy[0] = _normy[newcount]; } } bool FillPolygonObj::Contains (PointObj& p) { // derived from A. Glassner, if (_normCount == 0) { // "An Introduction to Normalize(); // Ray Tracing", p. 53, } // courtesy R. Cooperman int count = 0; PointObj p0(0, 0); bool cur_y_sign = _normy[0] >= p._y; for (int i = 0; i < _normCount - 2; ++i) { LineObj l ( _normx[i] - p._x, _normy[i] - p._y, _normx[i+1] - p._x, _normy[i+1] - p._y ); if (l.Contains(p0)) { return true; } bool next_y_sign = l._p2._y >= 0; if (next_y_sign != cur_y_sign) { bool cur_x_sign = l._p1._x >= 0; bool next_x_sign = l._p2._x >= 0; if (cur_x_sign && next_x_sign) { ++count; } else if (cur_x_sign || next_x_sign) { Coord dx = l._p2._x - l._p1._x; Coord dy = l._p2._y - l._p1._y; if (dy >= 0) { if (l._p1._x * dy > l._p1._y * dx) { ++count; } } else { if (l._p1._x * dy < l._p1._y * dx) { ++count; } } } } cur_y_sign = next_y_sign; } return count % 2 == 1; } bool FillPolygonObj::Intersects (LineObj& l) { BoxObj b; bool intersects = false; if (_normCount == 0) { Normalize(); } GetBox(b); if (b.Intersects(l)) { MultiLineObj ml (_normx, _normy, _normCount - 1); intersects = ml.Intersects(l) || Contains(l._p1) || Contains(l._p2); } return intersects; } bool FillPolygonObj::Intersects (BoxObj& ub) { BoxObj b; GetBox(b); if (!b.Intersects(ub)) { return false; } if (b.Within(ub)) { return true; } LineObj bottom(ub._left, ub._bottom, ub._right, ub._bottom); if (Intersects(bottom)) { return true; } LineObj right(ub._right, ub._bottom, ub._right, ub._top); if (Intersects(right)) { return true; } LineObj top(ub._right, ub._top, ub._left, ub._top); if (Intersects(top)) { return true; } LineObj left(ub._left, ub._top, ub._left, ub._bottom); return Intersects(left); } /*****************************************************************************/ Extent::Extent (float x0, float y0, float x1, float y1, float t) { _left = x0; _bottom = y0; _cx = x1; _cy = y1; _tol = t; } Extent::Extent (Extent& e) { _left = e._left; _bottom = e._bottom; _cx = e._cx; _cy = e._cy; _tol = e._tol; } bool Extent::Within (Extent& e) { float l = _left - _tol, b = _bottom - _tol; float el = e._left - _tol, eb = e._bottom - _tol; return l >= el && b >= eb && 2*_cx - l <= 2*e._cx - el && 2*_cy - b <= 2*e._cy - eb; } void Extent::Merge (Extent& e) { float nl = min(_left, e._left); float nb = min(_bottom, e._bottom); if (Undefined()) { _left = e._left; _bottom = e._bottom; _cx = e._cx; _cy = e._cy; } else if (!e.Undefined()) { _cx = (nl + max(2*_cx - _left, 2*e._cx - e._left)) / 2; _cy = (nb + max(2*_cy - _bottom, 2*e._cy - e._bottom)) / 2; _left = nl; _bottom = nb; } _tol = max(_tol, e._tol); } neuron-7.6.3/src/lib/Unidraw/globals.cpp000077500000000000000000000061511340731477100201470ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of unidraw global stuff. */ #include #include #include #include #include /* * global data */ CSolver* csolver; Unidraw* unidraw; PSColor* psblack; PSColor* pswhite; PSPattern* pssolid; PSPattern* psclear; PSPattern* psnonepat; PSBrush* pssingle; PSBrush* psnonebr; PSFont* psstdfont; Graphic* stdgraphic; /* * global functions */ void NormalRect (Coord& left, Coord& bottom, Coord& right, Coord& top) { Coord tempx, tempy; tempx = min(left, right); right = max(left, right); left = tempx; tempy = min(bottom, top); top = max(bottom, top); bottom = tempy; } void GetLine ( const char* s, int size, int begin, int& end, int& lineSize, int& nextBegin ) { int i = begin; while (i < size) { if (s[i] == '\n') { break; } else { ++i; } } end = i - 1; nextBegin = i + 1; lineSize = i - begin; } void GetAlignmentPoint (Graphic* gr, Alignment a, float& x, float& y) { float l, b, r, t; gr->GetBounds(l, b, r, t); switch (a) { case BottomLeft: case CenterLeft: case TopLeft: case Left: x = l; break; case BottomCenter: case Center: case TopCenter: case HorizCenter: x = (l + r)/2; break; case BottomRight: case CenterRight: case TopRight: case Right: x = r; break; } switch (a) { case BottomLeft: case BottomCenter: case BottomRight: case Bottom: y = b; break; case CenterLeft: case Center: case CenterRight: case VertCenter: y = (b + t)/2; break; case TopLeft: case TopCenter: case TopRight: case Top: y = t; break; } } void Ref (Resource* r) { if (r != nil) { r->Reference(); } } char* strnew (const char* s) { char* dup = new char[strlen(s) + 1]; strcpy(dup, s); return dup; } neuron-7.6.3/src/lib/Unidraw/graphic.cpp000066400000000000000000000442361340731477100201440ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Graphic base class implementation. */ #include #include #include #include #include #include #include /*****************************************************************************/ Transformer* Graphic::_identity; bool Graphic::_caching; Painter* Graphic::_p; BoxObj* Graphic::_clipping; Graphic::Graphic (Graphic* gr) { _parent = nil; _fg = _bg = nil; _tag = nil; _t = nil; if (_identity == nil) { _identity = new Transformer; cachingOn(); } if (_p == nil) { _p = new Painter; Ref(_p); } if (gr == nil) { FillBg(UNDEF); } else { FillBg(gr->BgFilled()); Graphic::SetColors(gr->GetFgColor(), gr->GetBgColor()); if (gr->_t != nil) { _t = new Transformer(gr->_t); } } } Graphic::~Graphic () { Unref(_fg); Unref(_bg); Unref(_t); } void Graphic::Draw (Canvas* c) { if (Parent() == nil) { draw(c, this); } else { FullGraphic gs; totalGS(gs); draw(c, &gs); } } void Graphic::Draw (Canvas* c, Coord l, Coord b, Coord r, Coord t) { if (Parent() == nil) { drawClipped(c, l, b, r, t, this); } else { FullGraphic gs; totalGS(gs); drawClipped(c, l, b, r, t, &gs); } } void Graphic::DrawClipped (Canvas* c, Coord l, Coord b, Coord r, Coord t) { _clipping = new BoxObj(l, b, r, t); _p->Clip(c, l, b, r, t); if (Parent() == nil) { drawClipped(c, l, b, r, t, this); } else { FullGraphic gs; totalGS(gs); drawClipped(c, l, b, r, t, &gs); } _p->NoClip(); delete _clipping; _clipping = nil; } void Graphic::Erase (Canvas* c) { if (Parent() == nil) { erase(c, this); } else { FullGraphic gs; totalGS(gs); erase(c, &gs); } } void Graphic::Erase (Canvas* c, Coord l, Coord b, Coord r, Coord t) { if (Parent() == nil) { eraseClipped(c, l, b, r, t, this); } else { FullGraphic gs; totalGS(gs); eraseClipped(c, l, b, r, t, &gs); } } void Graphic::EraseClipped (Canvas* c, Coord l, Coord b, Coord r, Coord t) { _clipping = new BoxObj(l, b, r, t); _p->Clip(c, l, b, r, t); if (Parent() == nil) { eraseClipped(c, l, b, r, t, this); } else { FullGraphic gs; totalGS(gs); eraseClipped(c, l, b, r, t, &gs); } _p->NoClip(); delete _clipping; _clipping = nil; } void Graphic::FillBg (int fillBg) { _fillBg = fillBg; } int Graphic::BgFilled () { return _fillBg; } void Graphic::SetColors (PSColor* fg, PSColor* bg) { Ref(fg); Ref(bg); Unref(_fg); Unref(_bg); _fg = fg; _bg = bg; } PSColor* Graphic::GetFgColor () { return _fg; } PSColor* Graphic::GetBgColor () { return _bg; } void Graphic::SetPattern (PSPattern*) { } PSPattern* Graphic::GetPattern () { return nil; } void Graphic::SetBrush (PSBrush*) { } PSBrush* Graphic::GetBrush() { return nil; } void Graphic::SetFont (PSFont*) { } PSFont* Graphic::GetFont () { return nil; } void Graphic::Translate (float dx, float dy) { if (dx != 0 || dy != 0) { if (_t == nil) { _t = new Transformer; } _t->Translate(dx, dy); uncacheParents(); } } void Graphic::Scale (float sx, float sy, float cx, float cy) { float ncx, ncy; if (sx != 1 || sy != 1) { if (_t == nil) { _t = new Transformer; } Transformer parents; parentXform(parents); parents.InvTransform(cx, cy, ncx, ncy); if (ncx != 0 || ncy != 0) { _t->Translate(-ncx, -ncy); _t->Scale(sx, sy); _t->Translate(ncx, ncy); } else { _t->Scale(sx, sy); } uncacheParents(); } } void Graphic::Rotate (float angle, float cx, float cy) { float mag = (angle < 0) ? -angle : angle; float ncx, ncy; if ((mag - int(mag)) != 0 || int(mag)%360 != 0) { if (_t == nil) { _t = new Transformer; } Transformer parents; parentXform(parents); parents.InvTransform(cx, cy, ncx, ncy); if (ncx != 0 || ncy != 0) { _t->Translate(-ncx, -ncy); _t->Rotate(angle); _t->Translate(ncx, ncy); } else { _t->Rotate(angle); } uncacheParents(); } } void Graphic::Align (Alignment falign, Graphic* moved, Alignment malign) { float fx0, fy0, fx1, fy1, mx0, my0, mx1, my1, dx = 0, dy = 0; GetBounds(fx0, fy0, fx1, fy1); moved->GetBounds(mx0, my0, mx1, my1); switch (falign) { case BottomLeft: case CenterLeft: case TopLeft: case Left: dx = fx0; break; case BottomCenter: case Center: case TopCenter: case HorizCenter: dx = (fx0 + fx1 + 1)/2; break; case BottomRight: case CenterRight: case TopRight: case Right: dx = fx1 + 1; break; } switch (falign) { case BottomLeft: case BottomCenter: case BottomRight: case Bottom: dy = fy0; break; case CenterLeft: case Center: case CenterRight: case VertCenter: dy = (fy0 + fy1 + 1)/2; break; case TopLeft: case TopCenter: case TopRight: case Top: dy = fy1 + 1; break; } switch (malign) { case BottomLeft: case CenterLeft: case TopLeft: case Left: dx -= mx0; break; case BottomCenter: case Center: case TopCenter: case HorizCenter: dx -= (mx0 + mx1 + 1)/2; break; case BottomRight: case CenterRight: case TopRight: case Right: dx -= (mx1 + 1); break; } switch (malign) { case BottomLeft: case BottomCenter: case BottomRight: case Bottom: dy -= my0; break; case CenterLeft: case Center: case CenterRight: case VertCenter: dy -= (my0 + my1 + 1)/2; break; case TopLeft: case TopCenter: case TopRight: case Top: dy -= (my1 + 1); break; } if (dx != 0 || dy != 0) { Transformer parents; moved->parentXform(parents); parents.Invert(); parents.Transform(0.0, 0.0, fx0, fy0); parents.Transform(dx, dy, mx0, my0); moved->Translate(mx0-fx0, my0-fy0); } } void Graphic::SetTransformer (Transformer* t) { if (t != _t) { Unref(_t); if (t != nil) { Ref(t); } _t = t; uncacheParents(); } } void Graphic::TotalTransformation (Transformer& total) { Graphic* parent = Parent(); if (parent == nil) { concatTransformer(nil, _t, &total); } else { parent->TotalTransformation(total); concatTransformer(_t, &total, &total); } } void Graphic::GetBounds (float& x0, float& y0, float& x1, float& y1) { FullGraphic gs; totalGS(gs); getBounds(x0, y0, x1, y1, &gs); } void Graphic::GetBox (Coord& x0, Coord& y0, Coord& x1, Coord& y1) { float left, bottom, right, top; GetBounds(left, bottom, right, top); x0 = Coord(left - 1); y0 = Coord(bottom - 1); x1 = Coord(right + 1); y1 = Coord(top + 1); } void Graphic::GetCenter (float& x, float& y) { FullGraphic gs; float l, b, tol; totalGS(gs); getExtent(l, b, x, y, tol, &gs); } bool Graphic::Contains (PointObj& p) { if (Parent() == nil) { return contains(p, this); } else { FullGraphic gs; totalGS(gs); return contains(p, &gs); } } bool Graphic::Intersects (BoxObj& b) { if (Parent() == nil) { return intersects(b, this); } else { FullGraphic gs; totalGS(gs); return intersects(b, &gs); } } void Graphic::First (Iterator&) { } void Graphic::Last (Iterator&) { } void Graphic::Next (Iterator&) { } void Graphic::Prev (Iterator&) { } bool Graphic::Done (Iterator) { return true; } Graphic* Graphic::GetGraphic (Iterator) { return nil; } void Graphic::SetGraphic (Graphic*, Iterator&) { } void Graphic::Append (Graphic*, Graphic*, Graphic*, Graphic*) { } void Graphic::Prepend (Graphic*, Graphic*, Graphic*, Graphic*) { } void Graphic::InsertBefore (Iterator, Graphic*) { } void Graphic::InsertAfter (Iterator, Graphic*) { } void Graphic::Remove (Graphic*) { } void Graphic::Remove (Iterator&) { } void Graphic::Bequeath () { } Graphic* Graphic::FirstGraphicContaining (PointObj&) { return nil; } Graphic* Graphic::LastGraphicContaining (PointObj&) { return nil; } Graphic* Graphic::FirstGraphicIntersecting (BoxObj&) { return nil; } Graphic* Graphic::LastGraphicIntersecting (BoxObj&) { return nil; } Graphic* Graphic::FirstGraphicWithin (BoxObj&) { return nil; } Graphic* Graphic::LastGraphicWithin (BoxObj&) { return nil; } Graphic& Graphic::operator = (Graphic& g) { SetColors(g.GetFgColor(), g.GetBgColor()); FillBg(g.BgFilled()); SetPattern(g.GetPattern()); SetBrush(g.GetBrush()); SetFont(g.GetFont()); if (g._t == nil) { Unref(_t); _t = nil; } else { if (_t == nil) { _t = new Transformer(g._t); } else { *_t = *g._t; } } invalidateCaches(); return *this; } Graphic* Graphic::Copy () { return nil; } void Graphic::update (Graphic* gs) { Transformer* t = _p->GetTransformer(); _p->FillBg(gs->BgFilled()); _p->SetColors(gs->GetFgColor(), gs->GetBgColor()); _p->SetPattern(gs->GetPattern()); _p->SetBrush(gs->GetBrush()); _p->SetBrush(gs->GetBrush()); _p->SetFont(gs->GetFont()); if (t == nil) { if (gs->_t != nil) { Transformer* newt = new Transformer(gs->_t); _p->SetTransformer(newt); Unref(newt); } } else { if (gs->_t == nil) { *t = *_identity; } else { *t = *gs->_t; } } } void Graphic::draw (Canvas*, Graphic*) { } void Graphic::erase (Canvas* c, Graphic* gs) { PSColor* fg = gs->GetFgColor(); PSColor* bg = gs->GetBgColor(); gs->SetColors(bg, bg); draw(c, gs); gs->SetColors(fg, bg); } void Graphic::drawClipped ( Canvas* c, Coord left, Coord bottom, Coord right, Coord top, Graphic* gs ) { BoxObj thisBox; BoxObj clipBox(left, bottom, right, top); getBox(thisBox, gs); if (clipBox.Intersects(thisBox)) { draw(c, gs); } } void Graphic::eraseClipped ( Canvas* c, Coord left, Coord bottom, Coord right, Coord top, Graphic* gs ) { BoxObj thisBox; BoxObj clipBox(left, bottom, right, top); getBox(thisBox, gs); if (clipBox.Intersects(thisBox)) { erase(c, gs); } } void Graphic::getExtent (float&, float&, float&, float&, float&, Graphic*) { } void Graphic::GetExtent (Extent& e) { FullGraphic gs; totalGS(gs); getExtent(e._left, e._bottom, e._cx, e._cy, e._tol, &gs); } void Graphic::getBox (Coord& x0, Coord& y0, Coord& x1, Coord& y1, Graphic* gs){ float left, bottom, right, top; getBounds(left, bottom, right, top, gs); x0 = Coord(left - 1); y0 = Coord(bottom - 1); x1 = Coord(right + 1); y1 = Coord(top + 1); } bool Graphic::contains (PointObj& po, Graphic* gs) { BoxObj b; getBox(b, gs); return b.Contains(po); } bool Graphic::intersects (BoxObj& userb, Graphic* gs) { BoxObj b; getBox(b, gs); return b.Intersects(userb); } Graphic* Graphic::getRoot () { Graphic* cur, *parent = this; do { cur = parent; parent = cur->Parent(); } while (parent != nil); return cur; } void Graphic::totalGS (Graphic& gs) { Graphic* parent = Parent(); if (parent == nil) { concat(nil, this, &gs); } else { parent->totalGS(gs); concat(this, &gs, &gs); } } void Graphic::parentXform (Transformer& t) { Graphic* parent = Parent(); if (parent == nil) { t = *_identity; } else { parent->TotalTransformation(t); } } void Graphic::setParent (Graphic* g, Graphic* parent) { if (g->Parent() == nil) { // a graphic can have only one parent g->_parent = parent; } } void Graphic::unsetParent (Graphic* g) { g->_parent = nil; g->invalidateCaches(); } void Graphic::cachingOn () { _caching = true; } void Graphic::cachingOff () { _caching = false; } bool Graphic::extentCached () { return false; } void Graphic::uncacheExtent () { } void Graphic::uncacheChildren () { } void Graphic::uncacheParents () { Graphic* p = Parent(); if (p != nil) { p->uncacheExtent(); p->uncacheParents(); } } void Graphic::invalidateCaches() { uncacheParents(); uncacheExtent(); uncacheChildren(); } void Graphic::concatGS (Graphic* a, Graphic* b, Graphic* dest) { int fill; PSColor* fg, *bg; PSFont* font; PSBrush* br; PSPattern* pat; if (a == nil) { *dest = *b; return; } else if (b == nil) { *dest = *a; return; } if ((fill = b->BgFilled()) == UNDEF) { fill = a->BgFilled(); } dest->FillBg(fill); if ((fg = b->GetFgColor()) == nil) { fg = a->GetFgColor(); } if ((bg = b->GetBgColor()) == nil) { bg = a->GetBgColor(); } dest->SetColors(fg, bg); if ((pat = b->GetPattern()) == nil) { pat = a->GetPattern(); } dest->SetPattern(pat); if ((font = b->GetFont()) == nil) { font = a->GetFont(); } dest->SetFont(font); if ((br = b->GetBrush()) == nil) { br = a->GetBrush(); } dest->SetBrush(br); } void Graphic::concatTransformer ( Transformer* a, Transformer* b, Transformer* dest ) { if (a == nil) { *dest = (b == nil) ? *_identity : *b; } else if (b == nil) { *dest = *a; } else { Transformer tmp(a); tmp.Postmultiply(b); *dest = tmp; } } void Graphic::concat (Graphic* a, Graphic* b, Graphic* dest) { Transformer* ta = (a == nil) ? nil : a->GetTransformer(); Transformer* tb = (b == nil) ? nil : b->GetTransformer(); Transformer* td = dest->GetTransformer(); if (td == nil) { td = new Transformer; } else { Ref(td); } concatTransformer(ta, tb, td); dest->SetTransformer(td); concatGS(a, b, dest); Unref(td); } void Graphic::transform (Coord& x, Coord& y, Graphic* g) { Transformer* t = (g == nil) ? GetTransformer() : g->GetTransformer(); if (t != nil) { t->Transform(x, y); } } void Graphic::transform (Coord x, Coord y, Coord& tx, Coord& ty, Graphic* g) { Transformer* t = (g == nil) ? GetTransformer() : g->GetTransformer(); if (t != nil) { t->Transform(x, y, tx, ty); } else { tx = x; ty = y; } } void Graphic::transform (float x, float y, float& tx, float& ty, Graphic* g) { Transformer* t = (g == nil) ? GetTransformer() : g->GetTransformer(); if (t != nil) { t->Transform(x, y, tx, ty); } else { tx = x; ty = y; } } void Graphic::transformList ( Coord x[], Coord y[], int n, Coord tx[], Coord ty[], Graphic* g ) { Transformer* t = (g == nil) ? GetTransformer() : g->GetTransformer(); if (t != nil) { t->TransformList(x, y, n, tx, ty); } else { ArrayCopy(x, y, n, tx, ty); } } void Graphic::transformRect ( float x0, float y0, float x1, float y1, float& nx0, float& ny0, float& nx1, float& ny1, Graphic* g ) { Transformer* t = (g == nil) ? GetTransformer() : g->GetTransformer(); nx0 = x0; ny0 = y0; nx1 = x1; ny1 = y1; if (t != nil) { t->TransformRect(nx0, ny0, nx1, ny1); } } void Graphic::invTransform (Coord& tx, Coord& ty, Graphic* g) { Transformer* t = (g == nil) ? GetTransformer() : g->GetTransformer(); if (t != nil) { t->InvTransform(tx, ty); } } void Graphic::invTransform ( Coord tx, Coord ty, Coord& x, Coord& y, Graphic* g ) { Transformer* t = (g == nil) ? GetTransformer() : g->GetTransformer(); if (t != nil) { t->InvTransform(tx, ty, x, y); } else { x = tx; y = ty; } } void Graphic::invTransform ( float tx, float ty, float& x, float& y, Graphic* g ) { Transformer* t = (g == nil) ? GetTransformer() : g->GetTransformer(); if (t != nil) { t->InvTransform(tx, ty, x, y); } else { x = tx; y = ty; } } void Graphic::invTransformList( Coord tx[], Coord ty[], int n, Coord x[], Coord y[], Graphic* g ) { Transformer* t = (g == nil) ? GetTransformer() : g->GetTransformer(); if (t != nil) { t->InvTransformList(tx, ty, n, x, y); } else { ArrayCopy(tx, ty, n, x, y); } } void Graphic::invTransformRect ( float x0, float y0, float x1, float y1, float& nx0, float& ny0, float& nx1, float& ny1, Graphic* g ) { Transformer* t = (g == nil) ? GetTransformer() : g->GetTransformer(); nx0 = x0; ny0 = y0; nx1 = x1; ny1 = y1; if (t != nil) { t->InvTransformRect(nx0, ny0, nx1, ny1); } } /*****************************************************************************/ FullGraphic::FullGraphic (Graphic* gr) : Graphic(gr) { _br = nil; _pat = nil; _font = nil; if (gr != nil) { FullGraphic::SetPattern(gr->GetPattern()); FullGraphic::SetBrush(gr->GetBrush()); FullGraphic::SetFont(gr->GetFont()); } } FullGraphic::~FullGraphic () { Unref(_pat); Unref(_br); Unref(_font); } void FullGraphic::SetPattern (PSPattern* pat) { Ref(pat); Unref(_pat); _pat = pat; } PSPattern* FullGraphic::GetPattern () { return _pat; } void FullGraphic::SetBrush (PSBrush* br) { if (_br != br) { Ref(br); Unref(_br); _br = br; invalidateCaches(); } } PSBrush* FullGraphic::GetBrush () { return _br; } void FullGraphic::SetFont (PSFont* font) { if (_font != font) { Ref(font); Unref(_font); _font = font; invalidateCaches(); } } PSFont* FullGraphic::GetFont () { return _font; } Graphic* FullGraphic::Copy () { return new FullGraphic(this); } neuron-7.6.3/src/lib/Unidraw/grblock.cpp000066400000000000000000000305621340731477100201470ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * GraphicBlock implementation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ GraphicBlock::GraphicBlock ( const char* name, Graphic* gr, Coord pad, Alignment a, Zooming z ) { SetClassName("GraphicBlock"); SetInstance(name); _graphic = gr; _pad = pad; _align = a; _zooming = z; perspective = new Perspective; _highlighted = false; Init(); } GraphicBlock::GraphicBlock (Graphic* gr, Coord pad, Alignment a, Zooming z) { SetClassName("GraphicBlock"); _graphic = gr; _pad = pad; _align = a; _zooming = z; perspective = new Perspective; _highlighted = false; Init(); } void GraphicBlock::Init () { register Perspective* p = perspective; Coord left, bottom, right, top; _mag = 1; if (_graphic == nil) { _x0 = _y0 = 0; p->width = p->height = 1; } else { GetGraphicBox(left, bottom, right, top); _x0 = left; _y0 = bottom; p->width = shape->width = right - left + 2*_pad; p->height = shape->height = top - bottom + 2*_pad; } if (canvas == nil) { p->curwidth = p->width; p->curheight = p->height; } else { p->curwidth = xmax + 1; p->curheight = ymax + 1; } Align(); } void GraphicBlock::Align () { register Perspective* p = perspective; Coord l, b, dummy1, dummy2; if (_graphic == nil) { return; } switch (_align) { case BottomLeft: case CenterLeft: case TopLeft: p->curx = 0; break; case BottomCenter: case Center: case TopCenter: p->curx = (p->width - p->curwidth)/2; break; case BottomRight: case CenterRight: case TopRight: p->curx = p->width - p->curwidth; break; } switch (_align) { case BottomLeft: case BottomCenter: case BottomRight: p->cury = 0; break; case CenterLeft: case Center: case CenterRight: p->cury = (p->height - p->curheight)/2; break; case TopLeft: case TopCenter: case TopRight: p->cury = p->height - p->curheight; break; } GetGraphicBox(l, b, dummy1, dummy2); l = _pad - l - p->curx; b = _pad - b - p->cury; _graphic->Translate(l, b); _x0 += l; _y0 += b; } void GraphicBlock::Fix () { register Perspective* p = perspective; Coord l, b, dummy1, dummy2; if (_graphic == nil) { return; } GetGraphicBox(l, b, dummy1, dummy2); l = _pad - l; b = _pad - b; switch (_align) { case BottomLeft: case Left: case TopLeft: p->curx = l; break; case Bottom: case Center: case Top: p->curx -= (xmax + 1 - p->curwidth)/2; break; case BottomRight: case Right: case TopRight: p->curx -= (xmax + 1 - p->curwidth); break; } switch (_align) { case BottomLeft: case Bottom: case BottomRight: p->cury = b; break; case Left: case Center: case Right: p->cury -= (ymax + 1 - p->curheight)/2; break; case TopLeft: case Top: case TopRight: p->cury -= (ymax + 1 - p->curheight); break; } l -= p->curx; b -= p->cury; _graphic->Translate(l, b); _x0 += l; _y0 += b; } float GraphicBlock::LimitMagnification (float desired) { return desired; // no limit by default } void GraphicBlock::Resize () { register Perspective* p = perspective; Fix(); p->curwidth = xmax + 1; p->curheight = ymax + 1; p->sx = p->curwidth/8; p->sy = p->curheight/8; p->lx = p->curwidth/2; p->ly = p->curheight/2; p->Update(); } void GraphicBlock::UpdatePerspective () { register Perspective* p = perspective; Coord left, bottom, right, top; if (_graphic != nil) { GetGraphicBox(left, bottom, right, top); if (_x0 != left) { p->curx += _x0 - left; _x0 = left; } if (_y0 != bottom) { p->cury += _y0 - bottom; _y0 = bottom; } p->width = right - left + 2*_pad; p->height = top - bottom + 2*_pad; } p->Update(); } void GraphicBlock::Update () { UpdatePerspective(); Draw(); } void GraphicBlock::Draw () { if (canvas != nil) { output->ClearRect(canvas, 0, 0, xmax, ymax); if (_graphic != nil) { _graphic->Draw(canvas, 0, 0, xmax, ymax); } } } void GraphicBlock::Redraw (Coord l, Coord b, Coord r, Coord t) { if (canvas != nil) { output->ClearRect(canvas, l, b, r, t); if (_graphic != nil) { _graphic->DrawClipped(canvas, l, b, r, t); } } } void GraphicBlock::Normalize (Perspective& np) { register Perspective* p = perspective; float hfactor, vfactor; if (p->width != np.width) { hfactor = float(p->width) / float(np.width); np.x0 = iv26_round(hfactor * float(np.x0)); np.width = p->width; np.curx = iv26_round(hfactor * float(np.curx)); np.curwidth = iv26_round(hfactor * float(np.curwidth)); np.sx = iv26_round(hfactor * float(np.sx)); } if (p->height != np.height) { vfactor = float(p->height) / float(np.height); np.y0 = iv26_round(vfactor * float(np.y0)); np.height = p->height; np.cury = iv26_round(vfactor * float(np.cury)); np.curheight = iv26_round(vfactor * float(np.curheight)); np.sy = iv26_round(vfactor * float(np.sy)); } } float GraphicBlock::NearestPow2 (float factor) { double mant; int pow2; mant = frexp(factor, &pow2); if (mant < 0.95) { --pow2; } return ldexp(1.0, pow2); } float GraphicBlock::ScaleFactor (Perspective& np) { register Perspective* p = perspective; float factor = 1; Coord dx, dy; dx = abs(p->curwidth - np.curwidth); dy = abs(p->curheight - np.curheight); if (dx < dy) { factor = float(p->curwidth) / float(np.curwidth); } else { factor = float(p->curheight) / float(np.curheight); } if (_zooming == Binary) { factor = NearestPow2(factor); } return factor; } void GraphicBlock::GetGraphicBox (Coord& l, Coord& b, Coord& r, Coord& t) { _graphic->GetBox(l, b, r, t); } void GraphicBlock::Zoom (Perspective& np) { register Perspective* p = perspective; Coord cx, cy, halfw, halfh, dx, dy; float factor = ScaleFactor(np); factor = LimitMagnification(_mag * factor)/_mag; if (_graphic != nil && factor != 1.0) { cx = np.curx + np.curwidth/2; cy = np.cury + np.curheight/2; halfw = p->curwidth/2; halfh = p->curheight/2; dx = (p->curx + halfw) - cx; dy = (p->cury + halfh) - cy; _graphic->Translate(dx, dy); _graphic->Scale(factor, factor, float(halfw), float(halfh)); _x0 = iv26_round((_x0 + dx - halfw)*factor + halfw); _y0 = iv26_round((_y0 + dy - halfh)*factor + halfh); p->width = iv26_round(p->width * factor); p->height = iv26_round(p->height * factor); p->curx = iv26_round(float(cx) * factor) - halfw; p->cury = iv26_round(float(cy) * factor) - halfh; } _mag *= factor; } void GraphicBlock::Scroll (Perspective& np) { register Perspective* p = perspective; Coord dx, dy; if (_graphic != nil) { dx = p->curx - np.curx; dy = p->cury - np.cury; _graphic->Translate(dx, dy); _x0 += dx; _y0 += dy; p->curx = np.curx; p->cury = np.cury; } } void GraphicBlock::Adjust (Perspective& np) { register Perspective* p = perspective; Perspective ptmp; if (canvas == nil) { *p = np; } else if (_graphic != nil && *p != np) { Normalize(np); ptmp = *p; if (np.curwidth != canvas->Width() || np.curheight!=canvas->Height()) { Zoom(np); } else { Scroll(np); } p->Update(); if (ptmp != *p) { Draw(); } } } GraphicBlock::~GraphicBlock () { Unref(perspective); } void GraphicBlock::Highlight (bool on) { if (_highlighted != on) { _highlighted = on; const Color* fg = output->GetFgColor(); const Color* bg = output->GetBgColor(); output->SetColors(bg, fg); if (_graphic != nil) { PSColor* fg = _graphic->GetFgColor(); PSColor* bg = _graphic->GetBgColor(); _graphic->SetColors(bg, fg); } Draw(); } } Graphic* GraphicBlock::GetGraphic () { return _graphic; } float GraphicBlock::GetMagnification () { return _mag; } void GraphicBlock::SetGraphic (Graphic* g) { _graphic = g; Init(); } void GraphicBlock::SetMagnification (float m) { register Perspective* p = perspective; float factor; Coord cx, cy, halfw, halfh; if (_zooming == Binary) { m = NearestPow2(m); } factor = LimitMagnification(m)/_mag; if (_graphic != nil && factor != 1.0) { halfw = p->curwidth/2; halfh = p->curheight/2; cx = p->curx + halfw; cy = p->cury + halfh; _graphic->Scale(factor, factor, float(halfw), float(halfh)); _x0 = iv26_round((_x0 - halfw)*factor + halfw); _y0 = iv26_round((_y0 - halfh)*factor + halfh); p->width = iv26_round(p->width * factor); p->height = iv26_round(p->height * factor); p->curx = iv26_round(float(cx) * factor) - halfw; p->cury = iv26_round(float(cy) * factor) - halfh; p->Update(); Draw(); } _mag *= factor; } void GraphicBlock::GrabScroll (Event& e) { Cursor* origCursor = GetCursor(); SetCursor(WidgetKit::instance()->hand_cursor()); int y = e.y; int x = e.x; Perspective s = *GetPerspective(); do { s.curx += (x - e.x); s.cury += (y - e.y); Adjust(s); y = e.y; x = e.x; Poll(e); } while (e.middlemouse); SetCursor(origCursor); } void GraphicBlock::RateScroll (Event& e) { Cursor* origCursor = GetCursor(); WidgetKit& kit = *WidgetKit::instance(); int y = e.y; int x = e.x; do { Perspective s = *GetPerspective(); int dx = x - e.x; int dy = y - e.y; if (dx == 0 && dy == 0) { SetCursor(origCursor); } else { double angle = atan2((double)dy, (double)dx)*180/M_PI; if (angle < -157.5) { SetCursor(kit.rfast_cursor()); } else if (angle < -112.5) { SetCursor(kit.rufast_cursor()); } else if (angle < -67.5) { SetCursor(kit.ufast_cursor()); } else if (angle < -22.5) { SetCursor(kit.lufast_cursor()); } else if (angle < 22.5) { SetCursor(kit.lfast_cursor()); } else if (angle < 67.5) { SetCursor(kit.ldfast_cursor()); } else if (angle < 112.5) { SetCursor(kit.dfast_cursor()); } else if (angle < 157.5) { SetCursor(kit.rdfast_cursor()); } else { SetCursor(kit.rfast_cursor()); } } s.curx -= dx; s.cury -= dy; s.curx = min(max(s.x0, s.curx), s.x0 + s.width - s.curwidth); s.cury = min(max(s.y0, s.cury), s.y0 + s.height - s.curheight); Adjust(s); Poll(e); } while (e.rightmouse); SetCursor(origCursor); } neuron-7.6.3/src/lib/Unidraw/grcomp.cpp000066400000000000000000000732531340731477100200170ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of GraphicComp and derived classes. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ static GraphicComp* Pred (GraphicComp* child) { Iterator i; GraphicComp* parent = (GraphicComp*) child->GetParent(); parent->SetComp(child, i); parent->Prev(i); return parent->GetComp(i); } static void NullGS (Graphic* g) { FullGraphic null; *g = null; } /*****************************************************************************/ class UngroupData : public Data { public: UngroupData(GraphicComp* parent, Graphic*); virtual ~UngroupData(); public: GraphicComp* _parent; FullGraphic* _gs; }; UngroupData::UngroupData (GraphicComp* p, Graphic* g) { _parent = p; _gs = new FullGraphic(g); } UngroupData::~UngroupData () { delete _gs; } /*****************************************************************************/ UList* GraphicComp::_brushes; UList* GraphicComp::_colors; UList* GraphicComp::_fonts; UList* GraphicComp::_patterns; ClassId GraphicComp::GetClassId () { return GRAPHIC_COMP; } bool GraphicComp::IsA (ClassId id) { return GRAPHIC_COMP == id || Component::IsA(id); } GraphicComp::GraphicComp (Graphic* g) { GraphicComp::SetGraphic(g); } GraphicComp::~GraphicComp () { delete _gr; } Graphic* GraphicComp::GetGraphic () { return _gr; } void GraphicComp::SetGraphic (Graphic* gr) { _gr = gr; if (gr != nil) gr->SetTag(this); } GraphicComp* GraphicComp::GetGraphicComp (Graphic* g) { return (GraphicComp*) g->GetTag(); } Component* GraphicComp::GetParent () { Graphic* parent = GetGraphic()->Parent(); return (parent == nil) ? nil : GetGraphicComp(parent); } GraphicComp* GraphicComp::GetComp (Iterator) { return nil; } void GraphicComp::SetComp (GraphicComp*, Iterator&) { } void GraphicComp::Bequeath () { } void GraphicComp::Append (GraphicComp*) { } void GraphicComp::Prepend (GraphicComp*) { } void GraphicComp::InsertBefore (Iterator, GraphicComp*) { } void GraphicComp::InsertAfter (Iterator, GraphicComp*) { } void GraphicComp::Remove (GraphicComp*) { } void GraphicComp::Remove (Iterator&) { } Mobility GraphicComp::GetMobility () { return Undef; } void GraphicComp::SetMobility (Mobility) { } void GraphicComp::Interpret (Command* cmd) { Graphic* gr = GetGraphic(); if (gr == nil) { return; } if (cmd->IsA(BRUSH_CMD)) { PSBrush* br = ((BrushCmd*) cmd)->GetBrush(); cmd->Store(this, new VoidData(gr->GetBrush())); gr->SetBrush(br); Notify(); } else if (cmd->IsA(FONT_CMD)) { PSFont* font = ((FontCmd*) cmd)->GetFont(); cmd->Store(this, new VoidData(gr->GetFont())); gr->SetFont(font); // gr->SetLineHeight(font->Height()); // hack; should be state var Notify(); } else if (cmd->IsA(PATTERN_CMD)) { PSPattern* pat = ((PatternCmd*) cmd)->GetPattern(); cmd->Store(this, new VoidData(gr->GetPattern())); gr->SetPattern(pat); Notify(); } else if (cmd->IsA(MOBILITY_CMD)) { Mobility m = ((MobilityCmd*) cmd)->GetMobility(); cmd->Store(this, new MobilityData(GetMobility(), gr)); SetMobility(m); Notify(); } else if (cmd->IsA(COLOR_CMD)) { ColorCmd* colorCmd = (ColorCmd*) cmd; PSColor* fg = colorCmd->GetFgColor(); PSColor* bg = colorCmd->GetBgColor(); fg = (fg == nil) ? gr->GetFgColor() : fg; bg = (bg == nil) ? gr->GetBgColor() : bg; cmd->Store(this, new ColorData(gr->GetFgColor(), gr->GetBgColor())); gr->SetColors(fg, bg); Notify(); } else if (cmd->IsA(MOVE_CMD)) { float dx, dy; ((MoveCmd*) cmd)->GetMovement(dx, dy); gr->Translate(dx, dy); Notify(); } else if (cmd->IsA(SCALE_CMD)) { float sx, sy, x, y; ScaleCmd* scaleCmd = (ScaleCmd*) cmd; scaleCmd->GetScaling(sx, sy); Alignment a = scaleCmd->GetAlignment(); GetAlignmentPoint(gr, a, x, y); cmd->Store(this, new GSData(gr)); gr->Scale(sx, sy, x, y); Notify(); } else if (cmd->IsA(ROTATE_CMD)) { float angle, cx, cy; angle = ((RotateCmd*) cmd)->GetRotation(); gr->GetCenter(cx, cy); gr->Rotate(angle, cx, cy); Notify(); } else if (cmd->IsA(ALIGN_CMD)) { AlignCmd* alignCmd = (AlignCmd*) cmd; Alignment a1, a2; float cx0, cy0, cx1, cy1; GraphicComp* refcomp = alignCmd->GetReference(this); if (refcomp != this) { alignCmd->GetAlignment(a1, a2); gr->GetCenter(cx0, cy0); #if 0 if (gr->Parent() != nil) { Transformer t; gr->Parent()->TotalTransformation(t); t.InvTransform(cx0, cy0, cx0, cy0); t.InvTransform(cx1, cy1, cx1, cy1); } #endif refcomp->GetGraphic()->Align(a1, gr, a2); gr->GetCenter(cx1, cy1); cmd->Store(this, new MoveData(cx1 - cx0, cy1 - cy0)); Notify(); } } else if ( cmd->IsA(GROUP_CMD) || cmd->IsA(FRONT_CMD) || cmd->IsA(BACK_CMD) ) { cmd->GetClipboard()->Append(this); } else { Component::Interpret(cmd); } } void GraphicComp::Uninterpret (Command* cmd) { Graphic* gr = GetGraphic(); if (gr == nil) { return; } if (cmd->IsA(BRUSH_CMD)) { VoidData* vd = (VoidData*) cmd->Recall(this); gr->SetBrush((PSBrush*) vd->_void); Notify(); } else if (cmd->IsA(FONT_CMD)) { VoidData* vd = (VoidData*) cmd->Recall(this); gr->SetFont((PSFont*) vd->_void); Notify(); } else if (cmd->IsA(PATTERN_CMD)) { VoidData* vd = (VoidData*) cmd->Recall(this); gr->SetPattern((PSPattern*) vd->_void); Notify(); } else if (cmd->IsA(MOBILITY_CMD)) { MobilityData* xd = (MobilityData*) cmd->Recall(this); SetMobility(xd->_mobility); *gr = *xd->_gs; Notify(); } else if (cmd->IsA(COLOR_CMD)) { ColorData* cd = (ColorData*) cmd->Recall(this); if (cd != nil) { gr->SetColors(cd->_fg, cd->_bg); Notify(); } } else if (cmd->IsA(MOVE_CMD)) { float dx, dy; ((MoveCmd*) cmd)->GetMovement(dx, dy); gr->Translate(-dx, -dy); Notify(); } else if (cmd->IsA(SCALE_CMD)) { GSData* gd = (GSData*) cmd->Recall(this); *gr = *gd->_gs; Notify(); } else if (cmd->IsA(ROTATE_CMD)) { float angle, cx, cy; angle = ((RotateCmd*) cmd)->GetRotation(); gr->GetCenter(cx, cy); gr->Rotate(-angle, cx, cy); Notify(); } else if (cmd->IsA(ALIGN_CMD)) { MoveData* md = (MoveData*) cmd->Recall(this); if (md != nil) { gr->Translate(-md->_dx, -md->_dy); Notify(); } } else { Component::Uninterpret(cmd); } } void GraphicComp::Skip (istream& in) { unidraw->GetCatalog()->Skip(in); } void GraphicComp::Mark (ostream& out) { unidraw->GetCatalog()->Mark(out); } int GraphicComp::ReadBgFilled (istream& in) { return unidraw->GetCatalog()->ReadBgFilled(in); } Transformer* GraphicComp::ReadTransformer (istream& in) { return unidraw->GetCatalog()->ReadTransformer(in); } PSBrush* GraphicComp::ReadBrush (istream& in) { return unidraw->GetCatalog()->ReadBrush(in); } PSColor* GraphicComp::ReadColor (istream& in) { return unidraw->GetCatalog()->ReadColor(in); } PSFont* GraphicComp::ReadFont (istream& in) { return unidraw->GetCatalog()->ReadFont(in); } PSPattern* GraphicComp::ReadPattern (istream& in) { return unidraw->GetCatalog()->ReadPattern(in); } void GraphicComp::WriteBgFilled (bool bgFilled, ostream& out) { unidraw->GetCatalog()->WriteBgFilled(bgFilled, out); } void GraphicComp::WriteTransformer (Transformer* t, ostream& out) { unidraw->GetCatalog()->WriteTransformer(t, out); } void GraphicComp::WriteBrush (PSBrush* br, ostream& out) { unidraw->GetCatalog()->WriteBrush(br, out); } void GraphicComp::WriteColor (PSColor* color, ostream& out) { unidraw->GetCatalog()->WriteColor(color, out); } void GraphicComp::WriteFont (PSFont* font, ostream& out) { unidraw->GetCatalog()->WriteFont(font, out); } void GraphicComp::WritePattern (PSPattern* pat, ostream& out) { unidraw->GetCatalog()->WritePattern(pat, out); } char* GraphicComp::ReadString (istream& in) { return unidraw->GetCatalog()->ReadString(in); } Bitmap* GraphicComp::ReadBitmap (istream& in) { return unidraw->GetCatalog()->ReadBitmap(in); } Raster* GraphicComp::ReadGraymap (istream& in) { return unidraw->GetCatalog()->ReadGraymap(in); } Raster* GraphicComp::ReadRaster(istream& in) { return unidraw->GetCatalog()->ReadRaster(in); } void GraphicComp::WriteString (const char* string, ostream& out) { unidraw->GetCatalog()->WriteString(string, out); } void GraphicComp::WriteBitmap (Bitmap* bm, ostream& out) { unidraw->GetCatalog()->WriteBitmap(bm, out); } void GraphicComp::WriteGraymap (Raster* gm, ostream& out) { unidraw->GetCatalog()->WriteGraymap(gm, out); } void GraphicComp::WriteRaster (Raster* raster, ostream& out) { unidraw->GetCatalog()->WriteRaster(raster, out); } void GraphicComp::ReadVertices ( istream& in, Coord*& x, Coord*& y, int& count ) { in >> count; x = new Coord[count]; y = new Coord[count]; if (unidraw->GetCatalog()->FileVersion() > UV_PRERELEASE) { for (int i = 0; i < count; ++i) { Skip(in); in >> x[i] >> y[i]; } } else { for (int i = 0; i < count; ++i) { in >> x[i] >> y[i]; } } } void GraphicComp::WriteVertices ( const Coord* x, const Coord* y, int count, ostream& out ) { out << count; for (int i = 0; i < count; ++i) { Mark(out); out << x[i] << " " << y[i] << " "; } } /*****************************************************************************/ ClassId GraphicComps::GetClassId () { return GRAPHIC_COMPS; } bool GraphicComps::IsA (ClassId id) { return GRAPHIC_COMPS == id || GraphicComp::IsA(id); } Component* GraphicComps::Copy () { return unidraw->GetCatalog()->Copy(this); } GraphicComps::GraphicComps () : GraphicComp(new Picture) { _comps = new UList;} GraphicComps::GraphicComps (Graphic* g) : GraphicComp(g) { _comps = new UList;} GraphicComps::~GraphicComps () { Iterator i; GraphicComp* comp; First(i); while (!Done(i)) { comp = GetComp(i); Remove(i); delete comp; } delete _comps; } void GraphicComps::Interpret (Command* cmd) { Editor* ed = cmd->GetEditor(); if ( (cmd->IsA(DELETE_CMD) || cmd->IsA(CUT_CMD)) && ed->GetComponent() != this ) { Iterator i; for (First(i); !Done(i); Next(i)) { GetComp(i)->Interpret(cmd); } } else if (cmd->IsA(DELETE_CMD)) { Clipboard* cb = cmd->GetClipboard(); Selection* s = ed->GetSelection(); if (cb == nil) { if (s->IsEmpty()) { return; } cmd->SetClipboard(cb = new Clipboard); cb->Init(s); } s->Clear(); Iterator i; for (cb->First(i); !cb->Done(i); cb->Next(i)) { GraphicComp* comp = cb->GetComp(i); unidraw->CloseDependents(comp); comp->Interpret(cmd); StorePosition(comp, cmd); Remove(comp); } Notify(); unidraw->Update(); } else if (cmd->IsA(CUT_CMD)) { Clipboard* cb = cmd->GetClipboard(); Selection* s = ed->GetSelection(); if (cb == nil) { if (s->IsEmpty()) { return; } GraphicView* views = ed->GetViewer()->GetGraphicView(); s->Sort(views); cmd->SetClipboard(cb = new Clipboard); cb->Init(s); Clipboard* globalcb = unidraw->GetCatalog()->GetClipboard(); globalcb->DeleteComps(); globalcb->CopyInit(s); } s->Clear(); Iterator i; for (cb->First(i); !cb->Done(i); cb->Next(i)) { GraphicComp* comp = cb->GetComp(i); unidraw->CloseDependents(comp); comp->Interpret(cmd); StorePosition(comp, cmd); Remove(comp); } Notify(); unidraw->Update(); } else if (cmd->IsA(PASTE_CMD)) { Clipboard* cb = cmd->GetClipboard(); Iterator i; if (cb == nil) { Clipboard* globalcb = unidraw->GetCatalog()->GetClipboard(); if (globalcb->IsEmpty()) { return; } cmd->SetClipboard(cb = globalcb->DeepCopy()); } for (cb->First(i); !cb->Done(i); cb->Next(i)) { Append(cb->GetComp(i)); } Notify(); SelectClipboard(cb, ed); unidraw->Update(); } else if (cmd->IsA(DUP_CMD)) { GraphicView* views = ed->GetViewer()->GetGraphicView(); GraphicComp* prev, *dup1; Iterator i, pos; Clipboard* cb = cmd->GetClipboard(); const float offset = 8; MoveCmd move(ed, offset, offset); if (cb == nil) { Selection* s = ed->GetSelection(); if (s->IsEmpty()) { return; } cmd->SetClipboard(cb = new Clipboard); s->Sort(views); for (s->First(i); !s->Done(i); s->Next(i)) { dup1 = (GraphicComp*) s->GetView(i)->GetGraphicComp()->Copy(); dup1->Interpret(&move); cb->Append(dup1); } cb->First(i); dup1 = cb->GetComp(i); Last(pos); prev = GetComp(pos); cmd->Store(dup1, new VoidData(prev)); } else { cb->First(i); dup1 = cb->GetComp(i); VoidData* vd = (VoidData*) cmd->Recall(dup1); prev = (GraphicComp*) vd->_void; SetComp(prev, pos); } for (cb->Last(i); !cb->Done(i); cb->Prev(i)) { InsertAfter(pos, cb->GetComp(i)); } Notify(); SelectClipboard(cb, ed); unidraw->Update(); } else if (cmd->IsA(GROUP_CMD)) { GroupCmd* gcmd = (GroupCmd*) cmd; GraphicComp* group = gcmd->GetGroup(); Component* edComp = gcmd->GetEditor()->GetComponent(); if (group == this) { edComp->Interpret(gcmd); } else if (edComp == (Component*) this) { Clipboard* cb = cmd->GetClipboard(); NullGS(group->GetGraphic()); Group(cb, group, cmd); Notify(); SelectViewsOf(group, ed); unidraw->Update(); } else { GraphicComp::Interpret(gcmd); } } else if (cmd->IsA(UNGROUP_CMD)) { UngroupCmd* ucmd = (UngroupCmd*) cmd; Component* edComp = ucmd->GetEditor()->GetComponent(); if (edComp == (Component*) this) { Clipboard* cb = cmd->GetClipboard(); Clipboard* kids = new Clipboard; ucmd->SetKids(kids); Iterator i; for (cb->First(i); !cb->Done(i); cb->Next(i)) { GraphicComp* parent = cb->GetComp(i); unidraw->CloseDependents(parent); Ungroup(parent, kids, cmd); } Notify(); SelectClipboard(kids, ed); unidraw->Update(); } else { cmd->GetClipboard()->Append(this); } } else if (cmd->IsA(FRONT_CMD) || cmd->IsA(BACK_CMD)) { Component* edComp = cmd->GetEditor()->GetComponent(); if (edComp == (Component*) this) { Clipboard* cb = cmd->GetClipboard(); Iterator i; if (cmd->IsA(FRONT_CMD)) { for (cb->First(i); !cb->Done(i); cb->Next(i)) { GraphicComp* comp = cb->GetComp(i); StorePosition(comp, cmd); Remove(comp); Append(comp); } } else { for (cb->Last(i); !cb->Done(i); cb->Prev(i)) { GraphicComp* comp = cb->GetComp(i); StorePosition(comp, cmd); Remove(comp); Prepend(comp); } } Notify(); unidraw->Update(); } else { GraphicComp::Interpret(cmd); } } else { GraphicComp::Interpret(cmd); } } void GraphicComps::Uninterpret (Command* cmd) { Editor* ed = cmd->GetEditor(); if ( (cmd->IsA(DELETE_CMD) || cmd->IsA(CUT_CMD)) && ed->GetComponent() != this ) { Iterator i; for (Last(i); !Done(i); Prev(i)) { GetComp(i)->Uninterpret(cmd); } } else if (cmd->IsA(DELETE_CMD)) { Clipboard* cb = cmd->GetClipboard(); if (cb != nil) { Iterator i; for (cb->Last(i); !cb->Done(i); cb->Prev(i)) { GraphicComp* comp = cb->GetComp(i); RestorePosition(comp, cmd); comp->Uninterpret(cmd); } Notify(); SelectClipboard(cb, ed); unidraw->Update(); } } else if (cmd->IsA(CUT_CMD)) { Clipboard* cb = cmd->GetClipboard(); if (cb != nil) { Iterator i; for (cb->Last(i); !cb->Done(i); cb->Prev(i)) { GraphicComp* comp = cb->GetComp(i); RestorePosition(comp, cmd); comp->Uninterpret(cmd); } Notify(); SelectClipboard(cb, ed); unidraw->Update(); } } else if (cmd->IsA(PASTE_CMD)) { Clipboard* cb = cmd->GetClipboard(); if (cb != nil) { Selection* s = ed->GetSelection(); Iterator i, pos; s->Clear(); for (cb->First(i); !cb->Done(i); cb->Next(i)) { GraphicComp* comp = cb->GetComp(i); unidraw->CloseDependents(comp); Remove(comp); } Notify(); unidraw->Update(); } } else if (cmd->IsA(DUP_CMD)) { Clipboard* cb = cmd->GetClipboard(); if (cb != nil) { Selection* s = ed->GetSelection(); Iterator i; s->Clear(); for (cb->First(i); !cb->Done(i); cb->Next(i)) { GraphicComp* comp = cb->GetComp(i); unidraw->CloseDependents(comp); Remove(comp); } Notify(); unidraw->Update(); } } else if (cmd->IsA(GROUP_CMD)) { GroupCmd* gcmd = (GroupCmd*) cmd; GraphicComp* group = gcmd->GetGroup(); Component* edComp = gcmd->GetEditor()->GetComponent(); if (group == this) { edComp->Uninterpret(gcmd); } else if (edComp == (Component*) this) { Clipboard* cb = cmd->GetClipboard(); Iterator i; cb->First(i); GraphicComp* group = (GraphicComp*) cb->GetComp(i)->GetParent(); GroupCmd* gcmd = (GroupCmd*) cmd; unidraw->CloseDependents(group); for (cb->Last(i); !cb->Done(i); cb->Prev(i)) { RestorePosition(cb->GetComp(i), cmd); } Remove(group); Notify(); SelectClipboard(cb, ed); unidraw->Update(); } else { GraphicComp::Uninterpret(gcmd); } } else if (cmd->IsA(UNGROUP_CMD)) { UngroupCmd* ucmd = (UngroupCmd*) cmd; Component* edComp = ucmd->GetEditor()->GetComponent(); if (edComp == (Component*) this) { Clipboard* cb = ucmd->GetClipboard(); Clipboard* kids = ucmd->GetKids(); Clipboard insertedParents; Iterator k; for (kids->First(k); !kids->Done(k); kids->Next(k)) { GraphicComp* kid = kids->GetComp(k); UngroupData* ud = (UngroupData*) cmd->Recall(kid); GraphicComp* parent = ud->_parent; *kid->GetGraphic() = *ud->_gs; if (!insertedParents.Includes(parent)) { GSData* gd = (GSData*) cmd->Recall(parent); *parent->GetGraphic() = *gd->_gs; Iterator insertPt; SetComp(kid, insertPt); InsertBefore(insertPt, parent); insertedParents.Append(parent); } Remove(kid); parent->Append(kid); } Notify(); SelectClipboard(cb, ed); unidraw->Update(); delete kids; ucmd->SetKids(nil); } } else if (cmd->IsA(FRONT_CMD)) { Component* edComp = cmd->GetEditor()->GetComponent(); if (edComp == (Component*) this) { Clipboard* cb = cmd->GetClipboard(); Iterator i; for (cb->Last(i); !cb->Done(i); cb->Prev(i)) { RestorePosition(cb->GetComp(i), cmd); } Notify(); SelectClipboard(cb, ed); unidraw->Update(); } else { GraphicComp::Uninterpret(cmd); } } else if (cmd->IsA(BACK_CMD)) { Component* edComp = cmd->GetEditor()->GetComponent(); if (edComp == (Component*) this) { Clipboard* cb = cmd->GetClipboard(); Iterator i; for (cb->First(i); !cb->Done(i); cb->Next(i)) { RestorePosition(cb->GetComp(i), cmd); } Notify(); SelectClipboard(cb, ed); unidraw->Update(); } else { GraphicComp::Uninterpret(cmd); } } else { GraphicComp::Uninterpret(cmd); } } UList* GraphicComps::Elem (Iterator i) { return (UList*) i.GetValue(); } void GraphicComps::First (Iterator& i) { i.SetValue(_comps->First()); } void GraphicComps::Last (Iterator& i) { i.SetValue(_comps->Last()); } void GraphicComps::Next (Iterator& i) { i.SetValue(Elem(i)->Next()); } void GraphicComps::Prev (Iterator& i) { i.SetValue(Elem(i)->Prev()); } bool GraphicComps::Done (Iterator i) { return Elem(i) == _comps->End(); } GraphicComp* GraphicComps::Comp (UList* r) { return (GraphicComp*) (*r)(); } GraphicComp* GraphicComps::GetComp (Iterator i) { return Comp(Elem(i)); } void GraphicComps::SetComp (GraphicComp* gc, Iterator& i) { i.SetValue(_comps->Find(gc)); } void GraphicComps::Append (GraphicComp* comp) { Graphic* g = comp->GetGraphic(); _comps->Append(new UList(comp)); if (g != nil) GetGraphic()->Append(g); SetParent(comp, this); } void GraphicComps::Prepend (GraphicComp* comp) { Graphic* g = comp->GetGraphic(); _comps->Prepend(new UList(comp)); if (g != nil) GetGraphic()->Prepend(g); SetParent(comp, this); } void GraphicComps::InsertBefore (Iterator i, GraphicComp* comp) { Graphic* g = comp->GetGraphic(); Graphic* parent; Elem(i)->Append(new UList(comp)); if (g != nil) { Iterator j; parent = GetGraphic(); parent->SetGraphic(GetComp(i)->GetGraphic(), j); parent->InsertBefore(j, g); } SetParent(comp, this); } void GraphicComps::InsertAfter (Iterator i, GraphicComp* comp) { Graphic* g = comp->GetGraphic(); Graphic* parent; Elem(i)->Prepend(new UList(comp)); if (g != nil) { Iterator j; parent = GetGraphic(); parent->SetGraphic(GetComp(i)->GetGraphic(), j); parent->InsertAfter(j, g); } SetParent(comp, this); } void GraphicComps::Remove (Iterator& i) { UList* doomed = Elem(i); GraphicComp* comp = Comp(doomed); Graphic* g = comp->GetGraphic(); Next(i); _comps->Remove(doomed); if (g != nil) GetGraphic()->Remove(g); SetParent(comp, nil); delete doomed; } void GraphicComps::Remove (GraphicComp* comp) { Graphic* g = comp->GetGraphic(); _comps->Delete(comp); if (g != nil) GetGraphic()->Remove(g); SetParent(comp, nil); } void GraphicComps::Bequeath () { GetGraphic()->Bequeath(); } void GraphicComps::SetMobility (Mobility m) { Iterator i; for (First(i); !Done(i); Next(i)) { GetComp(i)->SetMobility(m); } } void GraphicComps::Read (istream& in) { GraphicComp::Read(in); Graphic* g = GetGraphic(); int count; in >> count; for (int i = 0; i < count; ++i) { Append((GraphicComp*) unidraw->GetCatalog()->ReadComponent(in)); } g->FillBg(ReadBgFilled(in)); g->SetBrush(ReadBrush(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); g->SetColors(fg, bg); g->SetFont(ReadFont(in)); g->SetPattern(ReadPattern(in)); Transformer* t = ReadTransformer(in); g->SetTransformer(t); Unref(t); } void GraphicComps::Write (ostream& out) { GraphicComp::Write(out); Iterator i; int count = 0; Graphic* g = GetGraphic(); for (First(i); !Done(i); Next(i), ++count); out << count << "\n"; for (First(i); !Done(i); Next(i)) { GraphicComp* comp = GetComp(i); unidraw->GetCatalog()->WriteComponent(comp, out); out << "\n"; } WriteBgFilled(g->BgFilled(), out); WriteBrush(g->GetBrush(), out); WriteColor(g->GetFgColor(), out); WriteColor(g->GetBgColor(), out); WriteFont(g->GetFont(), out); WritePattern(g->GetPattern(), out); WriteTransformer(g->GetTransformer(), out); } void GraphicComps::SelectViewsOf (GraphicComp* comp, Editor* ed) { Selection* s = ed->GetSelection(); s->Clear(); Viewer* viewer; for (int i = 0; (viewer = ed->GetViewer(i)) != nil; ++i) { GraphicView* views = viewer->GetGraphicView(); GraphicView* view = views->GetGraphicView(comp); if (view != nil) s->Append(view); } } void GraphicComps::SelectClipboard (Clipboard* cb, Editor* ed) { Selection* s = ed->GetSelection(); s->Clear(); Viewer* viewer; Iterator i; for (int j = 0; (viewer = ed->GetViewer(j)) != nil; ++j) { for (cb->First(i); !cb->Done(i); cb->Next(i)) { GraphicView* views = viewer->GetGraphicView(); GraphicView* view = views->GetGraphicView(cb->GetComp(i)); if (view != nil) s->Append(view); } } } void GraphicComps::StorePosition (GraphicComp* comp, Command* cmd) { cmd->Store(comp, new VoidData(Pred(comp))); } void GraphicComps::RestorePosition (GraphicComp* comp, Command* cmd) { VoidData* vd = (VoidData*) cmd->Recall(comp); GraphicComp* pred = (GraphicComp*) vd->_void; GraphicComp* parent = (GraphicComp*) comp->GetParent(); if (parent != nil) parent->Remove(comp); if (pred == nil) { Prepend(comp); } else { Iterator insertPt; SetComp(pred, insertPt); InsertAfter(insertPt, comp); } } void GraphicComps::Group (Clipboard* cb, GraphicComp* group, Command* cmd) { Iterator insertPt, i; cb->Last(i); GraphicComp* last = cb->GetComp(i); SetComp(last, insertPt); InsertAfter(insertPt, group); for (cb->First(i); !cb->Done(i); cb->Next(i)) { GraphicComp* comp = cb->GetComp(i); StorePosition(comp, cmd); Remove(comp); group->Append(comp); } } void GraphicComps::Ungroup (GraphicComp* parent, Clipboard* cb, Command* cmd) { Iterator i, insertPt; parent->First(i); if (!parent->Done(i)) { SetComp(parent, insertPt); for (parent->First(i); !parent->Done(i); parent->Next(i)) { GraphicComp* kid = parent->GetComp(i); cmd->Store(kid, new UngroupData(parent, kid->GetGraphic())); } cmd->Store(parent, new GSData(parent->GetGraphic())); parent->Bequeath(); parent->First(i); do { GraphicComp* kid = parent->GetComp(i); parent->Remove(i); InsertBefore(insertPt, kid); cb->Append(kid); } while (!parent->Done(i)); Remove(parent); } } neuron-7.6.3/src/lib/Unidraw/grcomptool.cpp000066400000000000000000000056741340731477100207170ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Graphic component tool definitions. */ #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ ClassId GraphicCompTool::GetClassId () { return GRAPHIC_COMP_TOOL; } bool GraphicCompTool::IsA (ClassId id) { return GRAPHIC_COMP_TOOL == id || Tool::IsA(id); } GraphicCompTool::GraphicCompTool () { } GraphicCompTool::GraphicCompTool ( ControlInfo* m, GraphicComp* proto ) : Tool(m) { Init(proto); } GraphicCompTool::~GraphicCompTool () { delete _protoview; delete _prototype; } Tool* GraphicCompTool::Copy () { return new GraphicCompTool(CopyControlInfo(), GetPrototype()); } Manipulator* GraphicCompTool::CreateManipulator ( Viewer* v, Event& e, Transformer* t ) { v->GetSelection()->Clear(); return _protoview->CreateManipulator(v, e, t, this); } Command* GraphicCompTool::InterpretManipulator (Manipulator* m) { return _protoview->InterpretManipulator(m); } void GraphicCompTool::Init (GraphicComp* prototype) { _prototype = prototype; _protoview = (GraphicView*) _prototype->Create(COMPONENT_VIEW); _prototype->Attach(_protoview); _protoview->Update(); } void GraphicCompTool::Read (istream& in) { Tool::Read(in); Init((GraphicComp*) unidraw->GetCatalog()->ReadComponent(in)); } void GraphicCompTool::Write (ostream& out) { Tool::Write(out); unidraw->GetCatalog()->WriteComponent(GetPrototype(), out); } neuron-7.6.3/src/lib/Unidraw/grid.cpp000066400000000000000000000132221340731477100174430ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Grid implementation. */ #include #include #include #include #include #include #include #include /*****************************************************************************/ class GridGraphic : public Graphic { public: GridGraphic(float w, float h, float xincr, float yincr, Graphic* = nil); virtual ~GridGraphic(); void SetIncr(float xincr, float yincr); void GetOriginal(float&, float&, float&, float&); virtual void SetBrush(PSBrush*); virtual PSBrush* GetBrush(); virtual Graphic* Copy(); protected: void getExtent(float&, float&, float&, float&, float&, Graphic*); void draw(Canvas*, Graphic*); void drawClipped(Canvas*, Coord, Coord, Coord, Coord, Graphic*); private: float _width, _height; float _xincr, _yincr; PSBrush* _br; }; GridGraphic::GridGraphic ( float width, float height, float xincr, float yincr, Graphic* gr ) : Graphic(gr) { _br = nil; if (gr != nil) { GridGraphic::SetBrush(gr->GetBrush()); } _width = width; _height = height; _xincr = xincr; _yincr = yincr; } GridGraphic::~GridGraphic () { Unref(_br); } void GridGraphic::SetIncr(float xincr, float yincr) { _xincr = xincr; _yincr = yincr; invalidateCaches(); } void GridGraphic::GetOriginal ( float& width, float& height, float& xincr, float& yincr ) { width = _width; height = _height; xincr = _xincr; yincr = _yincr; } void GridGraphic::SetBrush (PSBrush* br) { if (_br != br) { Ref(br); Unref(_br); _br = br; invalidateCaches(); } } PSBrush* GridGraphic::GetBrush () { return _br; } Graphic* GridGraphic::Copy () { return new GridGraphic(_width, _height, _xincr, _yincr, this); } void GridGraphic::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { float width, dummy1, dummy2; width = float(gs->GetBrush()->Width()); tol = (width > 1) ? width/2 : 0; transformRect(0.0, 0.0, _width-1, _height-1, l, b, dummy1, dummy2, gs); transform((_width-1)/2, (_height-1)/2, cx, cy, gs); } void GridGraphic::draw (Canvas* c, Graphic* gs) { drawClipped(c, 0, 0, c->Width()-1, c->Height()-1, gs); } static inline float frac (float r) { if (r < 0) { r = -r; r = r - int(r); r = -r; } else { r = r - int(r); } return r; } void GridGraphic::drawClipped ( Canvas* c, Coord l, Coord b, Coord r, Coord t, Graphic* gs ) { if (!gs->GetBrush()->None()) { const float min_xincr = 4; const float min_yincr = 4; float x0, y0, x1, y1; transformRect(0., 0., _xincr, _yincr, x0, y0, x1, y1, gs); float xincr = x1 - x0; float yincr = y1 - y0; xincr = Math::max(min_xincr, xincr * int(1 + min_xincr/xincr)); yincr = Math::max(min_yincr, yincr * int(1 + min_yincr/yincr)); transform(0., 0.0, x0, y0, gs); x0 -= l; y0 -= b; x0 = l + frac(x0/xincr) * xincr; y0 = b + frac(y0/yincr) * yincr; update(gs); _p->SetTransformer(nil); ++r; ++t; for (register float x = x0; x <= r; x += xincr) { for (register float y = y0; y <= t; y += yincr) { _p->Point(c, iv26_round(x), iv26_round(y)); } } } } /*****************************************************************************/ Grid::Grid (float width, float height, float xincr, float yincr) { _graphic = new GridGraphic(width, height, xincr, yincr, stdgraphic); } Grid::Grid (Graphic* g) { _graphic = g; } Grid::~Grid () { delete _graphic; } Graphic* Grid::GetGraphic () { return _graphic; } void Grid::Constrain (Coord& x, Coord& y) { Transformer total(_graphic->GetTransformer()); GridGraphic* gg = (GridGraphic*) _graphic; float xincr, yincr, dummy1, dummy2; gg->TotalTransformation(total); gg->GetOriginal(dummy1, dummy2, xincr, yincr); float x0, y0; total.InvTransform(float(x), float(y), x0, y0); x0 = iv26_round(x0/xincr) * xincr; y0 = iv26_round(y0/yincr) * yincr; total.Transform(x0, y0, x0, y0); x = iv26_round(x0); y = iv26_round(y0); } void Grid::SetSpacing (float xincr, float yincr) { ((GridGraphic*)_graphic)->SetIncr(xincr,yincr); } void Grid::Visibility (bool visible) { if (visible != IsVisible()) { PSBrush* br = visible ? pssingle : psnonebr; _graphic->SetBrush(br); } } bool Grid::IsVisible () { return !_graphic->GetBrush()->None(); } neuron-7.6.3/src/lib/Unidraw/grview.cpp000066400000000000000000000475011340731477100200300ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of GraphicView and derived classes. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ ClassId GraphicView::GetClassId () { return GRAPHIC_VIEW; } bool GraphicView::IsA (ClassId id) { return GRAPHIC_VIEW == id || ComponentView::IsA(id); } GraphicView::GraphicView (GraphicComp* subj) : ComponentView(subj) { SetGraphic(nil); _handles = nil; } void GraphicView::SetGraphic (Graphic* graphic) { _gr = graphic; if (graphic != nil) { graphic->SetTag(this); } } void GraphicView::AddDamage (Graphic* g) { Viewer* viewer = GetViewer(); if (viewer != nil) { viewer->GetDamage()->Added(g); } } void GraphicView::IncurDamage (Graphic* g) { Viewer* viewer = GetViewer(); if (viewer != nil) { viewer->GetDamage()->Incur(g); } } void GraphicView::Unselect (GraphicView* gv) { Viewer* viewer = GetViewer(); if (viewer != nil) { Selection* s = viewer->GetSelection(); gv->EraseHandles(); viewer->GetSelection()->Remove(gv); } } GraphicView::~GraphicView () { if (_handles != nil) { delete _handles; } if (_gr != nil) { delete _gr; } } GraphicView* GraphicView::View (UList* r) { return (GraphicView*) (*r)(); } void GraphicView::Interpret (Command* cmd) { if (cmd->IsA(ALIGNTOGRID_CMD)) { float l, b, r, t; GetGraphic()->GetBounds(l, b, r, t); ((AlignToGridCmd*) cmd)->Align(this, l, b); } else { ComponentView::Interpret(cmd); } } void GraphicView::Uninterpret (Command* cmd) { if (cmd->IsA(ALIGNTOGRID_CMD)) { ((AlignToGridCmd*) cmd)->Unalign(this); } else { ComponentView::Uninterpret(cmd); } } void GraphicView::CreateHandles () { Coord left, bottom, right, top, halfx, halfy; Coord x[8], y[8]; Viewer* v = GetViewer(); if (v != nil) { GetGraphic()->GetBox(left, bottom, right, top); halfx = (right + left)/2; halfy = (top + bottom)/2; x[0] = left; y[0] = bottom; x[1] = halfx; y[1] = bottom; x[2] = right; y[2] = bottom; x[3] = right; y[3] = halfy; x[4] = right; y[4] = top; x[5] = halfx; y[5] = top; x[6] = left; y[6] = top; x[7] = left; y[7] = halfy; _handles = new RubberHandles(nil, nil, x, y, 8, 0, HANDLE_SIZE); v->InitRubberband(_handles); } } void GraphicView::DrawHandles () { if (_handles == nil) { CreateHandles(); } _handles->Draw(); } void GraphicView::RedrawHandles () { if (_handles == nil) { CreateHandles(); } _handles->Redraw(); } void GraphicView::InitHandles () { if (_handles != nil) { delete _handles; _handles = nil; CreateHandles(); } } void GraphicView::EraseHandles () { if (_handles != nil) { _handles->Erase(); delete _handles; _handles = nil; } } Manipulator* GraphicView::CreateGraphicCompManip ( Viewer* v, Event& e, Transformer* rel, Tool* tool ) { GraphicView* views = v->GetGraphicView(); GraphicComp* comp = GetGraphicComp(); Selection* s = v->GetSelection(); SlidingRect* sr; Coord x0, y0, x1, y1, halfw, halfh; s->Clear(); GetGraphic()->GetBox(x0, y0, x1, y1); if (rel != nil) { rel->Transform(x0, y0); rel->Transform(x1, y1); halfw = abs(x1 - x0) / 2; halfh = abs(y1 - y0) / 2; } v->Constrain(e.x, e.y); sr = new SlidingRect( nil, nil, e.x - halfw, e.y - halfh, e.x + halfw, e.y + halfh, e.x, e.y ); return new DragManip(v, sr, rel, tool, Gravity); } Manipulator* GraphicView::CreateStretchManip ( Viewer* v, Event& e, Transformer* rel, Tool* tool ) { Coord l, b, r, t, tmp; DragConstraint dc = HorizOrVert; v->Constrain(e.x, e.y); GetGraphic()->GetBox(l, b, r, t); bool horizCtr = e.x > (2*l + r)/3 && e.x < (l + 2*r)/3; bool vertCtr = e.y > (2*b + t)/3 && e.y < (b + 2*t)/3; if (e.x < (l + r)/2) { tmp = r; r = l; l = tmp; } if (e.y < (b + t)/2) { tmp = t; t = b; b = tmp; } if (horizCtr && !vertCtr) { dc = XFixed; } else if (!horizCtr && vertCtr) { dc = YFixed; } RubberRect* rub = new RubberRect(nil, nil, l, b, r, t); return new DragManip( v, rub, rel, tool, DragConstraint(dc | Gravity), r, t ); } Manipulator* GraphicView::CreateManipulator ( Viewer* v, Event& e, Transformer* rel, Tool* tool ) { Coord l, r, b, t; Rubberband* rub = nil; Manipulator* m = nil; if (tool->IsA(GRAPHIC_COMP_TOOL)) { m = CreateGraphicCompManip(v, e, rel, tool); } else if (tool->IsA(MOVE_TOOL)) { v->Constrain(e.x, e.y); v->GetSelection()->GetBox(l, b, r, t); rub = new SlidingRect(nil, nil, l, b, r, t, e.x, e.y); m = new DragManip( v, rub, rel, tool, DragConstraint(HorizOrVert | Gravity) ); } else if (tool->IsA(SCALE_TOOL)) { v->Constrain(e.x, e.y); GetGraphic()->GetBox(l, b, r, t); rub = new ScalingRect(nil, nil, l, b, r, t, (l+r)/2, (b+t)/2); m = new DragManip(v, rub, rel, tool, Gravity); } else if (tool->IsA(STRETCH_TOOL)) { m = CreateStretchManip(v, e, rel, tool); } else if (tool->IsA(ROTATE_TOOL)) { v->Constrain(e.x, e.y); GetGraphic()->GetBox(l, b, r, t); rub = new RotatingRect( nil, nil, l, b, r, t, (l+r)/2, (b+t)/2, e.x, e.y ); m = new DragManip(v, rub, rel, tool, Gravity); } return m; } Command* GraphicView::InterpretGraphicCompManip (Manipulator* m) { DragManip* dm = (DragManip*) m; Editor* ed = dm->GetViewer()->GetEditor(); Transformer* rel = dm->GetTransformer(); SlidingRect* slidingRect = (SlidingRect*) dm->GetRubberband(); Coord cx0, cy0, cx1, cy1; float cx, cy, px, py; GraphicComp* newComp = (GraphicComp*) GetGraphicComp()->Copy(); Graphic* grcomp = newComp->GetGraphic(); slidingRect->GetCurrent(cx0, cy0, cx1, cy1); px = float(cx0 + cx1) / 2; py = float(cy0 + cy1) / 2; rel->InvTransform(px, py, cx, cy); grcomp->GetCenter(px, py); grcomp->Translate(cx - px, cy - py); return new PasteCmd(ed, new Clipboard(newComp)); } Command* GraphicView::InterpretStretchManip (Manipulator* m) { Viewer* v = m->GetViewer(); DragManip* dm = (DragManip*) m; Editor* ed = v->GetEditor(); RubberRect* rr = (RubberRect*) dm->GetRubberband(); Coord l0, b0, r0, t0, l1, b1, r1, t1; float sx, sy; Alignment a; rr->GetOriginal(l0, b0, r0, t0); if (v->GetOrientation() == Landscape) { if (l0 > r0) { a = (b0 > t0) ? TopLeft : TopRight; } else { a = (b0 > t0) ? BottomLeft : BottomRight; } } else { if (l0 > r0) { a = (b0 > t0) ? TopRight : BottomRight; } else { a = (b0 > t0) ? TopLeft : BottomLeft; } } rr->GetCurrent(l1, b1, r1, t1); sx = float(r1 - l1) / float(r0 - l0); sy = float(t1 - b1) / float(t0 - b0); if (v->GetOrientation() == Landscape) { float tmp = sx; sx = sy; sy = tmp; } return new ScaleCmd(ed, sx, sy, a); } Command* GraphicView::InterpretManipulator (Manipulator* m) { DragManip* dm = (DragManip*) m; Editor* ed = dm->GetViewer()->GetEditor(); Tool* tool = dm->GetTool(); Transformer* rel = dm->GetTransformer(); Command* cmd = nil; if (tool->IsA(GRAPHIC_COMP_TOOL)) { cmd = InterpretGraphicCompManip(m); } else if (tool->IsA(MOVE_TOOL)) { SlidingRect* sr = (SlidingRect*) dm->GetRubberband(); Coord x0, y0, x1, y1, dummy1, dummy2; float fx0, fy0, fx1, fy1; sr->GetOriginal(x0, y0, dummy1, dummy2); sr->GetCurrent(x1, y1, dummy1, dummy2); if (rel != nil) { rel->InvTransform(float(x0), float(y0), fx0, fy0); rel->InvTransform(float(x1), float(y1), fx1, fy1); } cmd = new MoveCmd(ed, fx1-fx0, fy1-fy0); } else if (tool->IsA(SCALE_TOOL)) { ScalingRect* sr = (ScalingRect*) dm->GetRubberband(); float scale = sr->CurrentScaling(); cmd = new ScaleCmd(ed, scale, scale); } else if (tool->IsA(STRETCH_TOOL)) { cmd = InterpretStretchManip(m); } else if (tool->IsA(ROTATE_TOOL)) { RotatingRect* rr = (RotatingRect*) dm->GetRubberband(); cmd = new RotateCmd(ed, rr->CurrentAngle()); } return cmd; } Graphic* GraphicView::GetGraphic () { return _gr; } GraphicView* GraphicView::GetGraphicView (Graphic* g) { return (GraphicView*) g->GetTag(); } GraphicView* GraphicView::GetView (Iterator) { return nil; } void GraphicView::SetView (GraphicView*, Iterator&) { } void GraphicView::Add (GraphicView*) { } void GraphicView::Append (GraphicView*) { } void GraphicView::InsertBefore (Iterator, GraphicView*) { } void GraphicView::Remove (Iterator&) { } void GraphicView::DeleteView (Iterator&) { } Selection* GraphicView::SelectAll () { return nil; } Selection* GraphicView::ViewContaining (Coord, Coord) { return nil; } Selection* GraphicView::ViewsContaining (Coord, Coord) { return nil; } Selection* GraphicView::ViewIntersecting (Coord, Coord, Coord, Coord) { return nil; } Selection* GraphicView::ViewsIntersecting (Coord, Coord, Coord, Coord) { return nil; } Selection* GraphicView::ViewsWithin (Coord, Coord, Coord, Coord) { return nil; } ConnectorView* GraphicView::ConnectorIntersecting (Coord,Coord,Coord,Coord) { return nil; } bool GraphicView::Includes (GraphicView* view) { Iterator i; for (First(i); !Done(i); Next(i)) { if (GetView(i) == view) { return true; } } return false; } GraphicView* GraphicView::GetGraphicView (Component* c) { Iterator i; for (First(i); !Done(i); Next(i)) { GraphicView* view = GetView(i); if (view->GetSubject() == c) { return view; } } return nil; } ComponentView* GraphicView::GetParent () { Graphic* parent = GetGraphic()->Parent(); if (parent == nil) { return nil; } else { return GetGraphicView(parent); } } Viewer* GraphicView::GetViewer () { GraphicView* parent = (GraphicView*) GetParent(); if (parent == nil) { return nil; } else { return parent->GetViewer(); } } GraphicComp* GraphicView::GetGraphicComp () { return (GraphicComp*) GetSubject(); } int GraphicView::ClosestPoint( Coord x[], Coord y[], int n, Coord px, Coord py ) { int closestPt = 0; PointObj p(x[0],y[0]), cp(px,py); float minDist = p.Distance(cp); for (int i = 1; i < n; ++i) { p._x = x[i]; p._y = y[i]; float dist = p.Distance(cp); if (dist < minDist) { minDist = dist; closestPt = i; } } return closestPt; } /****************************************************************************/ GraphicViews::GraphicViews (GraphicComps* subj) : GraphicView(subj) { _views = new UList; } ClassId GraphicViews::GetClassId () { return GRAPHIC_VIEWS; } bool GraphicViews::IsA (ClassId id) { return GRAPHIC_VIEWS == id || GraphicView::IsA(id); } GraphicViews::~GraphicViews () { Iterator i; Graphic* parent = GetGraphic(); First(i); while (!Done(i)) { UList* doomed = Elem(i); GraphicView* view = GetView(i); Graphic* g = view->GetGraphic(); Next(i); _views->Remove(doomed); parent->Remove(g); delete doomed; delete view; } delete _views; } static GraphicView* GetLeaf (GraphicView* gv) { Iterator i; gv->First(i); if (!gv->Done(i)) { gv = GetLeaf(gv->GetView(i)); } return gv; } void GraphicViews::Interpret (Command* cmd) { if (cmd->IsA(ALIGNTOGRID_CMD)) { Viewer* viewer = GetViewer(); Grid* grid = (viewer == nil) ? nil : viewer->GetGrid(); if (grid == nil) { return; } AlignToGridCmd* acmd = (AlignToGridCmd*) cmd; GraphicView* leaf = GetLeaf(this); Graphic* leafg = leaf->GetGraphic(); float cx, cy, dx, dy; leafg->GetCenter(cx, cy); leaf->Interpret(acmd); leafg->GetCenter(dx, dy); leaf->Uninterpret(acmd); dx -= cx; dy -= cy; Coord rcx = 0, rcy = 0; grid->Constrain(rcx, rcy); acmd->Align(this, float(rcx) - dx, float(rcy) - dy); } else { GraphicView::Interpret(cmd); } } void GraphicViews::Update () { GVUpdater gvu(this); gvu.Update(); } UList* GraphicViews::Elem (Iterator i) { return (UList*) i.GetValue(); } void GraphicViews::First (Iterator& i) { i.SetValue(_views->First()); } void GraphicViews::Last (Iterator& i) { i.SetValue(_views->Last()); } void GraphicViews::Next (Iterator& i) { i.SetValue(Elem(i)->Next()); } void GraphicViews::Prev (Iterator& i) { i.SetValue(Elem(i)->Prev()); } bool GraphicViews::Done (Iterator i) { return Elem(i) == _views->End(); } GraphicView* GraphicViews::GetView (Iterator i) { return this->View(Elem(i)); } void GraphicViews::SetView (GraphicView* gv, Iterator& i) { i.SetValue(_views->Find(gv)); } Selection* GraphicViews::SelectAll () { Iterator i; Selection* selection = new Selection; for (First(i); !Done(i); Next(i)) { selection->Append(GetView(i)); } return selection; } Selection* GraphicViews::ViewContaining (Coord x, Coord y) { Selection* s = new Selection; PointObj pt(x, y); Graphic* g = GetGraphic()->LastGraphicContaining(pt); if (g != nil) { GraphicView* gv = GetGraphicView(g); if (gv != nil) { s->Append(gv); } } return s; } Selection* GraphicViews::ViewsContaining (Coord x, Coord y) { Iterator i; Selection* s = new Selection; PointObj pt(x, y); for (First(i); !Done(i); Next(i)) { GraphicView* view = GetView(i); if (view->GetGraphic()->Contains(pt)) { s->Append(view); } } return s; } Selection* GraphicViews::ViewIntersecting ( Coord x0, Coord y0, Coord x1, Coord y1 ) { Selection* s = new Selection; BoxObj b(x0, y0, x1, y1); Graphic* g = GetGraphic()->LastGraphicIntersecting(b); if (g != nil) { GraphicView* gv = GetGraphicView(g); if (gv != nil) { s->Append(gv); } } return s; } Selection* GraphicViews::ViewsIntersecting ( Coord x0, Coord y0, Coord x1, Coord y1 ) { Iterator i; Selection* s = new Selection; BoxObj b(x0, y0, x1, y1); for (First(i); !Done(i); Next(i)) { GraphicView* view = GetView(i); if (view->GetGraphic()->Intersects(b)) { s->Append(view); } } return s; } Selection* GraphicViews::ViewsWithin (Coord x0, Coord y0, Coord x1, Coord y1){ Iterator i; Selection* s = new Selection; BoxObj b(x0, y0, x1, y1); for (First(i); !Done(i); Next(i)) { GraphicView* view = GetView(i); BoxObj tmpbox; view->GetGraphic()->GetBox(tmpbox); if (tmpbox.Within(b)) { s->Append(view); } } return s; } Graphic* GraphicViews::GetGraphic () { Graphic* g = GraphicView::GetGraphic(); if (g == nil) { g = new Picture; Iterator i; for (First(i); !Done(i); Next(i)) { g->Append(GetView(i)->GetGraphic()); } SetGraphic(g); } return g; } GraphicComps* GraphicViews::GetGraphicComps () { return (GraphicComps*) GetSubject(); } void GraphicViews::Add (GraphicView* view) { Graphic* g = view->GetGraphic(); Graphic* parent = GetGraphic(); UList* rv = new UList(view); _views->Append(rv); parent->Append(g); SetParent(view, this); } void GraphicViews::Append (GraphicView* view) { Graphic* g = view->GetGraphic(); Graphic* parent = GetGraphic(); UList* rv = new UList(view); _views->Append(rv); parent->Append(g); SetParent(view, this); } void GraphicViews::InsertBefore (Iterator i, GraphicView* view) { Graphic* g = view->GetGraphic(); Graphic* parent = GetGraphic(); UList* r = Elem(i); UList* rv = new UList(view); r->Append(rv); if (r == _views->End()) { parent->Append(g); } else { Iterator j; parent->SetGraphic(this->View(r)->GetGraphic(), j); parent->InsertBefore(j, g); } SetParent(view, this); } void GraphicViews::Remove (Iterator& i) { UList* doomed = Elem(i); GraphicView* view = GetView(i); Graphic* g = view->GetGraphic(); Graphic* parent = GetGraphic(); Next(i); view->EraseHandles(); _views->Remove(doomed); parent->Remove(g); SetParent(view, nil); delete doomed; } void GraphicViews::DeleteView (Iterator& i) { UList* doomed = Elem(i); GraphicView* view = GetView(i); Graphic* g = view->GetGraphic(); Graphic* parent = GetGraphic(); Next(i); IncurDamage(g); view->EraseHandles(); _views->Remove(doomed); parent->Remove(g); delete doomed; delete view; } inline bool ConnectorIntersects ( Coord l, Coord b, Coord r, Coord t, ConnectorView* cv ) { BoxObj box(l, b, r, t); return cv->GetGraphic()->Intersects(box); } ConnectorView* GraphicViews::ConnectorIntersecting ( Coord l, Coord b, Coord r, Coord t ) { UList* rv; Iterator i; GraphicView* gv, *subgv; ConnectorView* cv; for (rv = _views->Last(); rv != _views->End(); rv = rv->Prev()) { gv = this->View(rv); if (gv->IsA(CONNECTOR_VIEW)) { cv = (ConnectorView*) gv; if (ConnectorIntersects(l, b, r, t, cv)) { return cv; } } for (gv->Last(i); !gv->Done(i); gv->Prev(i)) { subgv = gv->GetView(i); if (subgv->IsA(CONNECTOR_VIEW)) { cv = (ConnectorView*) subgv; if (ConnectorIntersects(l, b, r, t, cv)) { return cv; } } } } return nil; } neuron-7.6.3/src/lib/Unidraw/gvupdater.cpp000066400000000000000000000205301340731477100205170ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * GVUpdater implementation. */ #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ static const int SLOTS = 1000; /*****************************************************************************/ class GVU_HashElem : public UHashElem { public: GVU_HashElem(); bool Undefined(); void Init(Iterator iview, int); public: Iterator _iview; int _n; }; GVU_HashElem::GVU_HashElem () { _iview.SetValue(nil); _n = 0; } bool GVU_HashElem::Undefined () { return _iview.GetValue() == nil; } void GVU_HashElem::Init (Iterator iview, int n) { _iview = iview; _n = n; } /*****************************************************************************/ class GVU_HashTable : public UHashTable { public: GVU_HashTable(); GVU_HashElem* Find(GraphicComp*); }; GVU_HashTable::GVU_HashTable () : UHashTable(SLOTS) { } GVU_HashElem* GVU_HashTable::Find (GraphicComp* gc) { return (GVU_HashElem*) UHashTable::Find(gc); } /*****************************************************************************/ GVUpdater::GVUpdater (GraphicView* gv) { _gv = gv; } void GVUpdater::Update () { UpdateStructure(); UpdateState(); } static bool Different (Graphic* g1, Graphic* g2) { bool different = true; if ( g1->GetFgColor() == g2->GetFgColor() && g1->GetBgColor() == g2->GetBgColor() && g1->BgFilled() == g2->BgFilled() && g1->GetPattern() == g2->GetPattern() && g1->GetBrush() == g2->GetBrush() && g1->GetFont() == g2->GetFont() ) { Transformer identity; Transformer* t1 = g1->GetTransformer(); Transformer* t2 = g2->GetTransformer(); if (t1 == t2) { different = false; } else if (t1 == nil) { different = *t2 != identity; } else if (t2 == nil) { different = *t1 != identity; } else { different = *t1 != *t2; } } return different; } void GVUpdater::UpdateState () { Graphic* g1 = _gv->GetGraphic(); Graphic* g2 = _gv->GetGraphicComp()->GetGraphic(); if (Different(g1, g2)) { IncurDamage(g1); *g1 = *g2; IncurDamage(g1); } } void GVUpdater::UpdateStructure () { GVU_HashTable table; RegisterSubjects(&table); InitViews(&table); RearrangeViews(&table); DamageViews(&table); } ClassId GVUpdater::ViewCategory () { return COMPONENT_VIEW; } void GVUpdater::AddDamage (Graphic* g) { _gv->AddDamage(g); } void GVUpdater::IncurDamage (Graphic* g) { _gv->IncurDamage(g); } void GVUpdater::Unselect (GraphicView* view) { _gv->Unselect(view); } void GVUpdater::Append (GraphicView* view) { _gv->Append(view); } void GVUpdater::Remove (Iterator& i) { _gv->Remove(i); } void GVUpdater::DeleteView (Iterator& i) { _gv->DeleteView(i); } void GVUpdater::InsertBefore (Iterator i, GraphicView* view) { _gv->InsertBefore(i, view); } void GVUpdater::RegisterSubjects (GVU_HashTable* table) { GraphicComp* gc = _gv->GetGraphicComp(); Iterator i; for (gc->First(i); !gc->Done(i); gc->Next(i)) { GraphicComp* subj = gc->GetComp(i); table->Register(subj, new GVU_HashElem); } } static bool IsAGroup (GraphicView* view, GraphicComp* newParent) { bool result = false; Iterator i; view->First(i); if (!view->Done(i)) { GraphicView* kidview = view->GetView(i); GraphicComp* kidsubj = kidview->GetGraphicComp(); result = (kidsubj != nil) && (kidsubj->GetParent() == newParent); } return result; } void GVUpdater::InitViews (GVU_HashTable* table) { GraphicComp* gc = _gv->GetGraphicComp(); int count = 0; Iterator i; for (_gv->First(i); !_gv->Done(i);) { // ungroup subjectless view GraphicView* view = _gv->GetView(i); // delete unknown views and GraphicComp* subj = view->GetGraphicComp(); // register all others GVU_HashElem* info = table->Find(subj); if (info == nil) { Unselect(view); if (IsAGroup(view, gc)) { Iterator j, k = i; view->First(j); _gv->Next(k); while (!view->Done(j)) { GraphicView* subview = view->GetView(j); view->Remove(j); subview->Update(); InsertBefore(k, subview); } Remove(i); delete view; } else { DeleteView(i); } } else { info->Init(i, ++count); _gv->Next(i); } } for (gc->First(i); !gc->Done(i); gc->Next(i)) { // create missing views GraphicComp* subj = gc->GetComp(i); GVU_HashElem* info = table->Find(subj); if (info->Undefined()) { GraphicView* view = (GraphicView*) subj->Create(ViewCategory()); subj->Attach(view); Append(view); view->Update(); IncurDamage(view->GetGraphic()); Iterator j; _gv->Last(j); info->Init(j, ++count); } } } void GVUpdater::RearrangeViews (GVU_HashTable* table) { GraphicComp* gc = _gv->GetGraphicComp(); Iterator i, j, k; for (gc->First(i), _gv->First(j); !gc->Done(i); gc->Next(i)) { GraphicComp* comp = gc->GetComp(i); GraphicView* view = _gv->GetView(j); if (comp != view->GetGraphicComp()) { GVU_HashElem* info = table->Find(comp); view = _gv->GetView(info->_iview); Remove(info->_iview); InsertBefore(j, view); k = j; _gv->Prev(k); info->_iview = k; } else { _gv->Next(j); } } } void GVUpdater::DamageViews (GVU_HashTable* table) { GraphicComp* gc = _gv->GetGraphicComp(); UList fdamage, bdamage; Iterator f, b; int fcount = 0, bcount = 0; int fcur = 0, bcur; GVU_HashElem* info; gc->First(f); gc->Last(b); if (!gc->Done(b)) { info = table->Find(gc->GetComp(b)); bcur = info->_n; } for (gc->First(f); !gc->Done(f); gc->Next(f), gc->Prev(b)) { GraphicComp* fcomp = gc->GetComp(f); GraphicComp* bcomp = gc->GetComp(b); GVU_HashElem* finfo = table->Find(fcomp); GVU_HashElem* binfo = table->Find(bcomp); if (finfo->_n < fcur) { fdamage.Append(new UList(finfo)); ++fcount; } else { fcur = finfo->_n; } if (binfo->_n > bcur) { bdamage.Append(new UList(binfo)); ++bcount; } else { bcur = binfo->_n; } } UList* damage = (fcount < bcount) ? &fdamage : &bdamage; for (UList* u = damage->First(); u != damage->End(); u = u->Next()) { info = (GVU_HashElem*) (*u)(); GraphicView* view = _gv->GetView(info->_iview); IncurDamage(view->GetGraphic()); } } neuron-7.6.3/src/lib/Unidraw/import.cpp000066400000000000000000000277741340731477100200510ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * ImportCmd implementation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* avoid 'ignoring return value' warnings */ #undef Fgets #define Fgets(a,b,c) fgets(a,b,c)!=0 /*****************************************************************************/ static int hexmap[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /*****************************************************************************/ static FILE* CheckCompression( FILE* file, const char *filename, bool& compressed ) { char cmd[256]; if (!file || !fgets (cmd, 4, file)) { compressed = false; } else if (*((unsigned short *)cmd) == COMPRESS_MAGIC_NUM) { fclose (file); sprintf (cmd, "uncompress < %s", filename); file = popen (cmd, "r"); if (!file) { return NULL; } compressed = true; } else { rewind (file); compressed = false; } return file; } static const char* ReadCreator (const char* filename) { char* buf = nil; FILE* file = fopen(filename, "r"); if (file != nil) { bool compressed; static char creator[CHARBUFSIZE]; char line[CHARBUFSIZE]; file = CheckCompression(file, filename, compressed); if (!file) { return NULL; } if (fgets(line, CHARBUFSIZE, file) != NULL) { /* Two-byte magic numbers */ switch(*((unsigned short *)line)) { case TIFF1_MAGIC_NUM: case TIFF2_MAGIC_NUM: return ("TIFF"); case SUN_MAGIC_NUM: return ("SUN"); } /* One-byte Magic numbers */ switch (line[0]) { case BM_MAGIC_NUM: return ("BM"); case PBM_MAGIC_NUM: return ("PBM"); case ATK_MAGIC_NUM: return ("ATK"); case MP_MAGIC_NUM: return ("MP"); case X11_MAGIC_NUM: return ("X11"); case PCX_MAGIC_NUM: return ("PCX"); case IFF_MAGIC_NUM: return ("IFF"); case GIF_MAGIC_NUM: return ("GIF"); case RLE_MAGIC_NUM: return ("RLE"); } } else { return NULL; } do { if (sscanf(line, "%%%%Creator: %s", creator)) { buf = creator; break; } else if (strcmp(line, "%%EndComments\n") == 0) { break; } } while (fgets(line, CHARBUFSIZE, file) != NULL); if (compressed) { pclose(file); } else { fclose(file); } } return buf; } static int gethex (FILE* file) { int c; while ((c = getc(file)) == ' ' || c == '\n') { } return (hexmap[c] << 4) + hexmap[getc(file)]; } /*****************************************************************************/ ClassId ImportCmd::GetClassId () { return IMPORT_CMD; } bool ImportCmd::IsA (ClassId id) { return IMPORT_CMD == id || Command::IsA(id); } ImportCmd::ImportCmd (ControlInfo* c, FileChooser* f) : Command(c) { Init(f); } ImportCmd::ImportCmd (Editor* ed, FileChooser* f) : Command(ed) { Init(f); } ImportCmd::~ImportCmd () { Resource::unref(chooser_); } void ImportCmd::Init (FileChooser* f) { chooser_ = f; Resource::ref(chooser_); } Command* ImportCmd::Copy () { ImportCmd* copy = new ImportCmd(CopyControlInfo()); InitCopy(copy); return copy; } void ImportCmd::Execute () { GraphicComp* comp = PostDialog(); if (comp != nil) { PasteCmd* paste_cmd = new PasteCmd(GetEditor(), new Clipboard(comp)); paste_cmd->Execute(); paste_cmd->Log(); GetEditor()->GetViewer()->Align(comp, /* Center */ 4); } } bool ImportCmd::Reversible () { return false; } GraphicComp* ImportCmd::PostDialog () { bool imported = false; GraphicComp* comp = nil; Editor* ed = GetEditor(); Style* style; bool reset_caption = false; if (chooser_ == nil) { style = new Style(Session::instance()->style()); style->attribute("subcaption", "Import graphic from file:"); style->attribute("open", "Import"); chooser_ = DialogKit::instance()->file_chooser(".", style); Resource::ref(chooser_); } else { style = chooser_->style(); } while (chooser_->post_for(ed->GetWindow())) { const String* str = chooser_->selected(); if (str != nil) { NullTerminatedString ns(*str); comp = Import(ns.string()); if (comp != nil) { break; } style->attribute("caption", "Import failed!"); reset_caption = true; } } if (reset_caption) { style->attribute("caption", ""); } return comp; } GraphicComp* ImportCmd::Import (const char* filename) { GraphicComp* comp = nil; const char* creator = ReadCreator(filename); if (creator == nil || strcmp(creator, "idraw") == 0) { Catalog* catalog = unidraw->GetCatalog(); if (catalog->Valid(filename, (Component*&) comp)) { comp = (GraphicComp*) comp->Copy(); } else if (catalog->Retrieve(filename, (Component*&) comp)) { catalog->Forget(comp); } } else { if (strcmp(creator, "X11") == 0) { comp = XBitmap_Image(filename); } else if (strcmp(creator, "TIFF") == 0) { comp = TIFF_Image(filename); } else if ( strcmp(creator, "pgmtops") == 0 || strcmp(creator, "pnmtops") == 0 ) { comp = PGM_Image(filename); } else if (strcmp(creator, "ppmtops") == 0) { comp = PPM_Image(filename); } } return comp; } GraphicComp* ImportCmd::TIFF_Image (const char* filename) { GraphicComp* comp = nil; Raster* raster = TIFFRaster::load(filename); if (raster != nil) { raster->ref(); raster->flush(); comp = new RasterComp(new RasterRect(raster), filename); } return comp; } GraphicComp* ImportCmd::PGM_Image (const char* filename) { GraphicComp* comp = nil; FILE* file = fopen(filename, "r"); if (file != nil) { char line[1000]; do { Fgets(line, 1000, file); } while (strcmp(line, "gsave\n") != 0); Fgets(line, 1000, file); // translate Fgets(line, 1000, file); // scale Fgets(line, 1000, file); // sizes int w, h, d; sscanf(line, "%d %d %d", &w, &h, &d); Fgets(line, 1000, file); // [ ... ] Fgets(line, 1000, file); // { ... } Fgets(line, 1000, file); // image if (d == 1) { Bitmap* bm = new Bitmap((void*)nil, w, h); for (int row = h - 1; row >= 0; --row) { for (int column = 0; column < w; column += 8) { int byte = gethex(file); int bit = 0x80; int limit = column + 8; for (int pos = column; pos < limit; ++pos, bit >>= 1) { bool value = !(byte & bit); bm->poke(value, pos, row); } } } bm->flush(); comp = new StencilComp(new UStencil(bm, bm, stdgraphic)); } else { Raster* raster = new Raster(w, h); for (int row = h - 1; row >= 0; --row) { for (int column = 0; column < w; ++column) { int byte = gethex(file); float g = float(byte) / 0xff; raster->poke(column, row, g, g, g, 1.0); } } raster->flush(); comp = new RasterComp(new RasterRect(raster), filename); } } fclose(file); return comp; } GraphicComp* ImportCmd::PPM_Image (const char* filename) { GraphicComp* comp = nil; FILE* file = fopen(filename, "r"); bool compressed; file = CheckCompression(file, filename, compressed); if (file != nil) { char line[1000]; do { Fgets(line, 1000, file); } while (strcmp(line, "gsave\n") != 0); Fgets(line, 1000, file); // translate Fgets(line, 1000, file); // scale Fgets(line, 1000, file); // scale Fgets(line, 1000, file); // sizes int w, h, d; sscanf(line, "%d %d %d", &w, &h, &d); Fgets(line, 1000, file); // [ ... ] Fgets(line, 1000, file); // { ... } Fgets(line, 1000, file); // false 3 Fgets(line, 1000, file); // colorimage if (d == 1) { Bitmap* bm = new Bitmap((void*)nil, w, h); for (int row = h - 1; row >= 0; --row) { for (int column = 0; column < w; column += 8) { int byte = gethex(file); int bit = 0x80; int limit = column + 8; for (int pos = column; pos < limit; ++pos, bit >>= 1) { bool value = !(byte & bit); bm->poke(value, pos, row); } } } bm->flush(); comp = new StencilComp(new UStencil(bm, bm, stdgraphic)); } else { Raster* raster = new Raster(w, h); for (int row = h - 1; row >= 0; --row) { for (int column = 0; column < w; ++column) { int red = gethex(file); int green = gethex(file); int blue = gethex(file); raster->poke( column, row, float(red)/0xff, float(green)/0xff, float(blue)/0xff, 1.0 ); } } raster->flush(); comp = new RasterComp(new RasterRect(raster), filename); } } if (compressed) { pclose(file); } else { fclose(file); } return comp; } GraphicComp* ImportCmd::XBitmap_Image (const char* filename) { GraphicComp* comp = nil; FILE* file = fopen(filename, "r"); if (file != nil) { Bitmap* bm = Bitmap::open(filename); if (bm != nil) { comp = new StencilComp( new UStencil(bm, bm, stdgraphic), filename ); } } fclose(file); return comp; } neuron-7.6.3/src/lib/Unidraw/iterator.cpp000077500000000000000000000030251340731477100203520ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Iterator implementation. */ #include Iterator::Iterator () { _value = nil; } Iterator::Iterator (Iterator& i) { _value = i._value; } Iterator& Iterator::operator =(Iterator& i) { _value = i._value; return *this; } void* Iterator::GetValue () { return _value; } void Iterator::SetValue (void* v) { _value = v; } neuron-7.6.3/src/lib/Unidraw/keymap.cpp000077500000000000000000000062201340731477100200070ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Keymap implementation. */ #include #include #include #include /*****************************************************************************/ KeyMap::KeyMap () { Init(); } KeyMap::KeyMap (UControl* c) { Init(); _ctrl = c; } KeyMap::KeyMap (KeyMap* k) { Init(); _submap = k; } KeyMap::~KeyMap () { if (_next != nil) { delete _next; } } void KeyMap::Init () { _next = nil; _submap = nil; _ctrl = nil; } void KeyMap::Register (UControl* c) { KeyMap* newMap = new KeyMap(c); newMap->_next = _next; _next = newMap; } void KeyMap::Register (KeyMap* k) { KeyMap* newMap = new KeyMap(k); newMap->_next = _next; _next = newMap; } void KeyMap::Unregister (UControl* c) { KeyMap* cur = this; KeyMap* prev = nil; while (cur != nil) { if (cur->_ctrl == c) { if (prev != nil) { prev->_next = cur->_next; } cur->_next = nil; delete cur; return; } else { prev = cur; cur = cur->_next; } } } void KeyMap::Unregister (KeyMap* k) { KeyMap* cur = this; KeyMap* prev = nil; while (cur != nil) { if (cur->_submap == k) { if (prev != nil) { prev->_next = cur->_next; } cur->_next = nil; delete cur; return; } else { prev = cur; cur = cur->_next; } } } void KeyMap::Execute (const char* keyCode) { if (*keyCode != '\0') { KeyMap* cur = this; while (cur != nil) { KeyMap* testk = cur->_submap; UControl* testc = cur->_ctrl; if (testk != nil) { testk->Execute(keyCode); } else if (testc != nil) { const char* target = testc->GetControlInfo()->GetKeyCode(); if (strcmp(target, keyCode) == 0) { testc->Do(); return; } } cur = cur->_next; } } } neuron-7.6.3/src/lib/Unidraw/kybd.cpp000077500000000000000000000123301340731477100174510ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Keycode values. */ #include /* * components */ const char* KLBL_LINE = "l", *CODE_LINE = "l"; const char* KLBL_ELLIPSE = "o", *CODE_ELLIPSE = "o"; const char* KLBL_RECT = "r", *CODE_RECT = "r"; const char* KLBL_POLY = "w", *CODE_POLY = "w"; const char* KLBL_MULTILINE = "e", *CODE_MULTILINE = "e"; const char* KLBL_SPLINE = "h", *CODE_SPLINE = "h"; const char* KLBL_CSPLINE = "y", *CODE_CSPLINE = "y"; const char* KLBL_TEXT = "t", *CODE_TEXT = "t"; const char* KLBL_PIN = "^P", *CODE_PIN = ""; const char* KLBL_SLOT = "^-", *CODE_SLOT = ""; const char* KLBL_PAD = "^W", *CODE_PAD = ""; const char* KLBL_LINK = "L", *CODE_LINK = "L"; /* * commands */ const char* KLBL_NEWCOMP = "^N", *CODE_NEWCOMP = "\016"; const char* KLBL_REVERT = "^R", *CODE_REVERT = "\022"; const char* KLBL_VIEWCOMP = "^O", *CODE_VIEWCOMP = "\017"; const char* KLBL_SAVECOMP = "^S", *CODE_SAVECOMP = "\023"; const char* KLBL_SAVECOMPAS = "^A", *CODE_SAVECOMPAS = "\001"; const char* KLBL_PRINT = "P", *CODE_PRINT = "P"; const char* KLBL_IMPORT = "^I", *CODE_IMPORT = "\011"; const char* KLBL_QUIT = "^Q", *CODE_QUIT = "\021"; const char* KLBL_UNDO = "U", *CODE_UNDO = "U"; const char* KLBL_REDO = "R", *CODE_REDO = "R"; const char* KLBL_CUT = "x", *CODE_CUT = "x"; const char* KLBL_COPY = "c", *CODE_COPY = "c"; const char* KLBL_PASTE = "v", *CODE_PASTE = "v"; const char* KLBL_DUP = "d", *CODE_DUP = "d"; const char* KLBL_DEL = "^D", *CODE_DEL = "\4"; const char* KLBL_SLCTALL = "a", *CODE_SLCTALL = "a"; const char* KLBL_HFLIP = "_", *CODE_HFLIP = "_"; const char* KLBL_VFLIP = "|", *CODE_VFLIP = "|"; const char* KLBL_CW90 = "]", *CODE_CW90 = "]"; const char* KLBL_CCW90 = "[", *CODE_CCW90 = "["; const char* KLBL_GROUP = "g", *CODE_GROUP = "g"; const char* KLBL_UNGROUP = "u", *CODE_UNGROUP = "u"; const char* KLBL_FRONT = "f", *CODE_FRONT = "f"; const char* KLBL_BACK = "b", *CODE_BACK = "b"; const char* KLBL_INSTANCE = "I", *CODE_INSTANCE = "I"; const char* KLBL_ALGNLEFT = "1", *CODE_ALGNLEFT = "1"; const char* KLBL_ALGNRIGHT = "2", *CODE_ALGNRIGHT = "2"; const char* KLBL_ALGNBOT = "3", *CODE_ALGNBOT = "3"; const char* KLBL_ALGNTOP = "4", *CODE_ALGNTOP = "4"; const char* KLBL_ALGNVCTR = "5", *CODE_ALGNVCTR = "5"; const char* KLBL_ALGNHCTR = "6", *CODE_ALGNHCTR = "6"; const char* KLBL_ALGNCTR = "7", *CODE_ALGNCTR = "7"; const char* KLBL_ABUTLEFT = "8", *CODE_ABUTLEFT = "8"; const char* KLBL_ABUTRIGHT = "9", *CODE_ABUTRIGHT = "9"; const char* KLBL_ABUTDOWN = "0", *CODE_ABUTDOWN = "0"; const char* KLBL_ABUTUP = "-", *CODE_ABUTUP = "-"; const char* KLBL_ALGNTOGRID = ".", *CODE_ALGNTOGRID = "."; const char* KLBL_NORMSIZE = "n", *CODE_NORMSIZE = "n"; const char* KLBL_REDTOFIT = "=", *CODE_REDTOFIT = "="; const char* KLBL_CENTER = "/", *CODE_CENTER = "/"; const char* KLBL_GRID = "?", *CODE_GRID = "?"; const char* KLBL_GRIDSPC = "S", *CODE_GRIDSPC = "S"; const char* KLBL_GRAVITY = ",", *CODE_GRAVITY = ","; const char* KLBL_ORIENTATION = "+", *CODE_ORIENTATION = "+"; const char* KLBL_CLOSEEDITOR = "K", *CODE_CLOSEEDITOR = "K"; /* * tools */ const char* KLBL_SELECT = "s", *CODE_SELECT = "s"; const char* KLBL_MOVE = "m", *CODE_MOVE = "m"; const char* KLBL_CONNECT = "C", *CODE_CONNECT = "C"; const char* KLBL_DETACH = "D", *CODE_DETACH = "D"; const char* KLBL_SCALE = "j", *CODE_SCALE = "j"; const char* KLBL_STRETCH = ";", *CODE_STRETCH = ";"; const char* KLBL_ROTATE = "k", *CODE_ROTATE = "k"; const char* KLBL_RESHAPE = "q", *CODE_RESHAPE = "q"; const char* KLBL_MAGNIFY = "z", *CODE_MAGNIFY = "z"; neuron-7.6.3/src/lib/Unidraw/line.cpp000066400000000000000000000363741340731477100174620ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Line and MultiLine component definitions. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ ClassId LineComp::GetClassId () { return LINE_COMP; } bool LineComp::IsA (ClassId id) { return LINE_COMP == id || GraphicComp::IsA(id); } Component* LineComp::Copy () { return new LineComp((Line*) GetGraphic()->Copy()); } LineComp::LineComp (Line* graphic) : GraphicComp(graphic) { } Line* LineComp::GetLine () { return (Line*) GetGraphic(); } void LineComp::Interpret (Command* cmd) { if (!cmd->IsA(PATTERN_CMD)) { GraphicComp::Interpret(cmd); } } void LineComp::Read (istream& in) { GraphicComp::Read(in); Coord x0, y0, x1, y1; in >> x0 >> y0 >> x1 >> y1; Line* line = new Line(x0, y0, x1, y1); line->FillBg(ReadBgFilled(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); line->SetColors(fg, bg); line->SetBrush(ReadBrush(in)); Transformer* t = ReadTransformer(in); line->SetTransformer(t); Unref(t); SetGraphic(line); } void LineComp::Write (ostream& out) { GraphicComp::Write(out); Line* line = GetLine(); Coord x0, y0, x1, y1; line->GetOriginal(x0, y0, x1, y1); out << x0 << " " << y0 << " " << x1 << " " << y1 << " "; WriteBgFilled(line->BgFilled(), out); WriteColor(line->GetFgColor(), out); WriteColor(line->GetBgColor(), out); WriteBrush(line->GetBrush(), out); WriteTransformer(line->GetTransformer(), out); } /****************************************************************************/ LineComp* LineView::GetLineComp () { return (LineComp*) GetSubject(); } ClassId LineView::GetClassId () { return LINE_VIEW; } bool LineView::IsA (ClassId id) { return LINE_VIEW == id || GraphicView::IsA(id); } LineView::LineView (LineComp* subj) : GraphicView(subj) { } void LineView::Interpret (Command* cmd) { if (cmd->IsA(ALIGNTOGRID_CMD)) { Line* line = (Line*) GetGraphic(); Transformer total; line->TotalTransformation(total); Coord x0, y0, x1, y1; float tx0, ty0; line->GetOriginal(x0, y0, x1, y1); total.Transform(float(x0), float(y0), tx0, ty0); ((AlignToGridCmd*) cmd)->Align(this, tx0, ty0); } else { GraphicView::Interpret(cmd); } } void LineView::Update () { Graphic* line = GetGraphic(); IncurDamage(line); *line = *GetLineComp()->GetGraphic(); IncurDamage(line); EraseHandles(); } void LineView::CreateHandles () { Coord x[2], y[2]; Viewer* v = GetViewer(); if (v != nil) { GetEndpoints(x[0], y[0], x[1], y[1]); _handles = new RubberHandles(nil, nil, x, y, 2, 0, HANDLE_SIZE); v->InitRubberband(_handles); } } Manipulator* LineView::CreateManipulator ( Viewer* v, Event& e, Transformer* rel, Tool* tool ) { Coord x0, y0, x1, y1; Rubberband* rub = nil; Manipulator* m = nil; if (tool->IsA(GRAPHIC_COMP_TOOL)) { v->Constrain(e.x, e.y); rub = new RubberLine(nil, nil, e.x, e.y, e.x, e.y); m = new DragManip( v, rub, rel, tool, DragConstraint(HorizOrVert | Gravity) ); } else if (tool->IsA(MOVE_TOOL)) { v->Constrain(e.x, e.y); GetEndpoints(x0, y0, x1, y1); rub = new SlidingLine(nil, nil, x0, y0, x1, y1, e.x, e.y); m = new DragManip( v, rub, rel, tool, DragConstraint(HorizOrVert | Gravity) ); } else if (tool->IsA(SCALE_TOOL)) { v->Constrain(e.x, e.y); GetEndpoints(x0, y0, x1, y1); rub = new ScalingLine(nil, nil, x0, y0, x1, y1, (x0+x1)/2, (y0+y1)/2); m = new DragManip(v, rub, rel, tool, Gravity); } else if (tool->IsA(ROTATE_TOOL)) { v->Constrain(e.x, e.y); GetEndpoints(x0, y0, x1, y1); rub = new RotatingLine( nil, nil, x0, y0, x1, y1, (x0+x1)/2, (y0+y1)/2, e.x, e.y ); m = new DragManip(v, rub, rel, tool, Gravity); } else if (tool->IsA(RESHAPE_TOOL)) { v->Constrain(e.x, e.y); GetEndpoints(x0, y0, x1, y1); PointObj p1(x0, y0), p2(x1, y1), cp(e.x, e.y); if (p1.Distance(cp) < p2.Distance(cp)) { rub = new RubberLine(nil, nil, x1, y1, e.x, e.y); } else { rub = new RubberLine(nil, nil, x0, y0, e.x, e.y); } m = new DragManip( v, rub, rel, tool, DragConstraint(HorizOrVert | Gravity) ); } else { m = GraphicView::CreateManipulator(v, e, rel, tool); } return m; } Command* LineView::InterpretManipulator (Manipulator* m) { DragManip* dm = (DragManip*) m; Editor* ed = dm->GetViewer()->GetEditor(); Tool* tool = dm->GetTool(); Transformer* rel = dm->GetTransformer(); Command* cmd = nil; if (tool->IsA(GRAPHIC_COMP_TOOL)) { RubberLine* rl = (RubberLine*) dm->GetRubberband(); Coord x0, y0, x1, y1; rl->GetCurrent(x0, y0, x1, y1); if (x0 != x1 || y0 != y1) { BrushVar* brVar = (BrushVar*) ed->GetState("BrushVar"); ColorVar* colVar = (ColorVar*) ed->GetState("ColorVar"); if (rel != nil) { rel = new Transformer(rel); rel->Invert(); } Graphic* pg = GetGraphicComp()->GetGraphic(); Line* line = new Line(x0, y0, x1, y1, pg); if (brVar != nil) line->SetBrush(brVar->GetBrush()); if (colVar != nil) { line->SetColors(colVar->GetFgColor(), colVar->GetBgColor()); } line->SetTransformer(rel); Unref(rel); cmd = new PasteCmd(ed, new Clipboard(new LineComp(line))); } } else if (tool->IsA(MOVE_TOOL)) { Coord x0, y0, x1, y1, dummy1, dummy2; float fx0, fy0, fx1, fy1; SlidingLine* sl = (SlidingLine*) dm->GetRubberband(); sl->GetOriginal(x0, y0, dummy1, dummy2); sl->GetCurrent(x1, y1, dummy1, dummy2); if (rel != nil) { rel->InvTransform(float(x0), float(y0), fx0, fy0); rel->InvTransform(float(x1), float(y1), fx1, fy1); } cmd = new MoveCmd(ed, fx1 - fx0, fy1 - fy0); } else if (tool->IsA(SCALE_TOOL)) { ScalingLine* sl = (ScalingLine*) dm->GetRubberband(); float sxy = sl->CurrentScaling(); cmd = new ScaleCmd(ed, sxy, sxy); } else if (tool->IsA(ROTATE_TOOL)) { RotatingLine* rl = (RotatingLine*) dm->GetRubberband(); float angle = rl->CurrentAngle() - rl->OriginalAngle(); cmd = new RotateCmd(ed, angle); } else if (tool->IsA(RESHAPE_TOOL)) { RubberLine* rl = (RubberLine*) dm->GetRubberband(); Coord x0, y0, x1, y1; rl->GetCurrent(x0, y0, x1, y1); if (rel != nil) { rel = new Transformer(rel); rel->Invert(); } Line* line = new Line(x0, y0, x1, y1, GetGraphic()); line->SetTransformer(rel); Unref(rel); cmd = new ReplaceCmd(ed, new LineComp(line)); } else { cmd = GraphicView::InterpretManipulator(m); } return cmd; } void LineView::GetEndpoints (Coord& x0, Coord& y0, Coord& x1, Coord& y1) { Line* line = (Line*) GetGraphic(); Transformer t; line->GetOriginal(x0, y0, x1, y1); line->TotalTransformation(t); t.Transform(x0, y0); t.Transform(x1, y1); } Graphic* LineView::GetGraphic () { Graphic* graphic = GraphicView::GetGraphic(); if (graphic == nil) { LineComp* lineComp = GetLineComp(); graphic = lineComp->GetGraphic()->Copy(); SetGraphic(graphic); } return graphic; } /****************************************************************************/ ClassId PSLine::GetClassId () { return PS_LINE; } bool PSLine::IsA (ClassId id) { return PS_LINE == id || PostScriptView::IsA(id); } PSLine::PSLine (LineComp* subj) : PostScriptView(subj) { } bool PSLine::Definition (ostream& out) { Coord x0, y0, x1, y1; LineComp* comp = (LineComp*) GetSubject(); comp->GetLine()->GetOriginal(x0, y0, x1, y1); out << "Begin " << MARK << " Line\n"; MinGS(out); out << MARK << "\n"; out << x0 << " " << y0 << " " << x1 << " " << y1 << " Line\n"; out << "End\n\n"; return out.good(); } /****************************************************************************/ ClassId MultiLineComp::GetClassId () { return MULTILINE_COMP; } bool MultiLineComp::IsA (ClassId id) { return MULTILINE_COMP == id || VerticesComp::IsA(id); } Component* MultiLineComp::Copy () { return new MultiLineComp((SF_MultiLine*) GetGraphic()->Copy()); } MultiLineComp::MultiLineComp (SF_MultiLine* graphic) : VerticesComp(graphic) {} SF_MultiLine* MultiLineComp::GetMultiLine () { return (SF_MultiLine*) GetGraphic(); } void MultiLineComp::Read (istream& in) { VerticesComp::Read(in); Coord* x, *y; int count; ReadVertices(in, x, y, count); SF_MultiLine* ml = new SF_MultiLine(x, y, count); delete x; delete y; ml->FillBg(ReadBgFilled(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); ml->SetColors(fg, bg); ml->SetBrush(ReadBrush(in)); ml->SetPattern(ReadPattern(in)); Transformer* t = ReadTransformer(in); ml->SetTransformer(t); Unref(t); SetGraphic(ml); } void MultiLineComp::Write (ostream& out) { VerticesComp::Write(out); SF_MultiLine* ml = GetMultiLine(); const Coord* x, *y; int count = ml->GetOriginal(x, y); WriteVertices(x, y, count, out); WriteBgFilled(ml->BgFilled(), out); WriteColor(ml->GetFgColor(), out); WriteColor(ml->GetBgColor(), out); WriteBrush(ml->GetBrush(), out); WritePattern(ml->GetPattern(), out); WriteTransformer(ml->GetTransformer(), out); } /****************************************************************************/ MultiLineView::MultiLineView (MultiLineComp* subj) : VerticesView(subj) { } MultiLineComp* MultiLineView::GetMultiLineComp () { return (MultiLineComp*) GetSubject(); } ClassId MultiLineView::GetClassId () { return MULTILINE_VIEW; } bool MultiLineView::IsA (ClassId id) { return MULTILINE_VIEW == id || VerticesView::IsA(id); } bool MultiLineView::VertexChanged () { SF_MultiLine* gview = (SF_MultiLine*) GetGraphic(); SF_MultiLine* gsubj = (SF_MultiLine*) GetMultiLineComp()->GetGraphic(); return *gview != *gsubj; } Manipulator* MultiLineView::CreateManipulator ( Viewer* v, Event& e, Transformer* rel, Tool* tool ) { Manipulator* m = nil; if (tool->IsA(GRAPHIC_COMP_TOOL)) { v->Constrain(e.x, e.y); Coord x[1], y[1]; x[0] = e.x; y[0] = e.y; GrowingVertices* rub = new GrowingMultiLine( nil, nil, x, y, 1, -1, HANDLE_SIZE ); m = new VertexManip( v, rub, rel, tool, DragConstraint(HorizOrVert | Gravity) ); } else if (tool->IsA(RESHAPE_TOOL)) { Coord* x, *y; int n; v->Constrain(e.x, e.y); GetVertices(x, y, n); GrowingMultiLine* rub = new GrowingMultiLine( nil, nil, x, y, n, ClosestPoint(x, y, n, e.x, e.y), HANDLE_SIZE ); delete x; delete y; m = new VertexManip( v, rub, rel, tool, DragConstraint(HorizOrVert | Gravity) ); } else { m = VerticesView::CreateManipulator(v, e, rel, tool); } return m; } Command* MultiLineView::InterpretManipulator (Manipulator* m) { DragManip* dm = (DragManip*) m; Editor* ed = dm->GetViewer()->GetEditor(); Tool* tool = dm->GetTool(); Transformer* rel = dm->GetTransformer(); Command* cmd = nil; if (tool->IsA(GRAPHIC_COMP_TOOL)) { GrowingVertices* gv = (GrowingVertices*) dm->GetRubberband(); Coord* x, *y; int n, pt; gv->GetCurrent(x, y, n, pt); if (n > 2 || x[0] != x[1] || y[0] != y[1]) { BrushVar* brVar = (BrushVar*) ed->GetState("BrushVar"); PatternVar* patVar = (PatternVar*) ed->GetState("PatternVar"); ColorVar* colVar = (ColorVar*) ed->GetState("ColorVar"); if (rel != nil) { rel = new Transformer(rel); rel->Invert(); } Graphic* pg = GetGraphicComp()->GetGraphic(); SF_MultiLine* polygon = new SF_MultiLine(x, y, n, pg); if (brVar != nil) polygon->SetBrush(brVar->GetBrush()); if (patVar != nil) polygon->SetPattern(patVar->GetPattern()); if (colVar != nil) { polygon->SetColors(colVar->GetFgColor(), colVar->GetBgColor()); } polygon->SetTransformer(rel); Unref(rel); cmd = new PasteCmd(ed, new Clipboard(new MultiLineComp(polygon))); } delete x; delete y; } else if (tool->IsA(RESHAPE_TOOL)) { GrowingVertices* gv = (GrowingVertices*) dm->GetRubberband(); Coord* x, *y; int n, pt; gv->RemoveVertex(); gv->GetCurrent(x, y, n, pt); if (rel != nil) { rel = new Transformer(rel); rel->Invert(); } SF_MultiLine* polygon = new SF_MultiLine(x, y, n, GetGraphic()); delete x; delete y; polygon->SetTransformer(rel); Unref(rel); cmd = new ReplaceCmd(ed, new MultiLineComp(polygon)); } else { cmd = VerticesView::InterpretManipulator(m); } return cmd; } /*****************************************************************************/ ClassId PSMultiLine::GetClassId () { return PS_MULTILINE; } bool PSMultiLine::IsA (ClassId id) { return PS_MULTILINE == id || PSVertices::IsA(id); } PSMultiLine::PSMultiLine (MultiLineComp* subj) : PSVertices(subj) { } const char* PSMultiLine::Name () { return "MLine"; } neuron-7.6.3/src/lib/Unidraw/lines.cpp000066400000000000000000000206321340731477100176330ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of Points, Lines, and MultiLines, objects derived from * Graphic. */ #include #include #include #include #include /*****************************************************************************/ Point::Point (Coord x, Coord y, Graphic* gr) : Graphic(gr) { _br = nil; if (gr != nil) { Point::SetBrush(gr->GetBrush()); } _x = x; _y = y; } Point::~Point () { Unref(_br); } void Point::GetOriginal (Coord& x, Coord& y) { x = _x; y = _y; } void Point::SetBrush (PSBrush* br) { if (_br != br) { Ref(br); Unref(_br); _br = br; invalidateCaches(); } } PSBrush* Point::GetBrush () { return _br; } Graphic* Point::Copy () { return new Point(_x, _y, this); } void Point::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { float width; width = float(gs->GetBrush()->Width()); tol = (width > 1) ? width / 2 : 0; transform(float(_x), float(_y), cx, cy, gs); l = cx; b = cy; } bool Point::contains (PointObj& po, Graphic* gs) { PointObj pt (&po); invTransform(pt._x, pt._y, gs); return (pt._x == _x) && (pt._y == _y); } bool Point::intersects (BoxObj& b, Graphic* gs) { PointObj pt (_x, _y); transform(pt._x, pt._y, gs); return b.Contains(pt); } void Point::draw (Canvas* c, Graphic* gs) { if (!gs->GetBrush()->None()) { update(gs); _p->Point(c, _x, _y); } } /*****************************************************************************/ Line::Line ( Coord x0, Coord y0, Coord x1, Coord y1, Graphic* gr ) : Graphic(gr) { _br = nil; if (gr != nil) { Line::SetBrush(gr->GetBrush()); } _x0 = x0; _y0 = y0; _x1 = x1; _y1 = y1; } Line::~Line () { Unref(_br); } void Line::GetOriginal (Coord& x0, Coord& y0, Coord& x1, Coord& y1) { x0 = _x0; y0 = _y0; x1 = _x1; y1 = _y1; } void Line::SetBrush (PSBrush* br) { if (_br != br) { Ref(br); Unref(_br); _br = br; invalidateCaches(); } } PSBrush* Line::GetBrush () { return _br; } Graphic* Line::Copy () { return new Line(_x0, _y0, _x1, _y1, this); } void Line::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { float r, t, width; width = float(gs->GetBrush()->Width()); tol = (width > 1) ? width / 2 : 0; transform(float(_x0+_x1)/2, float(_y0+_y1)/2, cx, cy, gs); transform(float(_x0), float(_y0), l, b, gs); transform(float(_x1), float(_y1), r, t, gs); l = min(l, r); b = min(b, t); } bool Line::contains (PointObj& po, Graphic* gs) { LineObj l(_x0, _y0, _x1, _y1); PointObj pt (&po); invTransform(pt._x, pt._y, gs); return l.Contains(pt); } bool Line::intersects (BoxObj& b, Graphic* gs) { LineObj l (_x0, _y0, _x1, _y1); transform(l._p1._x, l._p1._y, gs); transform(l._p2._x, l._p2._y, gs); return b.Intersects(l); } void Line::draw (Canvas* c, Graphic* gs) { if (!gs->GetBrush()->None()) { update(gs); _p->Line(c, _x0, _y0, _x1, _y1); } } /*****************************************************************************/ MultiLine::MultiLine ( Coord* x, Coord* y, int count, Graphic* gr ) : Vertices(x, y, count, gr) { } bool MultiLine::s_contains (PointObj& po, Graphic* gs) { MultiLineObj ml (_x, _y, _count); PointObj pt (&po); BoxObj b; getBox(b, gs); if (b.Contains(po)) { invTransform(pt._x, pt._y, gs); return ml.Contains(pt); } return false; } bool MultiLine::f_contains (PointObj& po, Graphic* gs) { BoxObj b; PointObj pt (&po); getBox(b, gs); if (b.Contains(pt)) { FillPolygonObj fp (_x, _y, _count); invTransform(pt._x, pt._y, gs); return fp.Contains(pt); } return false; } bool MultiLine::s_intersects (BoxObj& userb, Graphic* gs) { Coord* convx, *convy; BoxObj b; bool result = false; getBox(b, gs); if (b.Intersects(userb)) { convx = new Coord[_count]; convy = new Coord[_count]; transformList(_x, _y, _count, convx, convy, gs); MultiLineObj ml (convx, convy, _count); result = ml.Intersects(userb); delete convx; delete convy; } return result; } bool MultiLine::f_intersects (BoxObj& userb, Graphic* gs) { Coord* convx, *convy; BoxObj b; bool result = false; getBox(b, gs); if (b.Intersects(userb)) { convx = new Coord[_count+1]; convy = new Coord[_count+1]; transformList(_x, _y, _count, convx, convy, gs); FillPolygonObj fp (convx, convy, _count); result = fp.Intersects(userb); delete convx; delete convy; } return result; } /*****************************************************************************/ S_MultiLine::S_MultiLine ( Coord* x, Coord* y, int count, Graphic* gr ) : MultiLine(x, y, count, gr) { _br = nil; if (gr != nil) { S_MultiLine::SetBrush(gr->GetBrush()); } } S_MultiLine::~S_MultiLine () { Unref(_br); } void S_MultiLine::SetBrush (PSBrush* br) { if (_br != br) { Ref(br); Unref(_br); _br = br; invalidateCaches(); } } PSBrush* S_MultiLine::GetBrush () { return _br; } Graphic* S_MultiLine::Copy () { return new S_MultiLine(_x, _y, _count, this); } void S_MultiLine::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { s_getExtent(l, b, cx, cy, tol, gs); } bool S_MultiLine::contains (PointObj& po, Graphic* gs) { return s_contains(po, gs); } bool S_MultiLine::intersects (BoxObj& userb, Graphic* gs) { return s_intersects(userb, gs); } void S_MultiLine::draw (Canvas *c, Graphic* gs) { if (!gs->GetBrush()->None()) { update(gs); _p->MultiLine(c, _x, _y, _count); } } /*****************************************************************************/ SF_MultiLine::SF_MultiLine ( Coord* x, Coord* y, int count, Graphic* gr ) : MultiLine(x, y, count, gr) { _br = nil; _pat = nil; if (gr != nil) { SF_MultiLine::SetBrush(gr->GetBrush()); SF_MultiLine::SetPattern(gr->GetPattern()); } } SF_MultiLine::~SF_MultiLine () { Unref(_br); Unref(_pat); } void SF_MultiLine::SetBrush (PSBrush* br) { if (_br != br) { Ref(br); Unref(_br); _br = br; invalidateCaches(); } } PSBrush* SF_MultiLine::GetBrush () { return _br; } void SF_MultiLine::SetPattern (PSPattern* pat) { Ref(pat); Unref(_pat); _pat = pat; } PSPattern* SF_MultiLine::GetPattern () { return _pat; } Graphic* SF_MultiLine::Copy () { return new SF_MultiLine(_x, _y,_count,this); } void SF_MultiLine::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { s_getExtent(l, b, cx, cy, tol, gs); } bool SF_MultiLine::contains (PointObj& po, Graphic* gs) { return (!gs->GetPattern()->None() && f_contains(po, gs)) || s_contains(po, gs); } bool SF_MultiLine::intersects (BoxObj& userb, Graphic* gs) { return (!gs->GetPattern()->None() && f_intersects(userb, gs)) || s_intersects(userb, gs); } void SF_MultiLine::draw (Canvas *c, Graphic* gs) { update(gs); if (!gs->GetPattern()->None()) { _p->FillPolygon(c, _x, _y, _count); } if (!gs->GetBrush()->None()) { _p->MultiLine(c, _x, _y, _count); } } neuron-7.6.3/src/lib/Unidraw/link.cpp000066400000000000000000000370101340731477100174540ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Link component definitions. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ ClassId LinkComp::GetClassId () { return LINK_COMP; } bool LinkComp::IsA (ClassId id) { return LINK_COMP == id || GraphicComp::IsA(id); } static void InitLine (Line* line, float x0, float y0, float x1, float y1) { Transformer* t = new Transformer(x1-x0, 0, 0, y1-y0, x0, y0); line->SetTransformer(t); Unref(t); } Component* LinkComp::Copy () { LinkComp* copy = new LinkComp((Line*) GetLine()->Copy()); *copy->GetGraphic() = *GetGraphic(); return copy; } LinkComp::LinkComp (Line* line) { if (line != nil) { Coord x0, y0, x1, y1; float fx0, fy0, fx1, fy1; line->GetOriginal(x0, y0, x1, y1); Transformer* t = line->GetTransformer(); Graphic* parent = new Picture(line); parent->SetTransformer(nil); if (t == nil) { fx0 = x0; fy0 = y0; fx1 = x1; fy1 = y1; } else { t->Transform(float(x0), float(y0), fx0, fy0); t->Transform(float(x1), float(y1), fx1, fy1); } delete line; line = new Line(0, 0, 1, 1); InitLine(line, fx0, fy0, fx1, fy1); PinGraphic* pg1 = new PinGraphic; PinGraphic* pg2 = new PinGraphic; pg1->SetBrush(psnonebr); pg2->SetBrush(psnonebr); pg1->Translate(fx0, fy0); pg2->Translate(fx1, fy1); _conn1 = new PinComp(pg1); _conn2 = new PinComp(pg2); parent->Append(line, pg1, pg2); SetGraphic(parent); } } void LinkComp::Interpret (Command* cmd) { if (cmd->IsA(DELETE_CMD) || cmd->IsA(CUT_CMD)) { _conn1->Interpret(cmd); _conn2->Interpret(cmd); } else { GraphicComp::Interpret(cmd); } } void LinkComp::Uninterpret (Command* cmd) { if (cmd->IsA(DELETE_CMD) || cmd->IsA(CUT_CMD)) { _conn2->Uninterpret(cmd); _conn1->Uninterpret(cmd); } else { GraphicComp::Uninterpret(cmd); } } void LinkComp::Read (istream& in) { GraphicComp::Read(in); Line* line = new Line(0, 0, 1, 1); Transformer* t = ReadTransformer(in); line->SetTransformer(t); Unref(t); _conn1 = (Connector*) unidraw->GetCatalog()->ReadComponent(in); _conn2 = (Connector*) unidraw->GetCatalog()->ReadComponent(in); Graphic* parent = new Picture; parent->FillBg(ReadBgFilled(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); parent->SetColors(fg, bg); parent->SetBrush(ReadBrush(in)); t = ReadTransformer(in); parent->SetTransformer(t); Unref(t); parent->Append(line, _conn1->GetGraphic(), _conn2->GetGraphic()); SetGraphic(parent); } void LinkComp::Write (ostream& out) { GraphicComp::Write(out); Line* line = GetLine(); WriteTransformer(line->GetTransformer(), out); unidraw->GetCatalog()->WriteComponent(_conn1, out); unidraw->GetCatalog()->WriteComponent(_conn2, out); Graphic* parent = line->Parent(); WriteBgFilled(parent->BgFilled(), out); WriteColor(parent->GetFgColor(), out); WriteColor(parent->GetBgColor(), out); WriteBrush(parent->GetBrush(), out); WriteTransformer(parent->GetTransformer(), out); } void LinkComp::First (Iterator& i) { i.SetValue(_conn1); } void LinkComp::Last (Iterator& i) { i.SetValue(_conn2); } bool LinkComp::Done (Iterator i) { return i.GetValue() == nil; } void LinkComp::Next (Iterator& i) { void* v = i.GetValue(); if (v == nil) { i.SetValue(_conn1); } else if (v == _conn1) { i.SetValue(_conn2); } else { i.SetValue(nil); } } void LinkComp::Prev (Iterator& i) { void* v = i.GetValue(); if (v == nil) { i.SetValue(_conn2); } else if (v == _conn1) { i.SetValue(nil); } else { i.SetValue(_conn1); } } GraphicComp* LinkComp::GetComp (Iterator i) { return (GraphicComp*) i.GetValue(); } void LinkComp::SetComp (GraphicComp* gc, Iterator& i) { i.SetValue(gc); } void LinkComp::Update () { float fx0, fy0, fx1, fy1; Transformer* t1 = _conn1->GetGraphic()->GetTransformer(); Transformer* t2 = _conn2->GetGraphic()->GetTransformer(); t1->Transform(0., 0., fx0, fy0); t2->Transform(0., 0., fx1, fy1); InitLine(GetLine(), fx0, fy0, fx1, fy1); Notify(); } Line* LinkComp::GetLine () { Iterator i; Graphic* gr = GetGraphic(); gr->First(i); return (Line*) gr->GetGraphic(i); } void LinkComp::SetMobility (Mobility m) { _conn1->SetMobility(m); _conn2->SetMobility(m); } void LinkComp::GetConnectors (Connector*& c1, Connector*& c2) { c1 = _conn1; c2 = _conn2; } LinkComp::~LinkComp () { Graphic* parent = GraphicComp::GetGraphic(); Graphic* g1 = _conn1->GetGraphic(); Graphic* g2 = _conn2->GetGraphic(); parent->Remove(g1); parent->Remove(g2); delete _conn1; delete _conn2; } /****************************************************************************/ LinkComp* LinkView::GetLinkComp () { return (LinkComp*) GetSubject(); } ClassId LinkView::GetClassId () { return LINK_VIEW; } bool LinkView::IsA (ClassId id) { return LINK_VIEW == id || GraphicView::IsA(id); } LinkView::LinkView (LinkComp* subj) : GraphicView(subj) { _connView1 = _connView2 = nil; } void LinkView::Update () { LinkComp* linkComp = GetLinkComp(); Graphic* link = GetGraphic(); Graphic* line = GetLine(); Graphic* subjLine = linkComp->GetLine(); IncurDamage(line); *line = *subjLine; *link = *linkComp->GetGraphic(); IncurDamage(line); EraseHandles(); } void LinkView::CreateHandles () { Coord x[2], y[2]; Viewer* v = GetViewer(); if (v != nil) { GetEndpoints(x[0], y[0], x[1], y[1]); _handles = new RubberHandles(nil, nil, x, y, 2, 0, HANDLE_SIZE); v->InitRubberband(_handles); } } Manipulator* LinkView::CreateLinkCompManip ( Viewer* v, Event& e, Transformer* rel, Tool* tool ) { GraphicView* views = v->GetGraphicView(); Selection* s = v->GetSelection(); RubberGroup* rg = new RubberGroup(nil, nil); float x, y, tx, ty; Coord cx = 0, rad = PIN_RAD, dum1 = 0, dum2 = 0; ConnectorView* target = views->ConnectorIntersecting( e.x-SLOP, e.y-SLOP, e.x+SLOP, e.y+SLOP ); s->Clear(); if (target != nil) { target->GetConnector()->GetCenter(x, y); rel->Transform(x, y, tx, ty); e.x = iv26_round(tx); e.y = iv26_round(ty); } if (rel != nil) { rel->Transform(cx, dum1); rel->Transform(rad, dum2); rad = abs(rad - cx); } rg->Append( new RubberLine(nil, nil, e.x, e.y, e.x, e.y), new FixedPin(nil, nil, e.x, e.y, rad), new SlidingPin(nil, nil, e.x, e.y, rad, e.x, e.y) ); return new ConnectManip(v, rg, rel, tool); } Manipulator* LinkView::CreateManipulator ( Viewer* v, Event& e, Transformer* rel, Tool* tool ) { Coord x0, y0, x1, y1; Rubberband* rub = nil; Manipulator* m = nil; if (tool->IsA(GRAPHIC_COMP_TOOL)) { m = CreateLinkCompManip(v, e, rel, tool); } else if (tool->IsA(MOVE_TOOL)) { GetEndpoints(x0, y0, x1, y1); rub = new SlidingLine(nil, nil, x0, y0, x1, y1, e.x, e.y); m = new DragManip(v, rub, rel, tool, Gravity); } else if (tool->IsA(SCALE_TOOL)) { GetEndpoints(x0, y0, x1, y1); rub = new ScalingLine(nil, nil, x0, y0, x1, y1, (x0+x1)/2, (y0+y1)/2); m = new DragManip(v, rub, rel, tool, Gravity); } else if (tool->IsA(ROTATE_TOOL)) { GetEndpoints(x0, y0, x1, y1); rub = new RotatingLine( nil, nil, x0, y0, x1, y1, (x0+x1)/2, (y0+y1)/2, e.x, e.y ); m = new DragManip(v, rub, rel, tool, Gravity); } return m; } Command* LinkView::InterpLinkCompManip (Manipulator* m) { Viewer* v = m->GetViewer(); Editor* ed = v->GetEditor(); GraphicView* views = v->GetGraphicView(); BrushVar* brVar = (BrushVar*) ed->GetState("BrushVar"); ConnectManip* cm = (ConnectManip*) m; Transformer* rel = cm->GetTransformer(); RubberGroup* rg = (RubberGroup*) cm->GetRubberband(); RubberLine* rl = (RubberLine*) rg->First(); Coord x0, y0, x1, y1; Connector* c1, *c2; ConnectorView* target1, *target2; MacroCmd* macro = new MacroCmd(ed); rl->GetCurrent(x0, y0, x1, y1); if (rel != nil) { rel = new Transformer(rel); rel->Invert(); } Graphic* pg = GetGraphicComp()->GetGraphic(); Line* line = new Line(x0, y0, x1, y1, pg); if (brVar != nil) line->SetBrush(brVar->GetBrush()); line->SetTransformer(rel); Unref(rel); LinkComp* linkComp = NewSubject(line); linkComp->GetConnectors(c1, c2); macro->Append(new PasteCmd(ed, new Clipboard(linkComp))); target1 = views->ConnectorIntersecting(x0-SLOP, y0-SLOP, x0+SLOP, y0+SLOP); target2 = views->ConnectorIntersecting(x1-SLOP, y1-SLOP, x1+SLOP, y1+SLOP); if (target1 != nil) { macro->Append(new ConnectCmd(ed, c1, target1->GetConnector())); } if (target2 != nil) { macro->Append(new ConnectCmd(ed, c2, target2->GetConnector())); } return macro; } LinkComp* LinkView::NewSubject (Line* line) { return new LinkComp(line); } Command* LinkView::InterpretManipulator (Manipulator* m) { DragManip* dm = (DragManip*) m; Editor* ed = dm->GetViewer()->GetEditor(); Tool* tool = dm->GetTool(); Transformer* rel = dm->GetTransformer(); Command* cmd = nil; if (tool->IsA(GRAPHIC_COMP_TOOL)) { cmd = InterpLinkCompManip(dm); } else if (tool->IsA(MOVE_TOOL)) { SlidingLine* sl; Coord x0, y0, x1, y1, dummy1, dummy2; float fx0, fy0, fx1, fy1; sl = (SlidingLine*) dm->GetRubberband(); sl->GetOriginal(x0, y0, dummy1, dummy2); sl->GetCurrent(x1, y1, dummy1, dummy2); if (rel != nil) { rel->InvTransform(float(x0), float(y0), fx0, fy0); rel->InvTransform(float(x1), float(y1), fx1, fy1); } cmd = new MoveCmd(ed, fx1-fx0, fy1-fy0); } else if (tool->IsA(SCALE_TOOL)) { ScalingLine* sl = (ScalingLine*) dm->GetRubberband(); float sxy = sl->CurrentScaling(); cmd = new ScaleCmd(ed, sxy, sxy); } else if (tool->IsA(ROTATE_TOOL)) { RotatingLine* rl = (RotatingLine*) dm->GetRubberband(); float angle = rl->CurrentAngle() - rl->OriginalAngle(); cmd = new RotateCmd(ed, angle); } return cmd; } void LinkView::First (Iterator& i) { i.SetValue(_connView1); } void LinkView::Last (Iterator& i) { i.SetValue(_connView2); } bool LinkView::Done (Iterator i) { return i.GetValue() == nil; } void LinkView::Next (Iterator& i) { void* v = i.GetValue(); if (v == nil) { i.SetValue(_connView1); } else if (v == _connView1) { i.SetValue(_connView2); } else { i.SetValue(nil); } } void LinkView::Prev (Iterator& i) { void* v = i.GetValue(); if (v == nil) { i.SetValue(_connView2); } else if (v == _connView1) { i.SetValue(nil); } else { i.SetValue(_connView1); } } GraphicView* LinkView::GetView (Iterator i) { return (GraphicView*) i.GetValue(); } void LinkView::SetView (GraphicView* gv, Iterator& i) { i.SetValue(gv); } void LinkView::GetEndpoints (Coord& x0, Coord& y0, Coord& x1, Coord& y1) { Line* line = GetLine(); Transformer t; line->GetOriginal(x0, y0, x1, y1); line->TotalTransformation(t); t.Transform(x0, y0); t.Transform(x1, y1); } Line* LinkView::GetLine () { Iterator i; Graphic* gr = GetGraphic(); gr->First(i); return (Line*) gr->GetGraphic(i); } Graphic* LinkView::GetGraphic () { Graphic* gr = GraphicView::GetGraphic(); if (gr == nil) { LinkComp* linkComp = GetLinkComp(); gr = new Picture(linkComp->GetGraphic()); gr->Append(linkComp->GetLine()->Copy()); SetGraphic(gr); Connector* c1, *c2; linkComp->GetConnectors(c1, c2); _connView1 = (ConnectorView*) c1->Create(COMPONENT_VIEW); _connView2 = (ConnectorView*) c2->Create(COMPONENT_VIEW); c1->Attach(_connView1); c2->Attach(_connView2); _connView1->Update(); _connView2->Update(); gr->Append(_connView1->GetGraphic(), _connView2->GetGraphic()); } return gr; } LinkView::~LinkView () { Graphic* parent = GraphicView::GetGraphic(); Graphic* g1 = _connView1->GetGraphic(); Graphic* g2 = _connView2->GetGraphic(); parent->Remove(g1); parent->Remove(g2); delete _connView1; delete _connView2; } /****************************************************************************/ ClassId PSLink::GetClassId () { return PS_LINK; } bool PSLink::IsA (ClassId id) { return PS_LINK == id || PostScriptView::IsA(id); } PSLink::PSLink (LinkComp* subj) : PostScriptView(subj) { } bool PSLink::Definition (ostream& out) { LinkComp* comp = (LinkComp*) GetSubject(); Graphic* link = comp->GetGraphic(); Line* line = comp->GetLine(); Transformer* link_t = link->GetTransformer(); Transformer* line_t = line->GetTransformer(); Transformer* temp_t = new Transformer(line_t); Resource::ref(link_t); temp_t->postmultiply(*link_t); link->SetTransformer(temp_t); Coord x0, y0, x1, y1; line->GetOriginal(x0, y0, x1, y1); out << "Begin " << MARK << " Line\n"; MinGS(out); out << MARK << "\n"; out << x0 << " " << y0 << " " << x1 << " " << y1 << " Line\n"; out << "End\n\n"; link->SetTransformer(link_t); Resource::unref(link_t); Resource::unref(temp_t); return out.good(); } neuron-7.6.3/src/lib/Unidraw/macro.cpp000066400000000000000000000123071340731477100176220ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * MacroCmd implementation. */ #include #include #include #include #include #include #include #include /*****************************************************************************/ ClassId MacroCmd::GetClassId () { return MACRO_CMD; } bool MacroCmd::IsA (ClassId id) { return MACRO_CMD == id || Command::IsA(id); } MacroCmd::MacroCmd (ControlInfo* c) : Command(c) { _cmds = new UList; } MacroCmd::MacroCmd( Editor* ed, Command* c1, Command* c2, Command* c3, Command* c4 ) : Command(ed) { _cmds = new UList; if (c1 != nil) { Append(c1, c2, c3, c4); } } Command* MacroCmd::Cmd (UList* r) { return (Command*) (*r)(); } Command* MacroCmd::Copy () { MacroCmd* macro; Iterator i; macro = new MacroCmd(CopyControlInfo()); InitCopy(macro); for (First(i); !Done(i); Next(i)) { macro->Append(GetCommand(i)); } return macro; } void MacroCmd::Execute () { Iterator i; for (First(i); !Done(i); Next(i)) { GetCommand(i)->Execute(); } } void MacroCmd::Unexecute () { Iterator i; for (Last(i); !Done(i); Prev(i)) { GetCommand(i)->Unexecute(); } } void MacroCmd::SetEditor (Editor* ed) { Command::SetEditor(ed); Iterator i; for (First(i); !Done(i); Next(i)) { GetCommand(i)->SetEditor(ed); } } bool MacroCmd::Reversible () { Iterator i; for (First(i); !Done(i); Next(i)) { if (GetCommand(i)->Reversible()) { return true; } } return false; } UList* MacroCmd::Elem (Iterator& i) { return (UList*) i.GetValue(); } void MacroCmd::First (Iterator& i) { i.SetValue(_cmds->First()); } void MacroCmd::Last (Iterator& i) { i.SetValue(_cmds->Last()); } void MacroCmd::Next (Iterator& i) { i.SetValue(Elem(i)->Next()); } void MacroCmd::Prev (Iterator& i) { i.SetValue(Elem(i)->Prev()); } bool MacroCmd::Done (Iterator& i) { return Elem(i) == _cmds->End(); } Command* MacroCmd::GetCommand (Iterator& i) { return Cmd(Elem(i)); } void MacroCmd::SetCommand (Command* cmd, Iterator& i) { i.SetValue(_cmds->Find(cmd)); } void MacroCmd::Append (Command* c1, Command* c2, Command* c3, Command* c4) { _cmds->Append(new UList(c1)); if (c2 != nil) { _cmds->Append(new UList(c2)); if (c3 != nil) { _cmds->Append(new UList(c3)); if (c4 != nil) { _cmds->Append(new UList(c4)); } } } } void MacroCmd::Prepend (Command* c1, Command* c2, Command* c3, Command* c4) { _cmds->Prepend(new UList(c1)); if (c2 != nil) { _cmds->Prepend(new UList(c2)); if (c3 != nil) { _cmds->Prepend(new UList(c3)); if (c4 != nil) { _cmds->Prepend(new UList(c4)); } } } } void MacroCmd::InsertBefore (Iterator& i, Command* cmd) { Elem(i)->Append(new UList(cmd)); } void MacroCmd::InsertAfter (Iterator& i, Command* cmd) { Elem(i)->Prepend(new UList(cmd)); } void MacroCmd::Remove (Iterator& i) { UList* doomed = Elem(i); Command* cmd = Cmd(doomed); Next(i); _cmds->Remove(doomed); delete doomed; } void MacroCmd::Remove (Command* cmd) { _cmds->Delete(cmd); } MacroCmd::~MacroCmd () { while (!_cmds->IsEmpty()) { UList* cur = _cmds->First(); _cmds->Remove(cur); Command* cmd = Cmd(cur); delete cmd; delete cur; } delete _cmds; } void MacroCmd::Read (istream& in) { Command::Read(in); int count; in >> count; for (int i = 0; i < count; ++i) { Append(unidraw->GetCatalog()->ReadCommand(in)); } } void MacroCmd::Write (ostream& out) { Command::Write(out); Iterator i; int count = 0; for (First(i); !Done(i); Next(i), ++count); out << count << "\n"; for (First(i); !Done(i); Next(i)) { Command* cmd = GetCommand(i); unidraw->GetCatalog()->WriteCommand(cmd, out); out << "\n"; } } neuron-7.6.3/src/lib/Unidraw/magnify.cpp000066400000000000000000000045071340731477100201560ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Magnify tool definitions. */ #include #include #include #include #include #include #include #include #include /*****************************************************************************/ ClassId MagnifyTool::GetClassId () { return MAGNIFY_TOOL; } bool MagnifyTool::IsA (ClassId id) { return MAGNIFY_TOOL == id || Tool::IsA(id); } MagnifyTool::MagnifyTool (ControlInfo* m) : Tool(m) { } Tool* MagnifyTool::Copy () { return new MagnifyTool(CopyControlInfo()); } Manipulator* MagnifyTool::CreateManipulator ( Viewer* v, Event& e, Transformer* ) { RubberRect* rr = new RubberRect(nil, nil, e.x, e.y, e.x, e.y); return new DragManip(v, rr); } Command* MagnifyTool::InterpretManipulator (Manipulator* m) { Viewer* v = m->GetViewer(); DragManip* dm = (DragManip*) m; RubberRect* rr = (RubberRect*) dm->GetRubberband(); Coord l, r, b, t; rr->GetCurrent(l, b, r, t); v->Magnify(l, b, r, t); return nil; } neuron-7.6.3/src/lib/Unidraw/manip.cpp000066400000000000000000000033171340731477100176260ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of Manipulator base class. */ #include /****************************************************************************/ Manipulator::Manipulator () { } Manipulator::~Manipulator () { } void Manipulator::Grasp (Event&) { } bool Manipulator::Manipulating (Event&) { return false; } void Manipulator::Effect (Event&) { } void Manipulator::SetViewer (Viewer*) { } Viewer* Manipulator::GetViewer () { return nil; } void Manipulator::SetTool (Tool*) { } Tool* Manipulator::GetTool () { return nil; } neuron-7.6.3/src/lib/Unidraw/manips.cpp000066400000000000000000000563501340731477100200160ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of Manipulator subclasses. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /****************************************************************************/ class ManipList : public UList { public: ManipList(Manipulator* = nil); bool manipulating(); void manipulating(bool); private: bool _manipulating; }; ManipList::ManipList (Manipulator* m) : UList(m) { _manipulating = true; } inline bool ManipList::manipulating () { return _manipulating; } inline void ManipList::manipulating (bool m) { _manipulating = m; } /****************************************************************************/ ManipGroup::ManipGroup (Viewer* v, Tool* t) { _kids = new ManipList; _viewer = v; _tool = t; } ManipGroup::~ManipGroup () { while (!_kids->IsEmpty()) { UList* cur = _kids->First(); _kids->Remove(cur); Manipulator* m = Manip(cur); delete m; delete cur; } delete _kids; } void ManipGroup::Grasp (Event& e) { Iterator i; for (First(i); !Done(i); Next(i)) { GetManip(i)->Grasp(e); ManipList* ml = (ManipList*) Elem(i); ml->manipulating(true); } } bool ManipGroup::Manipulating (Event& e) { Iterator i; bool finished = true; for (First(i); !Done(i); Next(i)) { ManipList* ml = (ManipList*) Elem(i); if (ml->manipulating()) { ml->manipulating(GetManip(i)->Manipulating(e)); finished = finished && !ml->manipulating(); } } return !finished; } void ManipGroup::Effect (Event& e) { Iterator i; for (First(i); !Done(i); Next(i)) { GetManip(i)->Effect(e); } } void ManipGroup::SetViewer (Viewer* v) { Iterator i; _viewer = v; for (First(i); !Done(i); Next(i)) { GetManip(i)->SetViewer(v); } } void ManipGroup::SetTool (Tool* t) { Iterator i; _tool = t; for (First(i); !Done(i); Next(i)) { GetManip(i)->SetTool(t); } } Viewer* ManipGroup::GetViewer () { return _viewer; } Tool* ManipGroup::GetTool () { return _tool; } void ManipGroup::First (Iterator& i) { i.SetValue(_kids->First()); } void ManipGroup::Last (Iterator& i) { i.SetValue(_kids->Last()); } void ManipGroup::Next (Iterator& i) { i.SetValue(Elem(i)->Next()); } void ManipGroup::Prev (Iterator& i) { i.SetValue(Elem(i)->Prev()); } bool ManipGroup::Done (Iterator i) { return Elem(i) == _kids->End(); } Manipulator* ManipGroup::GetManip (Iterator i) { return Manip(Elem(i)); } void ManipGroup::SetManip (Manipulator* m, Iterator& i) { i.SetValue(_kids->Find(m)); } void ManipGroup::Append ( Manipulator* g0, Manipulator* g1, Manipulator* g2, Manipulator* g3 ) { _kids->Append(new ManipList(g0)); if (g1 != nil) _kids->Append(new ManipList(g1)); if (g2 != nil) _kids->Append(new ManipList(g2)); if (g3 != nil) _kids->Append(new ManipList(g3)); } void ManipGroup::Prepend ( Manipulator* g0, Manipulator* g1, Manipulator* g2, Manipulator* g3 ) { if (g3 != nil) _kids->Prepend(new ManipList(g3)); if (g2 != nil) _kids->Prepend(new ManipList(g2)); if (g1 != nil) _kids->Prepend(new ManipList(g1)); _kids->Prepend(new ManipList(g0)); } void ManipGroup::InsertBefore (Iterator i, Manipulator* g) { Elem(i)->Append(new ManipList(g)); } void ManipGroup::InsertAfter (Iterator i, Manipulator* g) { Elem(i)->Prepend(new ManipList(g)); } void ManipGroup::Remove (Manipulator* g) { _kids->Delete(g); } void ManipGroup::Remove (Iterator& i) { UList* doomed = Elem(i); Manipulator* g = Manip(doomed); Next(i); _kids->Remove(doomed); delete doomed; } Manipulator* ManipGroup::Manip (UList* r) { return (Manipulator*) (*r)(); } UList* ManipGroup::Elem (Iterator i) { return (UList*) i.GetValue(); } /****************************************************************************/ DragManip::DragManip ( Viewer* v, Rubberband* newr, Transformer* rel, Tool* t, DragConstraint c ) { Init(v, newr, rel, t, c); _origPreset = false; } DragManip::DragManip ( Viewer* v, Rubberband* newr, Transformer* rel, Tool* t, DragConstraint c, Coord x, Coord y ) { Init(v, newr, rel, t, c); _origx = x; _origy = y; _origPreset = true; } void DragManip::Init ( Viewer* v, Rubberband* newr, Transformer* rel, Tool* t, DragConstraint c ) { _r = newr; Ref(_r); if (_r != nil) v->InitRubberband(_r); _relative = rel; Ref(_relative); _viewer = v; _tool = t; _constraint = c; } DragManip::~DragManip () { if (_r != nil) Unref(_r); if (_relative != nil) Unref(_relative); } void DragManip::Grasp (Event& e) { _grasp_e = e; if (!_origPreset) { _origx = e.x; _origy = e.y; } Constrain(e); if (_r != nil) _r->Track(e.x, e.y); } bool DragManip::Manipulating (Event& e) { if (_r == nil) { return false; } if (e.eventType == MotionEvent) { Constrain(e); _r->Track(e.x, e.y); } else if (e.eventType == UpEvent) { return false; } return true; } void DragManip::Effect (Event&) { if (_r != nil) _r->Erase(); } void DragManip::SetConstraint (DragConstraint c) { _constraint = c; } DragConstraint DragManip::GetConstraint () { return _constraint; } void DragManip::Constrain (Event& e) { if (e.shift) { if (_constraint & XFixed) { e.x = _origx; } if (_constraint & YFixed) { e.y = _origy; } if (_constraint & XYEqual) { Coord w = abs(e.x - _origx); Coord h = abs(e.y - _origy); if (w > h) { e.y = _origy + ((e.y > _origy) ? w : -w); } else { e.x = _origx + ((e.x > _origx) ? h : -h); } } if (_constraint & HorizOrVert) { if (abs(e.x - _origx) < abs(e.y - _origy)) { e.x = _origx; } else { e.y = _origy; } } } if (_constraint & Gravity) { GetViewer()->Constrain(e.x, e.y); } } void DragManip::SetViewer (Viewer* v) { if (_viewer != v) { _viewer = v; if (_r != nil) _viewer->InitRubberband(_r); } } Viewer* DragManip::GetViewer () { return _viewer; } void DragManip::SetRubberband (Rubberband* newr) { if (_r != newr) { Ref(newr); Unref(_r); _r = newr; if (_r != nil) _viewer->InitRubberband(_r); } } Rubberband* DragManip::GetRubberband () { return _r; } void DragManip::SetTransformer (Transformer* t) { if (_relative != t) { Ref(t); Unref(_relative); _relative = t; } } Transformer* DragManip::GetTransformer () { return _relative; } void DragManip::SetTool (Tool* t) { _tool = t; } Tool* DragManip::GetTool () { return _tool; } /*****************************************************************************/ VertexManip::VertexManip ( Viewer* v, GrowingVertices* r, Transformer* rel, Tool* t, DragConstraint c ) : DragManip(v, r, rel, t, c) { } bool VertexManip::Manipulating (Event& e) { Rubberband* r = GetRubberband(); if (r == nil) { return false; } if (e.eventType == MotionEvent) { Constrain(e); r->Track(e.x, e.y); } else if (e.eventType == DownEvent) { Constrain(e); if (e.button == LEFTMOUSE) { GetGrowingVertices()->AddVertex(e.x, e.y); } else if (e.button == MIDDLEMOUSE) { GetGrowingVertices()->AddVertex(e.x, e.y); return false; } else if (e.button == RIGHTMOUSE) { GetGrowingVertices()->RemoveVertex(); } } return true; } GrowingVertices* VertexManip::GetGrowingVertices () { return (GrowingVertices*) GetRubberband(); } /****************************************************************************/ ConnectManip::ConnectManip ( Viewer* newv, Rubberband* newr, Transformer* rel, Tool* t ) : DragManip(newv, newr, rel, t) { _target = nil; } bool ConnectManip::Manipulating (Event& e) { GraphicView* views = GetViewer()->GetGraphicView(); Rubberband* r = GetRubberband(); float cx, cy; if (r == nil) { return false; } if (e.eventType == MotionEvent) { _target = views->ConnectorIntersecting( e.x-SLOP, e.y-SLOP, e.x+SLOP, e.y+SLOP ); if (_target == nil) { r->Track(e.x, e.y); } else { _target->GetGraphic()->GetCenter(cx, cy); r->Track(iv26_round(cx), iv26_round(cy)); } } else if (e.eventType == UpEvent) { r->Erase(); return false; } return true; } ConnectorView* ConnectManip::GetTarget () { return _target; } /*****************************************************************************/ TextManip::TextManip (Viewer* v, Painter* p, Coord tab, Tool* t) { Init(v, p, p->GetFont()->Height(), tab, t, false); _prepositioned = false; } TextManip::TextManip (Viewer* v, Painter* p, Coord h, Coord tab, Tool* t) { Init(v, p, h, tab, t, true); _prepositioned = false; } TextManip::TextManip ( Viewer* v, const char* sample, int samplen, Coord x, Coord y, Painter* p, Coord tab, Tool* t ) { Init(v, p, p->GetFont()->Height(), tab, t, false, sample, samplen); _xpos = x; _ypos = y; _prepositioned = true; } TextManip::TextManip ( Viewer* v, const char* sample, int samplen, Coord x, Coord y, Painter* p, Coord h, Coord tab, Tool* t ) { Init(v, p, h, tab, t, true, sample, samplen); _xpos = x; _ypos = y; _prepositioned = true; } void TextManip::Init ( Viewer* v, Painter* p, Coord h, Coord tab, Tool* t, bool multiline, const char* sample, int samplen ) { _bufsize = (CHARBUFSIZE > samplen) ? CHARBUFSIZE : samplen*2; _buf = new char[_bufsize]; if (samplen > 0) { strncpy(_buf, sample, samplen); } _text = new TextBuffer(_buf, samplen, _bufsize); _viewer = v; _painter = p; Ref(_painter); _lineHt = h; _tabWidth = tab; _multiline = multiline; _tool = t; _dot = _mark = 0; InitTextDisplay(sample, samplen); } void TextManip::InitTextDisplay (const char* sample, int samplen) { _display = new TextDisplay(true); _display->LineHeight(_lineHt); _display->TabWidth(_tabWidth); if (samplen > 0) { int beg, end, lineSize, nextBeg, line = 0; for (beg = 0; beg < samplen; beg = nextBeg) { GetLine(sample, samplen, beg, end, lineSize, nextBeg); _display->ReplaceText(line, &sample[beg], lineSize); ++line; } } } TextManip::~TextManip () { delete _text; delete _display; Unref(_painter); } void TextManip::SetViewer (Viewer* v) { _viewer = v; } Viewer* TextManip::GetViewer () { return _viewer; } void TextManip::SetTool (Tool* t) { _tool = t; } Tool* TextManip::GetTool () { return _tool; } Painter* TextManip::GetPainter () { return _painter; } Coord TextManip::GetLineHeight () { return _lineHt; } Coord TextManip::GetTabWidth () { return _tabWidth; } void TextManip::GetPosition (Coord& x, Coord& y) { x = _xpos; y = _ypos; } const char* TextManip::GetText (int& size) { size = _text->Length(); return _buf; } void TextManip::CheckBuf (int more) { int _textlen = _text->Length(); char* new_buf; if (_textlen + more >= _bufsize) { _bufsize = (_textlen + more) * 2; new_buf = new char[_bufsize]; strncpy(new_buf, _buf, _textlen); delete _text; delete _buf; _buf = new_buf; _text = new TextBuffer(_buf, _textlen, _bufsize); } } void TextManip::PlaceTextDisplay (Coord xpos, Coord ypos) { GetViewer()->InitTextDisplay(_display, _painter); Transformer* rel = _painter->GetTransformer(); if (rel != nil) rel->InvTransform(xpos, ypos); int l = xpos; int r = l + _display->Width(); int t = ypos + _lineHt-1; int b = t - _display->Height(); _display->Resize(l, b, r, t); } void TextManip::Grasp (Event& e) { _grasp_e = e; Viewer* v = GetViewer(); Selection* s = v->GetSelection(); v->Constrain(e.x, e.y); _selecting = true; if (!_prepositioned) { _xpos = e.x; _ypos = e.y; } PlaceTextDisplay(_xpos, _ypos); Coord l, b, r, t; _display->CaretStyle(BarCaret); _display->Bounds(l, b, r, t); _display->Redraw(l, b, r, t); _selection = new Selection(s); s->Clear(); if (_prepositioned) { Select(Locate(e.x, e.y)); } } bool TextManip::Manipulating (Event& e) { bool manipulating = true; if (e.eventType == KeyEvent) { manipulating = HandleKey(e); } else if (e.eventType == MotionEvent && _selecting) { SelectMore(Locate(e.x, e.y)); } else if (e.eventType == DownEvent) { if (e.shift) { SelectMore(Locate(e.x, e.y)); _selecting = true; } else if (Contains(e.x, e.y)) { Select(Locate(e.x, e.y)); _selecting = true; } else { manipulating = false; } } else if (e.eventType == UpEvent) { _selecting = false; } return manipulating; } void TextManip::Effect (Event& e) { Viewer* v = GetViewer(); _display->CaretStyle(NoCaret); Select(0); v->GetSelection()->Merge(_selection); v->UnRead(e); v->IncurTextDisplayDamage(_display, _painter); delete _selection; } bool TextManip::HandleKey (Event& e) { World* world = GetViewer()->GetWorld(); char c = e.keystring[0]; bool manipulating = true; switch (c) { case '\007': world->RingBell(1); break; case '\001': BeginningOfLine(); break; case '\005': EndOfLine(); break; case '\006': ForwardCharacter(1); break; case '\002': BackwardCharacter(1); break; case '\016': ForwardLine(1); break; case '\020': BackwardLine(1); break; case '\013': DeleteLine(); break; case '\004': DeleteCharacter(1); break; case '\010': DeleteCharacter(-1); break; case '\177': DeleteCharacter(-1); break; case '\011': InsertCharacter('\t'); break; case '\015': if (_multiline) InsertCharacter('\n'); break; case '\033': manipulating = false; break; default: if (!iscntrl(c & 0x7f)) { InsertCharacter(c); } break; } return manipulating; } void TextManip::InsertCharacter (char c) { DeleteSelection(); InsertText(&c, 1); } void TextManip::DeleteCharacter (int count) { if (_dot != _mark) { DeleteSelection(); } else { DeleteText(count); } } void TextManip::InsertText (const char* s, int count) { CheckBuf(count); count = _text->Insert(_dot, s, count); int sline = _text->LineNumber(_dot); int fline = _text->LineNumber(_dot + count); if (sline == fline) { int offset = _text->LineOffset(_dot); _display->InsertText(sline, offset, _text->Text(_dot), count); } else { _display->InsertLinesAfter(sline, fline-sline); for (int i = sline; i <= fline; ++i) { int bol = _text->BeginningOfLine(_text->LineIndex(i)); int eol = _text->EndOfLine(bol); _display->ReplaceText(i, _text->Text(bol, eol), eol-bol); } } Select(_dot + count); } void TextManip::DeleteText (int count) { int d = _dot; int c = count; while (c > 0) { d = _text->NextCharacter(d); --c; } while (c < 0) { _dot = _text->PreviousCharacter(_dot); ++c; } count = d - _dot; int sline = _text->LineNumber(_dot); int fline = _text->LineNumber(d); _text->Delete(_dot, count); if (sline == fline) { int offset = _text->LineOffset(_dot); _display->DeleteText(sline, offset, count); } else { int bol = _text->BeginningOfLine(_dot); int eol = _text->EndOfLine(_dot); _display->DeleteLinesAfter(sline, fline-sline); _display->ReplaceText(sline, _text->Text(bol, eol), eol-bol); } Select(_dot); } void TextManip::DeleteLine () { Select(_text->BeginningOfLine(_mark), _text->BeginningOfNextLine(_mark)); DeleteSelection(); } void TextManip::DeleteSelection () { if (_mark != _dot) { DeleteText(_mark - _dot); } } void TextManip::BeginningOfSelection () { Select(min(_mark, _dot)); } void TextManip::EndOfSelection () { Select(max(_mark, _dot)); } void TextManip::BeginningOfWord () { if (_dot != _mark) { Select(min(_mark, _dot)); } else { Select(_text->BeginningOfWord(_dot)); } } void TextManip::EndOfWord () { if (_dot != _mark) { Select(max(_mark, _dot)); } else { Select(_text->EndOfWord(_dot)); } } void TextManip::BeginningOfLine () { if (_dot != _mark) { Select(min(_mark, _dot)); } else { Select(_text->BeginningOfLine(_dot)); } } void TextManip::EndOfLine () { if (_dot != _mark) { Select(max(_mark, _dot)); } else { Select(_text->EndOfLine(_dot)); } } void TextManip::BeginningOfText () { Select(_text->BeginningOfText()); } void TextManip::EndOfText () { Select(_text->EndOfText()); } void TextManip::ForwardCharacter (int count) { if (_mark != _dot) { Select(max(_mark, _dot)); } else { int d = _dot; while (count > 0) { d = _text->NextCharacter(d); --count; } Select(d); } } void TextManip::BackwardCharacter (int count) { if (_dot != _mark) { Select(min(_mark, _dot)); } else { int d = _dot; while (count > 0) { d = _text->PreviousCharacter(d); --count; } Select(d); } } void TextManip::ForwardLine (int count) { if (_dot != _mark) { Select(max(_mark, _dot)); } else { int d = _dot; while (count > 0) { d = _text->BeginningOfNextLine(d); --count; } Select(d); } } void TextManip::BackwardLine (int count) { if (_dot != _mark) { Select(min(_mark, _dot)); } else { int d = _dot; while (count > 0) { d = _text->BeginningOfLine(_text->EndOfPreviousLine(d)); --count; } Select(d); } } void TextManip::ForwardWord (int count) { if (_dot != _mark) { Select(max(_mark, _dot)); } else { int d = _dot; while (count > 0) { d = _text->BeginningOfNextWord(d); --count; } Select(d); } } void TextManip::BackwardWord (int count) { if (_dot != _mark) { Select(min(_mark, _dot)); } else { int d = _dot; while (count > 0) { d = _text->BeginningOfWord(_text->EndOfPreviousWord(d)); --count; } Select(d); } } void TextManip::Select (int d) { Select(d, d); } void TextManip::SelectMore (int m) { Select(_dot, m); } void TextManip::SelectAll () { Select(_text->EndOfText(), _text->BeginningOfText()); } void TextManip::Select (int d, int m) { int oldl = min(_dot, _mark); int oldr = max(_dot, _mark); int newl = min(d, m); int newr = max(d, m); if (oldl == oldr && newl != newr) { _display->CaretStyle(NoCaret); } if (newr < oldl || newl > oldr) { if (oldr > oldl) { _display->RemoveStyle( _text->LineNumber(oldl), _text->LineOffset(oldl), _text->LineNumber(oldr-1), _text->LineOffset(oldr-1), Reversed ); } if (newr > newl) { _display->AddStyle( _text->LineNumber(newl), _text->LineOffset(newl), _text->LineNumber(newr-1), _text->LineOffset(newr-1), Reversed ); } } else { if (newl < oldl) { _display->AddStyle( _text->LineNumber(newl), _text->LineOffset(newl), _text->LineNumber(oldl-1), _text->LineOffset(oldl-1), Reversed ); } else if (newl > oldl) { _display->RemoveStyle( _text->LineNumber(oldl), _text->LineOffset(oldl), _text->LineNumber(newl-1), _text->LineOffset(newl-1), Reversed ); } if (newr > oldr) { _display->AddStyle( _text->LineNumber(oldr), _text->LineOffset(oldr), _text->LineNumber(newr-1), _text->LineOffset(newr-1), Reversed ); } else if (newr < oldr) { _display->RemoveStyle( _text->LineNumber(newr), _text->LineOffset(newr), _text->LineNumber(oldr-1), _text->LineOffset(oldr-1), Reversed ); } } if (oldl != oldr && newl == newr) { _display->CaretStyle(BarCaret); } _dot = d; _mark = m; if (_dot == _mark) { _display->Caret(_text->LineNumber(_dot), _text->LineOffset(_dot)); } } bool TextManip::Contains (Coord x, Coord y) { Transformer* rel = _painter->GetTransformer(); if (rel != nil) rel->InvTransform(x, y); int line = _display->LineNumber(y); int index = _display->LineIndex(line, x); return x >= _display->Left(line, _text->BeginningOfLine(index)) && x <= _display->Right(line, _text->EndOfLine(index)) && y >= _display->Base(line) && y <= _display->Top(line); } int TextManip::Locate (Coord x, Coord y) { Transformer* rel = _painter->GetTransformer(); if (rel != nil) rel->InvTransform(x, y); int line = _display->LineNumber(y); int index = _display->LineIndex(line, x); int l = _text->LineIndex(line); int i = 0; while (i < index) { l = _text->NextCharacter(l); i += 1; } return l; } neuron-7.6.3/src/lib/Unidraw/move.cpp000066400000000000000000000057721340731477100174770ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Move tool definitions. */ #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ ClassId MoveTool::GetClassId () { return MOVE_TOOL; } bool MoveTool::IsA (ClassId id) { return MOVE_TOOL == id || Tool::IsA(id); } MoveTool::MoveTool (ControlInfo* m) : Tool(m) { } Tool* MoveTool::Copy () { return new MoveTool(CopyControlInfo()); } Manipulator* MoveTool::CreateManipulator ( Viewer* v, Event& e, Transformer* rel ) { GraphicView* views = v->GetGraphicView(); Selection* s = v->GetSelection(), *newSel; GraphicView* gv; Manipulator* m = nil; Iterator i; newSel = views->ViewIntersecting(e.x-SLOP, e.y-SLOP, e.x+SLOP, e.y+SLOP); if (newSel->IsEmpty()) { s->Clear(); } else { newSel->First(i); gv = newSel->GetView(i); if (!s->Includes(gv)) { s->Clear(); s->Append(gv); s->Update(); } if (s->Number() > 1) { m = gv->GraphicView::CreateManipulator(v, e, rel, this); } else { m = gv->CreateManipulator(v, e, rel, this); } } delete newSel; return m; } Command* MoveTool::InterpretManipulator (Manipulator* m) { Selection* s; Command* cmd = nil; Iterator i; GraphicView* gv; if (m != nil) { s = m->GetViewer()->GetSelection(); s->First(i); gv = s->GetView(i); if (s->Number() > 1) { cmd = gv->GraphicView::InterpretManipulator(m); } else { cmd = gv->InterpretManipulator(m); } } return cmd; } neuron-7.6.3/src/lib/Unidraw/nop.cpp000066400000000000000000000034141340731477100173140ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of null command. */ #include #include /*****************************************************************************/ ClassId NOPCmd::GetClassId () { return NOP_CMD; } bool NOPCmd::IsA (ClassId id) { return NOP_CMD == id || Command::IsA(id); } NOPCmd::NOPCmd (ControlInfo* c) : Command(c) { } NOPCmd::NOPCmd (Editor* ed) : Command(ed) { } Command* NOPCmd::Copy () { Command* copy = new NOPCmd(CopyControlInfo()); InitCopy(copy); return copy; } void NOPCmd::Execute () { } bool NOPCmd::Reversible () { return false; } neuron-7.6.3/src/lib/Unidraw/pad.cpp000066400000000000000000000274041340731477100172710ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Pad component definitions. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ ClassId PadComp::GetClassId () { return PAD_COMP; } bool PadComp::IsA (ClassId id) { return PAD_COMP == id || Connector::IsA(id); } Component* PadComp::Copy () { PadComp* copy = new PadComp((PadGraphic*) GetGraphic()->Copy()); copy->_mobility = _mobility; return copy; } PadComp::PadComp (PadGraphic* graphic) : Connector(graphic) { _mobility = Fixed; } void PadComp::Interpret (Command* cmd) { if ( cmd->IsA(MOVE_CMD) || cmd->IsA(BRUSH_CMD) || cmd->IsA(ALIGN_CMD) || cmd->IsA(MOBILITY_CMD) || cmd->IsA(DELETE_CMD) || cmd->IsA(CUT_CMD) || cmd->IsA(GROUP_CMD) || cmd->IsA(FRONT_CMD) || cmd->IsA(BACK_CMD) ) { Connector::Interpret(cmd); } } void PadComp::Uninterpret (Command* cmd) { if ( cmd->IsA(MOVE_CMD) || cmd->IsA(BRUSH_CMD) || cmd->IsA(ALIGN_CMD) || cmd->IsA(MOBILITY_CMD) || cmd->IsA(DELETE_CMD) || cmd->IsA(CUT_CMD) || cmd->IsA(GROUP_CMD) || cmd->IsA(FRONT_CMD) || cmd->IsA(BACK_CMD) ) { Connector::Uninterpret(cmd); } } void PadComp::Connect (Connector* target, CGlue* g) { PadGraphic* padgr = GetPad(); float l, b, r, t; padgr->GetBounds(l, b, r, t); float h = (r - l)/2; float v = (t - b)/2; if (target->IsA(PIN_COMP)) { CGlue padGlue(0, 0, h*hfil, h*hfil, v*vfil, v*vfil, h, h, v, v); padGlue.Interpose(g); csolver->Connect(this, target, &padGlue); Connector::Connect(target, &padGlue); } else if (target->IsA(HSLOT_COMP)) { Graphic* peergr = target->GetGraphic(); peergr->GetBounds(l, b, r, t); h += (r - l)/2; CGlue slotGlue(0, 0, h*hfil, h*hfil, v*vfil, v*vfil, h, h, v, v); slotGlue.Interpose(g); csolver->Connect(this, target, &slotGlue); Connector::Connect(target, &slotGlue); } else if (target->IsA(VSLOT_COMP)) { Graphic* peergr = target->GetGraphic(); peergr->GetBounds(l, b, r, t); v += (t - b)/2; CGlue slotGlue(0, 0, h*hfil, h*hfil, v*vfil, v*vfil, h, h, v, v); slotGlue.Interpose(g); csolver->Connect(this, target, &slotGlue); Connector::Connect(target, &slotGlue); } else if (target->IsA(PAD_COMP)) { Graphic* peergr = target->GetGraphic(); peergr->GetBounds(l, b, r, t); h += (r - l)/2; v += (t - b)/2; CGlue padGlue(0, 0, h*hfil, h*hfil, v*vfil, v*vfil, h, h, v, v); padGlue.Interpose(g); csolver->Connect(this, target, &padGlue); Connector::Connect(target, &padGlue); } } void PadComp::SetMobility (Mobility m) { _mobility = m; } Mobility PadComp::GetMobility () { return _mobility; } PadGraphic* PadComp::GetPad () { return (PadGraphic*) GetGraphic(); } void PadComp::Read (istream& in) { Connector::Read(in); Coord l, b, r, t; int mobility; in >> l >> b >> r >> t >> mobility; PadGraphic* pad = new PadGraphic(l, b, r, t); _mobility = Mobility(mobility); pad->FillBg(ReadBgFilled(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); pad->SetColors(fg, bg); pad->SetBrush(ReadBrush(in)); Transformer* xf = ReadTransformer(in); pad->SetTransformer(xf); Unref(xf); SetGraphic(pad); } void PadComp::Write (ostream& out) { Connector::Write(out); PadGraphic* pad = GetPad(); Coord l, b, r, t; int mobility = _mobility; pad->GetOriginal(l, b, r, t); out << l << " " << b << " " << r << " " << t << " " << mobility << " "; WriteBgFilled(pad->BgFilled(), out); WriteColor(pad->GetFgColor(), out); WriteColor(pad->GetBgColor(), out); WriteBrush(pad->GetBrush(), out); WriteTransformer(pad->GetTransformer(), out); } /*****************************************************************************/ PadComp* PadView::GetPadComp () { return (PadComp*) GetSubject(); } ClassId PadView::GetClassId () { return PAD_VIEW; } bool PadView::IsA (ClassId id) { return PAD_VIEW == id || ConnectorView::IsA(id); } PadView::PadView (PadComp* subj) : ConnectorView(subj) { } PadGraphic* PadView::GetPad () { return (PadGraphic*) GetGraphic(); } void PadView::Interpret (Command* cmd) { if (cmd->IsA(ALIGNTOGRID_CMD)) { PadGraphic* padg = (PadGraphic*) GetGraphic(); Transformer total; padg->TotalTransformation(total); Coord x0, y0, x1, y1; float tx0, ty0; padg->GetOriginal(x0, y0, x1, y1); total.Transform(float(x0), float(y0), tx0, ty0); ((AlignToGridCmd*) cmd)->Align(this, tx0, ty0); } else { ConnectorView::Interpret(cmd); } } void PadView::Update () { PadGraphic* pad = GetPad(); Graphic* padgr = pad; IncurDamage(pad); *padgr = *GetPadComp()->GetGraphic(); IncurDamage(pad); EraseHandles(); } Manipulator* PadView::CreateGraphicCompManip ( Viewer* v, Event& e, Transformer* rel, Tool* tool ) { v->Constrain(e.x, e.y); Rubberband* rub = new RubberRect(nil, nil, e.x, e.y, e.x, e.y); return new DragManip(v, rub, rel, tool, DragConstraint(XYEqual | Gravity)); } Manipulator* PadView::CreateConnectManip ( Viewer* v, Event&, Transformer* rel, Tool* tool ) { Selection* s = v->GetSelection(); RubberGroup* rg = new RubberGroup(nil, nil); Coord l, b, r, t; s->Clear(); GetGraphic()->GetBox(l, b, r, t); Coord cx = (l+r)/2; Coord cy = (b+t)/2; rg->Append( new SlidingRect(nil, nil, l, b, r, t, cx, cy), new SlidingLine(nil, nil, l, b, r, t, cx, cy), new SlidingLine(nil, nil, l, t, r, b, cx, cy), new RubberLine(nil, nil, cx, cy, cx, cy) ); return new ConnectManip(v, rg, rel, tool); } Manipulator* PadView::CreateManipulator ( Viewer* v, Event& e, Transformer* rel, Tool* tool ) { Manipulator* manip = nil; if (tool->IsA(GRAPHIC_COMP_TOOL)) { manip = CreateGraphicCompManip(v, e, rel, tool); } else if (tool->IsA(MOVE_TOOL)) { manip = GraphicView::CreateManipulator(v, e, rel, tool); } else if (tool->IsA(CONNECT_TOOL)) { manip = CreateConnectManip(v, e, rel, tool); } return manip; } Command* PadView::InterpGraphicCompManip (Manipulator* m) { Command* cmd = nil; DragManip* dm = (DragManip*) m; SlidingRect* sr = (SlidingRect*) dm->GetRubberband(); Coord l, b, r, t; sr->GetCurrent(l, b, r, t); if (l != r || b != t) { DragManip* dm = (DragManip*) m; Editor* ed = dm->GetViewer()->GetEditor(); BrushVar* brVar = (BrushVar*) ed->GetState("Brush"); Transformer* rel = dm->GetTransformer(); if (rel != nil) { rel = new Transformer(rel); rel->Invert(); } Graphic* pg = GetGraphicComp()->GetGraphic(); PadGraphic* padGraphic = new PadGraphic(l, b, r, t, pg); if (brVar != nil) padGraphic->SetBrush(brVar->GetBrush()); padGraphic->SetTransformer(rel); Unref(rel); cmd = new PasteCmd(ed, new Clipboard(NewSubject(padGraphic))); } return cmd; } PadComp* PadView::NewSubject (PadGraphic* padgr) { return new PadComp(padgr); } Command* PadView::InterpConnectManip (Manipulator* m) { Editor* ed = m->GetViewer()->GetEditor(); ConnectManip* cm = (ConnectManip*) m; ConnectorView* target = cm->GetTarget(); Command* cmd = nil; if (target != nil) { cmd = new ConnectCmd(ed, GetConnector(), target->GetConnector()); } return cmd; } Command* PadView::InterpretManipulator (Manipulator* m) { DragManip* dm = (DragManip*) m; Tool* tool = dm->GetTool(); Command* cmd = nil; if (tool->IsA(GRAPHIC_COMP_TOOL)) { cmd = InterpGraphicCompManip(m); } else if (tool->IsA(MOVE_TOOL)) { cmd = GraphicView::InterpretManipulator(m); } else if (tool->IsA(CONNECT_TOOL)) { cmd = InterpConnectManip(m); } return cmd; } Graphic* PadView::GetGraphic () { Graphic* graphic = GraphicView::GetGraphic(); if (graphic == nil) { PadComp* padComp = GetPadComp(); graphic = padComp->GetGraphic()->Copy(); SetGraphic(graphic); } return graphic; } /*****************************************************************************/ PadGraphic::PadGraphic ( Coord l, Coord b, Coord r, Coord t, Graphic* gr ) : Graphic(gr) { _l = l; _b = b; _r = r; _t = t; _br = nil; if (gr != nil) { PadGraphic::SetBrush(gr->GetBrush()); } } PadGraphic::~PadGraphic () { Unref(_br); } Graphic* PadGraphic::Copy () { return new PadGraphic(_l, _b, _r, _t, this); } void PadGraphic::GetOriginal (Coord& l, Coord& b, Coord& r, Coord& t) { l = _l; b = _b; r = _r; t = _t; } void PadGraphic::SetBrush (PSBrush* br) { if (_br != br) { Ref(br); Unref(_br); _br = br; invalidateCaches(); } } PSBrush* PadGraphic::GetBrush () { return _br; } void PadGraphic::concatGS (Graphic* g1, Graphic* g2, Graphic* dest) { Graphic::concatGS(g1, g2, dest); dest->SetBrush(GetBrush()); } void PadGraphic::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { float fr, ft; transformRect(float(_l), float(_b), float(_r), float(_t), l, b, fr, ft,gs); cx = (l + fr)/2; cy = (b + ft)/2; tol = 0; } void PadGraphic::draw (Canvas* c, Graphic* gs) { if (!gs->GetBrush()->None()) { update(gs); _p->Rect(c, _l, _b, _r, _t); _p->Line(c, _l, _b, _r, _t); _p->Line(c, _l, _t, _r, _b); } } /**************************************************************************/ ClassId PSPad::GetClassId () { return PS_PAD; } bool PSPad::IsA (ClassId id) {return PS_PAD==id || PostScriptView::IsA(id);} PSPad::PSPad (PadComp* subj) : PostScriptView(subj) { } bool PSPad::Definition (ostream&) { // unimplemented return true; } neuron-7.6.3/src/lib/Unidraw/patcmd.cpp000066400000000000000000000045721340731477100177760ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Pattern command implemention. */ #include #include #include #include #include #include /*****************************************************************************/ ClassId PatternCmd::GetClassId () { return PATTERN_CMD; } bool PatternCmd::IsA (ClassId id) { return PATTERN_CMD == id || Command::IsA(id); } PatternCmd::PatternCmd (ControlInfo* c, PSPattern* pat) : Command(c) { _pat = pat; } PatternCmd::PatternCmd (Editor* ed, PSPattern* pat) : Command(ed) {_pat = pat;} Command* PatternCmd::Copy () { Command* copy = new PatternCmd(CopyControlInfo(), GetPattern()); InitCopy(copy); return copy; } void PatternCmd::Execute () { PatternVar* _patVar = (PatternVar*) GetEditor()->GetState("PatternVar"); if (_patVar != nil) { _patVar->SetPattern(GetPattern()); } Command::Execute(); } void PatternCmd::Read (istream& in) { Command::Read(in); _pat = unidraw->GetCatalog()->ReadPattern(in); } void PatternCmd::Write (ostream& out) { Command::Write(out); unidraw->GetCatalog()->WritePattern(GetPattern(), out); } neuron-7.6.3/src/lib/Unidraw/path.cpp000066400000000000000000000046301340731477100174550ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Path implementation. */ #include #include #include /*****************************************************************************/ inline int Hash (Connector* c) { return ((long) c) % SLOTS; } inline void* Elem (UList* u) { return (*u)(); } static UList* Copy (UList* ulist) { UList* copy = nil; if (ulist != nil) { copy = new UList; for (UList* u = ulist->First(); u != ulist->End(); u = u->Next()) { copy->Append(new UList(Elem(u))); } } return copy; } /*****************************************************************************/ Path::Path (Path* path) { Memory::zero(_slot, sizeof(void*) * SLOTS); if (path != nil) { for (int i = 0; i < SLOTS; ++i) { _slot[i] = Copy(path->_slot[i]); } } } Path::~Path () { for (int i = 0; i < SLOTS; ++i) { delete _slot[i]; } } void Path::Visit (Connector* c) { int n = Hash(c); if (_slot[n] == nil) { _slot[n] = new UList; } _slot[n]->Append(new UList(c)); } bool Path::Visited (Connector* c) { int n = Hash(c); UList* slot = _slot[n]; return (slot == nil) ? false : slot->Find(c) != nil; } neuron-7.6.3/src/lib/Unidraw/picture.cpp000066400000000000000000000243261340731477100202000ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Picture class implementation. A Picture is a Graphic that contains other * Graphics. */ #include #include #include #include #include /*****************************************************************************/ Picture::Picture (Graphic* gr) : FullGraphic(gr) { _extent = nil; _kids = new UList(); } Picture::~Picture () { while (!_kids->IsEmpty()) { UList* cur = _kids->First(); _kids->Remove(cur); Graphic* g = graphic(cur); delete g; delete cur; } delete _kids; uncacheExtent(); } void Picture::First (Iterator& i) { i.SetValue(_kids->First()); } void Picture::Last (Iterator& i) { i.SetValue(_kids->Last()); } void Picture::Next (Iterator& i) { i.SetValue(Elem(i)->Next()); } void Picture::Prev (Iterator& i) { i.SetValue(Elem(i)->Prev()); } bool Picture::Done (Iterator i) { return Elem(i) == _kids->End(); } bool Picture::IsEmpty () { return _kids->IsEmpty(); } Graphic* Picture::GetGraphic (Iterator i) { return graphic(Elem(i)); } void Picture::SetGraphic (Graphic* g, Iterator& i) { i.SetValue(_kids->Find(g)); } void Picture::Append (Graphic* g0, Graphic* g1, Graphic* g2, Graphic* g3) { invalidateCachesGraphic(g0); _kids->Append(new UList(g0)); setParent(g0, this); if (g1 != nil) { invalidateCachesGraphic(g1); _kids->Append(new UList(g1)); setParent(g1, this); } if (g2 != nil) { invalidateCachesGraphic(g2); _kids->Append(new UList(g2)); setParent(g2, this); } if (g3 != nil) { invalidateCachesGraphic(g3); _kids->Append(new UList(g3)); setParent(g3, this); } uncacheExtent(); uncacheParents(); } void Picture::Prepend (Graphic* g0, Graphic* g1, Graphic* g2, Graphic* g3) { if (g3 != nil) { invalidateCachesGraphic(g3); _kids->Prepend(new UList(g3)); setParent(g3, this); } if (g2 != nil) { invalidateCachesGraphic(g2); _kids->Prepend(new UList(g2)); setParent(g2, this); } if (g1 != nil) { invalidateCachesGraphic(g1); _kids->Prepend(new UList(g1)); setParent(g1, this); } invalidateCachesGraphic(g0); _kids->Prepend(new UList(g0)); setParent(g0, this); uncacheExtent(); uncacheParents(); } void Picture::InsertBefore (Iterator i, Graphic* g) { invalidateCachesGraphic(g); Elem(i)->Append(new UList(g)); setParent(g, this); uncacheExtent(); uncacheParents(); } void Picture::InsertAfter (Iterator i, Graphic* g) { invalidateCachesGraphic(g); Elem(i)->Prepend(new UList(g)); setParent(g, this); uncacheExtent(); uncacheParents(); } void Picture::Remove (Graphic* g) { unsetParent(g); _kids->Delete(g); uncacheExtent(); uncacheParents(); } void Picture::Remove (Iterator& i) { UList* doomed = Elem(i); Graphic* g = graphic(doomed); Next(i); unsetParent(g); _kids->Remove(doomed); delete doomed; uncacheExtent(); uncacheParents(); } Graphic* Picture::FirstGraphicContaining (PointObj& pt) { Iterator i; for (First(i); !Done(i); Next(i)) { Graphic* subgr = GetGraphic(i); if (subgr->Contains(pt)) { return subgr; } } return nil; } Graphic* Picture::LastGraphicContaining (PointObj& pt) { Iterator i; for (Last(i); !Done(i); Prev(i)) { Graphic* subgr = GetGraphic(i); if (subgr->Contains(pt)) { return subgr; } } return nil; } Graphic* Picture::FirstGraphicIntersecting (BoxObj& b) { Iterator i; for (First(i); !Done(i); Next(i)) { Graphic* subgr = GetGraphic(i); if (subgr->Intersects(b)) { return subgr; } } return nil; } Graphic* Picture::LastGraphicIntersecting (BoxObj& b) { Iterator i; for (Last(i); !Done(i); Prev(i)) { Graphic* subgr = GetGraphic(i); if (subgr->Intersects(b)) { return subgr; } } return nil; } Graphic* Picture::FirstGraphicWithin (BoxObj& userb) { Iterator i; BoxObj b; for (First(i); !Done(i); Next(i)) { Graphic* subgr = GetGraphic(i); subgr->GetBox(b); if (b.Within(userb)) { return subgr; } } return nil; } Graphic* Picture::LastGraphicWithin (BoxObj& userb) { Iterator i; BoxObj b; for (Last(i); !Done(i); Prev(i)) { Graphic* subgr = GetGraphic(i); subgr->GetBox(b); if (b.Within(userb)) { return subgr; } } return nil; } void Picture::Bequeath () { Iterator i; for (First(i); !Done(i); Next(i)) { Graphic* gr = GetGraphic(i); concatGraphic(gr, gr, this, gr); } FullGraphic null; *((Graphic*) this) = null; } Graphic* Picture::Copy () { Iterator i; Picture* newPicture = new Picture(this); for (First(i); !Done(i); Next(i)) { newPicture->Append(GetGraphic(i)->Copy()); } return newPicture; } Graphic* Picture::graphic(UList* r) { return (Graphic*) (*r)(); } UList* Picture::Elem (Iterator i) { return (UList*) i.GetValue(); } void Picture::draw (Canvas* c, Graphic* gs) { Iterator i; FullGraphic gstemp; Transformer ttemp; gstemp.SetTransformer(&ttemp); for (First(i); !Done(i); Next(i)) { Graphic* gr = GetGraphic(i); concatGraphic(gr, gr, gs, &gstemp); drawGraphic(gr, c, &gstemp); } gstemp.SetTransformer(nil); /* to avoid deleting ttemp explicitly */ } void Picture::drawClipped ( Canvas* c, Coord l, Coord b, Coord r, Coord t, Graphic* gs ) { BoxObj box, clipBox(l, b, r, t); getBox(box, gs); if (clipBox.Intersects(box)) { Iterator i; FullGraphic gstemp; Transformer ttemp; gstemp.SetTransformer(&ttemp); for (First(i); !Done(i); Next(i)) { Graphic* gr = GetGraphic(i); concatGraphic(gr, gr, gs, &gstemp); drawClippedGraphic(gr, c, l, b, r, t, &gstemp); } gstemp.SetTransformer(nil); /* to avoid deleting ttemp explicitly */ } } void Picture::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { Extent e; float right, top, dummy1, dummy2; if (extentCached()) { getCachedExtent(e._left, e._bottom, e._cx, e._cy, e._tol); } else { if (IsEmpty()) { l = b = cx = cy = tol = 0.0; return; } else { Iterator i; FullGraphic gstemp; Transformer ttemp; Extent te; gstemp.SetTransformer(&ttemp); First(i); Graphic* gr = GetGraphic(i); concatGSGraphic(gr, gr, gs, &gstemp); concatTransformerGraphic(gr, nil, gr->GetTransformer(), &ttemp); getExtentGraphic(gr, e._left,e._bottom,e._cx,e._cy,e._tol,&gstemp); for (Next(i); !Done(i); Next(i)) { gr = GetGraphic(i); concatGSGraphic(gr, gr, gs, &gstemp); concatTransformerGraphic(gr,nil, gr->GetTransformer(), &ttemp); getExtentGraphic( gr, te._left, te._bottom, te._cx, te._cy, te._tol, &gstemp ); e.Merge(te); } cacheExtent(e._left, e._bottom, e._cx, e._cy, e._tol); gstemp.SetTransformer(nil); // to avoid deleting ttemp explicitly } } right = 2*e._cx - e._left; top = 2*e._cy - e._bottom; transformRect(e._left, e._bottom, right, top, l, b, dummy1, dummy2, gs); transform(e._cx, e._cy, cx, cy, gs); tol = e._tol; } bool Picture::contains (PointObj& po, Graphic* gs) { if (!IsEmpty()) { Iterator i; FullGraphic gstemp; Transformer ttemp; BoxObj b; getBox(b, gs); if (b.Contains(po)) { gstemp.SetTransformer(&ttemp); for (First(i); !Done(i); Next(i)) { Graphic* gr = GetGraphic(i); concatGraphic(gr, gr, gs, &gstemp); if (containsGraphic(gr, po, &gstemp)) { gstemp.SetTransformer(nil); return true; } } gstemp.SetTransformer(nil); /* to avoid deleting ttemp explicitly*/ } } return false; } bool Picture::intersects (BoxObj& userb, Graphic* gs) { if (!IsEmpty()) { Iterator i; FullGraphic gstemp; Transformer ttemp; BoxObj b; getBox(b, gs); if (b.Intersects(userb)) { gstemp.SetTransformer(&ttemp); for (First(i); !Done(i); Next(i)) { Graphic* gr = GetGraphic(i); concatGraphic(gr, gr, gs, &gstemp); if (intersectsGraphic(gr, userb, &gstemp)) { gstemp.SetTransformer(nil); return true; } } gstemp.SetTransformer(nil); /* to avoid deleting ttemp explicitly*/ } } return false; } void Picture::getCachedExtent ( float& l, float& b, float& cx, float& cy, float& tol ) { l = _extent->_left; b = _extent->_bottom; cx = _extent->_cx; cy = _extent->_cy; tol = _extent->_tol; } bool Picture::extentCached () { return _caching && _extent != nil; } void Picture::cacheExtent (float l, float b, float cx, float cy, float tol) { if (_caching) { uncacheExtent(); _extent = new Extent(l, b, cx, cy, tol); } } void Picture::uncacheExtent () { delete _extent; _extent = nil; } void Picture::uncacheChildren () { register UList* i; Graphic* subgr; for (i = _kids->First(); i != _kids->End(); i = i->Next()) { subgr = graphic(i); uncacheExtentGraphic(subgr); uncacheChildrenGraphic(subgr); } } neuron-7.6.3/src/lib/Unidraw/pin.cpp000066400000000000000000000317161340731477100173140ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Pin component definitions. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ ClassId PinComp::GetClassId () { return PIN_COMP; } bool PinComp::IsA (ClassId id) { return PIN_COMP == id || Connector::IsA(id); } Component* PinComp::Copy () { PinComp* copy = new PinComp((PinGraphic*) GetGraphic()->Copy()); copy->_mobility = _mobility; return copy; } PinComp::PinComp (PinGraphic* graphic) : Connector(graphic) { _mobility = Fixed; } void PinComp::Interpret (Command* cmd) { if ( cmd->IsA(MOVE_CMD) || cmd->IsA(BRUSH_CMD) || cmd->IsA(ALIGN_CMD) || cmd->IsA(MOBILITY_CMD) || cmd->IsA(DELETE_CMD) || cmd->IsA(CUT_CMD) || cmd->IsA(GROUP_CMD) || cmd->IsA(FRONT_CMD) || cmd->IsA(BACK_CMD) ) { Connector::Interpret(cmd); } } void PinComp::Uninterpret (Command* cmd) { if ( cmd->IsA(MOVE_CMD) || cmd->IsA(BRUSH_CMD) || cmd->IsA(ALIGN_CMD) || cmd->IsA(MOBILITY_CMD) || cmd->IsA(DELETE_CMD) || cmd->IsA(CUT_CMD) || cmd->IsA(GROUP_CMD) || cmd->IsA(FRONT_CMD) || cmd->IsA(BACK_CMD) ) { Connector::Uninterpret(cmd); } } void PinComp::Connect (Connector* target, CGlue* g) { float l, b, r, t; if (target->IsA(PIN_COMP)) { csolver->Connect(this, target, g); Connector::Connect(target, g); } else if (target->IsA(HSLOT_COMP)) { Graphic* peergr = target->GetGraphic(); peergr->GetBounds(l, b, r, t); float h = (r - l)/2; CGlue slotGlue(0, 0, h*hfil, h*hfil, 0, 0, h, h, 0, 0); slotGlue.Interpose(g); csolver->Connect(this, target, &slotGlue); Connector::Connect(target, &slotGlue); } else if (target->IsA(VSLOT_COMP)) { Graphic* peergr = target->GetGraphic(); peergr->GetBounds(l, b, r, t); float v = (t - b)/2; CGlue slotGlue(0, 0, 0, 0, v*vfil, v*vfil, 0, 0, v, v); slotGlue.Interpose(g); csolver->Connect(this, target, &slotGlue); Connector::Connect(target, &slotGlue); } else if (target->IsA(PAD_COMP)) { Graphic* peergr = target->GetGraphic(); peergr->GetBounds(l, b, r, t); float h = (r - l)/2; float v = (t - b)/2; CGlue padGlue(0, 0, h*hfil, h*hfil, v*vfil, v*vfil, h, h, v, v); padGlue.Interpose(g); csolver->Connect(this, target, &padGlue); Connector::Connect(target, &padGlue); } } void PinComp::SetMobility (Mobility m) { _mobility = m; } Mobility PinComp::GetMobility () { return _mobility; } PinGraphic* PinComp::GetPin () { return (PinGraphic*) GetGraphic(); } void PinComp::Read (istream& in) { Connector::Read(in); Coord x0, y0; int mobility; in >> x0 >> y0 >> mobility; PinGraphic* pin = new PinGraphic(x0, y0); _mobility = Mobility(mobility); pin->FillBg(ReadBgFilled(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); pin->SetColors(fg, bg); pin->SetBrush(ReadBrush(in)); Transformer* t = ReadTransformer(in); pin->SetTransformer(t); Unref(t); SetGraphic(pin); } void PinComp::Write (ostream& out) { Connector::Write(out); PinGraphic* pin = GetPin(); Coord x0, y0; int mobility = _mobility; pin->GetOriginal(x0, y0); out << x0 << " " << y0 << " " << mobility << " "; WriteBgFilled(pin->BgFilled(), out); WriteColor(pin->GetFgColor(), out); WriteColor(pin->GetBgColor(), out); WriteBrush(pin->GetBrush(), out); WriteTransformer(pin->GetTransformer(), out); } /*****************************************************************************/ PinComp* PinView::GetPinComp () { return (PinComp*) GetSubject(); } ClassId PinView::GetClassId () { return PIN_VIEW; } bool PinView::IsA (ClassId id) { return PIN_VIEW == id || ConnectorView::IsA(id); } PinView::PinView (PinComp* subj) : ConnectorView(subj) { } PinGraphic* PinView::GetPin () { return (PinGraphic*) GetGraphic(); } void PinView::Interpret (Command* cmd) { if (cmd->IsA(ALIGNTOGRID_CMD)) { float cx, cy; GetGraphic()->GetCenter(cx, cy); ((AlignToGridCmd*) cmd)->Align(this, cx, cy); } else { ConnectorView::Interpret(cmd); } } void PinView::Update () { PinGraphic* pin = GetPin(); Graphic* pingr = pin; IncurDamage(pin); *pingr = *GetPinComp()->GetGraphic(); IncurDamage(pin); EraseHandles(); } Manipulator* PinView::CreateGraphicCompManip ( Viewer* v, Event& e, Transformer* rel, Tool* tool ) { GraphicView* views = v->GetGraphicView(); Selection* s = v->GetSelection(); SlidingPin* sp; Coord cx = 0, rad = PIN_RAD, dum1 = 0, dum2 = 0; s->Clear(); if (rel != nil) { rel->Transform(cx, dum1); rel->Transform(rad, dum2); rad = abs(rad - cx); } v->Constrain(e.x, e.y); sp = new SlidingPin(nil, nil, e.x, e.y, rad, e.x, e.y); return new DragManip(v, sp, rel, tool, Gravity); } Manipulator* PinView::CreateConnectManip ( Viewer* v, Event& e, Transformer* rel, Tool* tool ) { GraphicView* views = v->GetGraphicView(); Selection* s = v->GetSelection(); RubberGroup* rg = new RubberGroup(nil, nil); Coord cx = 0, rad = PIN_RAD, dum1 = 0, dum2 = 0; s->Clear(); if (rel != nil) { rel->Transform(cx, dum1); rel->Transform(rad, dum2); rad = abs(rad - cx); } rg->Append( new SlidingPin(nil, nil, e.x, e.y, rad, e.x, e.y), new RubberLine(nil, nil, e.x, e.y, e.x, e.y) ); return new ConnectManip(v, rg, rel, tool); } Manipulator* PinView::CreateManipulator ( Viewer* v, Event& e, Transformer* rel, Tool* tool ) { Manipulator* manip = nil; if (tool->IsA(GRAPHIC_COMP_TOOL)) { manip = CreateGraphicCompManip(v, e, rel, tool); } else if (tool->IsA(MOVE_TOOL)) { manip = GraphicView::CreateManipulator(v, e, rel, tool); } else if (tool->IsA(CONNECT_TOOL)) { manip = CreateConnectManip(v, e, rel, tool); } return manip; } inline void GetOffset (Transformer* t, Coord x, Coord y, float& dx, float& dy){ t->InvTransform(float(x), float(y), dx, dy); dx -= x; dy -= y; } Command* PinView::InterpGraphicCompManip (Manipulator* m) { DragManip* dm = (DragManip*) m; Editor* ed = dm->GetViewer()->GetEditor(); BrushVar* brVar = (BrushVar*) ed->GetState("Brush"); SlidingPin* sp = (SlidingPin*) dm->GetRubberband(); Transformer* rel = dm->GetTransformer(); Coord px, py, dum; float dx, dy; PinGraphic* pinGraphic; sp->GetCurrent(px, py, dum, dum); if (rel != nil) { GetOffset(rel, px, py, dx, dy); rel = new Transformer; rel->Translate(dx, dy); } Graphic* pg = GetGraphicComp()->GetGraphic(); pinGraphic = new PinGraphic(px, py, pg); if (brVar != nil) pinGraphic->SetBrush(brVar->GetBrush()); pinGraphic->SetTransformer(rel); Unref(rel); return new PasteCmd(ed, new Clipboard(NewSubject(pinGraphic))); } PinComp* PinView::NewSubject (PinGraphic* pingr) { return new PinComp(pingr); } Command* PinView::InterpConnectManip (Manipulator* m) { Editor* ed = m->GetViewer()->GetEditor(); ConnectManip* cm = (ConnectManip*) m; ConnectorView* target = cm->GetTarget(); Command* cmd = nil; if (target != nil) { cmd = new ConnectCmd(ed, GetConnector(), target->GetConnector()); } return cmd; } Command* PinView::InterpretManipulator (Manipulator* m) { DragManip* dm = (DragManip*) m; Tool* tool = dm->GetTool(); Command* cmd = nil; if (tool->IsA(GRAPHIC_COMP_TOOL)) { cmd = InterpGraphicCompManip(m); } else if (tool->IsA(MOVE_TOOL)) { cmd = GraphicView::InterpretManipulator(m); } else if (tool->IsA(CONNECT_TOOL)) { cmd = InterpConnectManip(m); } return cmd; } Graphic* PinView::GetGraphic () { Graphic* graphic = GraphicView::GetGraphic(); if (graphic == nil) { PinComp* pinComp = GetPinComp(); graphic = pinComp->GetGraphic()->Copy(); SetGraphic(graphic); } return graphic; } /*****************************************************************************/ PinGraphic::PinGraphic (Coord x, Coord y, Graphic* gr) : Graphic(gr) { _x = x; _y = y; _br = nil; if (gr != nil) { PinGraphic::SetBrush(gr->GetBrush()); } } PinGraphic::~PinGraphic () { Unref(_br); } Graphic* PinGraphic::Copy () { return new PinGraphic(_x, _y, this); } void PinGraphic::GetOriginal (Coord& x, Coord& y) { x = _x; y = _y; } void PinGraphic::SetBrush (PSBrush* br) { if (_br != br) { Ref(br); Unref(_br); _br = br; invalidateCaches(); } } PSBrush* PinGraphic::GetBrush () { return _br; } void PinGraphic::concatGS (Graphic* g1, Graphic* g2, Graphic* dest) { Graphic::concatGS(g1, g2, dest); dest->SetBrush(GetBrush()); } void PinGraphic::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { float fx = float(_x), fy = float(_y), rx, ry, rad; transform(fx - PIN_RAD, fy, rx, ry, gs); transform(fx, fy, cx, cy, gs); rad = sqrt(square(rx - cx) + square(ry - cy)); l = cx - rad; b = cy - rad; tol = 0; } void PinGraphic::draw (Canvas* c, Graphic* gs) { if (!gs->GetBrush()->None()) { update(gs); _p->Circle(c, _x, _y, PIN_RAD); _p->Line(c, _x, _y - PIN_RAD, _x, _y + PIN_RAD); _p->Line(c, _x - PIN_RAD, _y, _x + PIN_RAD, _y); } } /**************************************************************************/ ClassId PSPin::GetClassId () { return PS_PIN; } bool PSPin::IsA (ClassId id) {return PS_PIN==id || PostScriptView::IsA(id);} PSPin::PSPin (PinComp* subj) : PostScriptView(subj) { } bool PSPin::Definition (ostream&) { // unimplemented return true; } /**************************************************************************/ SlidingPin::SlidingPin ( Painter* p, Canvas* c, Coord cx, Coord cy, int r, Coord rfx, Coord rfy ) : SlidingEllipse(p, c, cx, cy, r, r, rfx, rfy) { } void SlidingPin::Draw () { Coord cx, cy, rx, ry, xr, yr; if (!drawn) { GetCurrent(cx, cy, rx, ry); CurrentRadii(xr, yr); cx += offx; cy += offy; output->Ellipse(canvas, cx, cy, xr, yr); output->Line(canvas, cx, cy - yr, cx, cy + yr); output->Line(canvas, cx - xr, cy, cx + xr, cy); drawn = true; } } /**************************************************************************/ FixedPin::FixedPin ( Painter* p, Canvas* c, Coord x, Coord y, int r ) : Rubberband(p, c, 0, 0) { _cx = x; _cy = y; _rad = r; } void FixedPin::GetOriginal (Coord& x, Coord& y, int& r) { x = _cx; y = _cy; r = _rad; } void FixedPin::Draw () { if (!drawn) { output->Circle(canvas, _cx, _cy, _rad); output->Line(canvas, _cx, _cy - _rad, _cx, _cy + _rad); output->Line(canvas, _cx - _rad, _cy, _cx + _rad, _cy); drawn = true; } } neuron-7.6.3/src/lib/Unidraw/polygon.cpp000066400000000000000000000160371340731477100202140ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Polygon component definitions. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /****************************************************************************/ ClassId PolygonComp::GetClassId () { return POLYGON_COMP; } bool PolygonComp::IsA (ClassId id) { return POLYGON_COMP == id || VerticesComp::IsA(id); } Component* PolygonComp::Copy () { return new PolygonComp((SF_Polygon*) GetGraphic()->Copy()); } PolygonComp::PolygonComp (SF_Polygon* graphic) : VerticesComp(graphic) { } SF_Polygon* PolygonComp::GetPolygon () { return (SF_Polygon*) GetGraphic(); } void PolygonComp::Read (istream& in) { VerticesComp::Read(in); Coord* x, *y; int count; ReadVertices(in, x, y, count); SF_Polygon* poly = new SF_Polygon(x, y, count); delete x; delete y; poly->FillBg(ReadBgFilled(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); poly->SetColors(fg, bg); poly->SetBrush(ReadBrush(in)); poly->SetPattern(ReadPattern(in)); Transformer* t = ReadTransformer(in); poly->SetTransformer(t); Unref(t); SetGraphic(poly); } void PolygonComp::Write (ostream& out) { VerticesComp::Write(out); SF_Polygon* poly = GetPolygon(); const Coord* x, *y; int count = poly->GetOriginal(x, y); WriteVertices(x, y, count, out); WriteBgFilled(poly->BgFilled(), out); WriteColor(poly->GetFgColor(), out); WriteColor(poly->GetBgColor(), out); WriteBrush(poly->GetBrush(), out); WritePattern(poly->GetPattern(), out); WriteTransformer(poly->GetTransformer(), out); } /****************************************************************************/ PolygonView::PolygonView (PolygonComp* subj) : VerticesView(subj) { } PolygonComp* PolygonView::GetPolygonComp () { return (PolygonComp*) GetSubject(); } ClassId PolygonView::GetClassId () { return POLYGON_VIEW; } bool PolygonView::IsA (ClassId id) { return POLYGON_VIEW == id || VerticesView::IsA(id); } bool PolygonView::VertexChanged () { SF_Polygon* gview = (SF_Polygon*) GetGraphic(); SF_Polygon* gsubj = (SF_Polygon*) GetPolygonComp()->GetGraphic(); return *gview != *gsubj; } Manipulator* PolygonView::CreateManipulator ( Viewer* v, Event& e, Transformer* rel, Tool* tool ) { Manipulator* m = nil; if (tool->IsA(GRAPHIC_COMP_TOOL)) { v->Constrain(e.x, e.y); Coord x[1], y[1]; x[0] = e.x; y[0] = e.y; GrowingVertices* rub = new GrowingPolygon( nil, nil, x, y, 1, -1, HANDLE_SIZE ); m = new VertexManip( v, rub, rel, tool, DragConstraint(HorizOrVert | Gravity) ); } else if (tool->IsA(RESHAPE_TOOL)) { Coord* x, *y; int n; v->Constrain(e.x, e.y); GetVertices(x, y, n); GrowingPolygon* rub = new GrowingPolygon( nil, nil, x, y, n, ClosestPoint(x, y, n, e.x, e.y), HANDLE_SIZE ); delete x; delete y; m = new VertexManip( v, rub, rel, tool, DragConstraint(HorizOrVert | Gravity) ); } else { m = VerticesView::CreateManipulator(v, e, rel, tool); } return m; } Command* PolygonView::InterpretManipulator (Manipulator* m) { DragManip* dm = (DragManip*) m; Editor* ed = dm->GetViewer()->GetEditor(); Tool* tool = dm->GetTool(); Transformer* rel = dm->GetTransformer(); Command* cmd = nil; if (tool->IsA(GRAPHIC_COMP_TOOL)) { GrowingVertices* gv = (GrowingVertices*) dm->GetRubberband(); Coord* x, *y; int n, pt; gv->GetCurrent(x, y, n, pt); if (n > 2 || x[0] != x[1] || y[0] != y[1]) { BrushVar* brVar = (BrushVar*) ed->GetState("BrushVar"); PatternVar* patVar = (PatternVar*) ed->GetState("PatternVar"); ColorVar* colVar = (ColorVar*) ed->GetState("ColorVar"); if (rel != nil) { rel = new Transformer(rel); rel->Invert(); } Graphic* pg = GetGraphicComp()->GetGraphic(); SF_Polygon* polygon = new SF_Polygon(x, y, n, pg); if (brVar != nil) polygon->SetBrush(brVar->GetBrush()); if (patVar != nil) polygon->SetPattern(patVar->GetPattern()); if (colVar != nil) { polygon->SetColors(colVar->GetFgColor(), colVar->GetBgColor()); } polygon->SetTransformer(rel); Unref(rel); cmd = new PasteCmd(ed, new Clipboard(new PolygonComp(polygon))); } delete x; delete y; } else if (tool->IsA(RESHAPE_TOOL)) { GrowingVertices* gv = (GrowingVertices*) dm->GetRubberband(); Coord* x, *y; int n, pt; gv->RemoveVertex(); gv->GetCurrent(x, y, n, pt); if (rel != nil) { rel = new Transformer(rel); rel->Invert(); } SF_Polygon* polygon = new SF_Polygon(x, y, n, GetGraphic()); delete x; delete y; polygon->SetTransformer(rel); Unref(rel); cmd = new ReplaceCmd(ed, new PolygonComp(polygon)); } else { cmd = VerticesView::InterpretManipulator(m); } return cmd; } /*****************************************************************************/ ClassId PSPolygon::GetClassId () { return PS_POLYGON; } bool PSPolygon::IsA (ClassId id) { return PS_POLYGON == id || PSVertices::IsA(id); } PSPolygon::PSPolygon (PolygonComp* subj) : PSVertices(subj) { } const char* PSPolygon::Name () { return "Poly"; } neuron-7.6.3/src/lib/Unidraw/polygons.cpp000066400000000000000000000312011340731477100203650ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of Rectangles and Polygons, objects derived from Graphic. */ #include #include #include #include #include /*****************************************************************************/ Rect::Rect (Coord x0, Coord y0, Coord x1, Coord y1, Graphic* gr) : Graphic(gr){ _x0 = min(x0, x1); _y0 = min(y0, y1); _x1 = max(x0, x1); _y1 = max(y0, y1); } void Rect::GetOriginal (Coord& x0, Coord& y0, Coord& x1, Coord& y1) { x0 = _x0; y0 = _y0; x1 = _x1; y1 = _y1; } void Rect::s_getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { float width, dummy1, dummy2; width = float(gs->GetBrush()->Width()); tol = (width > 1) ? width/2 : 0; transformRect(_x0, _y0, _x1, _y1, l, b, dummy1, dummy2, gs); transform(float(_x0+_x1)/2, float(_y0+_y1)/2, cx, cy, gs); } void Rect::f_getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ){ float dummy1, dummy2; transformRect(_x0, _y0, _x1, _y1, l, b, dummy1, dummy2, gs); transform(float(_x0+_x1)/2, float(_y0+_y1)/2, cx, cy, gs); tol = 0; } bool Rect::s_contains (PointObj& po, Graphic* gs) { PointObj pt (&po); invTransform(pt._x, pt._y, gs); return ( ((pt._x == _x0 || pt._x == _x1) && _y0 <= pt._y && pt._y <= _y1) || ((pt._y == _y0 || pt._y == _y1) && _x0 <= pt._x && pt._x <= _x1) ); } bool Rect::f_contains (PointObj& po, Graphic* gs) { PointObj pt (&po); invTransform(pt._x, pt._y, gs); BoxObj b (_x0, _y0, _x1, _y1); return b.Contains(pt); } bool Rect::s_intersects (BoxObj& userb, Graphic* gs) { Coord x[4], tx[5]; Coord y[4], ty[5]; x[0] = x[3] = _x0; y[0] = y[1] = _y0; x[2] = x[1] = _x1; y[2] = y[3] = _y1; transformList(x, y, 4, tx, ty, gs); tx[4] = tx[0]; ty[4] = ty[0]; MultiLineObj ml (tx, ty, 5); return ml.Intersects(userb) || ml.Within(userb); } bool Rect::f_intersects (BoxObj& userb, Graphic* gs) { Transformer* t = gs->GetTransformer(); Coord tx0, ty0, tx1, ty1; if (t != nil && t->Rotated()) { Coord x[4], tx[5]; Coord y[4], ty[5]; x[0] = x[3] = _x0; y[0] = y[1] = _y0; x[2] = x[1] = _x1; y[2] = y[3] = _y1; transformList(x, y, 4, tx, ty, gs); tx[4] = tx[0]; ty[4] = ty[0]; FillPolygonObj fp (tx, ty, 5); return fp.Intersects(userb); } else if (t != nil) { t->Transform(_x0, _y0, tx0, ty0); t->Transform(_x1, _y1, tx1, ty1); BoxObj b1 (tx0, ty0, tx1, ty1); return b1.Intersects(userb); } else { BoxObj b2 (_x0, _y0, _x1, _y1); return b2.Intersects(userb); } } /*****************************************************************************/ S_Rect::S_Rect ( Coord x0, Coord y0, Coord x1, Coord y1, Graphic* gr ) : Rect(x0, y0, x1, y1, gr) { _br = nil; if (gr != nil) { S_Rect::SetBrush(gr->GetBrush()); } } S_Rect::~S_Rect () { Unref(_br); } void S_Rect::SetBrush (PSBrush* br) { if (_br != br) { Ref(br); Unref(_br); _br = br; invalidateCaches(); } } PSBrush* S_Rect::GetBrush () { return _br; } Graphic* S_Rect::Copy () { return new S_Rect(_x0, _y0, _x1, _y1, this); } void S_Rect::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { s_getExtent(l, b, cx, cy, tol, gs); } bool S_Rect::contains (PointObj& po, Graphic* gs) { return s_contains(po, gs); } bool S_Rect::intersects (BoxObj& userb, Graphic* gs) { return s_intersects(userb, gs); } void S_Rect::draw (Canvas *c, Graphic* gs) { if (!gs->GetBrush()->None()) { update(gs); _p->Rect(c, _x0, _y0, _x1, _y1); } } /*****************************************************************************/ F_Rect::F_Rect ( Coord x0, Coord y0, Coord x1, Coord y1, Graphic* gr ) : Rect(x0, y0, x1, y1, gr) { _pat = nil; if (gr != nil) { F_Rect::SetPattern(gr->GetPattern()); } } F_Rect::~F_Rect () { Unref(_pat); } void F_Rect::SetPattern (PSPattern* pat) { Ref(pat); Unref(_pat); _pat = pat; } PSPattern* F_Rect::GetPattern () { return _pat; } Graphic* F_Rect::Copy () { return new F_Rect(_x0, _y0, _x1, _y1, this); } void F_Rect::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { f_getExtent(l, b, cx, cy, tol, gs); } bool F_Rect::contains (PointObj& po, Graphic* gs) { return !gs->GetPattern()->None() && f_contains(po, gs); } bool F_Rect::intersects (BoxObj& userb, Graphic* gs) { return !gs->GetPattern()->None() && f_intersects(userb, gs); } void F_Rect::draw (Canvas *c, Graphic* gs) { if (!gs->GetPattern()->None()) { update(gs); _p->FillRect(c, _x0, _y0, _x1, _y1); } } /*****************************************************************************/ SF_Rect::SF_Rect ( Coord x0, Coord y0, Coord x1, Coord y1, Graphic* gr ) : Rect(x0, y0, x1, y1, gr) { _br = nil; _pat = nil; if (gr != nil) { SF_Rect::SetBrush(gr->GetBrush()); SF_Rect::SetPattern(gr->GetPattern()); } } SF_Rect::~SF_Rect () { Unref(_br); Unref(_pat); } void SF_Rect::SetBrush (PSBrush* br) { if (_br != br) { Ref(br); Unref(_br); _br = br; invalidateCaches(); } } PSBrush* SF_Rect::GetBrush () { return _br; } void SF_Rect::SetPattern (PSPattern* pat) { Ref(pat); Unref(_pat); _pat = pat; } PSPattern* SF_Rect::GetPattern () { return _pat; } Graphic* SF_Rect::Copy () { return new SF_Rect(_x0, _y0, _x1, _y1, this); } void SF_Rect::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { s_getExtent(l, b, cx, cy, tol, gs); } bool SF_Rect::contains (PointObj& po, Graphic* gs) { return (!gs->GetPattern()->None() && f_contains(po, gs)) || s_contains(po, gs); } bool SF_Rect::intersects (BoxObj& userb, Graphic* gs) { return (!gs->GetPattern()->None() && f_intersects(userb, gs)) || s_intersects(userb, gs); } void SF_Rect::draw (Canvas* c, Graphic* gs) { update(gs); if (!gs->GetPattern()->None()) { _p->FillRect(c, _x0, _y0, _x1, _y1); } if (!gs->GetBrush()->None()) { _p->Rect(c, _x0, _y0, _x1, _y1); } } /*****************************************************************************/ Polygon::Polygon ( Coord* x, Coord* y, int count, Graphic* gr ) : Vertices(x, y, count, gr) { } bool Polygon::s_contains (PointObj& po, Graphic* gs) { BoxObj b; PointObj pt (&po); getBox(b, gs); if (b.Contains(pt)) { MultiLineObj ml (_x, _y, _count); LineObj l (_x[_count - 1], _y[_count - 1], *_x, *_y); invTransform(pt._x, pt._y, gs); return ml.Contains(pt) || l.Contains(pt); } return false; } bool Polygon::f_contains (PointObj& po, Graphic* gs) { BoxObj b; PointObj pt (&po); getBox(b, gs); if (b.Contains(pt)) { FillPolygonObj fp (_x, _y, _count); invTransform(pt._x, pt._y, gs); return fp.Contains(pt); } return false; } bool Polygon::s_intersects (BoxObj& userb, Graphic* gs) { Coord* convx, *convy; BoxObj b; bool result = false; getBox(b, gs); if (b.Intersects(userb)) { convx = new Coord[_count+1]; convy = new Coord[_count+1]; transformList(_x, _y, _count, convx, convy, gs); convx[_count] = *convx; convy[_count] = *convy; MultiLineObj ml(convx, convy, _count+1); result = ml.Intersects(userb); delete convx; delete convy; } return result; } bool Polygon::f_intersects (BoxObj& userb, Graphic* gs) { Coord* convx, *convy; BoxObj b; bool result = false; getBox(b, gs); if (b.Intersects(userb)) { convx = new Coord[_count+1]; convy = new Coord[_count+1]; transformList(_x, _y, _count, convx, convy, gs); FillPolygonObj fp (convx, convy, _count); result = fp.Intersects(userb); delete convx; delete convy; } return result; } /*****************************************************************************/ S_Polygon::S_Polygon ( Coord* x, Coord* y, int count, Graphic* gr ) : Polygon(x, y, count, gr) { _br = nil; if (gr != nil) { S_Polygon::SetBrush(gr->GetBrush()); } } S_Polygon::~S_Polygon () { Unref(_br); } void S_Polygon::SetBrush (PSBrush* br) { if (_br != br) { Ref(br); Unref(_br); _br = br; invalidateCaches(); } } PSBrush* S_Polygon::GetBrush () { return _br; } Graphic* S_Polygon::Copy () { return new S_Polygon(_x, _y, _count, this); } void S_Polygon::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { s_getExtent(l, b, cx, cy, tol, gs); } bool S_Polygon::contains (PointObj& po, Graphic* gs) { return s_contains(po, gs); } bool S_Polygon::intersects (BoxObj& userb, Graphic* gs) { return s_intersects(userb, gs); } void S_Polygon::draw (Canvas *c, Graphic* gs) { if (!gs->GetBrush()->None()) { update(gs); _p->Polygon(c, _x, _y, _count); } } /*****************************************************************************/ F_Polygon::F_Polygon ( Coord* x, Coord* y, int count, Graphic* gr ) : Polygon(x, y, count, gr) { _pat = nil; if (gr != nil) { F_Polygon::SetPattern(gr->GetPattern()); } } F_Polygon::~F_Polygon () { Unref(_pat); } void F_Polygon::SetPattern (PSPattern* pat) { Ref(pat); Unref(_pat); _pat = pat; } PSPattern* F_Polygon::GetPattern () { return _pat; } Graphic* F_Polygon::Copy () { return new F_Polygon(_x, _y, _count, this); } void F_Polygon::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { f_getExtent(l, b, cx, cy, tol, gs); } bool F_Polygon::contains (PointObj& po, Graphic* gs) { return !gs->GetPattern()->None() && f_contains(po, gs); } bool F_Polygon::intersects (BoxObj& userb, Graphic* gs) { return !gs->GetPattern()->None() && f_intersects(userb, gs); } void F_Polygon::draw (Canvas *c, Graphic* gs) { if (!gs->GetPattern()->None()) { update(gs); _p->FillPolygon(c, _x, _y, _count); } } /*****************************************************************************/ SF_Polygon::SF_Polygon ( Coord* x, Coord* y, int count, Graphic* gr ) : Polygon(x, y, count, gr) { _br = nil; _pat = nil; if (gr != nil) { SF_Polygon::SetBrush(gr->GetBrush()); SF_Polygon::SetPattern(gr->GetPattern()); } } SF_Polygon::~SF_Polygon () { Unref(_br); Unref(_pat); } void SF_Polygon::SetBrush (PSBrush* br) { if (_br != br) { Ref(br); Unref(_br); _br = br; invalidateCaches(); } } PSBrush* SF_Polygon::GetBrush () { return _br; } void SF_Polygon::SetPattern (PSPattern* pat) { Ref(pat); Unref(_pat); _pat = pat; } PSPattern* SF_Polygon::GetPattern () { return _pat; } Graphic* SF_Polygon::Copy () { return new SF_Polygon(_x, _y, _count, this); } void SF_Polygon::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { s_getExtent(l, b, cx, cy, tol, gs); } bool SF_Polygon::contains (PointObj& po, Graphic* gs) { return (!gs->GetPattern()->None() && f_contains(po, gs)) || s_contains(po, gs); } bool SF_Polygon::intersects (BoxObj& userb, Graphic* gs) { return (!gs->GetPattern()->None() && f_intersects(userb, gs)) || s_intersects(userb, gs); } void SF_Polygon::draw (Canvas *c, Graphic* gs) { update(gs); if (!gs->GetPattern()->None()) { _p->FillPolygon(c, _x, _y, _count); } if (!gs->GetBrush()->None()) { _p->Polygon(c, _x, _y, _count); } } neuron-7.6.3/src/lib/Unidraw/pspaint.cpp000077500000000000000000000067311340731477100202060ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of persistent paint subclasses (nee idraw code). */ #include #include #include #include #include #include #include /*****************************************************************************/ PSBrush::PSBrush () : Brush(0) { _none = true; } PSBrush::PSBrush (int p, int w) : Brush(p, w) { CalcDashPat(p); _linepat = p; _none = false; } int PSBrush::Width () { return _none ? 0 : Brush::Width(); } void PSBrush::CalcDashPat (int pat) { calc_dashes(pat, _dashpat, _dashpatsize); /* needed to make printout look exactly like screen */ if (_dashpatsize & 1) { _dashpat[_dashpatsize++] = 0; } _dashoffset = 0; } /*****************************************************************************/ PSColor::PSColor( ColorIntensity r, ColorIntensity g, ColorIntensity b, const char* name ) : Color(r, g, b) { _name = strnew(name); _r = r; _g = g; _b = b; } PSColor::~PSColor () { delete [] _name; } void PSColor::GetIntensities( ColorIntensity& r, ColorIntensity& g, ColorIntensity& b ) { r = _r; g = _g; b = _b; } /*****************************************************************************/ PSFont::PSFont(const char* name, const char* pf, const char* ps) : Font(name) { _name = strnew(name); _printfont = strnew(pf); _printsize = strnew(ps); _printfontandsize = new char[strlen(_printfont)+1 + strlen(_printsize)+1]; strcpy(_printfontandsize, _printfont); strcat(_printfontandsize, " "); strcat(_printfontandsize, _printsize); _lineHt = atoi(_printsize); } PSFont::~PSFont () { delete [] _name; delete [] _printfont; delete [] _printsize; delete [] _printfontandsize; } /*****************************************************************************/ PSPattern::PSPattern () : Pattern(0xffff) { _graylevel = -1; _size = 0; _none = true; } PSPattern::PSPattern (int dither, float g) : Pattern(dither) { _graylevel = g; _size = 0; _none = false; } PSPattern::PSPattern (const int* data, int s) : Pattern(data) { Memory::copy(data, _data, sizeof(int) * patternHeight); _graylevel = -1; _size = s; _none = false; } neuron-7.6.3/src/lib/Unidraw/psview.cpp000066400000000000000000000737571340731477100200560ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * PostScriptView implementation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ static const int MAXLINELEN = 256; static const char* reencodeISO[] = { "/reencodeISO {", "dup dup findfont dup length dict begin", "{ 1 index /FID ne { def }{ pop pop } ifelse } forall", "/Encoding ISOLatin1Encoding def", "currentdict end definefont", "} def", "", "/ISOLatin1Encoding [", "/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef", "/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef", "/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef", "/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef", "/space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright", "/parenleft/parenright/asterisk/plus/comma/minus/period/slash", "/zero/one/two/three/four/five/six/seven/eight/nine/colon/semicolon", "/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N", "/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright", "/asciicircum/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m", "/n/o/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/asciitilde", "/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef", "/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef", "/.notdef/dotlessi/grave/acute/circumflex/tilde/macron/breve", "/dotaccent/dieresis/.notdef/ring/cedilla/.notdef/hungarumlaut", "/ogonek/caron/space/exclamdown/cent/sterling/currency/yen/brokenbar", "/section/dieresis/copyright/ordfeminine/guillemotleft/logicalnot", "/hyphen/registered/macron/degree/plusminus/twosuperior/threesuperior", "/acute/mu/paragraph/periodcentered/cedilla/onesuperior/ordmasculine", "/guillemotright/onequarter/onehalf/threequarters/questiondown", "/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla", "/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex", "/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis", "/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute", "/Thorn/germandbls/agrave/aacute/acircumflex/atilde/adieresis", "/aring/ae/ccedilla/egrave/eacute/ecircumflex/edieresis/igrave", "/iacute/icircumflex/idieresis/eth/ntilde/ograve/oacute/ocircumflex", "/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex/udieresis", "/yacute/thorn/ydieresis", "] def", nil }; /*****************************************************************************/ ClassId PostScriptView::GetClassId () { return POSTSCRIPT_VIEW; } bool PostScriptView::IsA (ClassId id) { return POSTSCRIPT_VIEW == id || PreorderView::IsA(id); } PostScriptView::PostScriptView (GraphicComp* subj) : PreorderView(subj) { _fonts = nil; } GraphicComp* PostScriptView::GetGraphicComp () { return (GraphicComp*) GetSubject(); } static Transformer* SaveTransformer (Graphic* g) { Transformer* orig = g->GetTransformer(); Ref(orig); g->SetTransformer(new Transformer(orig)); return orig; } static void RestoreTransformer (Graphic* g, Transformer* orig) { g->SetTransformer(orig); Unref(orig); } // ScaleToPostscriptCoords scales the picture to Postscript // coordinates if screen and Postscript inches are different. static void ScaleToPostScriptCoords (Graphic* g) { const double ps_inch = 72.; if (inch != ps_inch) { double factor = ps_inch / inch; g->Scale(factor, factor); } } bool PostScriptView::Emit (ostream& out) { SetPSFonts(); Graphic* g = GetGraphicComp()->GetGraphic(); Transformer* t = SaveTransformer(g); ScaleToPostScriptCoords(g); Comments(out); Prologue(out); Version(out); GridSpacing(out); out << "\n\n%%Page: 1 1\n\n"; out << "Begin\n"; FullGS(out); out << "/originalCTM matrix currentmatrix def\n\n"; bool status = Definition(out); out << "End " << MARK << " eop\n\n"; out << "showpage\n\n"; Trailer(out); RestoreTransformer(g, t); return status; } void PostScriptView::Comments (ostream& out) { PSVersion(out); Creator(out); FontNames(out); Pages(out); BoundingBox(out); out << "%%EndComments\n\n"; } void PostScriptView::PSVersion (ostream& out) { out << "%!PS-Adobe-2.0 EPSF-1.2\n"; } void PostScriptView::Creator (ostream& out) { out << "%%Creator: unidraw\n"; } void PostScriptView::Pages (ostream& out) { out << "%%Pages: 1\n"; } void PostScriptView::BoundingBox (ostream& out) { Coord l, b, r, t; GetBox(l, b, r, t); out << "%%BoundingBox: " << l << " " << b << " " << r << " " << t << "\n"; } void PostScriptView::Prologue (ostream& out) { ConstProcs(out); BeginProc(out); EndProc(out); SetGSProcs(out); ObjectProcs(out); MiscProcs(out); out << "%%EndProlog\n\n"; } static int Count (UList* list) { int i = 0; for (UList* u = list->First(); u != list->End(); u = u->Next()) { ++i; } return i; } void PostScriptView::ConstProcs (ostream& out) { UList* fonts = GetPSFonts(); int nfonts = Count(fonts); out << "/IdrawDict " << (50 + nfonts) << " dict def\n"; out << "IdrawDict begin\n\n"; if (nfonts > 0) { for (const char** line = reencodeISO; *line != nil; ++line) { out << *line << "\n"; } for (UList* u = fonts->First(); u != fonts->End(); u = u->Next()) { PSFont* font = GetFont(u); // No way to check if the X font's encoding is iso8859-1, so... if (strncmp(font->GetPrintFont(), "Symbol", 6) != 0) { out << "/" << font->GetPrintFont() << " reencodeISO def\n"; } else { out << "/" << font->GetPrintFont() << " dup findfont def\n"; } } out << "\n"; } out << "/none null def\n"; out << "/numGraphicParameters 17 def\n"; out << "/stringLimit 65535 def\n\n"; } void PostScriptView::BeginProc (ostream& out) { out << "/Begin {\n"; out << "save\n"; out << "numGraphicParameters dict begin\n"; out << "} def\n\n"; } void PostScriptView::EndProc (ostream& out) { out << "/End {\n"; out << "end\n"; out << "restore\n"; out << "} def\n\n"; } void PostScriptView::SetGSProcs (ostream& out) { SetBrushProc(out); SetFgColorProc(out); SetBgColorProc(out); SetFontProc(out); SetPatternProc(out); } void PostScriptView::SetBrushProc (ostream& out) { out << "/SetB {\n"; out << "dup type /nulltype eq {\n"; out << "pop\n"; out << "true /brushNone idef\n"; out << "} {\n"; out << "/brushDashOffset idef\n"; out << "/brushDashArray idef\n"; out << "pop pop\n"; out << "/brushWidth idef\n"; out << "false /brushNone idef\n"; out << "} ifelse\n"; out << "} def\n\n"; } void PostScriptView::SetFgColorProc (ostream& out) { out << "/SetCFg {\n"; out << "/fgblue idef\n"; out << "/fggreen idef\n"; out << "/fgred idef\n"; out << "} def\n\n"; } void PostScriptView::SetBgColorProc (ostream& out) { out << "/SetCBg {\n"; out << "/bgblue idef\n"; out << "/bggreen idef\n"; out << "/bgred idef\n"; out << "} def\n\n"; } void PostScriptView::SetFontProc (ostream& out) { out << "/SetF {\n"; out << "/printSize idef\n"; out << "/printFont idef\n"; out << "} def\n\n"; } void PostScriptView::SetPatternProc (ostream& out) { out << "/SetP {\n"; out << "dup type /nulltype eq {\n"; out << "pop true /patternNone idef\n"; out << "} {\n"; out << "dup -1 eq {\n"; out << "/patternGrayLevel idef\n"; out << "/patternString idef\n"; out << "} {\n"; out << "/patternGrayLevel idef\n"; out << "} ifelse\n"; out << "false /patternNone idef\n"; out << "} ifelse\n"; out << "} def\n\n"; } void PostScriptView::ObjectProcs (ostream& out) { BSplineProc(out); CircleProc(out); ClosedBSplineProc(out); EllipseProc(out); LineProc(out); MultiLineProc(out); PolygonProc(out); RectangleProc(out); TextProc(out); } void PostScriptView::BSplineProc (ostream& out) { out << "/BSpl {\n"; out << "0 begin\n"; out << "storexyn\n"; out << "newpath\n"; out << "n 1 gt {\n"; out << "0 0 0 0 0 0 1 1 true subspline\n"; out << "n 2 gt {\n"; out << "0 0 0 0 1 1 2 2 false subspline\n"; out << "1 1 n 3 sub {\n"; out << "/i exch def\n"; out << "i 1 sub dup i dup i 1 add dup i 2 add dup false subspline\n"; out << "} for\n"; out << "n 3 sub dup n 2 sub dup n 1 sub dup 2 copy false subspline\n"; out << "} if\n"; out << "n 2 sub dup n 1 sub dup 2 copy 2 copy false subspline\n"; out << "patternNone not { "; out << "ifill } if\n"; out << "brushNone not { istroke } if\n"; out << "} if\n"; out << "end\n"; out << "} dup 0 4 dict put def\n\n"; } void PostScriptView::CircleProc (ostream& out) { out << "/Circ {\n"; out << "newpath\n"; out << "0 360 arc\n"; out << "patternNone not { ifill } if\n"; out << "brushNone not { istroke } if\n"; out << "} def\n\n"; } void PostScriptView::ClosedBSplineProc (ostream& out) { out << "/CBSpl {\n"; out << "0 begin\n"; out << "dup 2 gt {\n"; out << "storexyn\n"; out << "newpath\n"; out << "n 1 sub dup 0 0 1 1 2 2 true subspline\n"; out << "1 1 n 3 sub {\n"; out << "/i exch def\n"; out << "i 1 sub dup i dup i 1 add dup i 2 add dup false subspline\n"; out << "} for\n"; out << "n 3 sub dup n 2 sub dup n 1 sub dup 0 0 false subspline\n"; out << "n 2 sub dup n 1 sub dup 0 0 1 1 false subspline\n"; out << "patternNone not { ifill } if\n"; out << "brushNone not { istroke } if\n"; out << "} {\n"; out << "Poly\n"; out << "} ifelse\n"; out << "end\n"; out << "} dup 0 4 dict put def\n\n"; } void PostScriptView::EllipseProc (ostream& out) { out << "/Elli {\n"; out << "0 begin\n"; out << "newpath\n"; out << "4 2 roll\n"; out << "translate\n"; out << "scale\n"; out << "0 0 1 0 360 arc\n"; out << "patternNone not { ifill } if\n"; out << "brushNone not { istroke } if\n"; out << "end\n"; out << "} dup 0 1 dict put def\n\n"; } void PostScriptView::LineProc (ostream& out) { out << "/Line {\n"; out << "0 begin\n"; out << "2 storexyn\n"; out << "newpath\n"; out << "x 0 get y 0 get moveto\n"; out << "x 1 get y 1 get lineto\n"; out << "brushNone not { istroke } if\n"; out << "end\n"; out << "} dup 0 4 dict put def\n\n"; } void PostScriptView::MultiLineProc (ostream& out) { out << "/MLine {\n"; out << "0 begin\n"; out << "storexyn\n"; out << "newpath\n"; out << "n 1 gt {\n"; out << "x 0 get y 0 get moveto\n"; out << "1 1 n 1 sub {\n"; out << "/i exch def\n"; out << "x i get y i get lineto\n"; out << "} for\n"; out << "patternNone not { "; out << "ifill } if\n"; out << "brushNone not { istroke } if\n"; out << "} if\n"; out << "end\n"; out << "} dup 0 4 dict put def\n\n"; } void PostScriptView::PolygonProc (ostream& out) { out << "/Poly {\n"; out << "3 1 roll\n"; out << "newpath\n"; out << "moveto\n"; out << "-1 add\n"; out << "{ lineto } repeat\n"; out << "closepath\n"; out << "patternNone not { ifill } if\n"; out << "brushNone not { istroke } if\n"; out << "} def\n\n"; } void PostScriptView::RectangleProc (ostream& out) { out << "/Rect {\n"; out << "0 begin\n"; out << "/t exch def\n"; out << "/r exch def\n"; out << "/b exch def\n"; out << "/l exch def\n"; out << "newpath\n"; out << "l b moveto\n"; out << "l t lineto\n"; out << "r t lineto\n"; out << "r b lineto\n"; out << "closepath\n"; out << "patternNone not { ifill } if\n"; out << "brushNone not { istroke } if\n"; out << "end\n"; out << "} dup 0 4 dict put def\n\n"; } void PostScriptView::TextProc (ostream& out) { out << "/Text {\n"; out << "ishow\n"; out << "} def\n\n"; } void PostScriptView::MiscProcs (ostream& out) { DefinitionProc(out); FillProc(out); StrokeProc(out); ShowProc(out); PatternProc(out); MinMaxProcs(out); MidpointProc(out); ThirdpointProc(out); SubsplineProc(out); StoreVerticesProc(out); out << "/SSten {\n"; out << "fgred fggreen fgblue setrgbcolor\n"; out << "dup true exch 1 0 0 -1 0 6 -1 roll matrix astore\n"; out << "} def\n\n"; out << "/FSten {\n"; out << "dup 3 -1 roll dup 4 1 roll exch\n"; out << "newpath\n"; out << "0 0 moveto\n"; out << "dup 0 exch lineto\n"; out << "exch dup 3 1 roll exch lineto\n"; out << "0 lineto\n"; out << "closepath\n"; out << "bgred bggreen bgblue setrgbcolor\n"; out << "eofill\n"; out << "SSten\n"; out << "} def\n\n"; out << "/Rast {\n"; out << "exch dup 3 1 roll 1 0 0 -1 0 6 -1 roll matrix astore\n"; out << "} def\n\n"; /* out << "/concatprocs {\n"; out << "/proc2 exch cvlit def\n"; out << "/proc1 exch cvlit def\n"; out << "/newproc proc1 length proc2 length add array def\n"; out << "newproc 0 proc1 putinterval\n"; out << "newproc proc1 length proc2 putinterval\n"; out << "newproc cvx\n"; out << "} def\n\n"; out << "/invertproc {\n"; out << "{1 exch sub} currenttransfer concatprocs settransfer\n"; out << "} def\n\n"; */ } void PostScriptView::DefinitionProc (ostream& out) { out << "/idef {\n"; out << "dup where { pop pop pop } { exch def } ifelse\n"; out << "} def\n\n"; } void PostScriptView::FillProc (ostream& out) { out << "/ifill {\n"; out << "0 begin\n"; out << "gsave\n"; out << "patternGrayLevel -1 ne {\n"; out << "fgred bgred fgred sub patternGrayLevel mul add\n"; out << "fggreen bggreen fggreen sub patternGrayLevel mul add\n"; out << "fgblue bgblue fgblue sub patternGrayLevel mul add setrgbcolor\n"; out << "eofill\n"; out << "} {\n"; out << "eoclip\n"; out << "originalCTM setmatrix\n"; out << "pathbbox /t exch def /r exch def /b exch def /l exch def\n"; out << "/w r l sub ceiling cvi def\n"; out << "/h t b sub ceiling cvi def\n"; out << "/imageByteWidth w 8 div ceiling cvi def\n"; out << "/imageHeight h def\n"; out << "bgred bggreen bgblue setrgbcolor\n"; out << "eofill\n"; out << "fgred fggreen fgblue setrgbcolor\n"; out << "w 0 gt h 0 gt and {\n"; out << "l w add b translate w neg h scale\n"; out << "w h true [w 0 0 h neg 0 h] { patternproc } imagemask\n"; out << "} if\n"; out << "} ifelse\n"; out << "grestore\n"; out << "end\n"; out << "} dup 0 8 dict put def\n\n"; } void PostScriptView::StrokeProc (ostream& out) { out << "/istroke {\n"; out << "gsave\n"; out << "brushDashOffset -1 eq {\n"; out << "[] 0 setdash\n"; out << "1 setgray\n"; out << "} {\n"; out << "brushDashArray brushDashOffset setdash\n"; out << "fgred fggreen fgblue setrgbcolor\n"; out << "} ifelse\n"; out << "brushWidth setlinewidth\n"; out << "originalCTM setmatrix\n"; out << "stroke\n"; out << "grestore\n"; out << "} def\n\n"; } void PostScriptView::ShowProc (ostream& out) { out << "/ishow {\n"; out << "0 begin\n"; out << "gsave\n"; out << "fgred fggreen fgblue setrgbcolor\n"; out << "/fontDict printFont printSize scalefont dup setfont def\n"; #if 0 out << "/descender fontDict begin 0 [FontBBox] 1 get FontMatrix end\n"; out << "transform exch pop def\n"; #else // from http://foofoo.stanford.edu/interviews/pub/old/2.6-fixes/fix2 out << "/descender 0 fontDict /FontBBox get 1 get fontDict /FontMatrix\n"; out << "get transform exch pop def\n"; #endif out << "/vertoffset 1 printSize sub descender sub def {\n"; out << "0 vertoffset moveto show\n"; out << "/vertoffset vertoffset printSize sub def\n"; out << "} forall\n"; out << "grestore\n"; out << "end\n"; out << "} dup 0 3 dict put def\n"; } void PostScriptView::PatternProc (ostream& out) { out << "/patternproc {\n"; out << "0 begin\n"; out << "/patternByteLength patternString length def\n"; out << "/patternHeight patternByteLength 8 mul sqrt cvi def\n"; out << "/patternWidth patternHeight def\n"; out << "/patternByteWidth patternWidth 8 idiv def\n"; out << "/imageByteMaxLength imageByteWidth imageHeight mul\n"; out << "stringLimit patternByteWidth sub min def\n"; out << "/imageMaxHeight imageByteMaxLength imageByteWidth idiv "; out << "patternHeight idiv\n"; out << "patternHeight mul patternHeight max def\n"; out << "/imageHeight imageHeight imageMaxHeight sub store\n"; out << "/imageString imageByteWidth imageMaxHeight mul patternByteWidth "; out << "add string def\n"; out << "0 1 imageMaxHeight 1 sub {\n"; out << "/y exch def\n"; out << "/patternRow y patternByteWidth mul patternByteLength mod def\n"; out << "/patternRowString patternString patternRow patternByteWidth "; out << "getinterval def\n"; out << "/imageRow y imageByteWidth mul def\n"; out << "0 patternByteWidth imageByteWidth 1 sub {\n"; out << "/x exch def\n"; out << "imageString imageRow x add patternRowString putinterval\n"; out << "} for\n"; out << "} for\n"; out << "imageString\n"; out << "end\n"; out << "} dup 0 12 dict put def\n\n"; } void PostScriptView::MinMaxProcs (ostream& out) { out << "/min {\n"; out << "dup 3 2 roll dup 4 3 roll lt { exch } if pop\n"; out << "} def\n\n"; out << "/max {\n"; out << "dup 3 2 roll dup 4 3 roll gt { exch } if pop\n"; out << "} def\n\n"; } void PostScriptView::MidpointProc (ostream& out) { out << "/midpoint {\n"; out << "0 begin\n"; out << "/y1 exch def\n"; out << "/x1 exch def\n"; out << "/y0 exch def\n"; out << "/x0 exch def\n"; out << "x0 x1 add 2 div\n"; out << "y0 y1 add 2 div\n"; out << "end\n"; out << "} dup 0 4 dict put def\n\n"; } void PostScriptView::ThirdpointProc (ostream& out) { out << "/thirdpoint {\n"; out << "0 begin\n"; out << "/y1 exch def\n"; out << "/x1 exch def\n"; out << "/y0 exch def\n"; out << "/x0 exch def\n"; out << "x0 2 mul x1 add 3 div\n"; out << "y0 2 mul y1 add 3 div\n"; out << "end\n"; out << "} dup 0 4 dict put def\n\n"; } void PostScriptView::SubsplineProc (ostream& out) { out << "/subspline {\n"; out << "0 begin\n"; out << "/movetoNeeded exch def\n"; out << "y exch get /y3 exch def\n"; out << "x exch get /x3 exch def\n"; out << "y exch get /y2 exch def\n"; out << "x exch get /x2 exch def\n"; out << "y exch get /y1 exch def\n"; out << "x exch get /x1 exch def\n"; out << "y exch get /y0 exch def\n"; out << "x exch get /x0 exch def\n"; out << "x1 y1 x2 y2 thirdpoint\n"; out << "/p1y exch def\n"; out << "/p1x exch def\n"; out << "x2 y2 x1 y1 thirdpoint\n"; out << "/p2y exch def\n"; out << "/p2x exch def\n"; out << "x1 y1 x0 y0 thirdpoint\n"; out << "p1x p1y midpoint\n"; out << "/p0y exch def\n"; out << "/p0x exch def\n"; out << "x2 y2 x3 y3 thirdpoint\n"; out << "p2x p2y midpoint\n"; out << "/p3y exch def\n"; out << "/p3x exch def\n"; out << "movetoNeeded { p0x p0y moveto } if\n"; out << "p1x p1y p2x p2y p3x p3y curveto\n"; out << "end\n"; out << "} dup 0 17 dict put def\n\n"; } void PostScriptView::StoreVerticesProc (ostream& out) { out << "/storexyn {\n"; out << "/n exch def\n"; out << "/y n array def\n"; out << "/x n array def\n"; out << "n 1 sub -1 0 {\n"; out << "/i exch def\n"; out << "y i 3 2 roll put\n"; out << "x i 3 2 roll put\n"; out << "} for\n"; out << "} def\n\n"; } void PostScriptView::Version (ostream& out) { out << MARK << " Idraw " << PSV_LATEST << " "; } void PostScriptView::GridSpacing (ostream& out) { float xincr, yincr; GetGridSpacing(xincr, yincr); out << "Grid " << xincr << " " << yincr << " "; } void PostScriptView::Trailer (ostream& out) { out << "%%Trailer\n\n"; out << "end\n"; } void PostScriptView::MinGS (ostream& out) { Brush(out); FgColor(out); BgColor(out); Pattern(out); Transformation(out); } void PostScriptView::FullGS (ostream& out) { Brush(out); FgColor(out); BgColor(out); Font(out); Pattern(out); Transformation(out); } void PostScriptView::TextGS (ostream& out) { FgColor(out); Font(out); Transformation(out); } void PostScriptView::Brush (ostream& out) { PSBrush* brush = (PSBrush*) GetGraphicComp()->GetGraphic()->GetBrush(); if (brush == nil) { out << MARK << " b u\n"; } else if (brush->None()) { out << "none SetB " << MARK << " b n\n"; } else { int p = brush->GetLinePattern(); out << MARK << " b " << p << "\n"; int w = brush->Width(); out << w << " " << false << " " << false << " "; const int* dashpat = brush->GetDashPattern(); int dashpatsize = brush->GetDashPatternSize(); int dashoffset = brush->GetDashOffset(); if (dashpatsize <= 0) { out << "[] " << dashoffset << " "; } else { out << "["; int i; for (i = 0; i < dashpatsize - 1; i++) { out << dashpat[i] << " "; } out << dashpat[i] << "] " << dashoffset << " "; } out << "SetB\n"; } } void PostScriptView::FgColor (ostream& out) { PSColor* fgcolor = (PSColor*) GetGraphicComp()->GetGraphic()->GetFgColor(); if (fgcolor == nil) { out << MARK << " cfg u\n"; } else { const char* name = fgcolor->GetName(); out << MARK << " cfg " << name << "\n"; if (strcmp(name, "white") == 0 || strcmp(name, "White") == 0) { out << "1 1 1 SetCFg\n"; } else { ColorIntensity r, g, b; fgcolor->GetIntensities(r, g, b); out << r << " " << g << " " << b << " SetCFg\n"; } } } void PostScriptView::BgColor (ostream& out) { PSColor* bgcolor = (PSColor*) GetGraphicComp()->GetGraphic()->GetBgColor(); if (bgcolor == nil) { out << MARK << " cbg u\n"; } else { const char* name = bgcolor->GetName(); out << MARK << " cbg " << name << "\n"; if (strcmp(name, "white") == 0 || strcmp(name, "White") == 0) { out << "1 1 1 SetCBg\n"; } else { ColorIntensity r, g, b; bgcolor->GetIntensities(r, g, b); out << r << " " << g << " " << b << " SetCBg\n"; } } } void PostScriptView::Font (ostream& out) { PSFont* font = (PSFont*) GetGraphicComp()->GetGraphic()->GetFont(); if (font == nil) { out << MARK << " f u\n"; } else { const char* name = font->GetName(); const char* pf = font->GetPrintFont(); const char* ps = font->GetPrintSize(); out << MARK << " f " << name << "\n"; out << pf << " " << ps << " SetF\n"; } } void PostScriptView::Pattern (ostream& out) { PSPattern* pat = (PSPattern*) GetGraphicComp()->GetGraphic()->GetPattern(); if (pat == nil) { out << MARK << " p u\n"; } else if (pat->None()) { out << "none SetP " << MARK << " p n\n"; } else if (pat->GetSize() > 0) { const int* data = pat->GetData(); int size = pat->GetSize(); char buf[CHARBUFSIZE]; out << MARK << " p\n"; out << "< "; if (size <= 8) { for (int i = 0; i < 8; i++) { sprintf(buf, "%02x", data[i] & 0xff); out << buf << " "; } } else { for (int i = 0; i < patternHeight; i++) { sprintf(buf, "%0*x", patternWidth/4, data[i]); if (i != patternHeight - 2) { out << buf << " "; } else { out << buf << "\n "; } } } out << "> -1 SetP\n"; } else { float graylevel = pat->GetGrayLevel(); out << MARK << " p\n"; out << graylevel << " SetP\n"; } } void PostScriptView::Transformation (ostream& out) { Transformer* t = GetGraphicComp()->GetGraphic()->GetTransformer(); Transformer identity; if (t == nil || *t == identity) { out << MARK << " t u\n"; } else { float a00, a01, a10, a11, a20, a21; t->GetEntries(a00, a01, a10, a11, a20, a21); out << MARK << " t\n"; out << "[ " << a00 << " " << a01 << " " << a10 << " "; out << a11 << " " << a20 << " " << a21 << " ] concat\n"; } } static bool Uncollected (const char* name, UList* fonts) { for (UList* u = fonts->First(); u != fonts->End(); u = u->Next()) { PSFont* font = (PSFont*) (*u)(); if (strcmp(font->GetPrintFont(), name) == 0) { return false; } } return true; } static void CollectFonts (GraphicComp* comp, UList* fonts) { PSFont* font = comp->GetGraphic()->GetFont(); if (font != nil && Uncollected(font->GetPrintFont(), fonts)) { fonts->Append(new UList(font)); } Iterator i; for (comp->First(i); !comp->Done(i); comp->Next(i)) { CollectFonts(comp->GetComp(i), fonts); } } PSFont* PostScriptView::GetFont (UList* u) { return (PSFont*) (*u)(); } void PostScriptView::SetPSFonts (UList* u) { delete _fonts; _fonts = u; } UList* PostScriptView::GetPSFonts () { if (_fonts == nil) { _fonts = new UList; CollectFonts(GetGraphicComp(), _fonts); } return _fonts; } void PostScriptView::FontNames (ostream& out) { UList* fonts = GetPSFonts(); const char* comment = "%%DocumentFonts:"; int linelen = strlen(comment); out << comment; for (UList* u = fonts->First(); u != fonts->End(); u = u->Next()) { PSFont* font = GetFont(u); if (linelen + strlen(font->GetPrintFont()) + 2 <= MAXLINELEN) { out << " "; ++linelen; } else { out << "\n%%+ "; linelen = strlen("%%+ "); } out << font->GetPrintFont(); linelen += strlen(font->GetPrintFont()); } out << "\n"; } void PostScriptView::GetBox (Coord& l, Coord& b, Coord& r, Coord& t) { GetGraphicComp()->GetGraphic()->GetBox(l, b, r, t); } void PostScriptView::GetGridSpacing (float& xincr, float& yincr) { xincr = yincr = 8; // dumb default } PostScriptView* PostScriptView::View (UList* r) { return (PostScriptView*) (*r)(); } PostScriptView* PostScriptView::CreatePSView (GraphicComp* comp) { PostScriptView* psv = (PostScriptView*) comp->Create(POSTSCRIPT_VIEW); if (psv != nil) { comp->Attach(psv); psv->Update(); } return psv; } /*****************************************************************************/ ClassId PostScriptViews::GetClassId () { return POSTSCRIPT_VIEWS; } bool PostScriptViews::IsA (ClassId id) { return POSTSCRIPT_VIEWS == id || PostScriptView::IsA(id); } PostScriptViews::PostScriptViews (GraphicComps* subj) : PostScriptView(subj) { _views = new UList; } PostScriptViews::~PostScriptViews () { DeleteViews(); delete _views; } bool PostScriptViews::Emit (ostream& out) { SetPSFonts(); Graphic* g = GetGraphicComp()->GetGraphic(); Transformer* t = SaveTransformer(g); ScaleToPostScriptCoords(g); Comments(out); Prologue(out); Version(out); GridSpacing(out); out << "\n\n%%Page: 1 1\n\n"; out << "Begin\n"; FullGS(out); out << "/originalCTM matrix currentmatrix def\n\n"; bool status = PreorderView::Definition(out); out << "End " << MARK << " eop\n\n"; out << "showpage\n\n"; Trailer(out); RestoreTransformer(g, t); return status; } bool PostScriptViews::Definition (ostream& out) { out << "Begin " << MARK << " Pict\n"; FullGS(out); out << "\n"; bool status = PreorderView::Definition(out); out << "End " << MARK << " eop\n\n"; return status; } void PostScriptViews::Update () { DeleteViews(); GraphicComp* comps = GetGraphicComp(); Iterator i; for (comps->First(i); !comps->Done(i); comps->Next(i)) { GraphicComp* comp = comps->GetComp(i); PostScriptView* psv = CreatePSView(comp); if (psv != nil) { _views->Append(new UList(psv)); } } } GraphicComps* PostScriptViews::GetGraphicComps () { return (GraphicComps*) GetSubject(); } UList* PostScriptViews::Elem (Iterator i) { return (UList*) i.GetValue(); } void PostScriptViews::First (Iterator& i) { i.SetValue(_views->First()); } void PostScriptViews::Last (Iterator& i) { i.SetValue(_views->Last()); } void PostScriptViews::Next (Iterator& i) { i.SetValue(Elem(i)->Next()); } void PostScriptViews::Prev (Iterator& i) { i.SetValue(Elem(i)->Prev()); } bool PostScriptViews::Done (Iterator i) { return Elem(i) == _views->End(); } ExternView* PostScriptViews::GetView (Iterator i) { return View(Elem(i)); } void PostScriptViews::SetView (ExternView* ev, Iterator& i) { i.SetValue(_views->Find(ev)); } void PostScriptViews::DeleteView (Iterator& i) { UList* doomed = Elem(i); ExternView* view = GetView(i); Next(i); _views->Remove(doomed); SetParent(view, nil); delete doomed; delete view; } void PostScriptViews::DeleteViews () { Iterator i; First(i); while (!Done(i)) { DeleteView(i); } } neuron-7.6.3/src/lib/Unidraw/rastercomp.cpp000066400000000000000000000113321340731477100206750ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * RasterComp definitions. */ #include #include #include #include #include #include #include #include #include /*****************************************************************************/ static const int color_depth = 8; // bits per color in PostScript /*****************************************************************************/ ClassId RasterComp::GetClassId () { return RASTER_COMP; } bool RasterComp::IsA (ClassId id) { return RASTER_COMP == id || GraphicComp::IsA(id); } Component* RasterComp::Copy () { return new RasterComp((RasterRect*) GetGraphic()->Copy(), _filename); } RasterComp::RasterComp (RasterRect* s, const char* filename) : GraphicComp(s) { _filename = (filename == nil) ? nil : strnew(filename); } RasterComp::~RasterComp () { delete [] _filename; } RasterRect* RasterComp::GetRasterRect () { return (RasterRect*) GetGraphic(); } const char* RasterComp::GetFileName () { return _filename; } void RasterComp::Read (istream& in) { GraphicComp::Read(in); Raster* raster = ReadRaster(in); RasterRect* rr = new RasterRect(raster); Transformer* t = ReadTransformer(in); rr->SetTransformer(t); Unref(t); SetGraphic(rr); _filename = ReadString(in); } void RasterComp::Write (ostream& out) { GraphicComp::Write(out); RasterRect* rr = GetRasterRect(); Raster* raster = rr->GetOriginal(); WriteRaster(raster, out); WriteTransformer(rr->GetTransformer(), out); WriteString(_filename, out); } /*****************************************************************************/ RasterComp* RasterView::GetRasterComp () { return (RasterComp*) GetSubject(); } ClassId RasterView::GetClassId () { return RASTER_VIEW; } bool RasterView::IsA (ClassId id) { return RASTER_VIEW == id || GraphicView::IsA(id); } RasterView::RasterView (RasterComp* subj) : GraphicView(subj) { } void RasterView::Update () { Graphic* raster = GetGraphic(); IncurDamage(raster); *raster = *GetRasterComp()->GetGraphic(); IncurDamage(raster); EraseHandles(); } Graphic* RasterView::GetGraphic () { Graphic* graphic = GraphicView::GetGraphic(); if (graphic == nil) { RasterRect* rr = GetRasterComp()->GetRasterRect(); graphic = new RasterRect(rr->GetOriginal(), rr); SetGraphic(graphic); } return graphic; } /*****************************************************************************/ PSRaster::PSRaster (RasterComp* subj) : PostScriptView(subj) { } ClassId PSRaster::GetClassId () { return PS_RASTER; } bool PSRaster::IsA (ClassId id) { return PS_RASTER == id || PostScriptView::IsA(id); } bool PSRaster::Definition (ostream& out) { RasterComp* comp = (RasterComp*) GetSubject(); Raster* raster = comp->GetRasterRect()->GetOriginal(); Coord w = raster->Width(); Coord h = raster->Height(); out << "Begin " << MARK << " " << "Rast\n"; Transformation(out); out << MARK << "\n"; out << w << " " << h << " " << color_depth << " Rast "; out << "{ currentfile "; out << (w * color_depth + 7) / 8 << " "; out << "string readhexstring pop }\n"; out << "image"; Catalog* catalog = unidraw->GetCatalog(); catalog->WriteGraymapData(raster, out); catalog->Mark(out); out << "colorimage"; catalog->WriteRasterData(raster, out); out << "\nEnd\n\n"; return out.good(); } neuron-7.6.3/src/lib/Unidraw/rasterrect.cpp000066400000000000000000000062141340731477100206770ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of RasterRect, a Graphic that draws a Raster. */ #include #include #include #include #include #include /*****************************************************************************/ RasterRect::RasterRect (Raster* r, Graphic* gr) : Graphic(gr) { _raster = r; Ref(_raster); } RasterRect::~RasterRect () { Unref(_raster); } Graphic* RasterRect::Copy () { return new RasterRect(new Raster(*_raster), this); } void RasterRect::draw (Canvas *c, Graphic* gs) { update(gs); _p->RasterRect(c, 0, 0, _raster); } void RasterRect::getExtent ( float& x0, float& y0, float& cx, float& cy, float& tol, Graphic* gs ) { if (gs->GetTransformer() == nil) { x0 = y0 = 0; cx = _raster->Width() / 2; cy = _raster->Height() / 2; } else { transformRect(0,0,_raster->Width(),_raster->Height(),x0,y0,cx,cy,gs); cx = (cx + x0)/2; cy = (cy + y0)/2; } tol = 0; } bool RasterRect::contains (PointObj& po, Graphic* gs) { PointObj pt (&po); invTransform(pt._x, pt._y, gs); BoxObj b (0, 0, _raster->Width(), _raster->Height()); return b.Contains(pt); } bool RasterRect::intersects (BoxObj& userb, Graphic* gs) { Transformer* t = gs->GetTransformer(); Coord xmax = _raster->Width(); Coord ymax = _raster->Height(); Coord tx0, ty0, tx1, ty1; if (t != nil && t->Rotated()) { Coord x[4], tx[5]; Coord y[4], ty[5]; x[0] = x[3] = y[0] = y[1] = 0; x[2] = x[1] = xmax; y[2] = y[3] = ymax; transformList(x, y, 4, tx, ty, gs); tx[4] = tx[0]; ty[4] = ty[0]; FillPolygonObj fp (tx, ty, 5); return fp.Intersects(userb); } else if (t != nil) { t->Transform(0, 0, tx0, ty0); t->Transform(xmax, ymax, tx1, ty1); BoxObj b1 (tx0, ty0, tx1, ty1); return b1.Intersects(userb); } else { BoxObj b2 (0, 0, xmax, ymax); return b2.Intersects(userb); } } neuron-7.6.3/src/lib/Unidraw/rect.cpp000066400000000000000000000255451340731477100174660ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Rect component definitions. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ ClassId RectComp::GetClassId () { return RECT_COMP; } bool RectComp::IsA (ClassId id) { return RECT_COMP == id || GraphicComp::IsA(id); } Component* RectComp::Copy () { return new RectComp((SF_Rect*) GetGraphic()->Copy()); } RectComp::RectComp (SF_Rect* graphic) : GraphicComp(graphic) { } SF_Rect* RectComp::GetRect () { return (SF_Rect*) GetGraphic(); } void RectComp::Read (istream& in) { GraphicComp::Read(in); Coord x0, y0, x1, y1; in >> x0 >> y0 >> x1 >> y1; SF_Rect* rect = new SF_Rect(x0, y0, x1, y1); rect->FillBg(ReadBgFilled(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); rect->SetColors(fg, bg); rect->SetBrush(ReadBrush(in)); rect->SetPattern(ReadPattern(in)); Transformer* t = ReadTransformer(in); rect->SetTransformer(t); Unref(t); SetGraphic(rect); } void RectComp::Write (ostream& out) { GraphicComp::Write(out); SF_Rect* rect = GetRect(); Coord x0, y0, x1, y1; rect->GetOriginal(x0, y0, x1, y1); out << x0 << " " << y0 << " " << x1 << " " << y1 << " "; WriteBgFilled(rect->BgFilled(), out); WriteColor(rect->GetFgColor(), out); WriteColor(rect->GetBgColor(), out); WriteBrush(rect->GetBrush(), out); WritePattern(rect->GetPattern(), out); WriteTransformer(rect->GetTransformer(), out); } /*****************************************************************************/ RectComp* RectView::GetRectComp () { return (RectComp*) GetSubject(); } ClassId RectView::GetClassId () { return RECT_VIEW; } bool RectView::IsA (ClassId id) { return RECT_VIEW == id || GraphicView::IsA(id); } RectView::RectView (RectComp* subj) : GraphicView(subj) { } void RectView::Interpret (Command* cmd) { if (cmd->IsA(ALIGNTOGRID_CMD)) { SF_Rect* rect = (SF_Rect*) GetGraphic(); Transformer total; rect->TotalTransformation(total); Coord x0, y0, x1, y1; float tx0, ty0; rect->GetOriginal(x0, y0, x1, y1); total.Transform(float(x0), float(y0), tx0, ty0); ((AlignToGridCmd*) cmd)->Align(this, tx0, ty0); } else { GraphicView::Interpret(cmd); } } void RectView::Update () { Graphic* rect = GetGraphic(); IncurDamage(rect); *rect = *GetRectComp()->GetGraphic(); IncurDamage(rect); EraseHandles(); } void RectView::CreateHandles () { Coord x[4], y[4]; Viewer* v = GetViewer(); if (v != nil) { GetCorners(x, y); _handles = new RubberHandles(nil, nil, x, y, 4, 0, HANDLE_SIZE); v->InitRubberband(_handles); } } Manipulator* RectView::CreateManipulator ( Viewer* v, Event& e, Transformer* rel, Tool* tool ) { Coord x[5], y[5]; Rubberband* rub = nil; Manipulator* m = nil; if (tool->IsA(GRAPHIC_COMP_TOOL)) { v->Constrain(e.x, e.y); rub = new RubberRect(nil, nil, e.x, e.y, e.x, e.y); m = new DragManip( v, rub, rel, tool, DragConstraint(XYEqual | Gravity) ); } else if (tool->IsA(RESHAPE_TOOL)) { RubberGroup* rub = new RubberGroup(nil, nil); Coord x[4], y[4]; v->Constrain(e.x, e.y); GetCorners(x, y); _reshapeCorner = ClosestPoint(x, y, 4, e.x, e.y); if (_reshapeCorner > 0) { rub->Append( new RubberLine( nil, nil, x[_reshapeCorner-1], y[_reshapeCorner-1], e.x,e.y ) ); } else { rub->Append(new RubberLine(nil,nil,x[3],y[3],e.x,e.y)); } if (_reshapeCorner < 3) { rub->Append( new RubberLine( nil, nil, x[_reshapeCorner+1], y[_reshapeCorner+1], e.x,e.y ) ); } else { rub->Append(new RubberLine(nil, nil, x[0], y[0], e.x, e.y)); } m = new DragManip( v, rub, rel, tool, DragConstraint(HorizOrVert | Gravity) ); } else if (tool->IsA(MOVE_TOOL)) { v->Constrain(e.x, e.y); GetCorners(x, y); x[4] = x[0]; y[4] = y[0]; rub = new SlidingLineList(nil, nil, x, y, 5, e.x, e.y); m = new DragManip( v, rub, rel, tool, DragConstraint(HorizOrVert | Gravity) ); } else if (tool->IsA(SCALE_TOOL)) { v->Constrain(e.x, e.y); GetCorners(x, y); x[4] = x[0]; y[4] = y[0]; rub = new ScalingLineList(nil,nil,x,y,5, (x[0]+x[2])/2, (y[0]+y[2])/2); m = new DragManip(v, rub, rel, tool, Gravity); } else if (tool->IsA(ROTATE_TOOL)) { v->Constrain(e.x, e.y); GetCorners(x, y); x[4] = x[0]; y[4] = y[0]; rub = new RotatingLineList( nil, nil, x, y, 5, (x[0]+x[2])/2, (y[0]+y[2])/2, e.x, e.y ); m = new DragManip(v, rub, rel, tool, Gravity); } else { m = GraphicView::CreateManipulator(v, e, rel, tool); } return m; } Command* RectView::InterpretManipulator (Manipulator* m) { DragManip* dm = (DragManip*) m; Editor* ed = dm->GetViewer()->GetEditor(); Tool* tool = dm->GetTool(); Transformer* rel = dm->GetTransformer(); Command* cmd = nil; if (tool->IsA(GRAPHIC_COMP_TOOL)) { RubberRect* rr = (RubberRect*) dm->GetRubberband(); Coord x0, y0, x1, y1; rr->GetCurrent(x0, y0, x1, y1); if (x0 != x1 || y0 != y1) { BrushVar* brVar = (BrushVar*) ed->GetState("BrushVar"); PatternVar* patVar = (PatternVar*) ed->GetState("PatternVar"); ColorVar* colVar = (ColorVar*) ed->GetState("ColorVar"); if (rel != nil) { rel = new Transformer(rel); rel->Invert(); } Graphic* pg = GetGraphicComp()->GetGraphic(); SF_Rect* rect = new SF_Rect(x0, y0, x1, y1, pg); if (brVar != nil) rect->SetBrush(brVar->GetBrush()); if (patVar != nil) rect->SetPattern(patVar->GetPattern()); if (colVar != nil) { rect->SetColors(colVar->GetFgColor(), colVar->GetBgColor()); } rect->SetTransformer(rel); Unref(rel); cmd = new PasteCmd(ed, new Clipboard(new RectComp(rect))); } } else if (tool->IsA(RESHAPE_TOOL)) { RubberGroup* rubberGroup = (RubberGroup*) dm->GetRubberband(); RubberLine* rubberLine = (RubberLine*) rubberGroup->First(); SF_Polygon* polygon; Coord x[4], y[4]; Coord x0, y0; GetCorners(x, y); rubberLine->GetCurrent(x0, y0, x[_reshapeCorner], y[_reshapeCorner]); if (rel != nil) { rel = new Transformer(rel); rel->Invert(); } polygon = new SF_Polygon(x, y, 4, GetGraphic()); polygon->SetTransformer(rel); Unref(rel); cmd = new ReplaceCmd(ed, new PolygonComp(polygon)); } else if (tool->IsA(MOVE_TOOL)) { SlidingLineList* sll; Transformer* rel = dm->GetTransformer(); Coord* ox, *oy, *cx, *cy; float fx0, fy0, fx1, fy1; int n; sll = (SlidingLineList*) dm->GetRubberband(); sll->GetOriginal(ox, oy, n); sll->GetCurrent(cx, cy, n); if (rel != nil) { rel->InvTransform(float(ox[0]), float(oy[0]), fx0, fy0); rel->InvTransform(float(cx[0]), float(cy[0]), fx1, fy1); } delete ox; delete oy; delete cx; delete cy; cmd = new MoveCmd(ed, fx1 - fx0, fy1 - fy0); } else if (tool->IsA(SCALE_TOOL)) { ScalingLineList* sll = (ScalingLineList*) dm->GetRubberband(); float sxy = sll->CurrentScaling(); cmd = new ScaleCmd(ed, sxy, sxy); } else if (tool->IsA(ROTATE_TOOL)) { RotatingLineList* rll = (RotatingLineList*) dm->GetRubberband(); float angle = rll->CurrentAngle() - rll->OriginalAngle(); cmd = new RotateCmd(ed, angle); } else { cmd = GraphicView::InterpretManipulator(m); } return cmd; } void RectView::GetCorners (Coord* x, Coord* y) { SF_Rect* rect = (SF_Rect*) GetGraphic(); Coord tx[4], ty[4]; Transformer t; rect->GetOriginal(tx[0], ty[0], tx[2], ty[2]); rect->GetOriginal(tx[3], ty[1], tx[1], ty[3]); rect->TotalTransformation(t); t.TransformList((Coord*) tx, (Coord*) ty, 4, x, y); } Graphic* RectView::GetGraphic () { Graphic* graphic = GraphicView::GetGraphic(); if (graphic == nil) { RectComp* rectComp = GetRectComp(); graphic = rectComp->GetGraphic()->Copy(); SetGraphic(graphic); } return graphic; } /*****************************************************************************/ PSRect::PSRect (RectComp* subj) : PostScriptView(subj) { } ClassId PSRect::GetClassId () { return PS_RECT; } bool PSRect::IsA (ClassId id) { return PS_RECT == id || PostScriptView::IsA(id); } bool PSRect::Definition (ostream& out) { Coord l, b, r, t; RectComp* comp = (RectComp*) GetSubject(); comp->GetRect()->GetOriginal(l, b, r, t); out << "Begin " << MARK << " Rect\n"; MinGS(out); out << MARK << "\n"; out << l << " " << b << " " << r << " " << t << " Rect\n"; out << "End\n\n"; return out.good(); } neuron-7.6.3/src/lib/Unidraw/reshape.cpp000066400000000000000000000053211340731477100201460ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Reshape tool definitions. */ #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ ClassId ReshapeTool::GetClassId () { return RESHAPE_TOOL; } bool ReshapeTool::IsA (ClassId id) { return RESHAPE_TOOL == id || Tool::IsA(id); } ReshapeTool::ReshapeTool (ControlInfo* m) : Tool(m) { } Tool* ReshapeTool::Copy () { return new ReshapeTool(CopyControlInfo()); } Manipulator* ReshapeTool::CreateManipulator ( Viewer* v, Event& e, Transformer* rel ) { GraphicView* views = v->GetGraphicView(); Selection* s = v->GetSelection(), *newSel; GraphicView* gv; Manipulator* m = nil; Iterator i; newSel = views->ViewIntersecting(e.x-SLOP, e.y-SLOP, e.x+SLOP, e.y+SLOP); if (!newSel->IsEmpty()) { s->Clear(); newSel->First(i); gv = newSel->GetView(i); s->Append(gv); m = gv->CreateManipulator(v, e, rel, this); } delete newSel; return m; } Command* ReshapeTool::InterpretManipulator (Manipulator* m) { Selection* s; Command* cmd = nil; Iterator i; if (m != nil) { s = m->GetViewer()->GetSelection(); s->First(i); cmd = s->GetView(i)->InterpretManipulator(m); s->Update(); } return cmd; } neuron-7.6.3/src/lib/Unidraw/rotate.cpp000066400000000000000000000054711340731477100200230ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Rotate tool definitions. */ #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ ClassId RotateTool::GetClassId () { return ROTATE_TOOL; } bool RotateTool::IsA (ClassId id) { return ROTATE_TOOL == id || Tool::IsA(id); } RotateTool::RotateTool (ControlInfo* m) : Tool(m) { } Tool* RotateTool::Copy () { return new RotateTool(CopyControlInfo()); } Manipulator* RotateTool::CreateManipulator ( Viewer* v, Event& e, Transformer* rel ) { GraphicView* views = v->GetGraphicView(); Selection* s = v->GetSelection(), *newSel; GraphicView* gv; Manipulator* m = nil; Iterator i; newSel = views->ViewIntersecting(e.x-SLOP, e.y-SLOP, e.x+SLOP, e.y+SLOP); if (newSel->IsEmpty()) { s->Clear(); } else { newSel->First(i); gv = newSel->GetView(i); if (s->Includes(gv)) { s->Remove(gv); s->Prepend(gv); } else { s->Clear(); s->Append(gv); s->Update(); } m = gv->CreateManipulator(v, e, rel, this); } delete newSel; return m; } Command* RotateTool::InterpretManipulator (Manipulator* m) { Selection* s; Command* cmd = nil; Iterator i; if (m != nil) { s = m->GetViewer()->GetSelection(); s->First(i); cmd = s->GetView(i)->InterpretManipulator(m); } return cmd; } neuron-7.6.3/src/lib/Unidraw/scale.cpp000066400000000000000000000055231340731477100176120ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Scale tool definitions. */ #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ ClassId ScaleTool::GetClassId () { return SCALE_TOOL; } bool ScaleTool::IsA (ClassId id) { return SCALE_TOOL == id || Tool::IsA(id); } ScaleTool::ScaleTool (ControlInfo* m) : Tool(m) { } Tool* ScaleTool::Copy () { return new ScaleTool(CopyControlInfo()); } Manipulator* ScaleTool::CreateManipulator ( Viewer* v, Event& e, Transformer* rel ) { GraphicView* views = v->GetGraphicView(); Selection* s = v->GetSelection(), *newSel; GraphicView* gv; Manipulator* m = nil; Iterator i; newSel = views->ViewIntersecting(e.x-SLOP, e.y-SLOP, e.x+SLOP, e.y+SLOP); if (newSel->IsEmpty()) { s->Clear(); } else { newSel->First(i); gv = newSel->GetView(i); if (s->Includes(gv)) { s->Remove(gv); s->Prepend(gv); } else { s->Clear(); s->Append(gv); s->Update(); } m = gv->CreateManipulator(v, e, rel, this); } delete newSel; return m; } Command* ScaleTool::InterpretManipulator (Manipulator* m) { Selection* s; Command* cmd = nil; Iterator i; if (m != nil) { s = m->GetViewer()->GetSelection(); s->First(i); cmd = s->GetView(i)->InterpretManipulator(m); } return cmd; } neuron-7.6.3/src/lib/Unidraw/select.cpp000066400000000000000000000064611340731477100200040ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Select tool definitions. */ #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ ClassId SelectTool::GetClassId () { return SELECT_TOOL; } bool SelectTool::IsA (ClassId id) { return SELECT_TOOL == id || Tool::IsA(id); } SelectTool::SelectTool (ControlInfo* m) : Tool(m) { } Tool* SelectTool::Copy () { return new SelectTool(CopyControlInfo()); } Manipulator* SelectTool::CreateManipulator ( Viewer* v, Event& e, Transformer* rel ) { Manipulator* m = nil; GraphicView* views = v->GetGraphicView(); Selection* s = v->GetSelection(), *newSel; newSel = views->ViewIntersecting(e.x-SLOP, e.y-SLOP, e.x+SLOP, e.y+SLOP); if (e.shift) { Localize(s, v); } else { s->Clear(); } if (newSel->IsEmpty()) { // select w/RubberRect if nothing hit m = new DragManip(v, new RubberRect(nil,nil, e.x,e.y,e.x,e.y), rel); } else { // else user selected object directly s->Exclusive(newSel); } delete newSel; return m; } Command* SelectTool::InterpretManipulator (Manipulator* m) { DragManip* dm = (DragManip*) m; Viewer* viewer = dm->GetViewer(); GraphicView* views = viewer->GetGraphicView(); Selection* s = viewer->GetSelection(); RubberRect* rr = (RubberRect*) dm->GetRubberband(); Selection* newSel; Coord l, b, r, t; rr->GetCurrent(l, b, r, t); newSel = views->ViewsWithin(l, b, r, t); s->Exclusive(newSel); delete newSel; return nil; } void SelectTool::Localize (Selection* s, Viewer* v) { Iterator i; for (s->First(i); !s->Done(i);) { GraphicView* view = s->GetView(i); if (view->GetViewer() != v) { s->Remove(i); view->EraseHandles(); } else { s->Next(i); } } } neuron-7.6.3/src/lib/Unidraw/selection.cpp000066400000000000000000000144731340731477100205140ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of Selection class. */ #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ GraphicView* Selection::View (UList* r) { return (GraphicView*) (*r)(); } UList* Selection::Elem (Iterator i) { return (UList*) i.GetValue(); } Selection::Selection (Selection* s) { _ulist = new UList; _count = 0; if (s != nil) { Iterator i; for (s->First(i); !s->Done(i); s->Next(i)) { Append(GetView(i)); } } } Selection::~Selection () { delete _ulist; } void Selection::Show (Viewer* viewer) { Iterator i; for (First(i); !Done(i); Next(i)) { GraphicView* view = GetView(i); if (viewer == nil || view->GetViewer() == viewer) { view->RedrawHandles(); } } } void Selection::Update (Viewer* viewer) { Iterator i; for (First(i); !Done(i); Next(i)) { GraphicView* view = GetView(i); if (viewer == nil || view->GetViewer() == viewer) { view->DrawHandles(); } } } void Selection::Hide (Viewer* viewer) { Iterator i; for (First(i); !Done(i); Next(i)) { GraphicView* view = GetView(i); if (viewer == nil || view->GetViewer() == viewer) { view->EraseHandles(); } } } void Selection::Init (Viewer* viewer) { Iterator i; for (First(i); !Done(i); Next(i)) { GraphicView* view = GetView(i); if (viewer == nil || view->GetViewer() == viewer) { view->InitHandles(); } } } void Selection::Clear (Viewer* viewer) { Iterator i; First(i); while (!Done(i)) { GraphicView* view = GetView(i); if (viewer == nil || view->GetViewer() == viewer) { view->EraseHandles(); } Remove(i); } } void Selection::Append (GraphicView* v) { _ulist->Append(new UList(v)); ++_count; } void Selection::Prepend (GraphicView* v) { _ulist->Prepend(new UList(v)); ++_count; } void Selection::InsertAfter (Iterator i, GraphicView* v) { Elem(i)->Prepend(new UList(v)); ++_count; } void Selection::InsertBefore (Iterator i, GraphicView* v) { Elem(i)->Append(new UList(v)); ++_count; } void Selection::Remove (Iterator& i) { UList* doomed = Elem(i); Next(i); _ulist->Remove(doomed); delete doomed; --_count; } void Selection::Remove (GraphicView* p) { UList* temp; if ((temp = _ulist->Find(p)) != nil) { _ulist->Remove(temp); delete temp; --_count; } } GraphicView* Selection::GetView (Iterator i) { return View(Elem(i)); } void Selection::SetView (GraphicView* gv, Iterator& i) { i.SetValue(_ulist->Find(gv)); } void Selection::First (Iterator& i) { i.SetValue(_ulist->First()); } void Selection::Last (Iterator& i) { i.SetValue(_ulist->Last()); } void Selection::Next (Iterator& i) { i.SetValue(Elem(i)->Next()); } void Selection::Prev (Iterator& i) { i.SetValue(Elem(i)->Prev()); } bool Selection::Done (Iterator i) { return Elem(i) == _ulist->End(); } int Selection::Number () { return _count; } bool Selection::Includes (GraphicView* e) { return _ulist->Find(e) != nil; } void Selection::Sort (GraphicView* views) { /* * Note: this doesn't work if there are views in the selection from more than * one GraphicViews. */ Iterator i; UList* cur; UList* newList = new UList; views->First(i); while (!views->Done(i) && !_ulist->IsEmpty()) { cur = _ulist->First(); while (cur != _ulist->End()) { if (views->GetView(i) == View(cur)) { _ulist->Remove(cur); newList->Append(cur); break; } else { cur = cur->Next(); } } views->Next(i); } if (!_ulist->IsEmpty()) { cerr << "warning: selection contained spurious element(s)\n"; } delete _ulist; _ulist = newList; } void Selection::Merge (Selection* s) { Iterator i; GraphicView* gv; for (s->First(i); !s->Done(i); s->Next(i)) { gv = GetView(i); if (!Includes(gv)) { Append(gv); } } Update(); } void Selection::Exclusive (Selection* s) { Iterator i; GraphicView* gv; for (s->First(i); !s->Done(i); s->Next(i)) { gv = GetView(i); if (Includes(gv)) { Remove(gv); gv->EraseHandles(); } else { Append(gv); } } Update(); } void Selection::GetBox (Coord& l, Coord& b, Coord& r, Coord& t) { Iterator i; Graphic* gr; BoxObj btotal, bgraphic; First(i); gr = GetView(i)->GetGraphic(); gr->GetBox(btotal); for (Next(i); !Done(i); Next(i)) { gr = GetView(i)->GetGraphic(); gr->GetBox(bgraphic); btotal = btotal + bgraphic; } l = btotal._left; b = btotal._bottom; r = btotal._right; t = btotal._top; } bool Selection::IsEmpty () { return _ulist->IsEmpty(); } neuron-7.6.3/src/lib/Unidraw/slot.cpp000066400000000000000000000423521340731477100175050ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Slot component definitions. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ ClassId SlotComp::GetClassId () { return SLOT_COMP; } bool SlotComp::IsA (ClassId id) { return SLOT_COMP == id || Connector::IsA(id); } SlotComp::SlotComp (SlotGraphic* graphic) : Connector(graphic) { _mobility = Fixed; } void SlotComp::Interpret (Command* cmd) { if ( cmd->IsA(MOVE_CMD) || cmd->IsA(BRUSH_CMD) || cmd->IsA(ALIGN_CMD) || cmd->IsA(MOBILITY_CMD) || cmd->IsA(DELETE_CMD) || cmd->IsA(CUT_CMD) || cmd->IsA(GROUP_CMD) || cmd->IsA(FRONT_CMD) || cmd->IsA(BACK_CMD) ) { Connector::Interpret(cmd); } } void SlotComp::Uninterpret (Command* cmd) { if ( cmd->IsA(MOVE_CMD) || cmd->IsA(BRUSH_CMD) || cmd->IsA(ALIGN_CMD) || cmd->IsA(MOBILITY_CMD) || cmd->IsA(DELETE_CMD) || cmd->IsA(CUT_CMD) || cmd->IsA(GROUP_CMD) || cmd->IsA(FRONT_CMD) || cmd->IsA(BACK_CMD) ) { Connector::Uninterpret(cmd); } } void SlotComp::SetMobility (Mobility m) { _mobility = m; } Mobility SlotComp::GetMobility () { return _mobility; } SlotGraphic* SlotComp::GetSlot () { return (SlotGraphic*) GetGraphic(); } void SlotComp::Read (istream& in) { Connector::Read(in); Coord x0, y0, length; int mobility; in >> x0 >> y0 >> length >> mobility; SlotGraphic* pin = new SlotGraphic(x0, y0, length); _mobility = Mobility(mobility); pin->FillBg(ReadBgFilled(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); pin->SetColors(fg, bg); pin->SetBrush(ReadBrush(in)); Transformer* t = ReadTransformer(in); pin->SetTransformer(t); Unref(t); SetGraphic(pin); } void SlotComp::Write (ostream& out) { Connector::Write(out); SlotGraphic* pin = GetSlot(); Coord x0, y0, length; int mobility = _mobility; pin->GetOriginal(x0, y0, length); out << x0 << " " << y0 << " " << length << " " << mobility << " "; WriteBgFilled(pin->BgFilled(), out); WriteColor(pin->GetFgColor(), out); WriteColor(pin->GetBgColor(), out); WriteBrush(pin->GetBrush(), out); WriteTransformer(pin->GetTransformer(), out); } void SlotComp::SetOrientation (SlotGraphic* sg, Orientation o) { sg->SetOrientation(o); } /*****************************************************************************/ SlotComp* SlotView::GetSlotComp () { return (SlotComp*) GetSubject(); } SlotComp* SlotView::NewSubject (SlotGraphic*) { return nil; } ClassId SlotView::GetClassId () { return SLOT_VIEW; } bool SlotView::IsA (ClassId id) { return SLOT_VIEW == id || ConnectorView::IsA(id); } SlotView::SlotView (SlotComp* subj) : ConnectorView(subj) { } SlotGraphic* SlotView::GetSlot () { return (SlotGraphic*) GetGraphic(); } void SlotView::Interpret (Command* cmd) { if (cmd->IsA(ALIGNTOGRID_CMD)) { SlotGraphic* slotg = (SlotGraphic*) GetGraphic(); Transformer total; slotg->TotalTransformation(total); Coord x0, y0, l; float tx0, ty0; slotg->GetOriginal(x0, y0, l); total.Transform(float(x0), float(y0), tx0, ty0); ((AlignToGridCmd*) cmd)->Align(this, tx0, ty0); } else { ConnectorView::Interpret(cmd); } } void SlotView::Update () { SlotGraphic* slot = GetSlot(); Graphic* slotgr = slot; IncurDamage(slot); *slotgr = *GetSlotComp()->GetGraphic(); IncurDamage(slot); EraseHandles(); } Manipulator* SlotView::CreateGraphicCompManip ( Viewer* v, Event& e, Transformer* rel, Tool* tool ) { SlotGraphic* sg = (SlotGraphic*) GetGraphic(); Side side = (sg->GetOrientation() == Horizontal) ? RightSide : BottomSide; Selection* s = v->GetSelection(); Coord cx = 0, rad = PIN_RAD, dum1 = 0, dum2 = 0; Coord l, b, r, t; v->Constrain(e.x, e.y); s->Clear(); if (rel != nil) { rel->Transform(cx, dum1); rel->Transform(rad, dum2); rad = abs(rad - cx); } if (side == RightSide) { l = r = e.x; b = e.y - rad; t = e.y + rad; } else { l = e.x - rad; r = e.x + rad; b = t = e.y; } StretchingRect* sr = new StretchingRect(nil, nil, l, b, r, t, side); return new DragManip(v, sr, rel, tool, Gravity); } Manipulator* SlotView::CreateConnectManip ( Viewer* v, Event& e, Transformer* rel, Tool* tool ) { Selection* s = v->GetSelection(); RubberGroup* rg = new RubberGroup(nil, nil); Coord l, b, r, t; s->Clear(); GetGraphic()->GetBox(l, b, r, t); Coord cx = (l+r)/2; Coord cy = (b+t)/2; rg->Append( new SlidingRect(nil, nil, l, b, r, t, cx, cy), new SlidingLine(nil, nil, l, cy, r, cy, cx, cy), new SlidingLine(nil, nil, cx, b, cx, t, cx, cy), new RubberLine(nil, nil, e.x, e.y, e.x, e.y) ); return new ConnectManip(v, rg, rel, tool); } Manipulator* SlotView::CreateManipulator ( Viewer* v, Event& e, Transformer* rel, Tool* tool ) { Manipulator* manip = nil; if (tool->IsA(GRAPHIC_COMP_TOOL)) { manip = CreateGraphicCompManip(v, e, rel, tool); } else if (tool->IsA(MOVE_TOOL)) { manip = GraphicView::CreateManipulator(v, e, rel, tool); } else if (tool->IsA(CONNECT_TOOL)) { manip = CreateConnectManip(v, e, rel, tool); } return manip; } static void Correct ( Transformer* t, Coord x, Coord y, Coord& length, float& dx, float& dy ) { Transformer corr(t); corr.Invert(); corr.Transform(float(x), float(y), dx, dy); dx -= x; dy -= y; float x0 = 0, y0 = 0, x1 = length, y1 = 0; corr.TransformRect(x0, y0, x1, y1); length = iv26_round(sqrt(square(x0-x1) + square(y0-y1))); } Command* SlotView::InterpGraphicCompManip (Manipulator* m) { Command* cmd = nil; DragManip* dm = (DragManip*) m; StretchingRect* sr = (StretchingRect*) dm->GetRubberband(); Coord l, b, r, t; sr->GetCurrent(l, b, r, t); if (l != r || b != t) { SlotGraphic* sg = (SlotGraphic*) GetGraphic(); Editor* ed = dm->GetViewer()->GetEditor(); BrushVar* brVar = (BrushVar*) ed->GetState("Brush"); Transformer* rel = dm->GetTransformer(); Coord x0, y0, length; NormalRect(l, b, r, t); if (sg->GetOrientation() == Horizontal) { x0 = l; y0 = (b + t)/2; length = r - l; } else { x0 = (l + r)/2; y0 = b; length = t - b; } if (rel != nil) { float dx, dy; Correct(rel, x0, y0, length, dx, dy); rel = new Transformer; rel->Translate(dx, dy); } Graphic* pg = GetGraphicComp()->GetGraphic(); SlotGraphic* slotGraphic = new SlotGraphic(x0, y0, length, pg); if (brVar != nil) slotGraphic->SetBrush(brVar->GetBrush()); slotGraphic->SetTransformer(rel); Unref(rel); cmd = new PasteCmd(ed, new Clipboard(NewSubject(slotGraphic))); } return cmd; } Command* SlotView::InterpConnectManip (Manipulator* m) { Editor* ed = m->GetViewer()->GetEditor(); ConnectManip* cm = (ConnectManip*) m; ConnectorView* target = cm->GetTarget(); Command* cmd = nil; if (target != nil) { cmd = new ConnectCmd(ed, GetConnector(), target->GetConnector()); } return cmd; } Command* SlotView::InterpretManipulator (Manipulator* m) { DragManip* dm = (DragManip*) m; Tool* tool = dm->GetTool(); Command* cmd = nil; if (tool->IsA(GRAPHIC_COMP_TOOL)) { cmd = InterpGraphicCompManip(m); } else if (tool->IsA(MOVE_TOOL)) { cmd = GraphicView::InterpretManipulator(m); } else if (tool->IsA(CONNECT_TOOL)) { cmd = InterpConnectManip(m); } return cmd; } Graphic* SlotView::GetGraphic () { Graphic* graphic = GraphicView::GetGraphic(); if (graphic == nil) { SlotComp* slotComp = GetSlotComp(); graphic = slotComp->GetGraphic()->Copy(); SetGraphic(graphic); } return graphic; } /*****************************************************************************/ SlotGraphic::SlotGraphic ( Coord x, Coord y, Coord length, Graphic* gr ) : Graphic(gr) { _x = x; _y = y; _length = length; _br = nil; if (gr != nil) { SlotGraphic::SetBrush(gr->GetBrush()); } } SlotGraphic::~SlotGraphic () { Unref(_br); } Graphic* SlotGraphic::Copy () { return new SlotGraphic(_x, _y, _length, this);} void SlotGraphic::GetOriginal (Coord& x, Coord& y, Coord& length) { x = _x; y = _y; length = _length; } void SlotGraphic::SetBrush (PSBrush* br) { if (_br != br) { Ref(br); Unref(_br); _br = br; invalidateCaches(); } } PSBrush* SlotGraphic::GetBrush () { return _br; } void SlotGraphic::concatGS (Graphic* g1, Graphic* g2, Graphic* dest) { Graphic::concatGS(g1, g2, dest); dest->SetBrush(GetBrush()); } void SlotGraphic::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { float r, t; float x0 = _x, y0 = _y - PIN_RAD, x1 = _x+_length, y1 = _y+PIN_RAD; transformRect(x0, y0, x1, y1, l, b, r, t, gs); cx = (l + r)/2; cy = (b + t)/2; tol = 0; } void SlotGraphic::draw (Canvas* c, Graphic* gs) { if (!gs->GetBrush()->None()) { update(gs); Coord l = _x, b = _y - PIN_RAD, r = _x+_length, t = _y + PIN_RAD; Coord cx = (l+r)/2; Coord cy = (b+t)/2; _p->Rect(c, l, b, r, t); _p->Line(c, l, cy, r, cy); _p->Line(c, cx, b, cx, t); } } Orientation SlotGraphic::GetOrientation () { Transformer* t = GetTransformer(); return (t == nil || !t->Rotated90()) ? Horizontal : Vertical; } void SlotGraphic::SetOrientation (Orientation newOrient) { Orientation curOrient = GetOrientation(); if (newOrient != curOrient) { Transformer* rot = new Transformer, *t = GetTransformer(); rot->Translate(-_x, -_y); rot->Rotate((newOrient == Vertical) ? 90 : -90); rot->Translate(_x, _y); if (t != nil) { rot->Postmultiply(t); } SetTransformer(rot); Unref(rot); } } /**************************************************************************/ HSlotComp::HSlotComp (SlotGraphic* sg) : SlotComp(sg) { if (sg != nil) { SetOrientation(sg, Horizontal); } } Component* HSlotComp::Copy () { HSlotComp* copy = new HSlotComp((SlotGraphic*) GetGraphic()->Copy()); copy->_mobility = _mobility; return copy; } void HSlotComp::Connect (Connector* target, CGlue* g) { SlotGraphic* slotgr = GetSlot(); float l, b, r, t; slotgr->GetBounds(l, b, r, t); float h = (r - l)/2; if (target->IsA(PIN_COMP)) { CGlue slotGlue(0, 0, h*hfil, h*hfil, 0, 0, h, h, 0, 0); slotGlue.Interpose(g); csolver->Connect(this, target, &slotGlue); Connector::Connect(target, &slotGlue); } else if (target->IsA(HSLOT_COMP)) { Graphic* peergr = target->GetGraphic(); peergr->GetBounds(l, b, r, t); h += (r - l)/2 ; CGlue slotGlue(0, 0, h*hfil, h*hfil, 0, 0, h, h, 0, 0); slotGlue.Interpose(g); csolver->Connect(this, target, &slotGlue); Connector::Connect(target, &slotGlue); } else if (target->IsA(VSLOT_COMP)) { Graphic* peergr = target->GetGraphic(); peergr->GetBounds(l, b, r, t); float v = (t - b)/2; CGlue slotGlue(0, 0, h*hfil, h*hfil, v*vfil, v*vfil, h, h, v, v); slotGlue.Interpose(g); csolver->Connect(this, target, &slotGlue); Connector::Connect(target, &slotGlue); } else if (target->IsA(PAD_COMP)) { Graphic* peergr = target->GetGraphic(); peergr->GetBounds(l, b, r, t); h += (r - l)/2; float v = (t - b)/2; CGlue slotGlue(0, 0, h*hfil, h*hfil, v*vfil, v*vfil, h, h, v, v); slotGlue.Interpose(g); csolver->Connect(this, target, &slotGlue); Connector::Connect(target, &slotGlue); } } ClassId HSlotComp::GetClassId () { return HSLOT_COMP; } bool HSlotComp::IsA (ClassId id) {return HSLOT_COMP==id||SlotComp::IsA(id);} /**************************************************************************/ HSlotComp* HSlotView::GetHSlotComp () { return (HSlotComp*) GetSubject(); } HSlotView::HSlotView (HSlotComp* subj) : SlotView(subj) { } ClassId HSlotView::GetClassId () { return HSLOT_VIEW; } bool HSlotView::IsA (ClassId id) {return HSLOT_VIEW==id||SlotView::IsA(id);} SlotComp* HSlotView::NewSubject (SlotGraphic* slotgr) { return new HSlotComp(slotgr); } /**************************************************************************/ VSlotComp::VSlotComp (SlotGraphic* sg) : SlotComp(sg) { if (sg != nil) { SetOrientation(sg, Vertical); } } Component* VSlotComp::Copy () { VSlotComp* copy = new VSlotComp((SlotGraphic*) GetGraphic()->Copy()); copy->_mobility = _mobility; return copy; } void VSlotComp::Connect (Connector* target, CGlue* g) { SlotGraphic* slotgr = GetSlot(); float l, b, r, t; slotgr->GetBounds(l, b, r, t); float v = (t - b)/2; if (target->IsA(PIN_COMP)) { CGlue slotGlue(0, 0, 0, 0, v*vfil, v*vfil, 0, 0, v, v); slotGlue.Interpose(g); csolver->Connect(this, target, &slotGlue); Connector::Connect(target, &slotGlue); } else if (target->IsA(HSLOT_COMP)) { Graphic* peergr = target->GetGraphic(); peergr->GetBounds(l, b, r, t); float h = (r - l)/2; CGlue slotGlue(0, 0, h*hfil, h*hfil, v*vfil, v*vfil, h, h, v, v); slotGlue.Interpose(g); csolver->Connect(this, target, &slotGlue); Connector::Connect(target, &slotGlue); } else if (target->IsA(VSLOT_COMP)) { Graphic* peergr = target->GetGraphic(); peergr->GetBounds(l, b, r, t); v += (t - b)/2; CGlue slotGlue(0, 0, 0, 0, v*vfil, v*vfil, 0, 0, v, v); slotGlue.Interpose(g); csolver->Connect(this, target, &slotGlue); Connector::Connect(target, &slotGlue); } else if (target->IsA(PAD_COMP)) { Graphic* peergr = target->GetGraphic(); peergr->GetBounds(l, b, r, t); float h = (r - l)/2; v += (t - b)/2; CGlue slotGlue(0, 0, h*hfil, h*hfil, v*vfil, v*vfil, h, h, v, v); slotGlue.Interpose(g); csolver->Connect(this, target, &slotGlue); Connector::Connect(target, &slotGlue); } } ClassId VSlotComp::GetClassId () { return VSLOT_COMP; } bool VSlotComp::IsA (ClassId id) {return VSLOT_COMP==id||SlotComp::IsA(id);} /**************************************************************************/ VSlotComp* VSlotView::GetVSlotComp () { return (VSlotComp*) GetSubject(); } VSlotView::VSlotView (VSlotComp* subj) : SlotView(subj) { } ClassId VSlotView::GetClassId () { return VSLOT_VIEW; } bool VSlotView::IsA (ClassId id) {return VSLOT_VIEW==id||SlotView::IsA(id);} SlotComp* VSlotView::NewSubject (SlotGraphic* slotgr) { return new VSlotComp(slotgr); } /**************************************************************************/ ClassId PSSlot::GetClassId () { return PS_SLOT; } bool PSSlot::IsA (ClassId id) {return PS_SLOT==id||PostScriptView::IsA(id);} PSSlot::PSSlot (SlotComp* subj) : PostScriptView(subj) { } bool PSSlot::Definition (ostream&) { // unimplemented return true; } neuron-7.6.3/src/lib/Unidraw/spline.cpp000066400000000000000000000312671340731477100200210ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Spline component definitions. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /****************************************************************************/ ClassId SplineComp::GetClassId () { return SPLINE_COMP; } bool SplineComp::IsA (ClassId id) { return SPLINE_COMP == id || VerticesComp::IsA(id); } Component* SplineComp::Copy () { return new SplineComp((SFH_OpenBSpline*) GetGraphic()->Copy()); } SplineComp::SplineComp (SFH_OpenBSpline* graphic) : VerticesComp(graphic) { } SFH_OpenBSpline* SplineComp::GetSpline () { return (SFH_OpenBSpline*) GetGraphic(); } void SplineComp::Read (istream& in) { VerticesComp::Read(in); Coord* x, *y; int count; ReadVertices(in, x, y, count); SFH_OpenBSpline* spline = new SFH_OpenBSpline(x, y, count); delete x; delete y; spline->FillBg(ReadBgFilled(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); spline->SetColors(fg, bg); spline->SetBrush(ReadBrush(in)); spline->SetPattern(ReadPattern(in)); Transformer* t = ReadTransformer(in); spline->SetTransformer(t); Unref(t); SetGraphic(spline); } void SplineComp::Write (ostream& out) { VerticesComp::Write(out); SFH_OpenBSpline* spline = GetSpline(); const Coord* x, *y; int count = spline->GetOriginal(x, y); WriteVertices(x, y, count, out); WriteBgFilled(spline->BgFilled(), out); WriteColor(spline->GetFgColor(), out); WriteColor(spline->GetBgColor(), out); WriteBrush(spline->GetBrush(), out); WritePattern(spline->GetPattern(), out); WriteTransformer(spline->GetTransformer(), out); } /****************************************************************************/ SplineView::SplineView (SplineComp* subj) : VerticesView(subj) { } SplineComp* SplineView::GetSplineComp () { return (SplineComp*) GetSubject(); } ClassId SplineView::GetClassId () { return SPLINE_VIEW; } bool SplineView::IsA (ClassId id) { return SPLINE_VIEW == id || VerticesView::IsA(id); } bool SplineView::VertexChanged () { SFH_OpenBSpline* gview = (SFH_OpenBSpline*) GetGraphic(); SFH_OpenBSpline* gsubj = (SFH_OpenBSpline*) GetSplineComp()->GetGraphic(); return *gview != *gsubj; } Manipulator* SplineView::CreateManipulator ( Viewer* v, Event& e, Transformer* rel, Tool* tool ) { Manipulator* m = nil; if (tool->IsA(GRAPHIC_COMP_TOOL)) { v->Constrain(e.x, e.y); Coord x[1], y[1]; x[0] = e.x; y[0] = e.y; GrowingVertices* rub = new GrowingBSpline( nil, nil, x, y, 1, -1, HANDLE_SIZE ); m = new VertexManip( v, rub, rel, tool, DragConstraint(HorizOrVert | Gravity) ); } else if (tool->IsA(RESHAPE_TOOL)) { Coord* x, *y; int n; v->Constrain(e.x, e.y); GetVertices(x, y, n); GrowingBSpline* rub = new GrowingBSpline( nil, nil, x, y, n, ClosestPoint(x, y, n, e.x, e.y), HANDLE_SIZE ); delete x; delete y; m = new VertexManip( v, rub, rel, tool, DragConstraint(HorizOrVert | Gravity) ); } else { m = VerticesView::CreateManipulator(v, e, rel, tool); } return m; } Command* SplineView::InterpretManipulator (Manipulator* m) { DragManip* dm = (DragManip*) m; Editor* ed = dm->GetViewer()->GetEditor(); Tool* tool = dm->GetTool(); Transformer* rel = dm->GetTransformer(); Command* cmd = nil; if (tool->IsA(GRAPHIC_COMP_TOOL)) { GrowingVertices* gv = (GrowingVertices*) dm->GetRubberband(); Coord* x, *y; int n, pt; gv->GetCurrent(x, y, n, pt); if (n > 2 || x[0] != x[1] || y[0] != y[1]) { BrushVar* brVar = (BrushVar*) ed->GetState("BrushVar"); PatternVar* patVar = (PatternVar*) ed->GetState("PatternVar"); ColorVar* colVar = (ColorVar*) ed->GetState("ColorVar"); if (rel != nil) { rel = new Transformer(rel); rel->Invert(); } Graphic* pg = GetGraphicComp()->GetGraphic(); SFH_OpenBSpline* spline = new SFH_OpenBSpline(x, y, n, pg); if (brVar != nil) spline->SetBrush(brVar->GetBrush()); if (patVar != nil) spline->SetPattern(patVar->GetPattern()); if (colVar != nil) { spline->SetColors(colVar->GetFgColor(), colVar->GetBgColor()); } spline->SetTransformer(rel); Unref(rel); cmd = new PasteCmd(ed, new Clipboard(new SplineComp(spline))); } delete x; delete y; } else if (tool->IsA(RESHAPE_TOOL)) { GrowingVertices* gv = (GrowingVertices*) dm->GetRubberband(); Coord* x, *y; int n, pt; gv->RemoveVertex(); gv->GetCurrent(x, y, n, pt); if (rel != nil) { rel = new Transformer(rel); rel->Invert(); } SFH_OpenBSpline* spline = new SFH_OpenBSpline(x, y, n, GetGraphic()); delete x; delete y; spline->SetTransformer(rel); Unref(rel); cmd = new ReplaceCmd(ed, new SplineComp(spline)); } else { cmd = VerticesView::InterpretManipulator(m); } return cmd; } /*****************************************************************************/ ClassId PSSpline::GetClassId () { return PS_SPLINE; } bool PSSpline::IsA (ClassId id) { return PS_SPLINE == id || PSVertices::IsA(id); } PSSpline::PSSpline (SplineComp* subj) : PSVertices(subj) { } const char* PSSpline::Name () { return "BSpl"; } /*****************************************************************************/ ClassId ClosedSplineComp::GetClassId () { return CLOSEDSPLINE_COMP; } bool ClosedSplineComp::IsA (ClassId id) { return CLOSEDSPLINE_COMP == id || VerticesComp::IsA(id); } Component* ClosedSplineComp::Copy () { return new ClosedSplineComp((SFH_ClosedBSpline*) GetGraphic()->Copy()); } ClosedSplineComp::ClosedSplineComp ( SFH_ClosedBSpline* graphic ) : VerticesComp(graphic) { } SFH_ClosedBSpline* ClosedSplineComp::GetClosedSpline () { return (SFH_ClosedBSpline*) GetGraphic(); } void ClosedSplineComp::Read (istream& in) { VerticesComp::Read(in); Coord* x, *y; int count; ReadVertices(in, x, y, count); SFH_ClosedBSpline* spline = new SFH_ClosedBSpline(x, y, count); delete x; delete y; spline->FillBg(ReadBgFilled(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); spline->SetColors(fg, bg); spline->SetBrush(ReadBrush(in)); spline->SetPattern(ReadPattern(in)); Transformer* t = ReadTransformer(in); spline->SetTransformer(t); Unref(t); SetGraphic(spline); } void ClosedSplineComp::Write (ostream& out) { VerticesComp::Write(out); SFH_ClosedBSpline* spline = GetClosedSpline(); const Coord* x, *y; int count = spline->GetOriginal(x, y); WriteVertices(x, y, count, out); WriteBgFilled(spline->BgFilled(), out); WriteColor(spline->GetFgColor(), out); WriteColor(spline->GetBgColor(), out); WriteBrush(spline->GetBrush(), out); WritePattern(spline->GetPattern(), out); WriteTransformer(spline->GetTransformer(), out); } /****************************************************************************/ ClosedSplineView::ClosedSplineView ( ClosedSplineComp* subj ) : VerticesView(subj) { } ClosedSplineComp* ClosedSplineView::GetClosedSplineComp () { return (ClosedSplineComp*) GetSubject(); } ClassId ClosedSplineView::GetClassId () { return CLOSEDSPLINE_VIEW; } bool ClosedSplineView::IsA (ClassId id) { return CLOSEDSPLINE_VIEW == id || VerticesView::IsA(id); } bool ClosedSplineView::VertexChanged () { SFH_ClosedBSpline* gview = (SFH_ClosedBSpline*) GetGraphic(); SFH_ClosedBSpline* gsubj = (SFH_ClosedBSpline*) GetClosedSplineComp()->GetGraphic(); return *gview != *gsubj; } Manipulator* ClosedSplineView::CreateManipulator ( Viewer* v, Event& e, Transformer* rel, Tool* tool ) { Manipulator* m = nil; if (tool->IsA(GRAPHIC_COMP_TOOL)) { v->Constrain(e.x, e.y); Coord x[1], y[1]; x[0] = e.x; y[0] = e.y; GrowingVertices* rub = new GrowingClosedBSpline( nil, nil, x, y, 1, -1, HANDLE_SIZE ); m = new VertexManip( v, rub, rel, tool, DragConstraint(HorizOrVert | Gravity) ); } else if (tool->IsA(RESHAPE_TOOL)) { Coord* x, *y; int n; v->Constrain(e.x, e.y); GetVertices(x, y, n); GrowingClosedBSpline* rub = new GrowingClosedBSpline( nil, nil, x, y, n, ClosestPoint(x, y, n, e.x, e.y), HANDLE_SIZE ); delete x; delete y; m = new VertexManip( v, rub, rel, tool, DragConstraint(HorizOrVert | Gravity) ); } else { m = VerticesView::CreateManipulator(v, e, rel, tool); } return m; } Command* ClosedSplineView::InterpretManipulator (Manipulator* m) { DragManip* dm = (DragManip*) m; Editor* ed = dm->GetViewer()->GetEditor(); Tool* tool = dm->GetTool(); Transformer* rel = dm->GetTransformer(); Command* cmd = nil; if (tool->IsA(GRAPHIC_COMP_TOOL)) { GrowingVertices* gv = (GrowingVertices*) dm->GetRubberband(); Coord* x, *y; int n, pt; gv->GetCurrent(x, y, n, pt); if (n > 2 || x[0] != x[1] || y[0] != y[1]) { BrushVar* brVar = (BrushVar*) ed->GetState("BrushVar"); PatternVar* patVar = (PatternVar*) ed->GetState("PatternVar"); ColorVar* colVar = (ColorVar*) ed->GetState("ColorVar"); if (rel != nil) { rel = new Transformer(rel); rel->Invert(); } Graphic* pg = GetGraphicComp()->GetGraphic(); SFH_ClosedBSpline* cbs = new SFH_ClosedBSpline(x, y, n, pg); if (brVar != nil) cbs->SetBrush(brVar->GetBrush()); if (patVar != nil) cbs->SetPattern(patVar->GetPattern()); if (colVar != nil) { cbs->SetColors(colVar->GetFgColor(), colVar->GetBgColor()); } cbs->SetTransformer(rel); Unref(rel); cmd = new PasteCmd(ed, new Clipboard(new ClosedSplineComp(cbs))); } delete x; delete y; } else if (tool->IsA(RESHAPE_TOOL)) { GrowingVertices* gv = (GrowingVertices*) dm->GetRubberband(); Coord* x, *y; int n, pt; gv->RemoveVertex(); gv->GetCurrent(x, y, n, pt); if (rel != nil) { rel = new Transformer(rel); rel->Invert(); } SFH_ClosedBSpline* cbs = new SFH_ClosedBSpline(x, y, n, GetGraphic()); delete x; delete y; cbs->SetTransformer(rel); Unref(rel); cmd = new ReplaceCmd(ed, new ClosedSplineComp(cbs)); } else { cmd = VerticesView::InterpretManipulator(m); } return cmd; } /*****************************************************************************/ ClassId PSClosedSpline::GetClassId () { return PS_CLOSEDSPLINE; } bool PSClosedSpline::IsA (ClassId id) { return PS_CLOSEDSPLINE == id || PSVertices::IsA(id); } PSClosedSpline::PSClosedSpline (ClosedSplineComp* subj) : PSVertices(subj) { } const char* PSClosedSpline::Name () { return "CBSpl"; } neuron-7.6.3/src/lib/Unidraw/splines.cpp000066400000000000000000000371171340731477100202040ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Spline implementations. */ #include #include #include #include #include #include /*****************************************************************************/ OpenBSpline::OpenBSpline ( Coord* x, Coord* y, int count, Graphic* gr ) : Vertices(gr) { _count = count + 4; _x = new Coord[_count]; _y = new Coord[_count]; ArrayCopy(x, y, count, _x+2, _y+2); _x[0] = _x[1] = _x[2]; _y[0] = _y[1] = _y[2]; _x[_count-1] = _x[_count-2] = _x[_count-3]; _y[_count-1] = _y[_count-2] = _y[_count-3]; } int OpenBSpline::GetOriginal (const Coord*& x, const Coord*& y) { x = _x + 2; y = _y + 2; return _count - 4; } bool OpenBSpline::s_contains (PointObj& po, Graphic* gs) { PointObj pt (&po); BoxObj b; getBox(b, gs); if (b.Contains(pt)) { invTransform(pt._x, pt._y, gs); MultiLineObj ml; ml.SplineToMultiLine(_x, _y, _count); return ml.Contains(pt); } return false; } bool OpenBSpline::f_contains (PointObj& po, Graphic* gs) { PointObj pt (&po); BoxObj b; getBox(b, gs); if (b.Contains(pt)) { invTransform(pt._x, pt._y, gs); FillPolygonObj fp; fp.ClosedSplineToPolygon(_x, _y, _count); return fp.Contains(pt); } return false; } bool OpenBSpline::s_intersects (BoxObj& userb, Graphic* gs) { Coord* convx, *convy; BoxObj b; bool result = false; getBox(b, gs); if (b.Intersects(userb)) { convx = new Coord[_count]; convy = new Coord[_count]; transformList(_x, _y, _count, convx, convy, gs); MultiLineObj ml; ml.SplineToMultiLine(convx, convy, _count); result = ml.Intersects(userb); delete convx; delete convy; } return result; } bool OpenBSpline::f_intersects (BoxObj& userb, Graphic* gs) { Coord* convx, *convy; BoxObj b; bool result = false; getBox(b, gs); if (b.Intersects(userb)) { convx = new Coord[_count]; convy = new Coord[_count]; transformList(_x, _y, _count, convx, convy, gs); FillPolygonObj fp; fp.ClosedSplineToPolygon(convx, convy, _count); result = fp.Intersects(userb); delete convx; delete convy; } return result; } /*****************************************************************************/ S_OpenBSpline::S_OpenBSpline ( Coord* x, Coord* y, int count, Graphic* gr ) : OpenBSpline(x, y, count, gr) { _br = nil; if (gr != nil) { S_OpenBSpline::SetBrush(gr->GetBrush()); } } S_OpenBSpline::~S_OpenBSpline () { Unref(_br); } void S_OpenBSpline::SetBrush (PSBrush* br) { if (_br != br) { Ref(br); Unref(_br); _br = br; invalidateCaches(); } } PSBrush* S_OpenBSpline::GetBrush () { return _br; } Graphic* S_OpenBSpline::Copy () { Coord* x, *y; const Coord* cx, * cy; int count = GetOriginal(cx, cy); x = (Coord*)cx; y = (Coord*)cy; return new S_OpenBSpline(x, y, count, this); } void S_OpenBSpline::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { s_getExtent(l, b, cx, cy, tol, gs); } bool S_OpenBSpline::contains (PointObj& po, Graphic* gs) { return s_contains(po, gs); } bool S_OpenBSpline::intersects (BoxObj& userb, Graphic* gs) { return s_intersects(userb, gs); } void S_OpenBSpline::draw (Canvas *c, Graphic* gs) { if (!gs->GetBrush()->None()) { update(gs); _p->BSpline(c, _x, _y, _count); } } /*****************************************************************************/ F_OpenBSpline::F_OpenBSpline ( Coord* x, Coord* y, int count, Graphic* gr ) : OpenBSpline(x, y, count, gr) { _pat = nil; if (gr != nil) { F_OpenBSpline::SetPattern(gr->GetPattern()); } } F_OpenBSpline::~F_OpenBSpline () { Unref(_pat); } void F_OpenBSpline::SetPattern (PSPattern* pat) { Ref(pat); Unref(_pat); _pat = pat; } PSPattern* F_OpenBSpline::GetPattern () { return _pat; } Graphic* F_OpenBSpline::Copy () { Coord* x, *y; const Coord* cx, * cy; int count = GetOriginal(cx, cy); x = (Coord*)cx; y = (Coord*)cy; return new F_OpenBSpline(x, y, count, this); } void F_OpenBSpline::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { f_getExtent(l, b, cx, cy, tol, gs); } bool F_OpenBSpline::contains (PointObj& po, Graphic* gs) { return !gs->GetPattern()->None() && f_contains(po, gs); } bool F_OpenBSpline::intersects (BoxObj& userb, Graphic* gs) { return !gs->GetPattern()->None() && f_intersects(userb, gs); } void F_OpenBSpline::draw (Canvas *c, Graphic* gs) { if (!gs->GetPattern()->None()) { update(gs); _p->FillBSpline(c, _x, _y, _count); } } /*****************************************************************************/ SF_OpenBSpline::SF_OpenBSpline ( Coord* x, Coord* y, int count, Graphic* gr ) : OpenBSpline(x, y, count, gr) { _br = nil; _pat = nil; if (gr != nil) { SF_OpenBSpline::SetBrush(gr->GetBrush()); SF_OpenBSpline::SetPattern(gr->GetPattern()); } } SF_OpenBSpline::~SF_OpenBSpline () { Unref(_br); Unref(_pat); } void SF_OpenBSpline::SetBrush (PSBrush* br) { if (_br != br) { Ref(br); Unref(_br); _br = br; invalidateCaches(); } } PSBrush* SF_OpenBSpline::GetBrush () { return _br; } void SF_OpenBSpline::SetPattern (PSPattern* pat) { Ref(pat); Unref(_pat); _pat = pat; } PSPattern* SF_OpenBSpline::GetPattern () { return _pat; } Graphic* SF_OpenBSpline::Copy () { Coord* x, *y; const Coord* cx, * cy; int count = GetOriginal(cx, cy); x = (Coord*)cx; y = (Coord*)cy; return new SF_OpenBSpline(x, y, count, this); } void SF_OpenBSpline::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { s_getExtent(l, b, cx, cy, tol, gs); } bool SF_OpenBSpline::contains (PointObj& po, Graphic* gs) { return (!gs->GetPattern()->None() && f_contains(po, gs)) || s_contains(po, gs); } bool SF_OpenBSpline::intersects (BoxObj& userb, Graphic* gs) { return (!gs->GetPattern()->None() && f_intersects(userb, gs)) || s_intersects(userb, gs); } void SF_OpenBSpline::draw (Canvas *c, Graphic* gs) { update(gs); if (!gs->GetPattern()->None()) { _p->FillBSpline(c, _x, _y, _count); } if (!gs->GetBrush()->None()) { _p->BSpline(c, _x, _y, _count); } } /*****************************************************************************/ SFH_OpenBSpline::SFH_OpenBSpline( Coord* x, Coord* y, int count, Graphic* gr ) : SF_OpenBSpline(x, y, count, gr) { } Graphic* SFH_OpenBSpline::Copy () { Coord* x, *y; const Coord* cx, * cy; int count = GetOriginal(cx, cy); x = (Coord*)cx; y = (Coord*)cy; return new SFH_OpenBSpline(x, y, count, this); } bool SFH_OpenBSpline::contains (PointObj& po, Graphic* gs) { const Coord *x, *y; int count = GetOriginal(x, y); Transformer* t = gs->GetTransformer(); if (t != nil) { t->InvTransform(po._x, po._y); } for (int i = 0; i < count; i++) { if (x[i] == po._x && y[i] == po._y) { return true; } } return SF_OpenBSpline::contains(po, gs); } bool SFH_OpenBSpline::intersects (BoxObj& userb, Graphic* gs) { PointObj po; const Coord *x, *y; int count = GetOriginal(x, y); Transformer* t = gs->GetTransformer(); for (int i = 0; i < count; i++) { po._x = x[i]; po._y = y[i]; if (t != nil) { t->Transform(po._x, po._y); } if (userb.Contains(po)) { return true; } } return SF_OpenBSpline::intersects(userb, gs); } /*****************************************************************************/ ClosedBSpline::ClosedBSpline ( Coord* x, Coord* y, int count, Graphic* gr ) : Vertices(x, y, count, gr) { } bool ClosedBSpline::s_contains (PointObj& po, Graphic* gs) { PointObj pt (&po); BoxObj b; getBox(b, gs); if (b.Contains(pt)) { invTransform(pt._x, pt._y, gs); MultiLineObj ml; ml.ClosedSplineToPolygon(_x, _y, _count); return ml.Contains(pt); } return false; } bool ClosedBSpline::f_contains (PointObj& po, Graphic* gs) { PointObj pt (&po); BoxObj b; getBox(b, gs); if (b.Contains(pt)) { invTransform(pt._x, pt._y, gs); FillPolygonObj fp; fp.ClosedSplineToPolygon(_x, _y, _count); return fp.Contains(pt); } return false; } bool ClosedBSpline::s_intersects (BoxObj& userb, Graphic* gs) { Coord* convx, *convy; BoxObj b; bool result = false; getBox(b, gs); if (b.Intersects(userb)) { convx = new Coord[_count]; convy = new Coord[_count]; transformList(_x, _y, _count, convx, convy, gs); MultiLineObj ml; ml.ClosedSplineToPolygon(convx, convy, _count); result = ml.Intersects(userb); delete convx; delete convy; } return result; } bool ClosedBSpline::f_intersects (BoxObj& userb, Graphic* gs) { Coord* convx, *convy; BoxObj b; bool result = false; getBox(b, gs); if (b.Intersects(userb)) { convx = new Coord[_count]; convy = new Coord[_count]; transformList(_x, _y, _count, convx, convy, gs); FillPolygonObj fp; fp.ClosedSplineToPolygon(convx, convy, _count); result = fp.Intersects(userb); delete convx; delete convy; } return result; } /*****************************************************************************/ S_ClosedBSpline::S_ClosedBSpline ( Coord* x, Coord* y, int count, Graphic* gr ) : ClosedBSpline(x, y, count, gr) { _br = nil; if (gr != nil) { S_ClosedBSpline::SetBrush(gr->GetBrush()); } } S_ClosedBSpline::~S_ClosedBSpline () { Unref(_br); } void S_ClosedBSpline::SetBrush (PSBrush* br) { if (_br != br) { Ref(br); Unref(_br); _br = br; invalidateCaches(); } } PSBrush* S_ClosedBSpline::GetBrush () { return _br; } Graphic* S_ClosedBSpline::Copy () { return new S_ClosedBSpline(_x, _y, _count, this); } void S_ClosedBSpline::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { s_getExtent(l, b, cx, cy, tol, gs); } bool S_ClosedBSpline::contains (PointObj& po, Graphic* gs) { return s_contains(po, gs); } bool S_ClosedBSpline::intersects (BoxObj& userb, Graphic* gs) { return s_intersects(userb, gs); } void S_ClosedBSpline::draw (Canvas *c, Graphic* gs) { if (!gs->GetBrush()->None()) { update(gs); _p->BSpline(c, _x, _y, _count); } } /*****************************************************************************/ F_ClosedBSpline::F_ClosedBSpline ( Coord* x, Coord* y, int count, Graphic* gr ) : ClosedBSpline(x, y, count, gr) { _pat = nil; if (gr != nil) { F_ClosedBSpline::SetPattern(gr->GetPattern()); } } F_ClosedBSpline::~F_ClosedBSpline () { Unref(_pat); } void F_ClosedBSpline::SetPattern (PSPattern* pat) { Ref(pat); Unref(_pat); _pat = pat; } PSPattern* F_ClosedBSpline::GetPattern () { return _pat; } Graphic* F_ClosedBSpline::Copy () { return new F_ClosedBSpline(_x, _y, _count, this); } void F_ClosedBSpline::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { f_getExtent(l, b, cx, cy, tol, gs); } bool F_ClosedBSpline::contains (PointObj& po, Graphic* gs) { return !gs->GetPattern()->None() && f_contains(po, gs); } bool F_ClosedBSpline::intersects (BoxObj& userb, Graphic* gs) { return !gs->GetPattern()->None() && f_intersects(userb, gs); } void F_ClosedBSpline::draw (Canvas *c, Graphic* gs) { if (!gs->GetPattern()->None()) { update(gs); _p->FillBSpline(c, _x, _y, _count); } } /*****************************************************************************/ SF_ClosedBSpline::SF_ClosedBSpline ( Coord* x, Coord* y, int count, Graphic* gr ) : ClosedBSpline(x, y, count, gr) { _br = nil; _pat = nil; if (gr != nil) { SF_ClosedBSpline::SetBrush(gr->GetBrush()); SF_ClosedBSpline::SetPattern(gr->GetPattern()); } } SF_ClosedBSpline::~SF_ClosedBSpline () { Unref(_br); Unref(_pat); } void SF_ClosedBSpline::SetBrush (PSBrush* br) { if (_br != br) { Ref(br); Unref(_br); _br = br; invalidateCaches(); } } PSBrush* SF_ClosedBSpline::GetBrush () { return _br; } void SF_ClosedBSpline::SetPattern (PSPattern* pat) { Ref(pat); Unref(_pat); _pat = pat; } PSPattern* SF_ClosedBSpline::GetPattern () { return _pat; } Graphic* SF_ClosedBSpline::Copy () { return new SF_ClosedBSpline(_x, _y, _count, this); } void SF_ClosedBSpline::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { s_getExtent(l, b, cx, cy, tol, gs); } bool SF_ClosedBSpline::contains (PointObj& po, Graphic* gs) { return (!gs->GetPattern()->None() && f_contains(po, gs)) || s_contains(po, gs); } bool SF_ClosedBSpline::intersects (BoxObj& userb, Graphic* gs) { return (!gs->GetPattern()->None() && f_intersects(userb, gs)) || s_intersects(userb, gs); } void SF_ClosedBSpline::draw (Canvas *c, Graphic* gs) { update(gs); if (!gs->GetPattern()->None()) { _p->FillBSpline(c, _x, _y, _count); } if (!gs->GetBrush()->None()) { _p->ClosedBSpline(c, _x, _y, _count); } } /*****************************************************************************/ SFH_ClosedBSpline::SFH_ClosedBSpline( Coord* x, Coord* y, int count, Graphic* gr ) : SF_ClosedBSpline(x, y, count, gr) { } Graphic* SFH_ClosedBSpline::Copy () { Coord* x, *y; const Coord* cx, * cy; int count = GetOriginal(cx, cy); x = (Coord*)cx; y = (Coord*)cy; return new SFH_ClosedBSpline(x, y, count, this); } bool SFH_ClosedBSpline::contains (PointObj& po, Graphic* gs) { const Coord *x, *y; int count = GetOriginal(x, y); Transformer* t = gs->GetTransformer(); if (t != nil) { t->InvTransform(po._x, po._y); } for (int i = 0; i < count; i++) { if (x[i] == po._x && y[i] == po._y) { return true; } } return SF_ClosedBSpline::contains(po, gs); } bool SFH_ClosedBSpline::intersects (BoxObj& userb, Graphic* gs) { PointObj po; const Coord *x, *y; int count = GetOriginal(x, y); Transformer* t = gs->GetTransformer(); for (int i = 0; i < count; i++) { po._x = x[i]; po._y = y[i]; if (t != nil) { t->Transform(po._x, po._y); } if (userb.Contains(po)) { return true; } } return SF_ClosedBSpline::intersects(userb, gs); } neuron-7.6.3/src/lib/Unidraw/statevar.cpp000066400000000000000000000053131340731477100203510ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of StateVar base class. */ #include #include #include #include #include #include /*****************************************************************************/ inline StateVarView* view (UList* u) { return (StateVarView*) (*u)(); } StateVar::StateVar () { _views = new UList; _conn = nil; } StateVar::~StateVar () { while (!_views->IsEmpty()) { Detach(view(_views->First())); } delete _views; } void StateVar::Attach (StateVarView* view) { _views->Append(new UList(view)); view->SetSubject(this); } void StateVar::Detach (StateVarView* view) { _views->Delete(view); view->SetSubject(nil); } void StateVar::Notify () { for (UList* v = _views->First(); v != _views->End(); v = v->Next()) { view(v)->Update(); } } StateVar& StateVar::operator = (StateVar&) { return *this; } StateVar* StateVar::Copy () { return nil; } ClassId StateVar::GetClassId () { return STATE_VAR; } ClassId StateVar::GetSubstId (const char*&) { return UNDEFINED_CLASS; } bool StateVar::IsA (ClassId id) { return STATE_VAR == id; } void StateVar::SetBinding (Connector* conn) { _conn = conn; Notify(); } Connector* StateVar::GetBinding () { return _conn; } void StateVar::Read (istream& in) { _conn = (Connector*) unidraw->GetCatalog()->ReadComponent(in); } void StateVar::Write (ostream& out) { unidraw->GetCatalog()->WriteComponent((Component*) _conn, out); } neuron-7.6.3/src/lib/Unidraw/statevars.cpp000066400000000000000000000305621340731477100205400ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of StateVar subclasses. */ #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ UList* ModifStatusVar::_vars; NameVar::NameVar (const char* n) { _name = nil; SetName(n); } void NameVar::SetName (const char* n) { if (n == nil) { if (_name != nil) {delete [] _name;} _name = nil; Notify(); } else if (_name == nil || (_name != nil && (strcmp(n, _name) != 0))) { if (_name != nil) {delete [] _name;} _name = strnew(n); Notify(); } } const char* NameVar::GetName () { return _name; } StateVar& NameVar::operator = (StateVar& var) { if (var.IsA(NAME_VAR)) { NameVar* nameVar = (NameVar*) &var; SetName(nameVar->GetName()); } return *this; } StateVar* NameVar::Copy () { return new NameVar(GetName()); } ClassId NameVar::GetClassId () { return NAME_VAR; } bool NameVar::IsA (ClassId id) {return NAME_VAR == id || StateVar::IsA(id);} void NameVar::Read (istream& in) { StateVar::Read(in); _name = unidraw->GetCatalog()->ReadString(in); } void NameVar::Write (ostream& out) { StateVar::Write(out); unidraw->GetCatalog()->WriteString(GetName(), out); } /*****************************************************************************/ CompNameVar::CompNameVar (Component* c) : NameVar(nil) { _comp = nil; SetComponent(c); } void CompNameVar::UpdateName () { if (_comp == nil) { SetName(nil); } else { const char* tmp = unidraw->GetCatalog()->GetName(_comp); const char* name = (tmp == nil) ? PartOf() : tmp; SetName(name); } } void CompNameVar::SetComponent (Component* c) { if (c != _comp) { _comp = c; UpdateName(); Notify(); } } Component* CompNameVar::GetComponent () { return _comp; } const char* CompNameVar::PartOf () { Component* curComp = _comp->GetParent(); Catalog* catalog = unidraw->GetCatalog(); while (curComp != nil && catalog->GetName(curComp) == nil) { curComp = curComp->GetParent(); } return (curComp == nil) ? nil : catalog->GetName(curComp); } StateVar& CompNameVar::operator = (StateVar& var) { if (var.IsA(COMPNAME_VAR)) { CompNameVar* compNameVar = (CompNameVar*) &var; SetComponent(compNameVar->GetComponent()); } return *this; } StateVar* CompNameVar::Copy () { return new CompNameVar(GetComponent()); } ClassId CompNameVar::GetClassId () { return COMPNAME_VAR; } bool CompNameVar::IsA (ClassId id) { return COMPNAME_VAR == id || NameVar::IsA(id); } void CompNameVar::Read (istream& in) { NameVar::Read(in); _comp = unidraw->GetCatalog()->ReadComponent(in); } void CompNameVar::Write (ostream& out) { NameVar::Write(out); unidraw->GetCatalog()->WriteComponent(GetComponent(), out); } /*****************************************************************************/ inline ModifStatusVar* var (UList* u) { return (ModifStatusVar*) (*u)(); } ModifStatusVar::ModifStatusVar (Component* c, bool m) { _modified = m; if (_vars == nil) { _vars = new UList; } SetComponent(c); _vars->Append(new UList(this)); } ModifStatusVar::~ModifStatusVar () { _vars->Delete(this); } void ModifStatusVar::SetModifStatus (bool status) { if (status != _modified) { for (UList* v = _vars->First(); v != _vars->End(); v = v->Next()) { if (var(v)->GetComponent() == _component) { var(v)->modified(status); } } } } void ModifStatusVar::SetComponent (Component* c) { _component = (c == nil) ? nil : c->GetRoot(); for (UList* v = _vars->First(); v != _vars->End(); v = v->Next()) { ModifStatusVar* msv = var(v); if (msv != this && msv->GetComponent() == _component) { modified(msv->GetModifStatus()); return; } } modified(false); } bool ModifStatusVar::GetModifStatus () { return _modified; } Component* ModifStatusVar::GetComponent () { return _component; } void ModifStatusVar::modified (int m) { _modified = m; Notify(); } StateVar& ModifStatusVar::operator = (StateVar& var) { if (var.IsA(MODIFSTATUS_VAR)) { ModifStatusVar* msVar = (ModifStatusVar*) &var; SetModifStatus(msVar->GetModifStatus()); } return *this; } StateVar* ModifStatusVar::Copy () { return new ModifStatusVar(GetComponent(),GetModifStatus()); } ClassId ModifStatusVar::GetClassId () { return MODIFSTATUS_VAR; } bool ModifStatusVar::IsA (ClassId id) { return MODIFSTATUS_VAR == id || StateVar::IsA(id); } void ModifStatusVar::Read (istream& in) { StateVar::Read(in); in >> _modified; } void ModifStatusVar::Write (ostream& out) { StateVar::Write(out); out << _modified << " "; } /*****************************************************************************/ MagnifVar::MagnifVar (float m) { _magnif = m; } void MagnifVar::SetMagnif (float m) { if (m != _magnif) { _magnif = m; Notify(); } } float MagnifVar::GetMagnif () { return _magnif; } StateVar& MagnifVar::operator = (StateVar& var) { if (var.IsA(MAGNIF_VAR)) { MagnifVar* magVar = (MagnifVar*) &var; SetMagnif(magVar->GetMagnif()); } return *this; } StateVar* MagnifVar::Copy () { return new MagnifVar(GetMagnif()); } ClassId MagnifVar::GetClassId () { return MAGNIF_VAR; } bool MagnifVar::IsA (ClassId id) { return MAGNIF_VAR == id || StateVar::IsA(id); } void MagnifVar::Read (istream& in) { StateVar::Read(in); in >> _magnif; } void MagnifVar::Write (ostream& out) { StateVar::Write(out); out << _magnif << " "; } /*****************************************************************************/ GravityVar::GravityVar (bool active) { _active = active; } bool GravityVar::IsActive () { return _active; } void GravityVar::Activate (bool active) { if (active != _active) { _active = active; Notify(); } } StateVar& GravityVar::operator = (StateVar& var) { if (var.IsA(GRAVITY_VAR)) { GravityVar* gravityVar = (GravityVar*) &var; Activate(gravityVar->IsActive()); } return *this; } StateVar* GravityVar::Copy () { return new GravityVar(IsActive()); } ClassId GravityVar::GetClassId () { return GRAVITY_VAR; } bool GravityVar::IsA (ClassId id) { return GRAVITY_VAR == id || StateVar::IsA(id); } void GravityVar::Read (istream& in) { StateVar::Read(in); in >> _active; } void GravityVar::Write (ostream& out) { StateVar::Write(out); out << _active << " "; } /*****************************************************************************/ FontVar::FontVar (PSFont* f) { _psfont = f; Ref(_psfont); } FontVar::~FontVar () { Unref(_psfont); } void FontVar::SetFont (PSFont* f) { if (f != _psfont) { Unref(_psfont); _psfont = f; Ref(_psfont); Notify(); } } PSFont* FontVar::GetFont () { return _psfont; } StateVar& FontVar::operator = (StateVar& var) { if (var.IsA(FONT_VAR)) { FontVar* fontVar = (FontVar*) &var; SetFont(fontVar->GetFont()); } return *this; } StateVar* FontVar::Copy () { return new FontVar(GetFont()); } ClassId FontVar::GetClassId () { return FONT_VAR; } bool FontVar::IsA (ClassId id) { return FONT_VAR == id || StateVar::IsA(id); } void FontVar::Read (istream& in) { StateVar::Read(in); _psfont = unidraw->GetCatalog()->ReadFont(in); } void FontVar::Write (ostream& out) { StateVar::Write(out); unidraw->GetCatalog()->WriteFont(_psfont, out); } /*****************************************************************************/ BrushVar::BrushVar (PSBrush* b) { _psbrush = b; Ref(_psbrush); } BrushVar::~BrushVar () { Unref(_psbrush); } void BrushVar::SetBrush (PSBrush* b) { if (b != _psbrush) { Unref(_psbrush); _psbrush = b; Ref(_psbrush); Notify(); } } PSBrush* BrushVar::GetBrush () { return _psbrush; } StateVar& BrushVar::operator = (StateVar& var) { if (var.IsA(BRUSH_VAR)) { BrushVar* brVar = (BrushVar*) &var; SetBrush(brVar->GetBrush()); } return *this; } StateVar* BrushVar::Copy () { return new BrushVar(GetBrush()); } ClassId BrushVar::GetClassId () { return BRUSH_VAR; } bool BrushVar::IsA (ClassId id) { return BRUSH_VAR == id || StateVar::IsA(id); } void BrushVar::Read (istream& in) { StateVar::Read(in); _psbrush = unidraw->GetCatalog()->ReadBrush(in); } void BrushVar::Write (ostream& out) { StateVar::Write(out); unidraw->GetCatalog()->WriteBrush(_psbrush, out); } /*****************************************************************************/ PatternVar::PatternVar (PSPattern* p) { _pspattern = p; Ref(_pspattern); } PatternVar::~PatternVar () { Unref(_pspattern); } void PatternVar::SetPattern (PSPattern* p) { if (p != _pspattern) { Unref(_pspattern); _pspattern = p; Ref(_pspattern); Notify(); } } PSPattern* PatternVar::GetPattern () { return _pspattern; } StateVar& PatternVar::operator = (StateVar& var) { if (var.IsA(BRUSH_VAR)) { PatternVar* patVar = (PatternVar*) &var; SetPattern(patVar->GetPattern()); } return *this; } StateVar* PatternVar::Copy () { return new PatternVar(GetPattern()); } ClassId PatternVar::GetClassId () { return PATTERN_VAR; } bool PatternVar::IsA (ClassId id) { return PATTERN_VAR == id || StateVar::IsA(id); } void PatternVar::Read (istream& in) { StateVar::Read(in); _pspattern = unidraw->GetCatalog()->ReadPattern(in); } void PatternVar::Write (ostream& out) { StateVar::Write(out); unidraw->GetCatalog()->WritePattern(_pspattern, out); } /*****************************************************************************/ ColorVar::ColorVar (PSColor* fg, PSColor* bg) { _psfgcolor = fg; _psbgcolor = bg; Ref(_psfgcolor); Ref(_psbgcolor); } ColorVar::~ColorVar () { Unref(_psfgcolor); Unref(_psbgcolor); } void ColorVar::SetColors (PSColor* fg, PSColor* bg) { if (fg != _psfgcolor || bg != _psbgcolor) { Unref(_psfgcolor); Unref(_psbgcolor); _psfgcolor = fg; _psbgcolor = bg; Ref(_psfgcolor); Ref(_psbgcolor); Notify(); } } PSColor* ColorVar::GetFgColor() { return _psfgcolor; } PSColor* ColorVar::GetBgColor() { return _psbgcolor; } StateVar& ColorVar::operator = (StateVar& var) { if (var.IsA(COLOR_VAR)) { ColorVar* colorVar = (ColorVar*) &var; SetColors(colorVar->GetFgColor(),colorVar->GetBgColor()); } return *this; } StateVar* ColorVar::Copy () { return new ColorVar(_psfgcolor, _psbgcolor); } ClassId ColorVar::GetClassId () { return COLOR_VAR; } bool ColorVar::IsA (ClassId id) {return COLOR_VAR==id || StateVar::IsA(id);} void ColorVar::Read (istream& in) { StateVar::Read(in); Catalog* catalog = unidraw->GetCatalog(); _psfgcolor = catalog->ReadColor(in); _psbgcolor = catalog->ReadColor(in); } void ColorVar::Write (ostream& out) { StateVar::Write(out); Catalog* catalog = unidraw->GetCatalog(); catalog->WriteColor(_psfgcolor, out); catalog->WriteColor(_psbgcolor, out); } neuron-7.6.3/src/lib/Unidraw/stateview.cpp000066400000000000000000000036321340731477100205350ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of StateVarView base class. */ #include #include /*****************************************************************************/ StateVarView::StateVarView (StateVar* s) { _subject = s; _subject->Attach(this); } StateVarView::~StateVarView () { if (_subject != nil) _subject->Detach(this); } void StateVarView::Init () { } bool StateVarView::Stale () { return true; } void StateVarView::SetSubject (StateVar* s) { _subject = s; } StateVar* StateVarView::GetSubject () { return _subject; } void StateVarView::Reconfig () { Init(); MonoScene::Reconfig(); } void StateVarView::Update () { if (Stale()) { Init(); Draw(); } } neuron-7.6.3/src/lib/Unidraw/stateviews.cpp000066400000000000000000000416121340731477100207200ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of StateVarView subclasses. */ #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ static const int VIEW_WIDTH = 30; static const int VIEW_HEIGHT = 15; static const int HPAD = 2; static const int VPAD = 2; static const char* GRAVITY_ON = "gravity on"; static const char* MODIFIED = "*"; static const char* WPROTECTED = "%"; static const char* UNMODIFIED = " "; static const char* NONE = "None"; static const char* UNNAMED = "[unnamed]"; /*****************************************************************************/ class TextInteractor : public Interactor { public: TextInteractor(const char*, Alignment = Center); virtual ~TextInteractor(); void SetText(const char*); const char* GetText(); protected: void Align(); virtual void Reconfig(); virtual void Redraw(Coord, Coord, Coord, Coord); protected: char* _text; Alignment _alignment; }; TextInteractor::TextInteractor (const char* t, Alignment a) { _text = strnew(t); _alignment = a; } TextInteractor::~TextInteractor () { delete [] _text; } void TextInteractor::SetText (const char* t) { delete [] _text; _text = strnew(t); } const char* TextInteractor::GetText () { return _text; } void TextInteractor::Align () { const Font* f = output->GetFont(); int width = f->Width(_text); int height = f->Height(); Coord x; switch (_alignment) { case Left: x = HPAD; break; case Center: x = (xmax - width + 1)/2; break; case Right: x = xmax - width - HPAD; break; } output->MoveTo(x, (ymax - height+ 1)/2); } void TextInteractor::Reconfig () { const Font* f = output->GetFont(); int width = f->Width(_text); shape->Rect(width + 2*HPAD, f->Height() + 2*VPAD); shape->Rigid(width, hfil, 0, 0); } void TextInteractor::Redraw (Coord, Coord, Coord, Coord) { if (canvas != nil) { Align(); output->ClearRect(canvas, 0, 0, xmax, ymax); output->Text(canvas, _text); } } /*****************************************************************************/ NameVarView::NameVarView ( NameVar* n, Alignment a, const char* samp ) : StateVarView(n) { const char* sample = (samp == nil) ? "nnnnnnnnnnnnnnnnnnnnnn" : samp; TextInteractor* t = new TextInteractor(sample, a); Insert(t); } bool NameVarView::Stale () { const char* name = ((NameVar*) _subject)->GetName(); const char* text = ((TextInteractor*) interior())->GetText(); return (name == nil && strcmp(text, UNNAMED) != 0) || (name != nil && strcmp(text, name) != 0); } void NameVarView::Init() { const char* name = ((NameVar*) _subject)->GetName(); TextInteractor* t = (TextInteractor*) interior(); if (name == nil) { t->SetText(UNNAMED); } else { t->SetText(name); } } /*****************************************************************************/ FileNameVarView::FileNameVarView ( NameVar* n, Alignment a, bool relative, const char* samp ) : StateVarView(n) { const char* sample = (samp == nil) ? "nnnnnnnnnnnnnnnnnnnnnn" : samp; TextInteractor* t = new TextInteractor(sample, a); _relative = relative; Insert(t); } void FileNameVarView::Init() { const char* name = ((NameVar*) _subject)->GetName(); TextInteractor* t = (TextInteractor*) interior(); if (name == nil) { t->SetText(UNNAMED); } else if (_relative) { const char* relname = strrchr(name, '/'); if (relname == nil) { t->SetText(name); } else { t->SetText(++relname); } } else { t->SetText(name); } } /*****************************************************************************/ CompNameVarView::CompNameVarView ( CompNameVar* n, Alignment a, bool relative, const char* samp ) : StateVarView(n) { const char* sample = (samp == nil) ? "nnnnnnnnnnnnnnnnnnn" : samp; TextInteractor* t = new TextInteractor(sample, a); _relative = relative; Insert(t); } void CompNameVarView::Init() { CompNameVar* subj = (CompNameVar*) _subject; const char* name = subj->GetName(); TextInteractor* t = (TextInteractor*) interior(); if (name == nil) { t->SetText(UNNAMED); } else { char buf[CHARBUFSIZE]; buf[0] = '\0'; if (subj->PartOf() != nil) { strcat(buf, "[part of] "); } if (_relative) { const char* relname = strrchr(name, '/'); if (relname == nil) { strcat(buf, name); } else { strcat(buf, ++relname); } } else { strcat(buf, name); } t->SetText(buf); } } /*****************************************************************************/ ModifStatusVarView::ModifStatusVarView ( ModifStatusVar* m, Alignment a ) : StateVarView(m) { TextInteractor* t = new TextInteractor(" ", a); Insert(t); } bool ModifStatusVarView::Stale () { ModifStatusVar* msv = (ModifStatusVar*) _subject; return msv->GetModifStatus() != _prevVal || WriteProtected() != _prevProt; } bool ModifStatusVarView::WriteProtected () { ModifStatusVar* msv = (ModifStatusVar*) _subject; Catalog* catalog = unidraw->GetCatalog(); const char* name = catalog->GetName(msv->GetComponent()); return name != nil && catalog->Exists(name) && !catalog->Writable(name); } void ModifStatusVarView::Init () { ModifStatusVar* msv = (ModifStatusVar*) _subject; TextInteractor* t = (TextInteractor*) interior(); _prevVal = msv->GetModifStatus(); _prevProt = WriteProtected(); if (_prevProt) { t->SetText(WPROTECTED); } else if (_prevVal) { t->SetText(MODIFIED); } else { t->SetText(UNMODIFIED); } } void ModifStatusVarView::Reconfig () { StateVarView::Reconfig(); shape->Rigid(); } /*****************************************************************************/ MagnifVarView::MagnifVarView (MagnifVar* m, Alignment a) : StateVarView(m) { TextInteractor* t = new TextInteractor("nnnnnnnnnn", a); Insert(t); } bool MagnifVarView::Stale () { return ((MagnifVar*) _subject)->GetMagnif() != _prevVal; } void MagnifVarView::Init() { float mag = ((MagnifVar*) _subject)->GetMagnif(); TextInteractor* t = (TextInteractor*) interior(); char buf[32]; _prevVal = mag; sprintf(buf, "mag %gx", mag); t->SetText(buf); } /*****************************************************************************/ GravityVarView::GravityVarView (GravityVar* m, Alignment a) : StateVarView(m) { TextInteractor* t = new TextInteractor(GRAVITY_ON, a); Insert(t); } bool GravityVarView::Stale () { return ((GravityVar*) _subject)->IsActive() != _prevVal; } void GravityVarView::Init() { bool active = ((GravityVar*) _subject)->IsActive(); TextInteractor* t = (TextInteractor*) interior(); const char* string = active ? GRAVITY_ON : ""; _prevVal = active; t->SetText(string); } /*****************************************************************************/ FontVarView::FontVarView ( FontVar* f, Alignment a, const char* samp ) : StateVarView(f) { const char* sample = (samp == nil) ? "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn" : samp; TextInteractor* t = new TextInteractor(sample, a); Insert(t); } bool FontVarView::Stale () { return ((FontVar*) _subject)->GetFont() != _prevVal; } void FontVarView::Init () { PSFont* f = ((FontVar*) _subject)->GetFont(); const char* name = f->GetPrintFontAndSize(); TextInteractor* t = (TextInteractor*) interior(); _prevVal = f; t->SetText(name); } /*****************************************************************************/ static void CenterText ( const char* text, Painter* output, Coord xmax, Coord ymax ) { const Font* f = output->GetFont(); int width = f->Width(text); int height = f->Height(); output->MoveTo((xmax - width + 1)/2, (ymax - height + 1)/2); } /*****************************************************************************/ class BrushInteractor : public Interactor { public: BrushInteractor(PSBrush*, PSColor* fg = nil, PSColor* bg = nil); virtual ~BrushInteractor(); void SetBrush(PSBrush*); void SetColors(PSColor*, PSColor*); PSBrush* GetBrush(); PSColor* GetFgColor(); PSColor* GetBgColor(); protected: virtual void Reconfig(); virtual void Redraw(Coord, Coord, Coord, Coord); protected: PSBrush* _brush; PSColor* _fg, *_bg; }; BrushInteractor::BrushInteractor (PSBrush* b, PSColor* fg, PSColor* bg) { _brush = b; _fg = fg; _bg = bg; Ref(_brush); Ref(_fg); Ref(_bg); } BrushInteractor::~BrushInteractor () { Unref(_brush); Unref(_fg); Unref(_bg); } void BrushInteractor::SetBrush (PSBrush* b) { Ref(b); Unref(_brush); _brush = b; } PSBrush* BrushInteractor::GetBrush () { return _brush; } void BrushInteractor::SetColors (PSColor* fg, PSColor* bg) { Ref(fg); Ref(bg); Unref(_fg); Unref(_bg); _fg = fg; _bg = bg; } PSColor* BrushInteractor::GetFgColor () { return _fg; } PSColor* BrushInteractor::GetBgColor () { return _bg; } void BrushInteractor::Reconfig () { Painter* tmp = output; output = new Painter(tmp); Ref(output); Unref(tmp); const Font* f = output->GetFont(); shape->width = max(f->Width(NONE) + 2*HPAD, VIEW_WIDTH); shape->height = max(f->Height() + 2*VPAD, VIEW_HEIGHT); shape->Rigid(shape->width/2, shape->width, shape->height/2, shape->height); } void BrushInteractor::Redraw (Coord, Coord, Coord, Coord) { if (canvas != nil) { output->ClearRect(canvas, 0, 0, xmax, ymax); if (_brush->None()) { CenterText(NONE, output, xmax, ymax); output->Text(canvas, NONE); } else { const Color* origfg = output->GetFgColor(); const Color* origbg = output->GetBgColor(); Resource::ref(origfg); Resource::ref(origbg); output->SetBrush(_brush); output->SetColors(_fg, _bg); output->Line(canvas, HPAD, ymax/2, xmax-HPAD, ymax/2); if (_brush->Width() == 0) { CenterText("0", output, xmax, ymax); output->Text(canvas, "0"); } output->SetColors(origfg, origbg); Resource::unref(origfg); Resource::unref(origbg); } } } /*****************************************************************************/ BrushVarView::BrushVarView (BrushVar* bv, ColorVar* cv) : StateVarView(bv) { PSColor* fg = nil, *bg = nil; _colorSubj = cv; if (_colorSubj != nil) { _colorSubj->Attach(this); _subject = bv; // Attach changes _subject fg = _colorSubj->GetFgColor(); bg = _colorSubj->GetBgColor(); } BrushInteractor* b = new BrushInteractor(bv->GetBrush(), fg, bg); Insert(b); } BrushVarView::~BrushVarView () { if (_colorSubj != nil) { StateVar* subject = _subject; // Detach changes _subject _colorSubj->Detach(this); _subject = subject; } } bool BrushVarView::Stale () { bool colorsChanged = ( (_colorSubj != nil) && ( _colorSubj->GetFgColor() != _prevFg || _colorSubj->GetBgColor() != _prevBg ) ); return ((BrushVar*) _subject)->GetBrush() != _prevVal || colorsChanged; } void BrushVarView::Init () { BrushInteractor* b = (BrushInteractor*) interior(); _prevVal = ((BrushVar*) _subject)->GetBrush(); b->SetBrush(_prevVal); if (_colorSubj != nil) { _prevFg = _colorSubj->GetFgColor(); _prevBg = _colorSubj->GetBgColor(); b->SetColors(_prevFg, _prevBg); } } /*****************************************************************************/ class PatternInteractor : public Interactor { public: PatternInteractor(PSPattern*, PSColor* fg = nil, PSColor* bg = nil); virtual ~PatternInteractor(); void SetPattern(PSPattern*); void SetColors(PSColor*, PSColor*); PSPattern* GetPattern(); PSColor* GetFgColor(); PSColor* GetBgColor(); protected: virtual void Reconfig(); virtual void Redraw(Coord, Coord, Coord, Coord); protected: PSPattern* _pattern; PSColor* _fg, *_bg; }; PatternInteractor::PatternInteractor (PSPattern* p, PSColor* fg, PSColor* bg) { _pattern = p; _fg = fg; _bg = bg; Ref(_pattern); Ref(_fg); Ref(_bg); } PatternInteractor::~PatternInteractor () { Unref(_pattern); Unref(_fg); Unref(_bg); } void PatternInteractor::SetPattern (PSPattern* p) { Ref(p); Unref(_pattern); _pattern = p; } PSPattern* PatternInteractor::GetPattern () { return _pattern; } void PatternInteractor::SetColors (PSColor* fg, PSColor* bg) { Ref(fg); Ref(bg); Unref(_fg); Unref(_bg); _fg = fg; _bg = bg; } PSColor* PatternInteractor::GetFgColor () { return _fg; } PSColor* PatternInteractor::GetBgColor () { return _bg; } void PatternInteractor::Reconfig () { Painter* tmp = output; output = new Painter(tmp); Ref(output); Unref(tmp); const Font* f = output->GetFont(); shape->width = max(f->Width(NONE) + 2*HPAD, VIEW_WIDTH); shape->height = max(f->Height() + 2*VPAD, VIEW_HEIGHT); shape->Rigid(shape->width/2, shape->width, shape->height/2, shape->height); } void PatternInteractor::Redraw (Coord, Coord, Coord, Coord) { if (canvas != nil) { output->ClearRect(canvas, 0, 0, xmax, ymax); if (_pattern->None()) { CenterText(NONE, output, xmax, ymax); output->Text(canvas, NONE); } else { const Color* origfg = output->GetFgColor(); const Color* origbg = output->GetBgColor(); Resource::ref(origfg); Resource::ref(origbg); output->SetPattern(_pattern); output->SetColors(_fg, _bg); output->FillRect(canvas, HPAD, VPAD, xmax-HPAD, ymax-VPAD); output->Rect(canvas, HPAD, VPAD, xmax-HPAD, ymax-VPAD); output->SetColors(origfg, origbg); Resource::unref(origfg); Resource::unref(origbg); } } } /*****************************************************************************/ PatternVarView::PatternVarView ( PatternVar* pv, ColorVar* cv ) : StateVarView(pv) { PSColor* fg = nil, *bg = nil; _colorSubj = cv; if (_colorSubj != nil) { _colorSubj->Attach(this); _subject = pv; // Attach changes _subject fg = _colorSubj->GetFgColor(); bg = _colorSubj->GetBgColor(); } PatternInteractor* p = new PatternInteractor(pv->GetPattern(), fg, bg); Insert(p); } PatternVarView::~PatternVarView () { if (_colorSubj != nil) { StateVar* subject = _subject; // Detach changes _subject _colorSubj->Detach(this); _subject = subject; } } bool PatternVarView::Stale () { bool colorsChanged = ( (_colorSubj != nil) && ( _colorSubj->GetFgColor() != _prevFg || _colorSubj->GetBgColor() != _prevBg ) ); return ((PatternVar*) _subject)->GetPattern() != _prevVal || colorsChanged; } void PatternVarView::Init() { PatternInteractor* p = (PatternInteractor*) interior(); _prevVal = ((PatternVar*) _subject)->GetPattern(); p->SetPattern(_prevVal); if (_colorSubj != nil) { _prevFg = _colorSubj->GetFgColor(); _prevBg = _colorSubj->GetBgColor(); p->SetColors(_prevFg, _prevBg); } } neuron-7.6.3/src/lib/Unidraw/stencilcomp.cpp000066400000000000000000000130231340731477100210350ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * StencilComp definitions. */ #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ static const int no_mask = 0; static const int mask_equals_image = 1; static const int valid_mask = 2; /*****************************************************************************/ ClassId StencilComp::GetClassId () { return STENCIL_COMP; } bool StencilComp::IsA (ClassId id) { return STENCIL_COMP == id || GraphicComp::IsA(id); } Component* StencilComp::Copy () { return new StencilComp((UStencil*) GetGraphic()->Copy(), _filename); } StencilComp::StencilComp (UStencil* s, const char* filename) : GraphicComp(s) { _filename = (filename == nil) ? nil : strnew(filename); } StencilComp::~StencilComp () { delete [] _filename; } UStencil* StencilComp::GetStencil () { return (UStencil*) GetGraphic(); } const char* StencilComp::GetFileName () { return _filename; } void StencilComp::Read (istream& in) { GraphicComp::Read(in); Bitmap* image = ReadBitmap(in); Bitmap* mask = nil; Skip(in); int m; in >> m; if (m == valid_mask) { mask = ReadBitmap(in); } else if (m == mask_equals_image) { mask = image; } UStencil* stencil = new UStencil(image, mask); stencil->FillBg(ReadBgFilled(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); stencil->SetColors(fg, bg); Transformer* t = ReadTransformer(in); stencil->SetTransformer(t); Unref(t); SetGraphic(stencil); _filename = ReadString(in); } void StencilComp::Write (ostream& out) { GraphicComp::Write(out); UStencil* stencil = GetStencil(); Bitmap* image, *mask; stencil->GetOriginal(image, mask); WriteBitmap(image, out); Mark(out); if (mask == nil) { out << no_mask; } else if (mask == image) { out << mask_equals_image; } else { out << valid_mask; WriteBitmap(mask, out); } WriteBgFilled(stencil->BgFilled(), out); WriteColor(stencil->GetFgColor(), out); WriteColor(stencil->GetBgColor(), out); WriteTransformer(stencil->GetTransformer(), out); WriteString(_filename, out); } /*****************************************************************************/ StencilComp* StencilView::GetStencilComp () { return (StencilComp*) GetSubject(); } ClassId StencilView::GetClassId () { return STENCIL_VIEW; } bool StencilView::IsA (ClassId id) { return STENCIL_VIEW == id || GraphicView::IsA(id); } StencilView::StencilView (StencilComp* subj) : GraphicView(subj) { } void StencilView::Update () { Graphic* stencil = GetGraphic(); IncurDamage(stencil); *stencil = *GetStencilComp()->GetGraphic(); IncurDamage(stencil); EraseHandles(); } Graphic* StencilView::GetGraphic () { Graphic* graphic = GraphicView::GetGraphic(); if (graphic == nil) { StencilComp* stencilComp = GetStencilComp(); Bitmap* image, *mask; stencilComp->GetStencil()->GetOriginal(image, mask); graphic = new UStencil(image, mask, stencilComp->GetGraphic()); SetGraphic(graphic); } return graphic; } /*****************************************************************************/ PSStencil::PSStencil (StencilComp* subj) : PostScriptView(subj) { } ClassId PSStencil::GetClassId () { return PS_STENCIL; } bool PSStencil::IsA (ClassId id) { return PS_STENCIL == id || PostScriptView::IsA(id); } bool PSStencil::Definition (ostream& out) { StencilComp* comp = (StencilComp*) GetSubject(); Bitmap* image, *mask; comp->GetStencil()->GetOriginal(image, mask); const char* tag = (image == mask) ? "SSten" : "FSten"; Coord w = image->Width(); Coord h = image->Height(); out << "Begin " << MARK << " " << tag << "\n"; FgColor(out); BgColor(out); Transformation(out); out << MARK << "\n"; out << w << " " << h << " " << tag << " "; out << "{ currentfile "<< (w + 7) / 8 << " string readhexstring pop }\n"; out << "imagemask"; unidraw->GetCatalog()->WriteBitmapData(image, out); out << "\nEnd\n\n"; return out.good(); } neuron-7.6.3/src/lib/Unidraw/stretch.cpp000066400000000000000000000055531340731477100202020ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Stretch tool definitions. */ #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ ClassId StretchTool::GetClassId () { return STRETCH_TOOL; } bool StretchTool::IsA (ClassId id) { return STRETCH_TOOL == id || Tool::IsA(id); } StretchTool::StretchTool (ControlInfo* m) : Tool(m) { } Tool* StretchTool::Copy () { return new StretchTool(CopyControlInfo()); } Manipulator* StretchTool::CreateManipulator ( Viewer* v, Event& e, Transformer* rel ) { GraphicView* views = v->GetGraphicView(); Selection* s = v->GetSelection(), *newSel; GraphicView* gv; Manipulator* m = nil; Iterator i; newSel = views->ViewIntersecting(e.x-SLOP, e.y-SLOP, e.x+SLOP, e.y+SLOP); if (newSel->IsEmpty()) { s->Clear(); } else { newSel->First(i); gv = newSel->GetView(i); if (s->Includes(gv)) { s->Remove(gv); s->Prepend(gv); } else { s->Clear(); s->Append(gv); s->Update(); } m = gv->CreateManipulator(v, e, rel, this); } delete newSel; return m; } Command* StretchTool::InterpretManipulator (Manipulator* m) { Selection* s; Command* cmd = nil; Iterator i; if (m != nil) { s = m->GetViewer()->GetSelection(); s->First(i); cmd = s->GetView(i)->InterpretManipulator(m); } return cmd; } neuron-7.6.3/src/lib/Unidraw/struct.cpp000066400000000000000000000211111340731477100200360ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of structuring commands. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ ClassId GroupCmd::GetClassId () { return GROUP_CMD; } bool GroupCmd::IsA (ClassId id) { return GROUP_CMD == id || Command::IsA(id); } GroupCmd::GroupCmd (ControlInfo* c, GraphicComp* d) : Command(c) { Init(d); } GroupCmd::GroupCmd (Editor* ed, GraphicComp* d) : Command(ed) { Init(d); } void GroupCmd::Init (GraphicComp* dest) { _group = dest; _executed = false; } GroupCmd::~GroupCmd () { if (!_executed) { delete _group; } } Command* GroupCmd::Copy () { GraphicComp* dest = (_group == nil) ? nil : (GraphicComp*) _group->Copy(); Command* copy = new GroupCmd(CopyControlInfo(), dest); InitCopy(copy); return copy; } void GroupCmd::Execute () { Clipboard* cb = GetClipboard(); if (cb == nil) { SetClipboard(cb = new Clipboard); Editor* ed = GetEditor(); Selection* s = ed->GetSelection(); if (s->Number() > 1) { Iterator i; GraphicView* views = ed->GetViewer()->GetGraphicView(); s->Sort(views); for (s->First(i); !s->Done(i); s->Next(i)) { s->GetView(i)->Interpret(this); } } } else { Clipboard* oldcb = cb; SetClipboard(cb = new Clipboard); Iterator i; for (oldcb->First(i); !oldcb->Done(i); oldcb->Next(i)) { oldcb->GetComp(i)->Interpret(this); } delete oldcb; } if (!cb->IsEmpty()) { if (_group == nil) { SetGroup(new GraphicComps); } _group->Interpret(this); _executed = true; } } void GroupCmd::Unexecute () { _group->Uninterpret(this); _executed = false; Clipboard* cb = GetClipboard(); Iterator i; for (cb->Last(i); !cb->Done(i); cb->Prev(i)) { cb->GetComp(i)->Uninterpret(this); } } bool GroupCmd::Reversible () { Clipboard* cb = GetClipboard(); return cb == nil || !cb->IsEmpty(); } void GroupCmd::Read (istream& in) { Command::Read(in); _group = (GraphicComp*) unidraw->GetCatalog()->ReadComponent(in); } void GroupCmd::Write (ostream& out) { Command::Write(out); unidraw->GetCatalog()->WriteComponent(_group, out); } /*****************************************************************************/ ClassId UngroupCmd::GetClassId () { return UNGROUP_CMD; } bool UngroupCmd::IsA (ClassId id) { return UNGROUP_CMD == id || Command::IsA(id); } UngroupCmd::UngroupCmd (ControlInfo* c) : Command(c) { Init(); } UngroupCmd::UngroupCmd (Editor* ed) : Command(ed) { Init(); } void UngroupCmd::Init () { _kids = nil; _executed = false; } UngroupCmd::~UngroupCmd () { if (_executed) { GetClipboard()->DeleteComps(); delete _kids; } } Command* UngroupCmd::Copy () { Command* copy = new UngroupCmd(CopyControlInfo()); InitCopy(copy); return copy; } void UngroupCmd::Execute () { Clipboard* cb = GetClipboard(); Editor* ed = GetEditor(); if (cb == nil) { Selection* s = ed->GetSelection(); if (s->IsEmpty()) { return; } SetClipboard(cb = new Clipboard); GraphicView* views = ed->GetViewer()->GetGraphicView(); s->Sort(views); Iterator i; for (s->First(i); !s->Done(i); s->Next(i)) { s->GetView(i)->Interpret(this); } } else { Clipboard* oldcb = cb; SetClipboard(cb = new Clipboard); Iterator i; for (oldcb->First(i); !oldcb->Done(i); oldcb->Next(i)) { oldcb->GetComp(i)->Interpret(this); } delete oldcb; } if (!cb->IsEmpty()) { ed->GetComponent()->Interpret(this); _executed = true; } } void UngroupCmd::Unexecute () { GetEditor()->GetComponent()->Uninterpret(this); _executed = false; Clipboard* cb = GetClipboard(); Iterator i; for (cb->Last(i); !cb->Done(i); cb->Prev(i)) { cb->GetComp(i)->Uninterpret(this); } } /*****************************************************************************/ ClassId FrontCmd::GetClassId () { return FRONT_CMD; } bool FrontCmd::IsA (ClassId id) { return FRONT_CMD==id || Command::IsA(id);} FrontCmd::FrontCmd (ControlInfo* c) : Command(c) { } FrontCmd::FrontCmd (Editor* ed) : Command(ed) { } Command* FrontCmd::Copy () { Command* copy = new FrontCmd(CopyControlInfo()); InitCopy(copy); return copy; } void FrontCmd::Execute () { Clipboard* cb = GetClipboard(); Editor* ed = GetEditor(); if (cb == nil) { Selection* s = ed->GetSelection(); if (s->IsEmpty()) { return; } SetClipboard(cb = new Clipboard); GraphicView* views = ed->GetViewer()->GetGraphicView(); s->Sort(views); Iterator i; for (s->First(i); !s->Done(i); s->Next(i)) { s->GetView(i)->Interpret(this); } } else { Clipboard* oldcb = cb; SetClipboard(cb = new Clipboard); Iterator i; for (oldcb->First(i); !oldcb->Done(i); oldcb->Next(i)) { oldcb->GetComp(i)->Interpret(this); } delete oldcb; } if (!cb->IsEmpty()) { ed->GetComponent()->Interpret(this); } } void FrontCmd::Unexecute () { GetEditor()->GetComponent()->Uninterpret(this); Clipboard* cb = GetClipboard(); Iterator i; for (cb->Last(i); !cb->Done(i); cb->Prev(i)) { cb->GetComp(i)->Uninterpret(this); } } /*****************************************************************************/ ClassId BackCmd::GetClassId () { return BACK_CMD; } bool BackCmd::IsA (ClassId id) { return BACK_CMD == id || Command::IsA(id);} BackCmd::BackCmd (ControlInfo* c) : Command(c) { } BackCmd::BackCmd (Editor* ed) : Command(ed) { } Command* BackCmd::Copy () { Command* copy = new BackCmd(CopyControlInfo()); InitCopy(copy); return copy; } void BackCmd::Execute () { Clipboard* cb = GetClipboard(); Editor* ed = GetEditor(); if (cb == nil) { Selection* s = ed->GetSelection(); if (s->IsEmpty()) { return; } SetClipboard(cb = new Clipboard); GraphicView* views = ed->GetViewer()->GetGraphicView(); s->Sort(views); Iterator i; for (s->First(i); !s->Done(i); s->Next(i)) { s->GetView(i)->Interpret(this); } } else { Clipboard* oldcb = cb; SetClipboard(cb = new Clipboard); Iterator i; for (oldcb->First(i); !oldcb->Done(i); oldcb->Next(i)) { oldcb->GetComp(i)->Interpret(this); } delete oldcb; } if (!cb->IsEmpty()) { ed->GetComponent()->Interpret(this); } } void BackCmd::Unexecute () { GetEditor()->GetComponent()->Uninterpret(this); Clipboard* cb = GetClipboard(); Iterator i; for (cb->Last(i); !cb->Done(i); cb->Prev(i)) { cb->GetComp(i)->Uninterpret(this); } } neuron-7.6.3/src/lib/Unidraw/text.cpp000066400000000000000000000402601340731477100175040ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Text component definitions. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ static const int SBUFSIZE = 10000; static char sbuf[SBUFSIZE]; /*****************************************************************************/ ClassId TextComp::GetClassId () { return TEXT_COMP; } bool TextComp::IsA (ClassId id) { return TEXT_COMP == id || GraphicComp::IsA(id); } Component* TextComp::Copy () { return new TextComp((TextGraphic*) GetGraphic()->Copy()); } TextComp::TextComp (TextGraphic* graphic) : GraphicComp(graphic) { } void TextComp::Interpret (Command* cmd) { TextGraphic* gr = (TextGraphic*) GetGraphic(); if (cmd->IsA(BRUSH_CMD) || cmd->IsA(PATTERN_CMD)) { // do nothing } else if (cmd->IsA(FONT_CMD)) { PSFont* font = ((FontCmd*) cmd)->GetFont(); cmd->Store(this, new VoidData(gr->GetFont())); gr->SetFont(font); gr->SetLineHeight(font->Height()); // hack; should be state var Notify(); } else { GraphicComp::Interpret(cmd); } } void TextComp::Uninterpret (Command* cmd) { Graphic* gr = GetGraphic(); if (cmd->IsA(BRUSH_CMD) || cmd->IsA(PATTERN_CMD)) { // do nothing } else if (cmd->IsA(FONT_CMD)) { VoidData* vd = (VoidData*) cmd->Recall(this); PSFont* font = (PSFont*) vd->_void; gr->SetFont(font); Notify(); } else { GraphicComp::Uninterpret(cmd); } } TextGraphic* TextComp::GetText () { return (TextGraphic*) GetGraphic(); } void TextComp::Read (istream& in) { GraphicComp::Read(in); int lineHt; in >> lineHt; char* string = ReadString(in); TextGraphic* text = new TextGraphic(string, lineHt); delete string; text->FillBg(ReadBgFilled(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); text->SetColors(fg, bg); text->SetFont(ReadFont(in)); Transformer* t = ReadTransformer(in); text->SetTransformer(t); Unref(t); SetGraphic(text); } void TextComp::Write (ostream& out) { GraphicComp::Write(out); TextGraphic* text = GetText(); out << text->GetLineHeight() << "\n"; WriteString(text->GetOriginal(), out); WriteBgFilled(text->BgFilled(), out); WriteColor(text->GetFgColor(), out); WriteColor(text->GetBgColor(), out); WriteFont(text->GetFont(), out); WriteTransformer(text->GetTransformer(), out); } /****************************************************************************/ TextComp* TextView::GetTextComp () { return (TextComp*) GetSubject(); } ClassId TextView::GetClassId () { return TEXT_VIEW; } bool TextView::IsA (ClassId id) { return TEXT_VIEW == id || GraphicView::IsA(id); } TextView::TextView (TextComp* subj) : GraphicView(subj) { } bool TextView::TextChanged () { TextGraphic* gview = (TextGraphic*) GetGraphic(); TextGraphic* gsubj = (TextGraphic*) GetTextComp()->GetGraphic(); return *gview != *gsubj; } void TextView::Interpret (Command* cmd) { if (cmd->IsA(ALIGNTOGRID_CMD)) { Transformer total; GetGraphic()->TotalTransformation(total); float tx0, ty0; total.Transform(0., 0., tx0, ty0); ((AlignToGridCmd*) cmd)->Align(this, tx0, ty0); } else { GraphicView::Interpret(cmd); } } void TextView::Update () { TextGraphic* gview = (TextGraphic*) GetGraphic(); TextGraphic* gsubj = (TextGraphic*) GetTextComp()->GetGraphic(); IncurDamage(gview); * (Graphic*) gview = * (Graphic*) gsubj; gview->SetLineHeight(gsubj->GetLineHeight()); IncurDamage(gview); EraseHandles(); } Manipulator* TextView::CreateManipulator ( Viewer* v, Event& e, Transformer* rel, Tool* tool ) { Manipulator* m = nil; Editor* ed = v->GetEditor(); int tabWidth = iv26_round(.5*inch); if (tool->IsA(GRAPHIC_COMP_TOOL)) { FontVar* fontVar = (FontVar*) ed->GetState("FontVar"); ColorVar* colVar = (ColorVar*) ed->GetState("ColorVar"); PSFont* font = (fontVar == nil) ? psstdfont : fontVar->GetFont(); PSColor* fg = (colVar == nil) ? psblack : colVar->GetFgColor(); int lineHt = font->GetLineHt(); Painter* painter = new Painter; painter->FillBg(false); painter->SetFont(font); painter->SetColors(fg, nil); painter->SetTransformer(rel); m = new TextManip(v, painter, lineHt, tabWidth, tool); } else if (tool->IsA(RESHAPE_TOOL)) { TextGraphic* textgr = (TextGraphic*) GetGraphic(); Painter* painter = new Painter; int lineHt = textgr->GetLineHeight(); Coord xpos, ypos; rel = new Transformer; const char* text = textgr->GetOriginal(); int size = strlen(text); textgr->TotalTransformation(*rel); rel->Transform(0, 0, xpos, ypos); painter->FillBg(false); painter->SetFont(textgr->GetFont()); painter->SetColors(textgr->GetFgColor(), nil); painter->SetTransformer(rel); Unref(rel); m = new TextManip( v, text, size, xpos, ypos, painter, lineHt, tabWidth, tool ); } else { m = GraphicView::CreateManipulator(v, e, rel, tool); } return m; } Command* TextView::InterpretManipulator (Manipulator* m) { Viewer* v = m->GetViewer(); Editor* ed = v->GetEditor(); Tool* tool = m->GetTool(); Command* cmd = nil; if (tool->IsA(GRAPHIC_COMP_TOOL) || tool->IsA(RESHAPE_TOOL)) { TextManip* tm = (TextManip*) m; int size; const char* text = tm->GetText(size); if (size == 0) { if (tool->IsA(RESHAPE_TOOL)) { cmd = new DeleteCmd(ed); } else { v->Update(); // to repair text display-incurred damage } } else { Coord xpos, ypos; tm->GetPosition(xpos, ypos); Painter* p = tm->GetPainter(); Transformer* rel = tm->GetPainter()->GetTransformer(); int lineHt = tm->GetLineHeight(); Graphic* pg = GetGraphicComp()->GetGraphic(); TextGraphic* textgr = new TextGraphic(text, lineHt, pg); if (tool->IsA(GRAPHIC_COMP_TOOL)) { textgr->SetTransformer(nil); } if (rel != nil) { rel->InvTransform(xpos, ypos); } textgr->Translate(xpos, ypos); textgr->FillBg(false); textgr->SetFont((PSFont*) p->GetFont()); textgr->SetColors((PSColor*) p->GetFgColor(), nil); if (tool->IsA(GRAPHIC_COMP_TOOL)) { cmd = new PasteCmd(ed, new Clipboard(new TextComp(textgr))); } else { cmd = new ReplaceCmd(ed, new TextComp(textgr)); } } } else { cmd = GraphicView::InterpretManipulator(m); } return cmd; } Graphic* TextView::GetGraphic () { TextComp* textComp; Graphic* graphic = GraphicView::GetGraphic(); if (graphic == nil) { textComp = GetTextComp(); graphic = textComp->GetGraphic()->Copy(); SetGraphic(graphic); } return graphic; } /****************************************************************************/ TextGraphic::TextGraphic (const char* s, int h, Graphic* gr) : ULabel(s, gr) { _lineHt = h; } TextGraphic::TextGraphic (const char* s, Graphic* gr) : ULabel(s, gr) { _lineHt = gr->GetFont()->Height(); } bool TextGraphic::operator == (TextGraphic& tg) { const char* tgstring = tg.GetOriginal(); int tgcount = strlen(tgstring); int count = strlen(_string); return (tgcount == count) ? strcmp(tgstring, _string) == 0 : false; } bool TextGraphic::operator != (TextGraphic& tg) { return !(*this == tg); } Graphic* TextGraphic::Copy () { return new TextGraphic(_string, _lineHt, this); } void TextGraphic::SetLineHeight (int h) { _lineHt = h; } int TextGraphic::GetLineHeight () { return _lineHt; } void TextGraphic::draw (Canvas* c, Graphic* gs) { int beg, end, lineSize, nextBeg, ypos = 0; int count = strlen(_string); update(gs); for (beg = 0; beg < count; beg = nextBeg) { GetLine(_string, count, beg, end, lineSize, nextBeg); _p->Text(c, &_string[beg], lineSize, 0, ypos); ypos -= _lineHt; } } void TextGraphic::getExtent ( float& x0, float& y0, float& cx, float& cy, float& tol, Graphic* gs ) { PSFont* f = gs->GetFont(); Coord l, b, r, t; CalcBox(l, b, r, t, f); if (gs->GetTransformer() == nil) { x0 = l; y0 = b; cx = float(l + r) / 2; cy = float(b + t) / 2; } else { transformRect(l, b, r, t, x0, y0, cx, cy, gs); cx = (cx + x0)/2; cy = (cy + y0)/2; } tol = 0; } void TextGraphic::CalcBox (Coord& l, Coord& b, Coord& r, Coord& t, PSFont* f) { int beg, end, lineSize, nextBeg; const char* s = GetOriginal(); int size = strlen(s); l = r = 0; b = _lineHt; t = f->Height(); for (beg = 0; beg < size; beg = nextBeg) { GetLine(s, size, beg, end, lineSize, nextBeg); r = max(r, f->Width(&s[beg], lineSize) - 1); b -= _lineHt; } } bool TextGraphic::contains (PointObj& po, Graphic* gs) { PointObj pt (&po); PSFont* f = gs->GetFont(); BoxObj box(0, 0, 0, f->Height()); int beg, end, lineSize, nextBeg, ypos = 0; const char* s = GetOriginal(); int size = strlen(s); invTransform(pt._x, pt._y, gs); for (beg = 0; beg < size; beg = nextBeg) { GetLine(s, size, beg, end, lineSize, nextBeg); box._right = f->Width(&s[beg], lineSize) - 1; if (box.Contains(pt)) { return true; } box._top -= _lineHt; box._bottom -= _lineHt; } return false; } bool TextGraphic::RotatedIntersects (BoxObj& userb, Graphic* gs) { int beg, end, lineSize, nextBeg, ypos = 0; const char* s = GetOriginal(); int size = strlen(s); PSFont* f = gs->GetFont(); Coord x[4], tx[5]; Coord y[4], ty[5]; x[0] = x[1] = x[2] = x[3] = y[0] = y[1] = 0; y[2] = y[3] = f->Height(); for (beg = 0; beg < size; beg = nextBeg) { GetLine(s, size, beg, end, lineSize, nextBeg); x[1] = x[2] = f->Width(&s[beg], lineSize) - 1; transformList(x, y, 4, tx, ty, gs); tx[4] = tx[0]; ty[4] = ty[0]; FillPolygonObj fp(tx, ty, 5); if (fp.Intersects(userb)) { return true; } y[0] -= _lineHt; y[1] -= _lineHt; y[2] -= _lineHt; y[3] -= _lineHt; } return false; } bool TextGraphic::TransformedIntersects (BoxObj& userb, Graphic* gs) { int beg, end, lineSize, nextBeg, ypos = 0; const char* s = GetOriginal(); int size = strlen(s); PSFont* f = gs->GetFont(); Coord l, b, r, t = f->Height(); Coord tl, tb, tr, tt; l = b = r = 0; for (beg = 0; beg < size; beg = nextBeg) { GetLine(s, size, beg, end, lineSize, nextBeg); r = f->Width(&s[beg], lineSize) - 1; transform(l, b, tl, tb, gs); transform(r, t, tr, tt, gs); BoxObj box(tl, tb, tr, tt); if (box.Intersects(userb)) { return true; } b -= _lineHt; t -= _lineHt; } return false; } bool TextGraphic::UntransformedIntersects (BoxObj& userb, Graphic* gs) { int beg, end, lineSize, nextBeg, ypos = 0; const char* s = GetOriginal(); int size = strlen(s); PSFont* f = gs->GetFont(); BoxObj box(0, 0, 0, f->Height()); for (beg = 0; beg < size; beg = nextBeg) { GetLine(s, size, beg, end, lineSize, nextBeg); box._right = f->Width(&s[beg], lineSize) - 1; if (box.Intersects(userb)) { return true; } box._top -= _lineHt; box._bottom -= _lineHt; } return false; } bool TextGraphic::intersects (BoxObj& userb, Graphic* gs) { Transformer* t = gs->GetTransformer(); bool intersects; if (t != nil && t->Rotated()) { intersects = RotatedIntersects(userb, gs); } else if (t != nil) { intersects = TransformedIntersects(userb, gs); } else { intersects = UntransformedIntersects(userb, gs); } return intersects; } /****************************************************************************/ ClassId PSText::GetClassId () { return PS_TEXT; } bool PSText::IsA (ClassId id) { return PS_TEXT == id || PostScriptView::IsA(id); } PSText::PSText (TextComp* subj) : PostScriptView(subj) { } bool PSText::Definition (ostream& out) { TextComp* comp = (TextComp*) GetSubject(); TextGraphic* g = comp->GetText(); const char* text = g->GetOriginal(); int count = strlen(text); out << "Begin " << MARK << " Text\n"; float sep = g->GetLineHeight() - 1; // correct for vert shift Transformer corrected, *t = g->GetTransformer(); corrected.Translate(0., sep); if (t == nil) { g->SetTransformer(&corrected); TextGS(out); g->SetTransformer(t); } else { t->Reference(); corrected.Postmultiply(t); g->SetTransformer(&corrected); TextGS(out); g->SetTransformer(t); Unref(t); } out << MARK << "\n"; out << "[\n"; int beg, end, lineSize, nextBeg, ypos = 0; for (beg = 0; beg < count; beg = nextBeg) { GetLine(text, count, beg, end, lineSize, nextBeg); const char* string = Filter(&text[beg], end - beg + 1); out << "(" << string << ")\n"; } out << "] Text\n"; out << "End\n\n"; return out.good(); } // octal converts a character to the string \ddd where d is an octal digit. static char* octal(unsigned char c, register char* p) { *p-- = '\0'; // backwards from terminating null... *p-- = (char)('0' + c%8); *p-- = (char)('0' + (c >>= 3)%8); *p-- = (char)('0' + (c >>= 3)%8); *p = '\\'; // ...to beginning backslash return p; } // Filter escapes embedded special characters that would cause syntax // errors in a Postscript string. const char* PSText::Filter (const char* string, int len) { TextBuffer stext(sbuf, 0, SBUFSIZE); int dot; for (dot = 0; len--; string++) { char c = *string; if (!isascii(c) || iscntrl(c)) { char buf[5]; octal(c, &buf[sizeof(buf) - 1]); dot += stext.Insert(dot, buf, sizeof(buf) - 1); } else { switch (c) { case '(': case ')': case '\\': dot += stext.Insert(dot, "\\", 1); // fall through default: dot += stext.Insert(dot, string, 1); } } } stext.Insert(dot, "", 1); return stext.Text(); } neuron-7.6.3/src/lib/Unidraw/tool.cpp000066400000000000000000000047741340731477100175070ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of Tool and derived classes. */ #include #include #include #include #include #include /*****************************************************************************/ ClassId Tool::GetClassId () { return TOOL; } ClassId Tool::GetSubstId (const char*&) { return UNDEFINED_CLASS; } bool Tool::IsA (ClassId id) { return TOOL == id; } Tool::Tool (ControlInfo* m) { Tool::SetControlInfo(m); } Tool::~Tool () { if (_ctrlInfo != nil) { delete _ctrlInfo; } unidraw->GetCatalog()->Forget(this); } Tool* Tool::Copy () { return new Tool(CopyControlInfo()); } void Tool::Read (istream& in) { SetControlInfo(unidraw->GetCatalog()->ReadControlInfo(in)); } void Tool::Write (ostream& out) { unidraw->GetCatalog()->WriteControlInfo(GetControlInfo(), out); } Manipulator* Tool::CreateManipulator (Viewer*, Event&, Transformer*) { return nil; } Command* Tool::InterpretManipulator (Manipulator*) { return nil; } void Tool::SetControlInfo (ControlInfo* m) { _ctrlInfo = m; if (m != nil) { m->SetOwner(this); } } ControlInfo* Tool::GetControlInfo () { return _ctrlInfo; } ControlInfo* Tool::CopyControlInfo () { return (_ctrlInfo == nil) ? nil : _ctrlInfo->Copy(); } neuron-7.6.3/src/lib/Unidraw/transfn.cpp000066400000000000000000000037151340731477100201770ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of transfer function base class. */ #include #include #include /*****************************************************************************/ TransferFunct::TransferFunct () { } TransferFunct::~TransferFunct () { } void TransferFunct::Evaluate (Path*) { } TransferFunct* TransferFunct::Copy () { return nil; } ClassId TransferFunct::GetClassId () { return TRANSFER_FUNCT; } ClassId TransferFunct::GetSubstId (const char*&) { return UNDEFINED_CLASS; } bool TransferFunct::IsA (ClassId id) { return TRANSFER_FUNCT == id; } void TransferFunct::Read (istream&) { } void TransferFunct::Write (ostream&) { } Connector* TransferFunct::GetBinding (StateVar* stateVar) { return stateVar->GetBinding(); } neuron-7.6.3/src/lib/Unidraw/transfns.cpp000066400000000000000000000076311340731477100203630ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of transfer function subclasses. */ #include #include #include #include #include #include #include /*****************************************************************************/ TF_2Port::TF_2Port () { } void TF_2Port::Evaluate (Path* path) { Transfer(); for (int i = 0; i < Outputs(); ++i) { if (ChangedOutput(i)) { StateVar* output = GetOutput(i); Connector* conn = GetBinding(output); conn->Transmit(path); } } } StateVar* TF_2Port::GetInput (int) { return nil; } StateVar* TF_2Port::GetOutput (int) { return nil; } void TF_2Port::SetInput (StateVar*, int) { } void TF_2Port::SetOutput (StateVar*, int) { } void TF_2Port::Transfer () { } bool TF_2Port::ChangedOutput (int) { return false; } int TF_2Port::Inputs () { return 0; } int TF_2Port::Outputs () { return 0; } ClassId TF_2Port::GetClassId () { return TF_2PORT; } bool TF_2Port::IsA (ClassId id) { return TF_2PORT == id || TransferFunct::IsA(id); } /*****************************************************************************/ TF_Direct::TF_Direct (StateVar* input, StateVar* output) { _input = input; _output = output; _changed = false; } StateVar* TF_Direct::GetInput (int i) { return (i == 0) ? _input : nil; } StateVar* TF_Direct::GetOutput (int i) { return (i == 0) ? _output : nil; } int TF_Direct::Inputs () { return 1; } int TF_Direct::Outputs () { return 1; } void TF_Direct::SetInput (StateVar* input, int i) { if (i == 0) { _input = input; } } void TF_Direct::SetOutput (StateVar* output, int i) { if (i == 0) { _output = output; } } ClassId TF_Direct::GetClassId () { return TF_DIRECT; } bool TF_Direct::IsA (ClassId id) { return TF_DIRECT == id || TF_2Port::IsA(id); } void TF_Direct::Transfer () { *_output = *_input; _changed = true; } bool TF_Direct::ChangedOutput (int i) { bool changed = false; if (i == 0 && _changed) { changed = _changed; _changed = false; } return changed; } TransferFunct* TF_Direct::Copy () { return new TF_Direct(_input->Copy(), _output->Copy()); } void TF_Direct::Read (istream& in) { TF_2Port::Read(in); Catalog* catalog = unidraw->GetCatalog(); _input = catalog->ReadStateVar(in); _output = catalog->ReadStateVar(in); int changed; in >> changed; _changed = changed; } void TF_Direct::Write (ostream& out) { TF_2Port::Write(out); Catalog* catalog = unidraw->GetCatalog(); catalog->WriteStateVar(_input, out); catalog->WriteStateVar(_output, out); out << _changed << " "; } neuron-7.6.3/src/lib/Unidraw/transforms.cpp000066400000000000000000000073401340731477100207200ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of transformation commands; */ #include #include #include #include /*****************************************************************************/ ClassId MoveCmd::GetClassId () { return MOVE_CMD; } bool MoveCmd::IsA (ClassId id) { return MOVE_CMD == id || Command::IsA(id);} MoveCmd::MoveCmd (ControlInfo* c, float x, float y) : Command(c) { _dx = x; _dy = y; } MoveCmd::MoveCmd (Editor* ed, float x, float y) : Command(ed) { _dx = x; _dy = y; } Command* MoveCmd::Copy () { Command* copy = new MoveCmd(CopyControlInfo(), _dx, _dy); InitCopy(copy); return copy; } void MoveCmd::GetMovement (float& x, float& y) { x = _dx; y = _dy; } void MoveCmd::Read (istream& in) { Command::Read(in); in >> _dx >> _dy; } void MoveCmd::Write (ostream& out) { Command::Write(out); out << _dx << " " << _dy << " "; } /*****************************************************************************/ ClassId ScaleCmd::GetClassId () { return SCALE_CMD; } bool ScaleCmd::IsA (ClassId id) { return SCALE_CMD == id || Command::IsA(id); } ScaleCmd::ScaleCmd ( ControlInfo* c, float x, float y, Alignment a ) : Command(c) { _sx = x; _sy = y; _align = a; } ScaleCmd::ScaleCmd (Editor* ed, float x, float y, Alignment a) : Command(ed) { _sx = x; _sy = y; _align = a; } Command* ScaleCmd::Copy () { Command* copy = new ScaleCmd(CopyControlInfo(), _sx, _sy, _align); InitCopy(copy); return copy; } void ScaleCmd::GetScaling (float& x, float& y) { x = _sx; y = _sy; } void ScaleCmd::Read (istream& in) { Command::Read(in); long a; in >> _sx >> _sy >> a; _align = (Alignment) a; } void ScaleCmd::Write (ostream& out) { Command::Write(out); out << _sx << " " << _sy << " " << _align << " "; } /*****************************************************************************/ ClassId RotateCmd::GetClassId () { return ROTATE_CMD; } bool RotateCmd::IsA (ClassId id) { return ROTATE_CMD == id || Command::IsA(id); } RotateCmd::RotateCmd (ControlInfo* c, float a) : Command(c) { _angle = a; } RotateCmd::RotateCmd (Editor* ed, float a) : Command(ed) { _angle = a; } Command* RotateCmd::Copy () { Command* copy = new RotateCmd(CopyControlInfo(), _angle); InitCopy(copy); return copy; } void RotateCmd::Read (istream& in) { Command::Read(in); in >> _angle; } void RotateCmd::Write (ostream& out) { Command::Write(out); out << _angle << " "; } neuron-7.6.3/src/lib/Unidraw/uarray.cpp000077500000000000000000000051351340731477100200300ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * UArray implementation. */ #include #include #include /*****************************************************************************/ UArray::UArray (int defaultSize) { _bufsize = defaultSize; _buf = new void*[_bufsize]; _count = 0; } UArray::~UArray () { delete [] _buf; } void UArray::Check (int index) { void** newbuf; if (index >= _bufsize) { _bufsize = (index+1) * 2; newbuf = new void*[_bufsize]; Memory::copy(_buf, newbuf, _count*sizeof(void*)); delete _buf; _buf = newbuf; } } void UArray::Insert (void* v, int index) { void** spot; index = (index < 0) ? _count : index; if (index < _count) { Check(_count+1); spot = &_buf[index]; Memory::copy(spot, spot+1, (_count - index)*sizeof(void*)); } else { Check(index); spot = &_buf[index]; } *spot = v; ++_count; } void UArray::Remove (int index) { if (0 <= index && index < _count) { --_count; void** spot = &_buf[index]; Memory::copy(spot+1, spot, (_count - index)*sizeof(void*)); } } int UArray::Index (void* v) { for (int i = 0; i < _count; ++i) { if (_buf[i] == v) { return i; } } return -1; } void*& UArray::operator[] (int index) { Check(index); _count = Math::max(_count, index+1); return _buf[index]; } neuron-7.6.3/src/lib/Unidraw/uctrl.cpp000066400000000000000000000066551340731477100176630ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * UControl and UControlInteractor implementations. */ #include #include #include #include #include #include #include #include #include /*****************************************************************************/ UControl::UControl (ControlInfo* info) : Control(nil) { Init(info); } UControl::UControl (const char* name, ControlInfo* info) : Control(name, nil) { Init(info); } void UControl::Init (ControlInfo* info) { _info = info; } void UControl::SetControlInfo (ControlInfo* c) { _info = c; } ControlInfo* UControl::GetControlInfo () { return _info; } /*****************************************************************************/ UControlInteractor::UControlInteractor (ControlInfo* info) { Init(info); _label = InitLabel(_info); } UControlInteractor::UControlInteractor () { Init(nil); _label = nil; } UControlInteractor::~UControlInteractor () { delete _picture; } void UControlInteractor::Init (ControlInfo* info) { _info = info; _picture = new Picture; _highlighted = false; } void UControlInteractor::Redraw (Coord, Coord, Coord, Coord) { if (canvas != nil) { _picture->Draw(canvas); } } void UControlInteractor::Highlight (bool on) { if (_highlighted != on) { Invert(); _highlighted = on; Draw(); } } static void InvertGraphic (Graphic* g) { Iterator i; PSColor* fg = g->GetFgColor(); PSColor* bg = g->GetBgColor(); g->SetColors(bg, fg); for (g->First(i); !g->Done(i); g->Next(i)) { InvertGraphic(g->GetGraphic(i)); } } void UControlInteractor::Invert () { InvertGraphic(_picture); } void UControlInteractor::SetControlInfo (ControlInfo* c) { _info = c; } ControlInfo* UControlInteractor::GetControlInfo () { return _info; } Graphic* UControlInteractor::InitLabel (ControlInfo* info) { GraphicComp* comp = info->GetLabel(); GraphicView* view = (GraphicView*) comp->Create(COMPONENT_VIEW); comp->Attach(view); view->Update(); Graphic* label = view->GetGraphic()->Copy(); delete view; return label; } neuron-7.6.3/src/lib/Unidraw/uctrls.cpp000066400000000000000000000200361340731477100200330ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of UControl and UControlInteractor subclasses. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ static const int HPAD = 4; // horizontal padding around control labels static const int VPAD = 1; // vertical padding around control labels static const int SEP = 8; // separation between label & equiv static const int MINHT = 15; // minimum height of control labels static const int MINWD = 15; // minimum width of control labels /*****************************************************************************/ CommandControl::CommandControl (ControlInfo* info) : UControl(info) { Init(info); } CommandControl::CommandControl ( const char* name, ControlInfo* info ) : UControl(name, info) { Init(info); } void CommandControl::Init (ControlInfo* info) { Insert(new CommandInteractor(info)); } void CommandControl::Do () { Command* cmd = (Command*) _info->GetOwner(); if (cmd != nil) { Busy(); if (cmd->Reversible()) { cmd = cmd->Copy(); cmd->Execute(); if (cmd->Reversible()) { cmd->Log(); } else { delete cmd; } } else { cmd->Execute(); if (cmd->Reversible()) { cmd = cmd->Copy(); cmd->Log(); } } Done(); } } void CommandControl::Busy () { RootControl()->Highlight(true); World::current()->Sync(); } void CommandControl::Done () { RootControl()->Highlight(false); World::current()->Sync(); } /*****************************************************************************/ PanelControl::PanelControl ( Interactor* i, ControlInfo* info, ControlState* state ) : UControl(info) { Init(i, state); } PanelControl::PanelControl ( const char* name, Interactor* i, ControlInfo* info, ControlState* state ) : UControl(name, info) { Init(i, state); } void PanelControl::Init (Interactor* i, ControlState* state) { if (i != nil) { Insert(i); } if (state != nil) { SetState(state); } } void PanelControl::Do () { Down(); } void PanelControl::Down () { State()->NotifySelection(this); } void PanelControl::Enter () { } void PanelControl::Leave () { } void PanelControl::Select () { Highlight(true); } /*****************************************************************************/ HPanelControl::HPanelControl ( ControlInfo* info, ControlState* state ) : PanelControl(new PanelInteractor(info, Horizontal), info, state) { } HPanelControl::HPanelControl ( const char* name, ControlInfo* info, ControlState* state ) : PanelControl(name, new PanelInteractor(info, Horizontal), info, state) { } /*****************************************************************************/ VPanelControl::VPanelControl ( ControlInfo* info, ControlState* state ) : PanelControl(new PanelInteractor(info, Vertical), info, state) { } VPanelControl::VPanelControl ( const char* name, ControlInfo* info, ControlState* state ) : PanelControl(name, new PanelInteractor(info, Vertical), info, state) { } /*****************************************************************************/ CommandInteractor::CommandInteractor ( ControlInfo* info ) : UControlInteractor(info) { } void CommandInteractor::Reconfig () { const char* kl = _info->GetKeyLabel(); int x0, y0, x1, y1; _label->GetBox(x0, y0, x1, y1); shape->width = 2*HPAD + x1 - x0; shape->height = max(2*VPAD + y1 - y0, MINHT); if (*kl != '\0') { Font* f = stdgraphic->GetFont(); shape->width += f->Width(kl) + SEP; shape->height = max(shape->height, f->Height() + 2*VPAD); } shape->Rigid(shape->width, hfil, 0, 0); } void CommandInteractor::Resize () { const char* keyLabel = _info->GetKeyLabel(); Graphic* bg; bool invert = false; Iterator i; _picture->First(i); if (_picture->Done(i)) { bg = new F_Rect(0, 0, xmax, ymax, stdgraphic); invert = _highlighted; } else { bg = new F_Rect(0, 0, xmax, ymax, _picture->GetGraphic(i)); Graphic* newpict = new Picture(_picture); _picture->Remove(_label); delete _picture; _picture = newpict; } bg->SetPattern(psclear); _picture->Append(bg); _picture->Append(_label); if (*keyLabel == '\0') { bg->Align(Center, _label, Center); } else { bg->Align(CenterLeft, _label, CenterLeft); _label->Translate(HPAD, 0); Graphic* klbl = new ULabel(keyLabel, bg); klbl->SetFont(psstdfont); _picture->Append(klbl); bg->Align(CenterRight, klbl, CenterRight); klbl->Translate(-HPAD, 0); } if (invert) { Invert(); } } /*****************************************************************************/ PanelInteractor::PanelInteractor ( ControlInfo* info, Orientation orient ) : UControlInteractor(info) { _orient = orient; } void PanelInteractor::Reconfig () { int x0, y0, x1, y1; const char* kl = _info->GetKeyLabel(); _label->GetBox(x0, y0, x1, y1); shape->width = x1 - x0; shape->height = y1 - y0; if (*kl == '\0') { shape->width += 2*HPAD; shape->height += 2*VPAD; } else { PSFont* f = stdgraphic->GetFont(); shape->width += 2 * f->Width(kl) + HPAD; shape->height += f->Height(); } shape->height = max(shape->height, MINHT); if (_orient == Horizontal) { shape->Rigid(0, shape->width, 0, vfil); } else if (_orient == Vertical) { shape->Rigid(0, hfil, shape->height, 0); } } void PanelInteractor::Resize () { const char* keyLabel = _info->GetKeyLabel(); Graphic* bg; bool invert = false; Iterator i; _picture->First(i); if (_picture->Done(i)) { bg = new F_Rect(0, 0, xmax, ymax, stdgraphic); invert = _highlighted; } else { bg = new F_Rect(0, 0, xmax, ymax, _picture->GetGraphic(i)); Graphic* newpict = new Picture(_picture); _picture->Remove(_label); delete _picture; _picture = newpict; } bg->SetPattern(psclear); _picture->Append(bg); _picture->Append(_label); bg->Align(Center, _label, Center); if (*keyLabel != '\0') { Graphic* klbl = new ULabel(keyLabel, bg); klbl->SetFont(psstdfont); _picture->Append(klbl); _picture->Align(BottomRight, klbl, BottomRight); } if (invert) { Invert(); } } neuron-7.6.3/src/lib/Unidraw/uhash.cpp000066400000000000000000000107041340731477100176300ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * UHash implementation. */ #include #include #include #include /*****************************************************************************/ UHashElem::UHashElem (void* key) { _key = key; } UHashElem::~UHashElem () { } /*****************************************************************************/ UHashElem* UHashTable::CreateElem () { return nil; } UHashElem* UHashTable::Elem (UList* r) { return (UHashElem*) (*r)(); } int UHashTable::Hash (void* c) { return (unsigned long) c % _nslots; } UHashTable::UHashTable (int nslots) { _nslots = nslots; _slot = new UList*[_nslots]; Memory::zero(_slot, sizeof(void*) * _nslots); } UHashTable::~UHashTable () { for (int i = 0; i < _nslots; ++i) { if (_slot[i] != nil) { DeleteSlot(_slot[i]); } } delete [] _slot; } void UHashTable::Register (void* key, UHashElem* elem) { int n = Hash(key); if (_slot[n] == nil) { _slot[n] = new UList; } if (elem == nil) { elem = CreateElem(); } elem->SetKey(key); _slot[n]->Prepend(new UList(elem)); } void UHashTable::Unregister (void* key) { int n = Hash(key); UList* slot = _slot[n]; if (slot != nil) { for (UList* u = slot->First(); u != slot->End(); u = u->Next()) { UHashElem* elem = Elem(u); if (Equal(elem->GetKey(), key)) { slot->Remove(u); delete elem; delete u; if (_slot[n]->IsEmpty()) { delete _slot[n]; _slot[n] = nil; } break; } } } } UList* UHashTable::UElem (Iterator i) { return (UList*) i.GetValue(); } UHashElem* UHashTable::GetElem (Iterator i) { return Elem(UElem(i)); } void UHashTable::First (Iterator& i) { for (int j = 0; j < _nslots; ++j) { if (_slot[j] != nil) { i.SetValue(_slot[j]->First()); return; } } i.SetValue(nil); } void UHashTable::Next (Iterator& i) { UHashElem* elem = GetElem(i); if (elem != nil) { int n = Hash(elem->GetKey()); UList* u = UElem(i); u = u->Next(); if (u == _slot[n]->End()) { for (int j = n+1; j < _nslots; ++j) { if (_slot[j] != nil) { u = _slot[j]->First(); break; } } } i.SetValue(u); } } bool UHashTable::Done (Iterator i) { for (int j = _nslots - 1; j >= 0; --j) { if (_slot[j] != nil) { return UElem(i) == _slot[j]->End(); } } return true; } bool UHashTable::Equal (void* key1, void* key2) { return key1 == key2; } UHashElem* UHashTable::Find (void* key) { int n = Hash(key); UList* slot = _slot[n]; if (slot != nil) { for (UList* u = slot->First(); u != slot->End(); u = u->Next()) { UHashElem* elem = Elem(u); if (Equal(elem->GetKey(), key)) { return elem; } } } return nil; } void UHashTable::DeleteSlot (UList* slot) { while (!slot->IsEmpty()) { UList* u = slot->First(); slot->Remove(u); UHashElem* elem = Elem(u); delete elem; delete u; } delete slot; } neuron-7.6.3/src/lib/Unidraw/ulabel.cpp000066400000000000000000000071401340731477100177640ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of ULabel, an object derived from Graphic. */ #include #include #include #include #include #include /*****************************************************************************/ ULabel::ULabel (const char* s, Graphic* gr) : Graphic(gr) { _font = nil; if (gr != nil) { ULabel::SetFont(gr->GetFont()); } _string = strnew(s); } ULabel::~ULabel () { delete [] _string; Unref(_font); } void ULabel::SetFont (PSFont* font) { if (_font != font) { Ref(font); Unref(_font); _font = font; invalidateCaches(); } } extern PSPattern* pssolid; // hack (see header file) PSPattern* ULabel::GetPattern () { return pssolid; } PSFont* ULabel::GetFont () { return _font; } Graphic* ULabel::Copy () { return new ULabel(_string, this); } void ULabel::getExtent ( float& x0, float& y0, float& cx, float& cy, float& tol, Graphic* gs ) { PSFont* f = gs->GetFont(); float width = f->Width(_string); float height = f->Height(); if (gs->GetTransformer() == nil) { x0 = 0; y0 = 0; cx = width / 2; cy = height / 2; } else { transformRect(0, 0, width, height, x0, y0, cx, cy, gs); cx = (cx + x0)/2; cy = (cy + y0)/2; } tol = 0; } bool ULabel::contains (PointObj& po, Graphic* gs) { PointObj pt (&po); PSFont* f = gs->GetFont(); invTransform(pt._x, pt._y, gs); BoxObj b (0, 0, f->Width(_string), f->Height()); return b.Contains(pt); } bool ULabel::intersects (BoxObj& userb, Graphic* gs) { Transformer* t = gs->GetTransformer(); PSFont* f = gs->GetFont(); Coord xmax = f->Width(_string); Coord ymax = f->Height(); Coord tx0, ty0, tx1, ty1; if (t != nil && t->Rotated()) { Coord x[4], tx[5]; Coord y[4], ty[5]; x[0] = x[3] = y[0] = y[1] = 0; x[2] = x[1] = xmax; y[2] = y[3] = ymax; transformList(x, y, 4, tx, ty, gs); tx[4] = tx[0]; ty[4] = ty[0]; FillPolygonObj fp (tx, ty, 5); return fp.Intersects(userb); } else if (t != nil) { t->Transform(0, 0, tx0, ty0); t->Transform(xmax, ymax, tx1, ty1); BoxObj b1 (tx0, ty0, tx1, ty1); return b1.Intersects(userb); } else { BoxObj b2 (0, 0, xmax, ymax); return b2.Intersects(userb); } } void ULabel::draw (Canvas *c, Graphic* gs) { update(gs); _p->Text(c, _string, 0, 0); } neuron-7.6.3/src/lib/Unidraw/ulist.cpp000077500000000000000000000045661340731477100176740ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * UList implementation. */ #include /*****************************************************************************/ UList::UList (void* p) { _next = this; _prev = this; _object = p; } UList::~UList () { UList* next = _next; if (next != this && next != nil) { Remove(this); delete next; } } void UList::Append (UList* e) { _prev->_next = e; e->_prev = _prev; e->_next = this; _prev = e; } void UList::Prepend (UList* e) { _next->_prev = e; e->_prev = this; e->_next = _next; _next = e; } void UList::Remove (UList* e) { e->_prev->_next = e->_next; e->_next->_prev = e->_prev; e->_prev = e->_next = nil; } void UList::Delete (void* p) { register UList* e; e = Find(p); if (e != nil) { Remove(e); delete e; } } UList* UList::Find (void* p) { register UList* e; for (e = _next; e != this; e = e->_next) { if (e->_object == p) { return e; } } return nil; } UList* UList::operator[] (int count) { UList* pos = First(); int i; for (i = 1; i < count && pos != End(); ++i) { pos = pos->Next(); } if (i == count) { return pos; } return nil; } neuron-7.6.3/src/lib/Unidraw/umap.cpp000077500000000000000000000044651340731477100174740ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * UMap implementation. */ #include #include #include /*****************************************************************************/ UMapElem::UMapElem () { } UMapElem::~UMapElem () { } void* UMapElem::id () { return nil; } void* UMapElem::tag () { return nil; } /*****************************************************************************/ UMap::UMap () { } UMap::~UMap () { Clear(); } void UMap::Clear () { for (int i = 0; i < _elems.Count(); ++i) { UMapElem* e = Elem(i); delete e; } _elems.Clear(); } void UMap::Register (UMapElem* elem) { _elems.Insert(elem, _elems.Count()); } void UMap::Unregister (UMapElem* elem) { _elems.Remove(_elems.Index(elem)); } UMapElem* UMap::FindId (void* id) { for (int i = 0; i < _elems.Count(); ++i) { if (Elem(i)->id() == id) { return (UMapElem*) _elems[i]; } } return nil; } UMapElem* UMap::FindTag (void* tag) { for (int i = 0; i < _elems.Count(); ++i) { if (Elem(i)->tag() == tag) { return (UMapElem*) _elems[i]; } } return nil; } neuron-7.6.3/src/lib/Unidraw/unidraw.cpp000066400000000000000000000301071340731477100201700ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of Unidraw class. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ static const int DEFAULT_HISTLEN = 20; /*****************************************************************************/ class History : public UMapElem { public: History(Component*); virtual ~History(); virtual void* id(); virtual void* tag(); public: Component* _comp; UList* _past; UList* _future; }; History::History (Component* comp) { _comp = comp; _past = new UList; _future = new UList; } History::~History () { delete _past; delete _future; } void* History::id () { return _comp; } void* History::tag () { return this; } /*****************************************************************************/ class HistoryMap : public UMap { public: HistoryMap(); void Register(Component*); void Unregister(Component*); bool Registered(Component*); History* GetHistory(Component*); History* GetHistory(int index); Component* GetComponent(History*); Component* GetComponent(int index); }; HistoryMap::HistoryMap () { } void HistoryMap::Register (Component* comp) { UMap::Register(new History(comp)); } void HistoryMap::Unregister (Component* comp) { UMapElem* elem = FindId((void*) comp); if (elem != nil) { UMap::Unregister(elem); delete elem; } } bool HistoryMap::Registered (Component* comp) { return FindId((void*) comp) != nil; } History* HistoryMap::GetHistory (Component* comp) { UMapElem* elem = FindId((void*) comp); return (elem == nil) ? nil : (History*) elem->tag(); } History* HistoryMap::GetHistory (int index) { return (History*) Elem(index)->tag(); } Component* HistoryMap::GetComponent (History* hist) { UMapElem* elem = FindTag((void*) hist); return (elem == nil) ? nil : (Component*) elem->id(); } Component* HistoryMap::GetComponent (int index) { return (Component*) Elem(index)->id(); } /*****************************************************************************/ class DirtyCmd : public Command { public: DirtyCmd(ControlInfo*); DirtyCmd(Editor* = nil); virtual void Execute(); virtual void Unexecute(); virtual Command* Copy(); virtual ClassId GetClassId(); virtual bool IsA(ClassId); }; ClassId DirtyCmd::GetClassId () { return DIRTY_CMD; } bool DirtyCmd::IsA (ClassId id) {return DIRTY_CMD==id || Command::IsA(id);} DirtyCmd::DirtyCmd (ControlInfo* c) : Command(c) { } DirtyCmd::DirtyCmd (Editor* ed) : Command(ed) { } Command* DirtyCmd::Copy () { Command* copy = new DirtyCmd(CopyControlInfo()); InitCopy(copy); return copy; } void DirtyCmd::Execute () { ModifStatusVar* mv = (ModifStatusVar*) _editor->GetState("ModifStatusVar"); if (mv != nil) { mv->SetModifStatus(true); } } void DirtyCmd::Unexecute () { ModifStatusVar* mv = (ModifStatusVar*) _editor->GetState("ModifStatusVar"); if (mv != nil) { mv->SetModifStatus(false); } } /*****************************************************************************/ Unidraw::Unidraw ( Catalog* c, int& argc, char** argv, OptionDesc* od, PropertyData* pd ) { Init(c, new World(c->GetName(), argc, argv, od, pd)); } Unidraw::Unidraw (Catalog* c, World* w) { Init(c, w); } void Unidraw::Init (Catalog* c, World* w) { csolver = new CSolver; unidraw = this; _catalog = c; _world = w; _catalog->Init(_world); _editors = new UList; _deadEditors = new UList; alive(true); updated(false); _histories = new HistoryMap; InitAttributes(); } Unidraw::~Unidraw () { CloseAll(); ClearHistory(); delete _histories; delete _editors; delete _deadEditors; delete _catalog; delete _world; } void Unidraw::InitAttributes () { const char* attrib = GetWorld()->GetAttribute("history"); _histlen = (attrib == nil) ? DEFAULT_HISTLEN : atoi(attrib); } void Unidraw::Mark (Editor* editor) { UList* e = _editors->Find(editor); _editors->Remove(e); _deadEditors->Append(e); } void Unidraw::Sweep () { while (!_deadEditors->IsEmpty()) { UList* doomed = _deadEditors->First(); _deadEditors->Remove(doomed); Editor* ed = editor(doomed); Component* comp = ed->GetComponent(); Resource::unref(editor(doomed)); delete doomed; DeleteComponent(comp); } } void Unidraw::DeleteComponent (Component* comp) { Component* root = (comp == nil) ? nil : comp->GetRoot(); if ( root != nil && GetCatalog()->GetName(root) == nil && FindAny(root) == nil && FindAnyDead(root) == nil ) { delete root; } } void Unidraw::Run () { Session* session = GetWorld()->session(); Event e; alive(true); while (alive() && !session->done()) { updated(false); session->read(e); e.handle(); Process(); Sweep(); if (updated()) { Update(true); } } } void Unidraw::DoUpdate () { csolver->Solve(); for (UList* e = _editors->First(); e != _editors->End(); e = e->Next()) { editor(e)->Update(); } } void Unidraw::Update (bool immediate) { if (immediate) { DoUpdate(); } updated(!immediate); } void Unidraw::Quit () { alive(false); } void Unidraw::Open (Editor* editor) { ManagedWindow* w = editor->GetWindow(); if (w == nil) { w = new ApplicationWindow(editor); editor->SetWindow(w); } w->map(); _editors->Append(new UList(editor)); Resource::ref(editor); editor->Open(); } void Unidraw::Close (Editor* editor) { editor->Close(); Mark(editor); editor->GetWindow()->unmap(); } void Unidraw::CloseDependents (Component* comp) { Iterator i; for (First(i); !Done(i);) { Editor* ed = GetEditor(i); Next(i); if (ed->DependsOn(comp)) { Close(ed); ed->SetComponent(nil); } } } void Unidraw::CloseAll () { UList* u = _editors->First(); while (u != _editors->End()) { Close(editor(u)); u = _editors->First(); } } bool Unidraw::Opened (Editor* ed) { for (UList* u = _editors->First(); u != _editors->End(); u = u->Next()) { if (editor(u) == ed) { return true; } } return false; } Editor* Unidraw::editor (UList* u) { return (Editor*) (*u)(); } Command* Unidraw::command (UList* r) { return (Command*) (*r)(); } UList* Unidraw::elem (Iterator i) { return (UList*) i.GetValue(); } void Unidraw::First (Iterator& i) { i.SetValue(_editors->First()); } void Unidraw::Next (Iterator& i) { i.SetValue(elem(i)->Next()); } bool Unidraw::Done (Iterator i) { return elem(i) == _editors->End(); } Editor* Unidraw::GetEditor (Iterator i) { return editor(elem(i)); } Editor* Unidraw::Find (Component* comp) { for (UList* u = _editors->First(); u != _editors->End(); u = u->Next()) { Editor* ed = editor(u); if (ed->GetComponent() == comp) { return ed; } } return nil; } Editor* Unidraw::FindAny (Component* comp) { return FindAny(comp, _editors); } Editor* Unidraw::FindAnyDead (Component* comp) { return FindAny(comp, _deadEditors); } Editor* Unidraw::FindAny (Component* comp, UList* editors) { comp = comp->GetRoot(); for (UList* u = editors->First(); u != editors->End(); u = u->Next()) { Editor* ed = editor(u); Component* test = ed->GetComponent(); if (test != nil && test->GetRoot() == comp) { return ed; } } return nil; } void Unidraw::SetHistoryLength (int hl) { _histlen = hl; } int Unidraw::GetHistoryLength () { return _histlen; } void Unidraw::ClearHistory (Editor* ed) { Component* comp = ed->GetComponent(); if (comp != nil && FindAny(comp) == nil) { ClearHistory(comp); } } void Unidraw::ClearHistory (Component* comp) { if (comp == nil) { for (int i = 0; i < _histories->Count(); ++i) { History* history = _histories->GetHistory(i); if (history != nil) { ClearHistory(history->_past); ClearHistory(history->_future); } } } else { History* history = _histories->GetHistory(comp->GetRoot()); if (history != nil) { ClearHistory(history->_past); ClearHistory(history->_future); } } } void Unidraw::ClearHistory (UList* hist, int start) { UList* doomed = (*hist)[start]; UList* next; if (doomed != nil) { while (doomed != hist->End()) { next = doomed->Next(); hist->Remove(doomed); Command* cmd = command(doomed); Editor* ed = cmd->GetEditor(); Resource::unref(ed); delete cmd; delete doomed; doomed = next; } } } void Unidraw::Log (Command* cmd) { if (cmd->Reversible()) { Editor* ed = cmd->GetEditor(); Component* comp = ed->GetComponent()->GetRoot(); UList* past, *future; GetHistory(comp, past, future); Resource::ref(ed); ClearHistory(future); if (IsClean(ed)) { DirtyCmd* dc = new DirtyCmd(ed); dc->Execute(); cmd = new MacroCmd(ed, cmd, dc); } past->Prepend(new UList(cmd)); ClearHistory(past, _histlen+1); } } void Unidraw::Process () { /* do nothing by default */ } bool Unidraw::IsClean (Editor* ed) { ModifStatusVar* mv = (ModifStatusVar*) ed->GetState("ModifStatusVar"); return (mv != nil && !mv->GetModifStatus()); } void Unidraw::Undo (Component* comp, int n) { UList* past, *future; GetHistory(comp, past, future); UList* cur = past->First(); for (int i = 0; i < n && cur != past->End(); ++i) { Command* cmd = command(cur); cmd->Unexecute(); past->Remove(cur); future->Prepend(cur); cur = past->First(); } } void Unidraw::Redo (Component* comp, int n) { UList* past, *future; GetHistory(comp, past, future); UList* cur = future->First(); for (int i = 0; i < n && cur != future->End(); ++i) { Command* cmd = command(cur); cmd->Execute(); future->Remove(cur); past->Prepend(cur); cur = future->First(); } } void Unidraw::GetHistory (Component* comp, UList*& past, UList*& future) { Component* root = comp->GetRoot(); if (!_histories->Registered(comp)) { _histories->Register(comp); } History* history = _histories->GetHistory(root); past = history->_past; future = history->_future; } neuron-7.6.3/src/lib/Unidraw/upage.cpp000077500000000000000000000065461340731477100176350ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * UPage implementation. */ #include #include #include #include #include /*****************************************************************************/ class PageGraphic : public Graphic { public: PageGraphic(float, float, Graphic* = nil); virtual ~PageGraphic(); void GetOriginal(float&, float&); virtual void SetBrush(PSBrush*); virtual PSBrush* GetBrush(); virtual Graphic* Copy(); protected: virtual void getExtent(float&, float&, float&, float&, float&, Graphic*); virtual void draw(Canvas*, Graphic*); private: float _width, _height; PSBrush* _br; }; PageGraphic::PageGraphic ( float width, float height, Graphic* gr ) : Graphic(gr) { _br = nil; if (gr != nil) { PageGraphic::SetBrush(gr->GetBrush()); } _width = width; _height = height; } PageGraphic::~PageGraphic () { Unref(_br); } void PageGraphic::GetOriginal (float& width, float& height) { width = _width; height = _height; } void PageGraphic::SetBrush (PSBrush* br) { if (_br != br) { Ref(br); Unref(_br); _br = br; invalidateCaches(); } } PSBrush* PageGraphic::GetBrush () { return _br; } Graphic* PageGraphic::Copy () { return new PageGraphic(_width, _height, this);} void PageGraphic::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { float width, dummy1, dummy2; width = float(gs->GetBrush()->Width()); tol = (width > 1) ? width/2 : 0; transformRect(0, 0, _width-1, _height-1, l, b, dummy1, dummy2, gs); transform((_width-1)/2, (_height-1)/2, cx, cy, gs); } void PageGraphic::draw (Canvas* c, Graphic* gs) { if (!gs->GetBrush()->None()) { update(gs); _p->Rect(c, 0, 0, iv26_round(_width)-1, iv26_round(_height)-1); } } /*****************************************************************************/ UPage::UPage (float width, float height) { _graphic = new PageGraphic(width, height, stdgraphic); } UPage::UPage (Graphic* g) { _graphic = g; } UPage::~UPage () { delete _graphic; } Graphic* UPage::GetGraphic () { return _graphic; } neuron-7.6.3/src/lib/Unidraw/ustencil.cpp000066400000000000000000000074061340731477100203530ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of UStencil, an object derived from Graphic. */ #include #include #include #include #include #include /*****************************************************************************/ UStencil::UStencil (Bitmap* i, Bitmap* m, Graphic* gr) : Graphic(gr) { _image = i; _mask = m; Ref(_image); Ref(_mask); } UStencil::~UStencil () { Unref(_image); Unref(_mask); } void UStencil::GetOriginal (Bitmap*& i, Bitmap*& m) { i = _image; m = _mask; } extern PSPattern* pssolid; // hack (see header file) PSPattern* UStencil::GetPattern () { return pssolid; } Graphic* UStencil::Copy () { Bitmap* image_cpy = new Bitmap(*_image); Bitmap* mask_cpy = (_mask == nil) ? nil : (_mask == _image) ? image_cpy : new Bitmap(*_mask); return new UStencil(image_cpy, mask_cpy, this); } void UStencil::draw (Canvas *c, Graphic* gs) { update(gs); _p->Stencil(c, _image->Left(), _image->Bottom(), _image, _mask); } void UStencil::getExtent ( float& x0, float& y0, float& cx, float& cy, float& tol, Graphic* gs ) { Bitmap* bitmap = (_mask == nil) ? _image : _mask; float w = float(bitmap->Width()); float h = float(bitmap->Height()); if (gs->GetTransformer() == nil) { x0 = y0 = 0; cx = w/2; cy = h/2; } else { transformRect(0, 0, w, h, x0, y0, cx, cy, gs); cx = (cx + x0)/2; cy = (cy + y0)/2; } tol = 0; } bool UStencil::contains (PointObj& po, Graphic* gs) { Bitmap* bitmap = (_mask == nil) ? _image : _mask; PointObj pt (&po); invTransform(pt._x, pt._y, gs); BoxObj b (0, 0, bitmap->Width(), bitmap->Height()); return b.Contains(pt); } bool UStencil::intersects (BoxObj& userb, Graphic* gs) { Transformer* t = gs->GetTransformer(); Bitmap* bitmap = (_mask == nil) ? _image : _mask; Coord xmax = bitmap->Width(); Coord ymax = bitmap->Height(); Coord tx0, ty0, tx1, ty1; if (t != nil && t->Rotated()) { Coord x[4], tx[5]; Coord y[4], ty[5]; x[0] = x[3] = y[0] = y[1] = 0; x[2] = x[1] = xmax; y[2] = y[3] = ymax; transformList(x, y, 4, tx, ty, gs); tx[4] = tx[0]; ty[4] = ty[0]; FillPolygonObj fp (tx, ty, 5); return fp.Intersects(userb); } else if (t != nil) { t->Transform(0, 0, tx0, ty0); t->Transform(xmax, ymax, tx1, ty1); BoxObj b1 (tx0, ty0, tx1, ty1); return b1.Intersects(userb); } else { BoxObj b2 (0, 0, xmax, ymax); return b2.Intersects(userb); } } neuron-7.6.3/src/lib/Unidraw/vertices.cpp000066400000000000000000000114631340731477100203470ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Vertices component definitions. */ #include #include #include #include #include #include #include #include #include #include /****************************************************************************/ ClassId VerticesComp::GetClassId () { return VERTICES_COMP; } bool VerticesComp::IsA (ClassId id) { return VERTICES_COMP == id || GraphicComp::IsA(id); } VerticesComp::VerticesComp (Vertices* graphic) : GraphicComp(graphic) { } Vertices* VerticesComp::GetVertices () { return (Vertices*) GetGraphic(); } /****************************************************************************/ VerticesComp* VerticesView::GetVerticesComp () { return (VerticesComp*) GetSubject(); } ClassId VerticesView::GetClassId () { return VERTICES_VIEW; } bool VerticesView::IsA (ClassId id) { return VERTICES_VIEW == id || GraphicView::IsA(id); } VerticesView::VerticesView (VerticesComp* subj) : GraphicView(subj) { } void VerticesView::Update () { Graphic* vertices = GetGraphic(); IncurDamage(vertices); if (VertexChanged()) { // unimplemented } *vertices = *GetVerticesComp()->GetGraphic(); IncurDamage(vertices); EraseHandles(); } void VerticesView::CreateHandles () { Coord* x, *y; int n; Viewer* v = GetViewer(); if (v != nil) { GetVertices(x, y, n); _handles = new RubberHandles(nil, nil, x, y, n, 0, HANDLE_SIZE); v->InitRubberband(_handles); delete x; delete y; } } bool VerticesView::VertexChanged () { return false; } void VerticesView::Interpret (Command* cmd) { if (cmd->IsA(ALIGNTOGRID_CMD)) { Vertices* verts = (Vertices*) GetGraphic(); Transformer total; verts->TotalTransformation(total); float tx0, ty0; const Coord* x, *y; int n = verts->GetOriginal(x, y); total.Transform(float(x[0]), float(y[0]), tx0, ty0); ((AlignToGridCmd*) cmd)->Align(this, tx0, ty0); } else { GraphicView::Interpret(cmd); } } void VerticesView::GetVertices (Coord*& x, Coord*& y, int& n) { Vertices* vertices = (Vertices*) GetGraphic(); Transformer t; const Coord* origx, *origy; n = vertices->GetOriginal(origx, origy); ArrayDup(origx, origy, n, x, y); vertices->TotalTransformation(t); t.TransformList(x, y, n); } Graphic* VerticesView::GetGraphic () { Graphic* graphic = GraphicView::GetGraphic(); if (graphic == nil) { VerticesComp* verticesComp = GetVerticesComp(); graphic = verticesComp->GetGraphic()->Copy(); SetGraphic(graphic); } return graphic; } /****************************************************************************/ ClassId PSVertices::GetClassId () { return PS_VERTICES; } bool PSVertices::IsA (ClassId id) { return PS_VERTICES == id || PostScriptView::IsA(id); } PSVertices::PSVertices (VerticesComp* subj) : PostScriptView(subj) { } const char* PSVertices::Name () { return ""; } bool PSVertices::Definition (ostream& out) { const Coord* x; const Coord* y; int n; VerticesComp* comp = (VerticesComp*) GetSubject(); n = comp->GetVertices()->GetOriginal(x, y); out << "Begin " << MARK << " " << Name() << "\n"; MinGS(out); out << MARK << " " << n << "\n"; for (int i = 0; i < n; i++) { out << x[i] << " " << y[i] << "\n"; } out << n << " " << Name() << "\n"; out << "End\n\n"; return out.good(); } neuron-7.6.3/src/lib/Unidraw/verts.cpp000066400000000000000000000103271340731477100176640ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Vertices implementation. */ #include #include #include /*****************************************************************************/ Vertices::Vertices (Graphic* gr) : Graphic(gr) { _extent = nil; } Vertices::Vertices (Coord* x, Coord* y, int count, Graphic* gr) : Graphic(gr){ _extent = nil; _count = count; ArrayDup(x, y, count, _x, _y); } Vertices::~Vertices () { uncacheExtent(); delete [] _x; delete [] _y; } int Vertices::GetOriginal (const Coord*& x, const Coord*& y) { x = _x; y = _y; return _count; } bool Vertices::operator == (const Vertices& ml) const { if (_count == ml._count) { for (int i = 0; i < _count; ++i) { if (_x[i] != ml._x[i] || _y[i] != ml._y[i]) { return false; } } return true; } return false; } bool Vertices::operator != (const Vertices& ml) const { return !(*this == ml); } Graphic* Vertices::Copy () { return new Vertices(_x, _y, _count, this); } bool Vertices::extentCached () { return _caching && _extent != nil; } void Vertices::cacheExtent (float l, float b, float cx, float cy, float tol) { if (_caching) { uncacheExtent(); _extent = new Extent(l, b, cx, cy, tol); } } void Vertices::uncacheExtent() { delete _extent; _extent = nil; } void Vertices::getCachedExtent ( float& l, float& b, float& cx, float& cy, float& tol ) { l = _extent->_left; b = _extent->_bottom; cx = _extent->_cx; cy = _extent->_cy; tol = _extent->_tol; } void Vertices::s_getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { float bx0, by0, bx1, by1, tcx, tcy, width, dummy1, dummy2; if (extentCached()) { getCachedExtent(bx0, by0, tcx, tcy, tol); bx1 = 2*tcx - bx0; by1 = 2*tcy - by0; } else { width = float(gs->GetBrush()->Width()); tol = (width > 1) ? width/2 : 0; bx0 = bx1 = _x[0]; by0 = by1 = _y[0]; for (int i = 1; i < _count; ++i) { bx0 = min(bx0, float(_x[i])); by0 = min(by0, float(_y[i])); bx1 = max(bx1, float(_x[i])); by1 = max(by1, float(_y[i])); } tcx = (bx0 + bx1) / 2; tcy = (by0 + by1) / 2; cacheExtent(bx0, by0, tcx, tcy, tol); } transformRect(bx0, by0, bx1, by1, l, b, dummy1, dummy2, gs); transform(tcx, tcy, cx, cy, gs); } void Vertices::f_getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { float bx0, by0, bx1, by1, tcx, tcy, dummy1, dummy2; if (extentCached()) { getCachedExtent(bx0, by0, tcx, tcy, tol); bx1 = 2*tcx - bx0; by1 = 2*tcy - by0; } else { bx0 = bx1 = _x[0]; by0 = by1 = _y[0]; for (int i = 1; i < _count; ++i) { bx0 = min(bx0, float(_x[i])); by0 = min(by0, float(_y[i])); bx1 = max(bx1, float(_x[i])); by1 = max(by1, float(_y[i])); } tcx = (bx0 + bx1) / 2; tcy = (by0 + by1) / 2; tol = 0; cacheExtent(bx0, by0, tcx, tcy, tol); } transformRect(bx0, by0, bx1, by1, l, b, dummy1, dummy2, gs); transform(tcx, tcy, cx, cy, gs); } neuron-7.6.3/src/lib/Unidraw/viewcmds.cpp000066400000000000000000000213731340731477100203450ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Implementation of view commands. */ #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ ClassId NormSizeCmd::GetClassId () { return NORMSIZE_CMD; } bool NormSizeCmd::IsA (ClassId id) { return NORMSIZE_CMD == id || Command::IsA(id); } NormSizeCmd::NormSizeCmd (ControlInfo* c) : Command(c) { } NormSizeCmd::NormSizeCmd (Editor* ed) : Command(ed) { } Command* NormSizeCmd::Copy () { Command* copy = new NormSizeCmd(CopyControlInfo()); InitCopy(copy); return copy; } void NormSizeCmd::Execute () { Viewer* viewer; for (int i = 0; (viewer = GetEditor()->GetViewer(i)) != nil; ++i) { viewer->SetMagnification(1.0); } } bool NormSizeCmd::Reversible () { return false; } /*****************************************************************************/ ClassId RedToFitCmd::GetClassId () { return REDTOFIT_CMD; } bool RedToFitCmd::IsA (ClassId id) { return REDTOFIT_CMD == id || Command::IsA(id); } RedToFitCmd::RedToFitCmd (ControlInfo* c) : Command(c) { } RedToFitCmd::RedToFitCmd (Editor* ed) : Command(ed) { } Command* RedToFitCmd::Copy () { Command* copy = new RedToFitCmd(CopyControlInfo()); InitCopy(copy); return copy; } void RedToFitCmd::Execute () { Viewer* viewer; for (int i = 0; (viewer = GetEditor()->GetViewer(i)) != nil; ++i) { viewer->ReduceToFit(); } } bool RedToFitCmd::Reversible () { return false; } /*****************************************************************************/ ClassId CenterCmd::GetClassId () { return CENTER_CMD; } bool CenterCmd::IsA (ClassId id) { return CENTER_CMD == id || Command::IsA(id); } CenterCmd::CenterCmd (ControlInfo* c) : Command(c) { } CenterCmd::CenterCmd (Editor* ed) : Command(ed) { } Command* CenterCmd::Copy () { Command* copy = new CenterCmd(CopyControlInfo()); InitCopy(copy); return copy; } void CenterCmd::Execute () { Viewer* viewer; for (int i = 0; (viewer = GetEditor()->GetViewer(i)) != nil; ++i) { viewer->CenterOp(); } } bool CenterCmd::Reversible () { return false; } /*****************************************************************************/ ClassId GridCmd::GetClassId () { return GRID_CMD; } bool GridCmd::IsA (ClassId id) { return GRID_CMD == id || Command::IsA(id); } GridCmd::GridCmd (ControlInfo* c) : Command(c) { } GridCmd::GridCmd (Editor* ed) : Command(ed) { } Command* GridCmd::Copy () { Command* copy = new GridCmd(CopyControlInfo()); InitCopy(copy); return copy; } void GridCmd::Execute () { Viewer* viewer; for (int i = 0; (viewer = GetEditor()->GetViewer(i)) != nil; ++i) { Grid* grid = viewer->GetGrid(); if (grid != nil) grid->Visibility(!grid->IsVisible()); viewer->Draw(); } } bool GridCmd::Reversible () { return false; } /*****************************************************************************/ ClassId GridSpacingCmd::GetClassId () { return GRIDSPACING_CMD; } bool GridSpacingCmd::IsA (ClassId id) { return GRIDSPACING_CMD == id || Command::IsA(id); } GridSpacingCmd::GridSpacingCmd (ControlInfo* c) : Command(c) { _dialog = nil; } GridSpacingCmd::GridSpacingCmd (Editor* ed) : Command(ed) { _dialog = nil; } GridSpacingCmd::~GridSpacingCmd () { delete _dialog; } Command* GridSpacingCmd::Copy () { Command* copy = new GridSpacingCmd(CopyControlInfo()); InitCopy(copy); return copy; } void GridSpacingCmd::Execute () { float xincr, yincr; Editor* ed = GetEditor(); if (_dialog == nil) { _dialog = new GridDialog(); } ed->InsertDialog(_dialog); bool accepted = _dialog->Accept(); ed->RemoveDialog(_dialog); if (accepted) { _dialog->GetValues(xincr, yincr); if (xincr != 0.0 && yincr != 0.0) { Viewer* viewer; for (int i = 0; (viewer = ed->GetViewer(i)) != nil; ++i) { viewer->GetGrid()->SetSpacing(xincr, yincr); viewer->Draw(); } } } } bool GridSpacingCmd::Reversible () { return false; } /*****************************************************************************/ ClassId GravityCmd::GetClassId () { return GRAVITY_CMD; } bool GravityCmd::IsA (ClassId id) { return GRAVITY_CMD == id || Command::IsA(id); } GravityCmd::GravityCmd (ControlInfo* c) : Command(c) { } GravityCmd::GravityCmd (Editor* ed) : Command(ed) { } Command* GravityCmd::Copy () { Command* copy = new GravityCmd(CopyControlInfo()); InitCopy(copy); return copy; } void GravityCmd::Execute () { GravityVar* gravity = (GravityVar*) GetEditor()->GetState("GravityVar"); if (gravity != nil) { gravity->Activate(!gravity->IsActive()); } } bool GravityCmd::Reversible () { return false; } /*****************************************************************************/ ClassId OrientationCmd::GetClassId () { return ORIENTATION_CMD; } bool OrientationCmd::IsA (ClassId id) { return ORIENTATION_CMD == id || Command::IsA(id); } OrientationCmd::OrientationCmd (ControlInfo* c) : Command(c) { } OrientationCmd::OrientationCmd (Editor* ed) : Command(ed) { } Command* OrientationCmd::Copy () { Command* copy = new OrientationCmd(CopyControlInfo()); InitCopy(copy); return copy; } void OrientationCmd::Execute () { Viewer* viewer; for (int i = 0; (viewer = GetEditor()->GetViewer(i)) != nil; ++i) { Orientation o = viewer->GetOrientation(); Orientation newOrient = (o == Normal || o == Portrait || o == Vertical) ? Rotated : Normal; viewer->SetOrientation(newOrient); } } bool OrientationCmd::Reversible () { return false; } /*****************************************************************************/ ClassId CloseEditorCmd::GetClassId () { return CLOSEEDITOR_CMD; } bool CloseEditorCmd::IsA (ClassId id) { return CLOSEEDITOR_CMD == id || Command::IsA(id); } CloseEditorCmd::CloseEditorCmd (ControlInfo* c) : Command(c) { } CloseEditorCmd::CloseEditorCmd (Editor* ed) : Command(ed) { } Command* CloseEditorCmd::Copy () { Command* copy = new CloseEditorCmd(CopyControlInfo()); InitCopy(copy); return copy; } static bool FoundAnyExcept (Editor* ed) { Component* comp = ed->GetComponent()->GetRoot(); Iterator i; for (unidraw->First(i); !unidraw->Done(i); unidraw->Next(i)) { Editor* test_ed = unidraw->GetEditor(i); if (test_ed != ed) { Component* test_comp = test_ed->GetComponent(); if (test_comp != nil && test_comp->GetRoot() == comp) { return true; } } } return false; } void CloseEditorCmd::Execute () { Editor* ed = GetEditor(); Iterator i; unidraw->First(i); unidraw->Next(i); if (!unidraw->Done(i)) { ModifStatusVar* mv = (ModifStatusVar*) ed->GetState("ModifStatusVar"); if (mv != nil && mv->GetModifStatus() && !FoundAnyExcept(ed)) { ConfirmDialog dialog("Save changes?"); ed->InsertDialog(&dialog); char resp = dialog.Confirm(); ed->RemoveDialog(&dialog); if (resp == '\007') { return; } else if (resp == 'y') { SaveCompCmd saveComp(ed); saveComp.Execute(); if (mv->GetModifStatus()) { return; // save dialog was aborted } } } unidraw->Close(ed); } } bool CloseEditorCmd::Reversible () { return false; } neuron-7.6.3/src/lib/Unidraw/viewer.cpp000066400000000000000000000401731340731477100200240ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include <../../config.h> #endif /* * Copyright (c) 1990, 1991 Stanford University * * 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 Stanford not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. Stanford makes no representations about * the suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Viewer implementation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ static Painter* xorPainter; /*****************************************************************************/ static bool Different (Graphic* g1, Graphic* g2) { bool different = true; if ( g1->GetFgColor() == g2->GetFgColor() && g1->GetBgColor() == g2->GetBgColor() && g1->BgFilled() == g2->BgFilled() && g1->GetPattern() == g2->GetPattern() && g1->GetBrush() == g2->GetBrush() && g1->GetFont() == g2->GetFont() ) { Transformer identity; Transformer* t1 = g1->GetTransformer(); Transformer* t2 = g2->GetTransformer(); if (t1 == t2) { different = false; } else if (t1 == nil) { different = *t2 != identity; } else if (t2 == nil) { different = *t1 != identity; } else { different = *t1 != *t2; } } return different; } /*****************************************************************************/ class ViewerGraphic : public Picture { public: ViewerGraphic(GraphicView*); void Update(); private: void totalGSGraphic(Graphic*, Graphic&); // should be in base class private: GraphicView* _view; }; ViewerGraphic::ViewerGraphic (GraphicView* view) { _view = view; Append(_view->GetGraphic()); } void ViewerGraphic::Update () { GraphicComp* parent = (GraphicComp*) _view->GetGraphicComp()->GetParent(); if (parent != nil) { FullGraphic gs; totalGSGraphic(parent->GetGraphic(), gs); if (Different(this, &gs)) { Damage* damage = _view->GetViewer()->GetDamage(); damage->Incur(this); *(Graphic*)this = *(Graphic*)(&gs); damage->Incur(this); } } } void ViewerGraphic::totalGSGraphic (Graphic* g, Graphic& gs) { Graphic* parent = g->Parent(); if (parent == nil) { concatGraphic(g, nil, g, &gs); } else { totalGSGraphic(parent, gs); concatGraphic(g, g, &gs, &gs); } } /*****************************************************************************/ class ViewerView : public GraphicView { public: ViewerView(GraphicView*, UPage*, Grid*, Viewer*); virtual ~ViewerView(); virtual void Update(); virtual Viewer* GetViewer(); private: Viewer* _viewer; ViewerGraphic* _vg; }; ViewerView::ViewerView (GraphicView* g, UPage* page, Grid* grid, Viewer* v) { Picture* p = new Picture; if (grid != nil) { p->Append(grid->GetGraphic()); } p->Append(page->GetGraphic()); p->Append(_vg = new ViewerGraphic(g)); SetGraphic(p); _vg->SetTag(this); _viewer = v; Update(); } ViewerView::~ViewerView () { Graphic* g = GetGraphic(); Iterator i; g->First(i); while (!g->Done(i)) { g->Remove(i); } _vg->First(i); _vg->Remove(i); delete _vg; } void ViewerView::Update () { _vg->Update(); } Viewer* ViewerView::GetViewer () { return _viewer; } /*****************************************************************************/ Viewer::Viewer ( Editor* ed, GraphicView* gv, UPage* page, Grid* grid, Coord w, Coord h, Orientation orientation, Alignment align, Zooming zoom ) : GraphicBlock(nil, 0, align, zoom) { Init(ed, gv, page, grid, w, h, orientation); } Viewer::Viewer ( const char* instance1, Editor* ed, GraphicView* gv, UPage* page, Grid* grid, Coord w, Coord h, Orientation orientation, Alignment align, Zooming zoom ) : GraphicBlock(instance1, nil, 0, align, zoom) { Init(ed, gv, page, grid, w, h, orientation); } void Viewer::Init( Editor* ed, GraphicView* gv, UPage* page, Grid* grid, Coord w, Coord h, Orientation orientation ) { SetClassName("Viewer"); if (xorPainter == nil) { xorPainter = new Painter; Ref(xorPainter); } _damage = new Damage; _orientation = orientation; input = new Sensor(updownEvents); Init(ed, gv, page, grid); shape->width = w; shape->height = h; SetCanvasType(CanvasSaveContents); } void Viewer::Init (Editor* ed, GraphicView* gview, UPage* page, Grid* grid) { _editor = ed; _gview = gview; _page = page; _grid = grid; _viewerView = new ViewerView(_gview, _page, _grid, this); _graphic = _viewerView->GetGraphic(); _damage->SetGraphic(_graphic); Reorient(); GraphicBlock::Init(); UpdateMagnifVar(); } Viewer::~Viewer () { delete _damage; delete _viewerView; delete _page; delete _grid; delete _gview; } void Viewer::Reconfig () { _damage->SetPainter(output); } void Viewer::Update () { Selection* s = GetSelection(); GraphicView* view = GetGraphicView(); Component* viewComp = view->GetGraphicComp(); Component* edComp = _editor->GetComponent(); if (viewComp != edComp) { ComponentView* newView = edComp->Create(ViewCategory()); if (newView->IsA(GRAPHIC_VIEW)) { edComp->Attach(newView); newView->Update(); SetGraphicView((GraphicView*) newView); } else { delete newView; } } else { s->Hide(this); _viewerView->Update(); GraphicBlock::UpdatePerspective(); _damage->Repair(); s->Show(this); } } void Viewer::Draw () { Selection* s = GetSelection(); GraphicBlock::Draw(); s->Init(this); s->Show(this); _damage->Reset(); } void Viewer::Redraw (Coord l, Coord b, Coord r, Coord t) { GraphicBlock::Redraw(l, b, r, t); xorPainter->Clip(canvas, l, b, r, t); GetSelection()->Show(this); xorPainter->NoClip(); } void Viewer::Resize () { GraphicBlock::Resize(); _damage->SetCanvas(canvas); GetSelection()->Init(this); } void Viewer::GetGraphicBox (Coord& l, Coord& b, Coord& r, Coord& t) { _page->GetGraphic()->GetBox(l, b, r, t); } void Viewer::Adjust (Perspective& np) { GraphicBlock::Adjust(np); UpdateMagnifVar(); } void Viewer::Handle (Event& e) { Tool* tool = CurTool(); if (tool != nil && e.eventType == DownEvent) { switch (e.button) { case LEFTMOUSE: UseTool(tool, e); break; case MIDDLEMOUSE: if (e.control) { GrabScroll(e); } else { MomentaryUseTool(CODE_MOVE, e); } break; case RIGHTMOUSE: if (e.control) { RateScroll(e); } else { MomentaryUseTool(CODE_SELECT, e); } break; } } } void Viewer::InitRubberband (Rubberband* r) { r->SetPainter(xorPainter); r->SetCanvas(canvas); } void Viewer::InitTextDisplay (TextDisplay* td, Painter* p) { if (!p->BgFilled()) { p->FillBg(true); p->SetColors(nil, output->GetBgColor()); } td->Draw(p, canvas); } void Viewer::IncurTextDisplayDamage (TextDisplay* td, Painter* p) { Coord l, b, r, t; td->Bounds(l, b, r, t); --l; --b; ++r; ++t; Transformer* rel = p->GetTransformer(); if (rel != nil) rel->TransformRect(l, b, r, t); _damage->Incur(l, b, r, t); } void Viewer::SetGraphicView (GraphicView* gv) { Perspective np = *perspective; GetEditor()->GetSelection()->Clear(); delete _viewerView; delete _gview; _gview = gv; _viewerView = new ViewerView(_gview, _page, _grid, this); _graphic = _viewerView->GetGraphic(); _damage->SetGraphic(_graphic); _damage->Incur(0, 0, 0, 0); // for detecting Draw in Adjust Reorient(); GraphicBlock::Init(); Adjust(np); if (_damage->Incurred()) { // Adjust didn't Draw Draw(); } } void Viewer::SetPage (UPage* page) { if (_page != page) { delete _viewerView; delete _page; Init(_editor, _gview, page, _grid); GraphicBlock::Update(); } } void Viewer::SetGrid (Grid* grid) { if (_grid != grid) { delete _viewerView; delete _grid; Init(_editor, _gview, _page, grid); GraphicBlock::Update(); } } void Viewer::UpdateMagnifVar () { MagnifVar* magnifVar = (MagnifVar*) _editor->GetState("MagnifVar"); if (magnifVar != nil) magnifVar->SetMagnif(GetMagnification()); } void Viewer::SetMagnification (float m) { GraphicBlock::SetMagnification(m); UpdateMagnifVar(); } void Viewer::Reorient () { if ( _orientation == Rotated || _orientation == Landscape || _orientation == Horizontal ) { Coord l, b, r, t; GetGraphicBox(l, b, r, t); Graphic* g = GraphicBlock::GetGraphic(); g->Rotate(-90., l, b); g->Translate(0., r-l); } } void Viewer::SetOrientation (Orientation o) { if (_orientation != o) { _orientation = o; Coord l, b, r, t; GetGraphicBox(l, b, r, t); Graphic* g = GraphicBlock::GetGraphic(); if ( _orientation == Normal || _orientation == Portrait || _orientation == Vertical ) { g->Rotate(90., l, b); g->Translate(t-b, 0.); } else if ( _orientation == Rotated || _orientation == Landscape || _orientation == Horizontal ) { g->Rotate(-90., l, b); g->Translate(0., r-l); } GraphicBlock::Update(); } } Graphic* Viewer::GetGraphic () { return _gview->GetGraphic(); } GraphicView* Viewer::GetGraphicView () { return _gview; } UPage* Viewer::GetPage () { return _page; } Grid* Viewer::GetGrid () { return _grid; } Orientation Viewer::GetOrientation () { return _orientation; } Editor* Viewer::GetEditor () { return _editor; } Selection* Viewer::GetSelection () { return _editor->GetSelection(); } Damage* Viewer::GetDamage () { return _damage; } void Viewer::CenterOp () { Perspective np = *perspective; np.curx = (np.width - np.curwidth)/2; np.cury = (np.height - np.curheight)/2; Adjust(np); } void Viewer::Magnify (Coord left, Coord bottom, Coord right, Coord top) { Perspective np = *perspective; NormalRect(left, bottom, right, top); np.curx += left; np.cury += bottom; np.curwidth = Math::max(right - left, 1); np.curheight = Math::max(top - bottom, 1); Adjust(np); } void Viewer::ReduceToFit () { Perspective np = *perspective; np.curx = np.x0; np.cury = np.y0; np.curwidth = np.width; np.curheight = np.height; Adjust(np); } void Viewer::Constrain (Coord& x, Coord& y) { if (_grid != nil) { GravityVar* grav = (GravityVar*) GetEditor()->GetState("GravityVar"); if (grav != nil && grav->IsActive()) { _grid->Constrain(x, y); } } } Tool* Viewer::CurTool () { return _editor->GetCurTool(); } void Viewer::Manipulate (Manipulator* m, Event& e) { Listen(allEvents); m->Grasp(e); /* * bool b is just here to workaround a cfront 3.0 bug. */ bool b = false; do { Read(e); b = m->Manipulating(e); } while (b); m->Effect(e); Listen(input); } static Transformer* ComputeRel (Viewer* v, Transformer* t) { Transformer* rel = new Transformer; GraphicComp* comp = v->GetGraphicView()->GetGraphicComp(); comp->GetGraphic()->TotalTransformation(*rel); rel->Postmultiply(t); return rel; } void Viewer::UseTool (Tool* t) { Event e; e.target = nil; e.eventType = EnterEvent; UseTool(t, e); } void Viewer::UseTool (Tool* t, Event& e) { Transformer* relative = ComputeRel(this, _graphic->GetTransformer()); Manipulator* m = t->CreateManipulator(this, e, relative); if (m != nil) { Manipulate(m, e); Command* cmd = t->InterpretManipulator(m); if (cmd != nil) { cmd->Execute(); if (cmd->Reversible()) { cmd->Log(); } else { delete cmd; } } delete m; } Unref(relative); } void Viewer::MomentaryUseTool (const char* keyCode, Event& e) { Tool* curTool= _editor->GetCurTool(); const char* origCode = curTool->GetControlInfo()->GetKeyCode(); KeyMap* keymap = _editor->GetKeyMap(); if (strcmp(origCode, keyCode) == 0) { UseTool(CurTool(), e); /* already using this tool */ } else { keymap->Execute(keyCode); /* engage tool momentarily */ UseTool(CurTool(), e); keymap->Execute(origCode); /* revert to original tool */ } } Transformer* Viewer::GetTransformer () { Transformer* t = _graphic->GetTransformer(); if (t == nil) { t = new Transformer; _graphic->SetTransformer(t); Unref(t); } return t; } float Viewer::LimitMagnification (float desired) { const float lo = 1./8.; const float hi = 16.; return (desired < lo) ? lo : (desired > hi) ? hi : desired; } ClassId Viewer::ViewCategory () { return COMPONENT_VIEW; } void Viewer::Align (GraphicComp* comp, Alignment a) { Graphic* g = comp->GetGraphic(); float cl, cb, cr, ct; g->GetBounds(cl, cb, cr, ct); Perspective* p = GetPerspective(); float mag = GetMagnification(); float vl = float(p->curx - p->x0) / mag; float vb = float(p->cury - p->y0) / mag; float vr = float(p->curx - p->x0 + p->curwidth - 1) / mag; float vt = float(p->cury - p->y0 + p->curheight - 1) / mag; float dx, dy; switch (a) { case TopLeft: case CenterLeft: case BottomLeft: case Left: dx = vl - cl; break; case TopCenter: case Center: case BottomCenter: dx = (vr + vl - cr - cl) / 2; break; case TopRight: case CenterRight: case BottomRight: case Right: dx = vr - cr; break; } switch (a) { case TopLeft: case TopCenter: case TopRight: case Top: dy = vt - ct; break; case CenterLeft: case Center: case CenterRight: dy = (vt + vb - ct - cb) / 2; break; case BottomLeft: case BottomCenter: case BottomRight: case Bottom: dy = vb - cb; break; } MoveCmd mvcmd(GetEditor(), dx, dy); comp->Interpret(&mvcmd); } neuron-7.6.3/src/lib/app-defaults/000077500000000000000000000000001340731477100167665ustar00rootroot00000000000000neuron-7.6.3/src/lib/app-defaults/Doc000077500000000000000000000233431340731477100174260ustar00rootroot00000000000000Doc*default_text_menubar: text_menubar Doc*text_menubar:\ (menu text_file_menu) File\n\ (menu text_edit_menu) Edit\n\ (menu text_font_menu) Font\n\ (menu text_size_menu) Size\n\ (menu text_color_menu) Color\n\ (menu text_align_menu) Alignment\n\ (menu text_macro_menu) Macro\n\ (menu text_item_menu) Item\n\ (menu text_special_menu) Special Doc*text_file_menu:\ [] (viewer new) New\\hfil\n\ [] (viewer open) Open ...\\hfil\n\ [] (viewer save) Save\\hfil\\quad^S\n\ [] (viewer saveas) Save as ...\\hfil\n\ [] (viewer print) Print\\hfil\n\ \n\ [] (viewer view) New view\\hfil\n\ [] (viewer close) Close\\hfil\n\ [] (application quit) Quit\\hfil Doc*text_edit_menu:\ [] (clip cut) Cut\\hfil\\quad^X\n\ [] (clip copy) Copy\\hfil\\quad^C\n\ [] (clip paste) Paste\\hfil\\quad^V\n\ \n\ [] (select all) Select all\\hfil\n\ [] (select paragraph) Select paragraph\\hfil\\quad^U\n\ [] (select word) Select word\\hfil\\quad^W\n\ \n\ [] (go beginning) Go to beginning\\hfil\n\ [] (go end) Go to end\\hfil Doc*text_font_menu:\ (font Times-Roman)\ Times Roman\\hfil\\quad\\size{14}\\font{Times-Roman}Gnu\n\ (font Times-Bold)\ Times Bold\\hfil\\quad\\size{14}\\font{Times-Bold}Gnu\n\ (font Times-Italic)\ Times Italic\\hfil\\quad\\size{14}\\font{Times-Italic} Gnu\n\ (font Courier)\ Courier\\hfil\\quad\\size{14}\\font{Courier} Gnu\n\ (font Helvetica)\ Helvetica\\hfil\\quad\\size{14}\\font{Helvetica} Gnu\n\ (font Symbol)\ Symbol\\hfil\\quad\\size{14}\\font{Symbol} Gnu\n\ \n\ []<> (font)\ Other font ...\\hfil Doc*text_size_menu:\ <6> (size 6)\ 6 point\\hfil\\quad\\font{Times-Roman}\\size{6} Gnu\n\ <8> (size 8)\ 8 point\\hfil\\quad\\font{Times-Roman}\\size{8} Gnu\n\ <10> (size 10)\ 10 point\\hfil\\quad\\font{Times-Roman}\\size{10} Gnu\n\ <12> (size 12)\ 12 point\\hfil\\quad\\font{Times-Roman}\\size{12} Gnu\n\ <14> (size 14)\ 14 point\\hfil\\quad\\font{Times-Roman}\\size{14} Gnu\n\ <18> (size 18)\ 18 point\\hfil\\quad\\font{Times-Roman}\\size{18} Gnu\n\ <24> (size 24)\ 24 point\\hfil\\quad\\font{Times-Roman}\\size{24} Gnu\n\ <30> (size 30)\ 30 point\\hfil\\quad\\font{Times-Roman}\\size{30} Gnu\n\ \n\ []<> (size)\ Other size ...\\hfil Doc*text_color_menu:\ (color black)\ black\\hfil\\quad\\font{Times-Roman}\\size{14}\\color{black} Gnu\n\ (color red)\ red\\hfil\\quad\\font{Times-Roman}\\size{14}\\color{red} Gnu\n\ (color green)\ green\\hfil\\quad\\font{Times-Roman}\\size{14}\\color{green} Gnu\n\ (color blue)\ blue\\hfil\\quad\\font{Times-Roman}\\size{14}\\color{blue} Gnu\n\ \n\ []<> (color)\ Other color ...\\hfil Doc*text_align_menu:\ (align left) Align left\\hfil\n\
(align center) Center\\hfil\n\ (align right) Align right\\hfil\n\ (align justify) Justify\\hfil Doc*text_macro_menu:\ [] (macro chapter) Chapter\\hfil\n\ []
(macro section) Section\\hfil\n\ [] (macro subsection) Subsection\\hfil\n\ [] (macro itemized) Itemized\\hfil\n\ [] (macro enumerated) Enumerated\\hfil\n\ [] (macro referenced) Referenced\\hfil\n\ []
(macro figure) Figure\\hfil\n\ [] (macro table) Table\\hfil\n\ \n\ []<> (macro) Other macro ...\\hfil Doc*text_item_menu:\ [] (item psfig) Import graphic ...\\hfil\n\ [] (item import) Import text file ...\\hfil\n\ [] (item parbox) Parbox ...\\hfil\n\ [] (item float) Float ...\\hfil\n\ [] (item tabular) Tabular ...\\hfil\n\ []