tkeden1.32/004070000025250000147000000000000737051041400140235ustar00ashleydcsother00001250000011tkeden1.32/config.sub010070000025250000147000000466110727406557200160300ustar00ashleydcsother00001250000011#! /bin/sh # Configuration validation subroutine script, version 1.1. # Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc. # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # 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 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # 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. # 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. if [ x$1 = x ] then echo Configuration name missing. 1>&2 echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 echo "or $0 ALIAS" 1>&2 echo where ALIAS is a recognized configuration type. 1>&2 exit 1 fi # First pass through any local machine types. case $1 in *local*) echo $1 exit 0 ;; *) ;; 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 linux-gnu*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) 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) os= basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -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/'` ;; -sco*) os=-sco3.2v2 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*) 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 ;; 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. tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 | hppa2.0 \ | alpha | alphaev5 | alphaev56 |alphaev6 | we32k | ns16k | clipper \ | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \ | mips64 | mipsel | mips64el | mips64orion | mips64orionel \ | mipstx39 | mipstx39el \ | sparc | sparclet | sparclite | sparc64 | v850) basic_machine=$basic_machine-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[34567]86) 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. vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \ | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \ | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* \ | alpha-* | alphaev5-* | alphaev56-* |alpha-ev6-* |alphaev6-* | we32k-* | cydra-* \ | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \ | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ | sparc64-* | mips64-* | mipsel-* \ | mips64el-* | mips64orion-* | mips64orionel-* \ | mipstx39-* | mipstx39el-* \ | f301-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-cbm ;; amigaos | amigados) basic_machine=m68k-cbm os=-amigaos ;; amigaunix | amix) basic_machine=m68k-cbm os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; 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 | ymp) basic_machine=ymp-cray os=-unicos ;; cray2) basic_machine=cray2-cray os=-unicos ;; [ctj]90-cray) basic_machine=c90-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; 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 ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-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 ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; i370-ibm* | ibm*) basic_machine=i370-ibm os=-mvs ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i[34567]86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i[34567]86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i[34567]86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i[34567]86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; miniframe) basic_machine=m68000-convergent ;; mipsel*-linux*) basic_machine=mipsel-unknown os=-linux-gnu ;; mips*-linux*) basic_machine=mips-unknown os=-linux-gnu ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; 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 ;; 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 ;; np1) basic_machine=np1-gould ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | nexen) basic_machine=i586-pc ;; pentiumpro | p6 | k6 | 6x86) basic_machine=i686-pc ;; pentiumii | pentium2) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | nexen-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | k6-* | 6x86-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=rs6000-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) 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/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; 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 ;; symmetry) basic_machine=i386-sequent os=-dynix ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; tower | tower-32) basic_machine=m68k-ncr ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; 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 ;; xmp) basic_machine=xmp-cray os=-unicos ;; xps | xps100) basic_machine=xps100-honeywell ;; 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. mips) if [ x$os = x-linux-gnu ]; then basic_machine=mips-unknown else basic_machine=mips-mips fi ;; romp) basic_machine=romp-ibm ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sparc) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; *) 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. -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* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -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|'` ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -ctix* | -uts*) os=-sysv ;; -ns2 ) os=-nextstep2 ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -xenix) os=-xenix ;; -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 *-acorn) os=-riscix1.2 ;; arm*-semi) os=-aout ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-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 ;; f301-fujitsu) os=-uxpv ;; *) 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 ;; -aix*) vendor=ibm ;; -hpux*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs*) vendor=ibm ;; -ptx*) vendor=sequent ;; -vxsim* | -vxworks*) vendor=wrs ;; -aux*) vendor=apple ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os 86.*/86-pc/'` os=-sysv ;; i[34567]86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; tkeden1.32/configure010070000025250000147000006002450733227345600157500ustar00ashleydcsother00001250000011#! /bin/sh # From configure.in Revision: 1.19 # Check this file exists to make sure we are in the correct directory # Guess values for system-dependent variables and create Makefiles. # Generated automatically using autoconf version 2.13 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # Defaults: ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: ac_help="$ac_help --enable-debug enable debugging" ac_help="$ac_help --enable-dcc enable dcc function for disabling circular checking" ac_help="$ac_help --enable-depend enable Makefile source dependency checking" ac_help="$ac_help --enable-disable-sasami don't try to build the Sasami OpenGL notation" ac_help="$ac_help --enable-ipc enable support for Eden IPC functions (send_msg...)" ac_help="$ac_help --with-x use the X Window System" ac_help="$ac_help --with-curses-include=DIR (n)curses include files are in DIR" ac_help="$ac_help --with-curses-lib=DIR (n)curses library files are in DIR" ac_help="$ac_help --with-tcl-include=compiler options to enable location of tcl.h eg \"-I/usr/local/include\"" ac_help="$ac_help --with-tcl-lib=linker options to enable location of the tcl library eg \"-L/usr/local/lib -R/usr/local/lib -ltcl\"" ac_help="$ac_help --with-tk-include=compiler options to enable location of tk.h eg \"-I/usr/local/include\"" ac_help="$ac_help --with-tk-lib=linker options to enable location of the tk library eg \"-L/usr/local/lib -R/usr/local/lib -ltk\"" ac_help="$ac_help --with-readline-include=compiler options to enable location of GNU readline header files eg \"-I/gnu/include/readline\"" ac_help="$ac_help --with-readline-lib=linker options to enable location of the GNU readline library eg \"-L/gnu/lib -R/gnu/lib -lreadline\"" ac_help="$ac_help --with-gl-include=compiler options to enable location of GL header files eg \"-I/usr/openwin/include\"" ac_help="$ac_help --with-gl-lib=linker options to enable location of the GL library eg \"-L/usr/openwin/lib -R/usr/openwin/lib -lGL\"" ac_help="$ac_help --with-png-include=compiler options to enable location of PNG header files eg \"-I/usr/local/include\"" ac_help="$ac_help --with-png-lib=linker options to enable location of the PNG library eg \"-L/usr/local/lib -R/usr/local/lib -lpng\"" ac_help="$ac_help --with-dmalloc-include=DIR dmalloc include file is in DIR" ac_help="$ac_help --with-dmalloc-lib=DIR dmalloc lib file is in DIR" # Initialize some variables set by options. # The variables have the same names as the options, with # dashes changed to underlines. build=NONE cache_file=./config.cache exec_prefix=NONE host=NONE no_create= nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= target=NONE verbose= x_includes=NONE x_libraries=NONE bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. ac_max_here_lines=12 ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi case "$ac_option" in -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) ac_optarg= ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case "$ac_option" in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir="$ac_optarg" ;; -build | --build | --buil | --bui | --bu) ac_prev=build ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build="$ac_optarg" ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file="$ac_optarg" ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir="$ac_optarg" ;; -disable-* | --disable-*) ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` eval "enable_${ac_feature}=no" ;; -enable-* | --enable-*) ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "enable_${ac_feature}='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix="$ac_optarg" ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he) # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat << EOF Usage: configure [options] [host] Options: [defaults in brackets after descriptions] Configuration: --cache-file=FILE cache test results in FILE --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [same as prefix] --bindir=DIR user executables in DIR [EPREFIX/bin] --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] --libexecdir=DIR program executables in DIR [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data in DIR [PREFIX/share] --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data in DIR [PREFIX/com] --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] --libdir=DIR object code libraries in DIR [EPREFIX/lib] --includedir=DIR C header files in DIR [PREFIX/include] --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] --infodir=DIR info documentation in DIR [PREFIX/info] --mandir=DIR man documentation in DIR [PREFIX/man] --srcdir=DIR find the sources in DIR [configure dir or ..] --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names EOF cat << EOF Host type: --build=BUILD configure for building on BUILD [BUILD=HOST] --host=HOST configure for HOST [guessed] --target=TARGET configure for TARGET [TARGET=HOST] Features and packages: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR EOF if test -n "$ac_help"; then echo "--enable and --with options recognized:$ac_help" fi exit 0 ;; -host | --host | --hos | --ho) ac_prev=host ;; -host=* | --host=* | --hos=* | --ho=*) host="$ac_optarg" ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir="$ac_optarg" ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir="$ac_optarg" ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir="$ac_optarg" ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir="$ac_optarg" ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir="$ac_optarg" ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir="$ac_optarg" ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir="$ac_optarg" ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix="$ac_optarg" ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix="$ac_optarg" ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix="$ac_optarg" ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name="$ac_optarg" ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir="$ac_optarg" ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir="$ac_optarg" ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site="$ac_optarg" ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir="$ac_optarg" ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir="$ac_optarg" ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target="$ac_optarg" ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers) echo "configure generated by autoconf version 2.13" exit 0 ;; -with-* | --with-*) ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "with_${ac_package}='$ac_optarg'" ;; -without-* | --without-*) ac_package=`echo $ac_option|sed -e 's/-*without-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` eval "with_${ac_package}=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes="$ac_optarg" ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries="$ac_optarg" ;; -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } ;; *) if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then echo "configure: warning: $ac_option: invalid host type" 1>&2 fi if test "x$nonopt" != xNONE; then { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } fi nonopt="$ac_option" ;; esac done if test -n "$ac_prev"; then { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } fi trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 # File descriptor usage: # 0 standard input # 1 file creation # 2 errors and warnings # 3 some systems may open it to /dev/tty # 4 used on the Kubota Titan # 6 checking for... messages and results # 5 compiler messages saved in config.log if test "$silent" = yes; then exec 6>/dev/null else exec 6>&1 fi exec 5>./config.log echo "\ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. " 1>&5 # Strip out --no-create and --no-recursion so they do not pile up. # Also quote any args containing shell metacharacters. ac_configure_args= for ac_arg do case "$ac_arg" in -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) ac_configure_args="$ac_configure_args '$ac_arg'" ;; *) ac_configure_args="$ac_configure_args $ac_arg" ;; esac done # NLS nuisances. # Only set these to C if already set. These must not be set unconditionally # because not all systems understand e.g. LANG=C (notably SCO). # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! # Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo > confdefs.h # A filename unique to this package, relative to the directory that # configure is in, which we can look for to find out if srcdir is correct. ac_unique_file=Eden/main.c # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_prog=$0 ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } else { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } fi fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then echo "loading site script $ac_site_file" . "$ac_site_file" fi done if test -r "$cache_file"; then echo "loading cache $cache_file" . $cache_file else echo "creating cache $cache_file" > $cache_file fi ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross ac_exeext= ac_objext=o if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then ac_n= ac_c=' ' ac_t=' ' else ac_n=-n ac_c= ac_t= fi else ac_n= ac_c='\c' ac_t= fi # Sanity check ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break fi done if test -z "$ac_aux_dir"; then { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } fi ac_config_guess=$ac_aux_dir/config.guess ac_config_sub=$ac_aux_dir/config.sub ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # # Check if we're accidentally using a cache from a different machine. # Derive the system name, as a check for reusing the autoconf cache. # # If we've packaged config.guess and config.sub, run that (since it does a # better job than uname). # if test -f $srcdir/config.guess ; then # Make sure we can run config.sub. if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 echo "configure:627: checking host system type" >&5 host_alias=$host case "$host_alias" in NONE) case $nonopt in NONE) if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } fi ;; *) host_alias=$nonopt ;; esac ;; esac host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 system_name="$host_os" else system_name="`(uname -s -r) 2>/dev/null`" if test -z "$system_name" ; then system_name="`(hostname) 2>/dev/null`" fi fi test -n "$system_name" && cat >> confdefs.h <&6 else cf_cv_system_name="$system_name" fi test -z "$system_name" && system_name="$cf_cv_system_name" test -n "$cf_cv_system_name" && echo "$ac_t"""Configuring for $cf_cv_system_name"" 1>&6 if test ".$system_name" != ".$cf_cv_system_name" ; then echo "$ac_t"""Cached system name does not agree with actual"" 1>&6 { echo "configure: error: "Please remove config.cache and try again."" 1>&2; exit 1; } fi # !@!@ Not sure if all of these are required # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:678: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" break fi done IFS="$ac_save_ifs" fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:708: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" break fi done IFS="$ac_save_ifs" if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# -gt 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift set dummy "$ac_dir/$ac_word" "$@" shift ac_cv_prog_CC="$@" fi fi fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$CC"; then case "`uname -s`" in *win32* | *WIN32*) # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:759: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="cl" break fi done IFS="$ac_save_ifs" fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi ;; esac fi test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 echo "configure:791: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF #line 802 "configure" #include "confdefs.h" main(){return(0);} EOF if { (eval echo configure:807: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then ac_cv_prog_cc_cross=no else ac_cv_prog_cc_cross=yes fi else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_prog_cc_works=no fi rm -fr conftest* ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 echo "configure:833: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 echo "configure:838: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no fi fi echo "$ac_t""$ac_cv_prog_gcc" 1>&6 if test $ac_cv_prog_gcc = yes; then GCC=yes else GCC= fi ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 echo "configure:866: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then ac_cv_prog_cc_g=yes else ac_cv_prog_cc_g=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 echo "configure:898: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # This must be in double quotes, not single quotes, because CPP may get # substituted into the Makefile and "${CC-cc}" will confuse make. CPP="${CC-cc} -E" # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:919: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:936: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:953: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP=/lib/cpp fi rm -f conftest* fi rm -f conftest* fi rm -f conftest* ac_cv_prog_CPP="$CPP" fi CPP="$ac_cv_prog_CPP" else ac_cv_prog_CPP="$CPP" fi echo "$ac_t""$CPP" 1>&6 # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 echo "configure:989: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do if test -f $ac_dir/$ac_prog; then if test $ac_prog = install && grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 fi fi done ;; esac done IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then INSTALL="$ac_cv_path_install" else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL="$ac_install_sh" fi fi echo "$ac_t""$INSTALL" 1>&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Extract the first word of "flex", so it can be a program name with args. set dummy flex; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:1044: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_LEX="flex" break fi done IFS="$ac_save_ifs" test -z "$ac_cv_prog_LEX" && ac_cv_prog_LEX="lex" fi fi LEX="$ac_cv_prog_LEX" if test -n "$LEX"; then echo "$ac_t""$LEX" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$LEXLIB" then case "$LEX" in flex*) ac_lib=fl ;; *) ac_lib=l ;; esac echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 echo "configure:1078: checking for yywrap in -l$ac_lib" >&5 ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-l$ac_lib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 LEXLIB="-l$ac_lib" else echo "$ac_t""no" 1>&6 fi fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 echo "configure:1120: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftestmake <<\EOF all: @echo 'ac_maketemp="${MAKE}"' EOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftestmake fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$ac_t""yes" 1>&6 SET_MAKE= else echo "$ac_t""no" 1>&6 SET_MAKE="MAKE=${MAKE-make}" fi # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:1149: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_RANLIB="ranlib" break fi done IFS="$ac_save_ifs" test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" fi fi RANLIB="$ac_cv_prog_RANLIB" if test -n "$RANLIB"; then echo "$ac_t""$RANLIB" 1>&6 else echo "$ac_t""no" 1>&6 fi # Find options to use ANSI C echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6 echo "configure:1180: checking for ${CC-cc} option to accept ANSI C" >&5 if eval "test \"`echo '$''{'cf_cv_ansi_cc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cf_cv_ansi_cc=no cf_save_CFLAGS="$CFLAGS" # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX -Aa -D_HPUX_SOURCE # SVR4 -Xc # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) for cf_arg in "-DCC_HAS_PROTOS" "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -Xc do CFLAGS="$cf_save_CFLAGS $cf_arg" cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_ansi_cc="$cf_arg"; break else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest* done CFLAGS="$cf_save_CFLAGS" fi echo "$ac_t""$cf_cv_ansi_cc" 1>&6 if test "$cf_cv_ansi_cc" != "no"; then if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then CFLAGS="$CFLAGS $cf_cv_ansi_cc" else cat >> confdefs.h <<\EOF #define CC_HAS_PROTOS 1 EOF fi fi # Is the math library OK? echo $ac_n "checking for tan in -lm""... $ac_c" 1>&6 echo "configure:1243: checking for tan in -lm" >&5 ac_lib_var=`echo m'_'tan | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_lib=HAVE_LIB`echo m | sed -e 's/[^a-zA-Z0-9_]/_/g' \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` cat >> confdefs.h <&6 { echo "configure: error: can't find math functions" 1>&2; exit 1; } fi # Tcl on Linux on PC seems to require -ldl echo $ac_n "checking for dlerror in -ldl""... $ac_c" 1>&6 echo "configure:1293: checking for dlerror in -ldl" >&5 ac_lib_var=`echo dl'_'dlerror | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_lib=HAVE_LIB`echo dl | sed -e 's/[^a-zA-Z0-9_]/_/g' \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` cat >> confdefs.h <&6 fi ######################################################################### # Compile time switches ######################################################################### # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" cat >> confdefs.h <<\EOF #define DEBUG 1 EOF cat >> confdefs.h <<\EOF #define YYDEBUG 1 EOF # parser debugging wrapped into general debug now fi # Check whether --enable-dcc or --disable-dcc was given. if test "${enable_dcc+set}" = set; then enableval="$enable_dcc" cat >> confdefs.h <<\EOF #define NO_CHECK_CIRCULAR 1 EOF fi # Check whether --enable-depend or --disable-depend was given. if test "${enable_depend+set}" = set; then enableval="$enable_depend" DEPEND_MAKEDEFS="include ../depend.mk" else DEPEND_MAKEDEFS="#include ../depend.mk" fi # Check whether --enable-disable-sasami or --disable-disable-sasami was given. if test "${enable_disable_sasami+set}" = set; then enableval="$enable_disable_sasami" echo "configure: warning: Disabling Sasami" 1>&2 aw_want_sasami="no" else aw_want_sasami="yes" cat >> confdefs.h <<\EOF #define WANT_SASAMI 1 EOF fi # Check whether --enable-ipc or --disable-ipc was given. if test "${enable_ipc+set}" = set; then enableval="$enable_ipc" cat >> confdefs.h <<\EOF #define ipc 1 EOF fi ######################################################################### # X ######################################################################### # If we find X, set shell vars x_includes and x_libraries to the # paths, otherwise set no_x=yes. # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 echo "configure:1424: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then withval="$with_x" : fi # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then # Both variables are already set. have_x=yes else if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # One or both of the vars are not set, and there is no cached value. ac_x_includes=NO ac_x_libraries=NO rm -fr conftestdir if mkdir conftestdir; then cd conftestdir # Make sure to not put "make" in the Imakefile rules, since we grep it out. cat > Imakefile <<'EOF' acfindx: @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' EOF if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl; do if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && test -f $ac_im_libdir/libX11.$ac_extension; then ac_im_usrlibdir=$ac_im_libdir; break fi done # Screen out bogus values from the imake configuration. They are # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. case "$ac_im_incroot" in /usr/include) ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;; esac case "$ac_im_usrlibdir" in /usr/lib | /lib) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;; esac fi cd .. rm -fr conftestdir fi if test "$ac_x_includes" = NO; then # Guess where to find include files, by looking for this one X11 .h file. test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1491: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* # We can compile using X headers with no special include directory. ac_x_includes= else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Look for the header file in a standard set of common directories. # Check X11 before X11Rn because it is often a symlink to the current release. for ac_dir in \ /usr/X11/include \ /usr/X11R6/include \ /usr/X11R5/include \ /usr/X11R4/include \ \ /usr/include/X11 \ /usr/include/X11R6 \ /usr/include/X11R5 \ /usr/include/X11R4 \ \ /usr/local/X11/include \ /usr/local/X11R6/include \ /usr/local/X11R5/include \ /usr/local/X11R4/include \ \ /usr/local/include/X11 \ /usr/local/include/X11R6 \ /usr/local/include/X11R5 \ /usr/local/include/X11R4 \ \ /usr/X386/include \ /usr/x386/include \ /usr/XFree86/include/X11 \ \ /usr/include \ /usr/local/include \ /usr/unsupported/include \ /usr/athena/include \ /usr/local/x11r5/include \ /usr/lpp/Xamples/include \ \ /usr/openwin/include \ /usr/openwin/share/include \ ; \ do if test -r "$ac_dir/$x_direct_test_include"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest* fi # $ac_x_includes = NO if test "$ac_x_libraries" = NO; then # Check for the libraries. test -z "$x_direct_test_library" && x_direct_test_library=Xt test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. ac_x_libraries= else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* LIBS="$ac_save_LIBS" # First see if replacing the include by lib works. # Check X11 before X11Rn because it is often a symlink to the current release. for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \ /usr/X11/lib \ /usr/X11R6/lib \ /usr/X11R5/lib \ /usr/X11R4/lib \ \ /usr/lib/X11 \ /usr/lib/X11R6 \ /usr/lib/X11R5 \ /usr/lib/X11R4 \ \ /usr/local/X11/lib \ /usr/local/X11R6/lib \ /usr/local/X11R5/lib \ /usr/local/X11R4/lib \ \ /usr/local/lib/X11 \ /usr/local/lib/X11R6 \ /usr/local/lib/X11R5 \ /usr/local/lib/X11R4 \ \ /usr/X386/lib \ /usr/x386/lib \ /usr/XFree86/lib/X11 \ \ /usr/lib \ /usr/local/lib \ /usr/unsupported/lib \ /usr/athena/lib \ /usr/local/x11r5/lib \ /usr/lpp/Xamples/lib \ /lib/usr/lib/X11 \ \ /usr/openwin/lib \ /usr/openwin/share/lib \ ; \ do for ac_extension in a so sl; do if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f conftest* fi # $ac_x_libraries = NO if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then # Didn't find X anywhere. Cache the known absence of X. ac_cv_have_x="have_x=no" else # Record where we found X for the cache. ac_cv_have_x="have_x=yes \ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" fi fi fi eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then echo "$ac_t""$have_x" 1>&6 no_x=yes else # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes \ ac_x_includes=$x_includes ac_x_libraries=$x_libraries" echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6 fi if test "$no_x" = yes; then # Not all programs may use this symbol, but it does not hurt to define it. cat >> confdefs.h <<\EOF #define X_DISPLAY_MISSING 1 EOF X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= else if test -n "$x_includes"; then X_CFLAGS="$X_CFLAGS -I$x_includes" fi # It would also be nice to do this for all -L options, not just this one. if test -n "$x_libraries"; then X_LIBS="$X_LIBS -L$x_libraries" # For Solaris; some versions of Sun CC require a space after -R and # others require no space. Words are not sufficient . . . . case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 echo "configure:1673: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_R_nospace=no fi rm -f conftest* if test $ac_R_nospace = yes; then echo "$ac_t""no" 1>&6 X_LIBS="$X_LIBS -R$x_libraries" else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_R_space=no fi rm -f conftest* if test $ac_R_space = yes; then echo "$ac_t""yes" 1>&6 X_LIBS="$X_LIBS -R $x_libraries" else echo "$ac_t""neither works" 1>&6 fi fi LIBS="$ac_xsave_LIBS" esac fi # Check for system-dependent libraries X programs must link with. # Do this before checking for the system-independent R6 libraries # (-lICE), since we may need -lsocket or whatever for X linking. if test "$ISC" = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" else # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 echo "configure:1738: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" else echo "$ac_t""no" 1>&6 fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 echo "configure:1779: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" else echo "$ac_t""no" 1>&6 fi fi # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, # to get the SysV transport functions. # chad@anasazi.com says the Pyramis MIS-ES running DC/OSx (SVR4) # needs -lnsl. # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 echo "configure:1827: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) choke me #else gethostbyname(); #endif ; return 0; } EOF if { (eval echo configure:1855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_gethostbyname=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 echo "configure:1876: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" else echo "$ac_t""no" 1>&6 fi fi # lieder@skyler.mavd.honeywell.com says without -lsocket, # socket/setsockopt and other routines are undefined under SCO ODT # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary # on later versions), says simon@lia.di.epfl.ch: it contains # gethostby* variants that don't use the nameserver (or something). # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 echo "configure:1925: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_connect) || defined (__stub___connect) choke me #else connect(); #endif ; return 0; } EOF if { (eval echo configure:1953: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_connect=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 echo "configure:1974: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" else echo "$ac_t""no" 1>&6 fi fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 echo "configure:2017: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char remove(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_remove) || defined (__stub___remove) choke me #else remove(); #endif ; return 0; } EOF if { (eval echo configure:2045: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_remove=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'remove`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 echo "configure:2066: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" else echo "$ac_t""no" 1>&6 fi fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 echo "configure:2109: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shmat(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_shmat) || defined (__stub___shmat) choke me #else shmat(); #endif ; return 0; } EOF if { (eval echo configure:2137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_shmat=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'shmat`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 echo "configure:2158: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" else echo "$ac_t""no" 1>&6 fi fi fi # Check for libraries that X11R6 Xt/Xaw programs need. ac_save_LDFLAGS="$LDFLAGS" test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to # check for ICE first), but we must link in the order -lSM -lICE or # we get undefined symbols. So assume we have SM if we have ICE. # These have to be linked with before -lX11, unlike the other # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 echo "configure:2210: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" else echo "$ac_t""no" 1>&6 fi LDFLAGS="$ac_save_LDFLAGS" fi # Bit of a bodge but I can't think of a better way of detecting Windoz if test "$no_x" = "yes"; then # Probably Windoz AW_X_LIBS="-lGDI32 -lUSER32 -lCOMDLG32 -lKERNEL32" else AW_X_LIBS="-lXt -lX11" if test "$aw_want_sasami" = "yes"; then AW_X_LIBS="$AW_X_LIBS -lXmu -lXext" fi fi ######################################################################### # Run time linker ######################################################################### # The Solaris implementation of dynamic linking means that the run-time # linker needs to know where to locate the (dynamically linked) libraries. # This means when we are linking, for each -L option, we need to pass a # similar -R option. # Apparently some versions of Sun CC require a space after the -R, and # some no space, which seems incredibly dumb. I haven't bothered to check # for this yet though. echo $ac_n "checking whether we need -R""... $ac_c" 1>&6 echo "configure:2281: checking whether we need -R" >&5 case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) aw_need_r=yes echo "$ac_t""yes" 1>&6 ;; *) aw_need_r=no echo "$ac_t""no" 1>&6 ;; esac ######################################################################### # curses ######################################################################### # # Prefer "new" curses: ncurses. # # Examples: # bax and holst: /usr/include/ncurses/curses.h: # -I/usr/include/ncurses -L/usr/lib -L/usr/lib/ncurses -lncurses # gem: /gnu/include/ncurses.h: # -I/gnu/include -L/gnu/lib -lncurses # gem: /usr/include/curses.h: # -lcurses # # Possible include directories: /usr/include /gnu/include /usr/local/include # # One of these directories might include # ncurses/curses.h: -Iinc_dir/ncurses -Llib_dir -Llib_dir/ncurses -lncurses # ncurses.h: -Iinc_dir -Llib_dir -lcurses # curses.h: -Iinc_dir -Llib_dir -lcurses # # Everything set up already (eg in LIBS) is not an option as we want # this to apply only to ttyeden. # # Sets Example # CURSES_TYPE curses # CURSES_INCLUDE -I/usr/local/include # CURSES_LIB -lcurses # CURSES_LIB_PATH -L/usr/local/lib # HAVE_CURSES "" # # See if the user supplied some arguments # Check whether --with-curses-include or --without-curses-include was given. if test "${with_curses_include+set}" = set; then withval="$with_curses_include" aw_user_supplied_curses_include=$withval # Try and find this with the lib variable unset - the user # should really provide --with-curses-lib as well. # Three possible cases # ncurses/curses.h: -Iinc_dir/ncurses -Llib_dir -Llib_dir/ncurses -lncurses # ncurses.h: -Iinc_dir -Llib_dir -lcurses # curses.h: -Iinc_dir -Llib_dir -lcurses if test "$aw_need_r" = "yes"; then # We need the -R for runtime linking # Note this code is repeated below with -R taken away aw_curses_include_dir=$aw_user_supplied_curses_include aw_curses_header_look=ncurses/curses.h aw_curses_type=ncurses aw_curses_include=-I$aw_user_supplied_curses_include/ncurses aw_curses_lib_path="-L -L/ncurses -R -R/ncurses" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:2354: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:2361: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:2370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=$aw_user_supplied_curses_include aw_curses_header_look=ncurses.h aw_curses_type=ncurses aw_curses_include=-I$aw_user_supplied_curses_include aw_curses_lib_path="-L -R" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:2408: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:2415: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:2424: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=$aw_user_supplied_curses_include aw_curses_header_look=curses.h aw_curses_type=curses aw_curses_include=-I$aw_user_supplied_curses_include aw_curses_lib_path="-L -R" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:2462: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:2469: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:2478: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi else # We don't need the -R option # Note this code is repeated above with -R added aw_curses_include_dir=$aw_user_supplied_curses_include aw_curses_header_look=ncurses/curses.h aw_curses_type=ncurses aw_curses_include=-I$aw_user_supplied_curses_include/ncurses aw_curses_lib_path="-L -L/ncurses" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:2519: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:2526: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:2535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=$aw_user_supplied_curses_include aw_curses_header_look=ncurses.h aw_curses_type=ncurses aw_curses_include=-I$aw_user_supplied_curses_include aw_curses_lib_path=-L if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:2573: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:2580: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:2589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=$aw_user_supplied_curses_include aw_curses_header_look=curses.h aw_curses_type=curses aw_curses_include=-I$aw_user_supplied_curses_include aw_curses_lib_path=-L if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:2627: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:2634: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:2643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi fi fi # Check whether --with-curses-lib or --without-curses-lib was given. if test "${with_curses_lib+set}" = set; then withval="$with_curses_lib" aw_user_supplied_curses_lib_dir=$withval # Three possible cases # ncurses/curses.h: -Iinc_dir/ncurses -Llib_dir -Llib_dir/ncurses -lncurses # ncurses.h: -Iinc_dir -Llib_dir -lcurses # curses.h: -Iinc_dir -Llib_dir -lcurses if test "$aw_need_r" = "yes"; then # We need the -R for runtime linking # Note this code is repeated below with -R taken away aw_curses_include_dir=$aw_user_supplied_curses_include aw_curses_header_look=ncurses/curses.h aw_curses_type=ncurses aw_curses_include=-I$aw_user_supplied_curses_include/ncurses aw_curses_lib_path="-L$aw_user_supplied_curses_lib_dir -L$aw_user_supplied_curses_lib_dir/ncurses -R$aw_user_supplied_curses_lib_dir -R$aw_user_supplied_curses_lib_dir/ncurses" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:2700: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:2707: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:2716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=$aw_user_supplied_curses_include aw_curses_header_look=ncurses.h aw_curses_type=ncurses aw_curses_include=-I$aw_user_supplied_curses_include aw_curses_lib_path="-L$aw_user_supplied_curses_lib_dir -R$aw_user_supplied_curses_lib_dir" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:2754: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:2761: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:2770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=$aw_user_supplied_curses_include aw_curses_header_look=curses.h aw_curses_type=curses aw_curses_include=-I$aw_user_supplied_curses_include aw_curses_lib_path="-L$aw_user_supplied_curses_lib_dir -R$aw_user_supplied_curses_lib_dir" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:2808: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:2815: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:2824: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi else # We don't need the -R option # Note this code is repeated above with -R added aw_curses_include_dir=$aw_user_supplied_curses_include aw_curses_header_look=ncurses/curses.h aw_curses_type=ncurses aw_curses_include=-I$aw_user_supplied_curses_include/ncurses aw_curses_lib_path="-L$aw_user_supplied_curses_lib_dir -L$aw_user_supplied_curses_lib_dir/ncurses" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:2865: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:2872: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:2881: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=$aw_user_supplied_curses_include aw_curses_header_look=ncurses.h aw_curses_type=ncurses aw_curses_include=-I$aw_user_supplied_curses_include aw_curses_lib_path=-L$aw_user_supplied_curses_lib_dir if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:2919: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:2926: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:2935: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=$aw_user_supplied_curses_include aw_curses_header_look=curses.h aw_curses_type=curses aw_curses_include=-I$aw_user_supplied_curses_include aw_curses_lib_path=-L$aw_user_supplied_curses_lib_dir if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:2973: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:2980: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:2989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi fi fi # Attempt to guess where it might be # Three possible cases # ncurses/curses.h: -Iinc_dir/ncurses -Llib_dir -Llib_dir/ncurses -lncurses # ncurses.h: -Iinc_dir -Llib_dir -lcurses # curses.h: -Iinc_dir -Llib_dir -lcurses if test "$aw_need_r" = "yes"; then # We need the -R for runtime linking # Note this code is repeated below with -R taken away aw_curses_include_dir=/usr/local/include aw_curses_header_look=ncurses/curses.h aw_curses_type=ncurses aw_curses_include=-I/usr/local/include/ncurses aw_curses_lib_path="-L/usr/local/lib -L/usr/local/lib/ncurses -R/usr/local/lib -R/usr/local/lib/ncurses" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3043: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3050: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=/usr/local/include aw_curses_header_look=ncurses.h aw_curses_type=ncurses aw_curses_include=-I/usr/local/include aw_curses_lib_path="-L/usr/local/lib -R/usr/local/lib" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3097: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3104: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3113: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=/usr/local/include aw_curses_header_look=curses.h aw_curses_type=curses aw_curses_include=-I/usr/local/include aw_curses_lib_path="-L/usr/local/lib -R/usr/local/lib" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3151: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3158: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3167: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi else # We don't need the -R option # Note this code is repeated above with -R added aw_curses_include_dir=/usr/local/include aw_curses_header_look=ncurses/curses.h aw_curses_type=ncurses aw_curses_include=-I/usr/local/include/ncurses aw_curses_lib_path="-L/usr/local/lib -L/usr/local/lib/ncurses" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3208: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3215: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3224: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=/usr/local/include aw_curses_header_look=ncurses.h aw_curses_type=ncurses aw_curses_include=-I/usr/local/include aw_curses_lib_path=-L/usr/local/lib if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3262: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3269: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=/usr/local/include aw_curses_header_look=curses.h aw_curses_type=curses aw_curses_include=-I/usr/local/include aw_curses_lib_path=-L/usr/local/lib if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3316: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3323: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3332: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi fi # Three possible cases # ncurses/curses.h: -Iinc_dir/ncurses -Llib_dir -Llib_dir/ncurses -lncurses # ncurses.h: -Iinc_dir -Llib_dir -lcurses # curses.h: -Iinc_dir -Llib_dir -lcurses if test "$aw_need_r" = "yes"; then # We need the -R for runtime linking # Note this code is repeated below with -R taken away aw_curses_include_dir=/gnu/include aw_curses_header_look=ncurses/curses.h aw_curses_type=ncurses aw_curses_include=-I/gnu/include/ncurses aw_curses_lib_path="-L/gnu/lib -L/gnu/lib/ncurses -R/gnu/lib -R/gnu/lib/ncurses" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3380: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3387: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3396: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=/gnu/include aw_curses_header_look=ncurses.h aw_curses_type=ncurses aw_curses_include=-I/gnu/include aw_curses_lib_path="-L/gnu/lib -R/gnu/lib" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3434: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3441: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=/gnu/include aw_curses_header_look=curses.h aw_curses_type=curses aw_curses_include=-I/gnu/include aw_curses_lib_path="-L/gnu/lib -R/gnu/lib" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3488: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3495: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3504: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi else # We don't need the -R option # Note this code is repeated above with -R added aw_curses_include_dir=/gnu/include aw_curses_header_look=ncurses/curses.h aw_curses_type=ncurses aw_curses_include=-I/gnu/include/ncurses aw_curses_lib_path="-L/gnu/lib -L/gnu/lib/ncurses" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3545: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3552: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3561: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=/gnu/include aw_curses_header_look=ncurses.h aw_curses_type=ncurses aw_curses_include=-I/gnu/include aw_curses_lib_path=-L/gnu/lib if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3599: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3606: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3615: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=/gnu/include aw_curses_header_look=curses.h aw_curses_type=curses aw_curses_include=-I/gnu/include aw_curses_lib_path=-L/gnu/lib if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3653: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3660: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3669: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi fi # Three possible cases # ncurses/curses.h: -Iinc_dir/ncurses -Llib_dir -Llib_dir/ncurses -lncurses # ncurses.h: -Iinc_dir -Llib_dir -lcurses # curses.h: -Iinc_dir -Llib_dir -lcurses if test "$aw_need_r" = "yes"; then # We need the -R for runtime linking # Note this code is repeated below with -R taken away aw_curses_include_dir=/usr/include aw_curses_header_look=ncurses/curses.h aw_curses_type=ncurses aw_curses_include=-I/usr/include/ncurses aw_curses_lib_path="-L/usr/lib -L/usr/lib/ncurses -R/usr/lib -R/usr/lib/ncurses" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3717: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3724: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3733: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=/usr/include aw_curses_header_look=ncurses.h aw_curses_type=ncurses aw_curses_include=-I/usr/include aw_curses_lib_path="-L/usr/lib -R/usr/lib" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3771: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3778: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=/usr/include aw_curses_header_look=curses.h aw_curses_type=curses aw_curses_include=-I/usr/include aw_curses_lib_path="-L/usr/lib -R/usr/lib" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3825: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3832: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3841: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi else # We don't need the -R option # Note this code is repeated above with -R added aw_curses_include_dir=/usr/include aw_curses_header_look=ncurses/curses.h aw_curses_type=ncurses aw_curses_include=-I/usr/include/ncurses aw_curses_lib_path="-L/usr/lib -L/usr/lib/ncurses" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3882: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3889: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3898: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=/usr/include aw_curses_header_look=ncurses.h aw_curses_type=ncurses aw_curses_include=-I/usr/include aw_curses_lib_path=-L/usr/lib if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3936: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3943: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3952: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=/usr/include aw_curses_header_look=curses.h aw_curses_type=curses aw_curses_include=-I/usr/include aw_curses_lib_path=-L/usr/lib if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3990: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3997: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:4006: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi fi # Declare the type of curses found so that we can include the # appropriate header file, and include the curses object in the list # of objects to be built in the appropriate Makefiles if test "$CURSES_TYPE" = "ncurses"; then cat >> confdefs.h <<\EOF #define HAVE_NCURSES 1 EOF HAVE_CURSES="ncurses" elif test "$CURSES_TYPE" = "curses"; then cat >> confdefs.h <<\EOF #define HAVE_CURSES 1 EOF HAVE_CURSES="curses" else HAVE_CURSES="" fi # Print results echo $ac_n "checking for curses""... $ac_c" 1>&6 echo "configure:4060: checking for curses" >&5 echo "$ac_t""$CURSES_TYPE $CURSES_INCLUDE $CURSES_LIB $CURSES_LIB_PATH $CURSES_IF_ENABLED" 1>&6 ######################################################################### # tcl ######################################################################### # # Sets Example # TCL_INCLUDE -I/usr/local/include # TCL_LIB -L/usr/local/lib -ltcl # # Check whether --with-tcl-include or --without-tcl-include was given. if test "${with_tcl_include+set}" = set; then withval="$with_tcl_include" aw_user_tcl_include=$withval fi # Check whether --with-tcl-lib or --without-tcl-lib was given. if test "${with_tcl_lib+set}" = set; then withval="$with_tcl_lib" aw_user_tcl_lib=$withval fi # If the user provided both or either option, then try it first if test -n "$aw_user_tcl_include" -o -n "$aw_user_tcl_lib"; then aw_tcl_include=$aw_user_tcl_include aw_tcl_lib=$aw_user_tcl_lib if test "$aw_need_r" = "yes"; then # !@!@ This bit should really be an AC function # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_tcl_lib=`echo $aw_tcl_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_tcl"; then aw_save_libs=$LIBS LIBS="$aw_tcl_include $aw_tcl_lib $LIBS" echo $ac_n "checking whether we can link tcl using $LIBS""... $ac_c" 1>&6 echo "configure:4109: checking whether we can link tcl using $LIBS" >&5 cat > conftest.$ac_ext < int main() { Tcl_AsyncReady() ; return 0; } EOF if { (eval echo configure:4119: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_tcl="yes" TCL_INCLUDE=$aw_tcl_include TCL_LIB=$aw_tcl_lib echo $ac_n "checking whether tcl has Tcl_EvalEx""... $ac_c" 1>&6 echo "configure:4129: checking whether tcl has Tcl_EvalEx" >&5 cat > conftest.$ac_ext < int main() { Tcl_Interp *interp; Tcl_EvalEx(interp, "", -1, 0) ; return 0; } EOF if { (eval echo configure:4141: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_TCL_EVALEX 1 EOF else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* echo "$ac_t""no" 1>&6 fi rm -f conftest* LIBS=$aw_save_libs else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi fi # Else can we use tcl with just -ltcl? aw_tcl_include= aw_tcl_lib="-ltcl" if test "$aw_need_r" = "yes"; then # !@!@ This bit should really be an AC function # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_tcl_lib=`echo $aw_tcl_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_tcl"; then aw_save_libs=$LIBS LIBS="$aw_tcl_include $aw_tcl_lib $LIBS" echo $ac_n "checking whether we can link tcl using $LIBS""... $ac_c" 1>&6 echo "configure:4195: checking whether we can link tcl using $LIBS" >&5 cat > conftest.$ac_ext < int main() { Tcl_AsyncReady() ; return 0; } EOF if { (eval echo configure:4205: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_tcl="yes" TCL_INCLUDE=$aw_tcl_include TCL_LIB=$aw_tcl_lib echo $ac_n "checking whether tcl has Tcl_EvalEx""... $ac_c" 1>&6 echo "configure:4215: checking whether tcl has Tcl_EvalEx" >&5 cat > conftest.$ac_ext < int main() { Tcl_Interp *interp; Tcl_EvalEx(interp, "", -1, 0) ; return 0; } EOF if { (eval echo configure:4227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_TCL_EVALEX 1 EOF else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* echo "$ac_t""no" 1>&6 fi rm -f conftest* LIBS=$aw_save_libs else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # Now we're guessing... :) # This works at DCS, University of ÌÇÐÄTV aw_tcl_include="-I/usr/local/include" aw_tcl_lib="-L/usr/local/lib -ltcl" if test "$aw_need_r" = "yes"; then # !@!@ This bit should really be an AC function # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_tcl_lib=`echo $aw_tcl_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_tcl"; then aw_save_libs=$LIBS LIBS="$aw_tcl_include $aw_tcl_lib $LIBS" echo $ac_n "checking whether we can link tcl using $LIBS""... $ac_c" 1>&6 echo "configure:4282: checking whether we can link tcl using $LIBS" >&5 cat > conftest.$ac_ext < int main() { Tcl_AsyncReady() ; return 0; } EOF if { (eval echo configure:4292: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_tcl="yes" TCL_INCLUDE=$aw_tcl_include TCL_LIB=$aw_tcl_lib echo $ac_n "checking whether tcl has Tcl_EvalEx""... $ac_c" 1>&6 echo "configure:4302: checking whether tcl has Tcl_EvalEx" >&5 cat > conftest.$ac_ext < int main() { Tcl_Interp *interp; Tcl_EvalEx(interp, "", -1, 0) ; return 0; } EOF if { (eval echo configure:4314: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_TCL_EVALEX 1 EOF else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* echo "$ac_t""no" 1>&6 fi rm -f conftest* LIBS=$aw_save_libs else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # This works at ITS, University of ÌÇÐÄTV aw_tcl_include= aw_tcl_lib="-L/usr/local/lib -ltcl8.0" if test "$aw_need_r" = "yes"; then # !@!@ This bit should really be an AC function # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_tcl_lib=`echo $aw_tcl_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_tcl"; then aw_save_libs=$LIBS LIBS="$aw_tcl_include $aw_tcl_lib $LIBS" echo $ac_n "checking whether we can link tcl using $LIBS""... $ac_c" 1>&6 echo "configure:4367: checking whether we can link tcl using $LIBS" >&5 cat > conftest.$ac_ext < int main() { Tcl_AsyncReady() ; return 0; } EOF if { (eval echo configure:4377: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_tcl="yes" TCL_INCLUDE=$aw_tcl_include TCL_LIB=$aw_tcl_lib echo $ac_n "checking whether tcl has Tcl_EvalEx""... $ac_c" 1>&6 echo "configure:4387: checking whether tcl has Tcl_EvalEx" >&5 cat > conftest.$ac_ext < int main() { Tcl_Interp *interp; Tcl_EvalEx(interp, "", -1, 0) ; return 0; } EOF if { (eval echo configure:4399: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_TCL_EVALEX 1 EOF else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* echo "$ac_t""no" 1>&6 fi rm -f conftest* LIBS=$aw_save_libs else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # This works on ride, a Sparc Solaris 7 machine with packages # from sunfreeware.com aw_tcl_include= aw_tcl_lib="-L/usr/local/lib -ltcl" if test "$aw_need_r" = "yes"; then # !@!@ This bit should really be an AC function # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_tcl_lib=`echo $aw_tcl_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_tcl"; then aw_save_libs=$LIBS LIBS="$aw_tcl_include $aw_tcl_lib $LIBS" echo $ac_n "checking whether we can link tcl using $LIBS""... $ac_c" 1>&6 echo "configure:4453: checking whether we can link tcl using $LIBS" >&5 cat > conftest.$ac_ext < int main() { Tcl_AsyncReady() ; return 0; } EOF if { (eval echo configure:4463: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_tcl="yes" TCL_INCLUDE=$aw_tcl_include TCL_LIB=$aw_tcl_lib echo $ac_n "checking whether tcl has Tcl_EvalEx""... $ac_c" 1>&6 echo "configure:4473: checking whether tcl has Tcl_EvalEx" >&5 cat > conftest.$ac_ext < int main() { Tcl_Interp *interp; Tcl_EvalEx(interp, "", -1, 0) ; return 0; } EOF if { (eval echo configure:4485: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_TCL_EVALEX 1 EOF else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* echo "$ac_t""no" 1>&6 fi rm -f conftest* LIBS=$aw_save_libs else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # I give a warning if tcl is not found at the end of the script ######################################################################### # tk ######################################################################### # # Sets Example # TK_INCLUDE -I/usr/local/include # TK_LIB -L/usr/local/lib -ltk # # Check whether --with-tk-include or --without-tk-include was given. if test "${with_tk_include+set}" = set; then withval="$with_tk_include" aw_user_tk_include=$withval fi # Check whether --with-tk-lib or --without-tk-lib was given. if test "${with_tk_lib+set}" = set; then withval="$with_tk_lib" aw_user_tk_lib=$withval fi # If the user provided both or either option, then try it first if test -n "$aw_user_tk_include" -o -n "$aw_user_tk_lib"; then aw_tk_include=$aw_user_tk_include aw_tk_lib=$aw_user_tk_lib if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_tk_lib=`echo $aw_tk_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_tk"; then aw_save_libs=$LIBS # Also add X stuff and tcl stuff. Existing LIBS must go at the # end: -lm must come after -ltk for example. # NB don't seem to need $AW_X_LIBS and -lglPNG may cause an error LIBS="$aw_tk_include $aw_tk_lib $X_CFLAGS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $TCL_INCLUDE $TCL_LIB $LIBS" echo $ac_n "checking whether we can link tk using $LIBS""... $ac_c" 1>&6 echo "configure:4571: checking whether we can link tk using $LIBS" >&5 cat > conftest.$ac_ext < int main() { Tk_GetNumMainWindows(); ; return 0; } EOF if { (eval echo configure:4581: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_tk="yes" TK_INCLUDE=$aw_tk_include TK_LIB=$aw_tk_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi fi # Else can we use tk with just -ltk? aw_tk_include= aw_tk_lib="-ltk" if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_tk_lib=`echo $aw_tk_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_tk"; then aw_save_libs=$LIBS # Also add X stuff and tcl stuff. Existing LIBS must go at the # end: -lm must come after -ltk for example. # NB don't seem to need $AW_X_LIBS and -lglPNG may cause an error LIBS="$aw_tk_include $aw_tk_lib $X_CFLAGS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $TCL_INCLUDE $TCL_LIB $LIBS" echo $ac_n "checking whether we can link tk using $LIBS""... $ac_c" 1>&6 echo "configure:4627: checking whether we can link tk using $LIBS" >&5 cat > conftest.$ac_ext < int main() { Tk_GetNumMainWindows(); ; return 0; } EOF if { (eval echo configure:4637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_tk="yes" TK_INCLUDE=$aw_tk_include TK_LIB=$aw_tk_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # Now we're guessing... :) # This works at DCS, University of ÌÇÐÄTV aw_tk_include="-I/usr/local/include" aw_tk_lib="-L/usr/local/lib -ltk" if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_tk_lib=`echo $aw_tk_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_tk"; then aw_save_libs=$LIBS # Also add X stuff and tcl stuff. Existing LIBS must go at the # end: -lm must come after -ltk for example. # NB don't seem to need $AW_X_LIBS and -lglPNG may cause an error LIBS="$aw_tk_include $aw_tk_lib $X_CFLAGS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $TCL_INCLUDE $TCL_LIB $LIBS" echo $ac_n "checking whether we can link tk using $LIBS""... $ac_c" 1>&6 echo "configure:4684: checking whether we can link tk using $LIBS" >&5 cat > conftest.$ac_ext < int main() { Tk_GetNumMainWindows(); ; return 0; } EOF if { (eval echo configure:4694: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_tk="yes" TK_INCLUDE=$aw_tk_include TK_LIB=$aw_tk_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # This works at ITS, University of ÌÇÐÄTV aw_tk_include= aw_tk_lib="-L/usr/local/lib -ltk8.0" if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_tk_lib=`echo $aw_tk_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_tk"; then aw_save_libs=$LIBS # Also add X stuff and tcl stuff. Existing LIBS must go at the # end: -lm must come after -ltk for example. # NB don't seem to need $AW_X_LIBS and -lglPNG may cause an error LIBS="$aw_tk_include $aw_tk_lib $X_CFLAGS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $TCL_INCLUDE $TCL_LIB $LIBS" echo $ac_n "checking whether we can link tk using $LIBS""... $ac_c" 1>&6 echo "configure:4739: checking whether we can link tk using $LIBS" >&5 cat > conftest.$ac_ext < int main() { Tk_GetNumMainWindows(); ; return 0; } EOF if { (eval echo configure:4749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_tk="yes" TK_INCLUDE=$aw_tk_include TK_LIB=$aw_tk_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # This works on ride, a Sparc Solaris 7 machine with packages from # sunfreeware.com aw_tk_include= aw_tk_lib="-L/usr/local/lib -ltk8.2" if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_tk_lib=`echo $aw_tk_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_tk"; then aw_save_libs=$LIBS # Also add X stuff and tcl stuff. Existing LIBS must go at the # end: -lm must come after -ltk for example. # NB don't seem to need $AW_X_LIBS and -lglPNG may cause an error LIBS="$aw_tk_include $aw_tk_lib $X_CFLAGS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $TCL_INCLUDE $TCL_LIB $LIBS" echo $ac_n "checking whether we can link tk using $LIBS""... $ac_c" 1>&6 echo "configure:4795: checking whether we can link tk using $LIBS" >&5 cat > conftest.$ac_ext < int main() { Tk_GetNumMainWindows(); ; return 0; } EOF if { (eval echo configure:4805: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_tk="yes" TK_INCLUDE=$aw_tk_include TK_LIB=$aw_tk_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # I give a warning if tk is not found at the end of the script ######################################################################### # Readline ######################################################################### # # Sets Example # READLINE_INCLUDE -I/gnu/include/readline # READLINE_LIB -L/gnu/lib -R/gnu/lib -lreadline # # Check whether --with-readline-include or --without-readline-include was given. if test "${with_readline_include+set}" = set; then withval="$with_readline_include" aw_user_readline_include=$withval fi # Check whether --with-readline-lib or --without-readline-lib was given. if test "${with_readline_lib+set}" = set; then withval="$with_readline_lib" aw_user_readline_lib=$withval fi # If the user provided both or either option, then try it first if test -n "$aw_user_readline_include" -o -n "$aw_user_readline_lib"; then aw_readline_include=$aw_user_readline_include aw_readline_lib=$aw_user_readline_lib if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_readline_lib=`echo $aw_readline_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_readline"; then aw_save_libs=$LIBS # Need curses as well as the supplied settings LIBS="$aw_readline_include $aw_readline_lib $CURSES_INCLUDE $CURSES_LIB_PATH $CURSES_LIB $LIBS" echo $ac_n "checking whether we can link readline using $LIBS""... $ac_c" 1>&6 echo "configure:4879: checking whether we can link readline using $LIBS" >&5 cat > conftest.$ac_ext < #include #include int main() { readline("test"); ; return 0; } EOF if { (eval echo configure:4893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_readline="yes" READLINE_INCLUDE=$aw_readline_include READLINE_LIB=$aw_readline_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi fi # Else can we use readline with just -lreadline? aw_readline_include= aw_readline_lib="-lreadline" if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_readline_lib=`echo $aw_readline_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_readline"; then aw_save_libs=$LIBS # Need curses as well as the supplied settings LIBS="$aw_readline_include $aw_readline_lib $CURSES_INCLUDE $CURSES_LIB_PATH $CURSES_LIB $LIBS" echo $ac_n "checking whether we can link readline using $LIBS""... $ac_c" 1>&6 echo "configure:4938: checking whether we can link readline using $LIBS" >&5 cat > conftest.$ac_ext < #include #include int main() { readline("test"); ; return 0; } EOF if { (eval echo configure:4952: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_readline="yes" READLINE_INCLUDE=$aw_readline_include READLINE_LIB=$aw_readline_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # Now we're guessing... :) # This works on cygwin aw_readline_include="-I/usr/include/readline" aw_readline_lib="-L/usr/lib -lreadline" if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_readline_lib=`echo $aw_readline_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_readline"; then aw_save_libs=$LIBS # Need curses as well as the supplied settings LIBS="$aw_readline_include $aw_readline_lib $CURSES_INCLUDE $CURSES_LIB_PATH $CURSES_LIB $LIBS" echo $ac_n "checking whether we can link readline using $LIBS""... $ac_c" 1>&6 echo "configure:4998: checking whether we can link readline using $LIBS" >&5 cat > conftest.$ac_ext < #include #include int main() { readline("test"); ; return 0; } EOF if { (eval echo configure:5012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_readline="yes" READLINE_INCLUDE=$aw_readline_include READLINE_LIB=$aw_readline_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # This works at DCS, University of ÌÇÐÄTV aw_readline_include="-I/gnu/include/readline -I/gnu/include" aw_readline_lib="-L/gnu/lib -R/gnu/lib -lreadline" if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_readline_lib=`echo $aw_readline_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_readline"; then aw_save_libs=$LIBS # Need curses as well as the supplied settings LIBS="$aw_readline_include $aw_readline_lib $CURSES_INCLUDE $CURSES_LIB_PATH $CURSES_LIB $LIBS" echo $ac_n "checking whether we can link readline using $LIBS""... $ac_c" 1>&6 echo "configure:5056: checking whether we can link readline using $LIBS" >&5 cat > conftest.$ac_ext < #include #include int main() { readline("test"); ; return 0; } EOF if { (eval echo configure:5070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_readline="yes" READLINE_INCLUDE=$aw_readline_include READLINE_LIB=$aw_readline_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # This works on a newly installed Solaris 7 machine with standard GNU install aw_readline_include="-I/usr/local/include/readline" aw_readline_lib="-L/usr/local/lib -R/usr/local/lib -lreadline" if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_readline_lib=`echo $aw_readline_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_readline"; then aw_save_libs=$LIBS # Need curses as well as the supplied settings LIBS="$aw_readline_include $aw_readline_lib $CURSES_INCLUDE $CURSES_LIB_PATH $CURSES_LIB $LIBS" echo $ac_n "checking whether we can link readline using $LIBS""... $ac_c" 1>&6 echo "configure:5114: checking whether we can link readline using $LIBS" >&5 cat > conftest.$ac_ext < #include #include int main() { readline("test"); ; return 0; } EOF if { (eval echo configure:5128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_readline="yes" READLINE_INCLUDE=$aw_readline_include READLINE_LIB=$aw_readline_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # If we found an answer, then we HAVE_READLINE if test -n "$aw_finished_readline"; then cat >> confdefs.h <<\EOF #define HAVE_READLINE 1 EOF fi ######################################################################### # OpenGL ######################################################################### # # Sets Example # OPENGL_INCLUDE -I/usr/openwin/include # OPENGL_LIB -L/usr/openwin/lib -R/usr/openwin/lib -lGL # Check whether --with-gl-include or --without-gl-include was given. if test "${with_gl_include+set}" = set; then withval="$with_gl_include" aw_user_gl_include=$withval fi # Check whether --with-gl-lib or --without-gl-lib was given. if test "${with_gl_lib+set}" = set; then withval="$with_gl_lib" aw_user_gl_lib=$withval fi if test "$aw_want_sasami" = "yes"; then # We want to build Sasami - so figure out OpenGL # If the user provided both or either option, then try it first if test -n "$aw_user_gl_include" -o -n "$aw_user_gl_lib"; then aw_gl_include=$aw_user_gl_include aw_gl_lib=$aw_user_gl_lib if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_gl_lib=`echo $aw_gl_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_gl"; then aw_save_libs=$LIBS # Debian seems to require -lm... LIBS="$aw_gl_include $aw_gl_lib -lm" echo $ac_n "checking whether we can link GL using $LIBS""... $ac_c" 1>&6 echo "configure:5212: checking whether we can link GL using $LIBS" >&5 # !@!@ should put a test for the Solaris GL implementation in here, # because I can't get it to use the correct colormap on 8-bit GFX # hardware: the workaround is to use Mesa instead cat > conftest.$ac_ext < int main() { glLoadIdentity(); ; return 0; } EOF if { (eval echo configure:5227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_gl="yes" OPENGL_INCLUDE=$aw_gl_include OPENGL_LIB=$aw_gl_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi fi # Else can we use GL with just -lGL? aw_gl_include= aw_gl_lib="-lGL" if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_gl_lib=`echo $aw_gl_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_gl"; then aw_save_libs=$LIBS # Debian seems to require -lm... LIBS="$aw_gl_include $aw_gl_lib -lm" echo $ac_n "checking whether we can link GL using $LIBS""... $ac_c" 1>&6 echo "configure:5272: checking whether we can link GL using $LIBS" >&5 # !@!@ should put a test for the Solaris GL implementation in here, # because I can't get it to use the correct colormap on 8-bit GFX # hardware: the workaround is to use Mesa instead cat > conftest.$ac_ext < int main() { glLoadIdentity(); ; return 0; } EOF if { (eval echo configure:5287: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_gl="yes" OPENGL_INCLUDE=$aw_gl_include OPENGL_LIB=$aw_gl_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi else OPENGL_INCLUDE="" OPENGL_LIB="" fi ######################################################################### # PNG library ######################################################################### # # Sets Example # PNG_INCLUDE -I/usr/local/include # PNG_LIB -L/usr/local/lib -R/usr/local/lib -lpng # Check whether --with-png-include or --without-png-include was given. if test "${with_png_include+set}" = set; then withval="$with_png_include" aw_user_png_include=$withval fi # Check whether --with-png-lib or --without-png-lib was given. if test "${with_png_lib+set}" = set; then withval="$with_png_lib" aw_user_png_lib=$withval fi if test "$aw_want_sasami" = "yes"; then # We want to build Sasami - so figure out PNG # If the user provided both or either option, then try it first if test -n "$aw_user_png_include" -o -n "$aw_user_png_lib"; then aw_png_include=$aw_user_png_include aw_png_lib=$aw_user_png_lib if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_png_lib=`echo $aw_png_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_png"; then aw_save_libs=$LIBS # -lpng needs -lm LIBS="$aw_png_include $aw_png_lib -lm" echo $ac_n "checking whether we can link png using $LIBS""... $ac_c" 1>&6 echo "configure:5367: checking whether we can link png using $LIBS" >&5 cat > conftest.$ac_ext < int main() { png_structp png; png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); ; return 0; } EOF if { (eval echo configure:5382: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_png="yes" PNG_INCLUDE=$aw_png_include PNG_LIB=$aw_png_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi fi # Else can we use PNG with just -lpng? aw_png_include= aw_png_lib="-lpng" if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_png_lib=`echo $aw_png_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_png"; then aw_save_libs=$LIBS # -lpng needs -lm LIBS="$aw_png_include $aw_png_lib -lm" echo $ac_n "checking whether we can link png using $LIBS""... $ac_c" 1>&6 echo "configure:5427: checking whether we can link png using $LIBS" >&5 cat > conftest.$ac_ext < int main() { png_structp png; png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); ; return 0; } EOF if { (eval echo configure:5442: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_png="yes" PNG_INCLUDE=$aw_png_include PNG_LIB=$aw_png_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # Try this... aw_png_include="-I/usr/local/include" aw_png_lib="-L/usr/local/lib -lpng" if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_png_lib=`echo $aw_png_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_png"; then aw_save_libs=$LIBS # -lpng needs -lm LIBS="$aw_png_include $aw_png_lib -lm" echo $ac_n "checking whether we can link png using $LIBS""... $ac_c" 1>&6 echo "configure:5486: checking whether we can link png using $LIBS" >&5 cat > conftest.$ac_ext < int main() { png_structp png; png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); ; return 0; } EOF if { (eval echo configure:5501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_png="yes" PNG_INCLUDE=$aw_png_include PNG_LIB=$aw_png_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi else PNG_INCLUDE="" PNG_LIB="" fi ######################################################################### # Memory alignment ######################################################################### # I could use the gcc __alignof__ function, but then this would # restrict us to using gcc only. So we attempt to detect the alignment # required instead. echo $ac_n "checking how doubles should be aligned""... $ac_c" 1>&6 echo "configure:5543: checking how doubles should be aligned" >&5 if test "$cross_compiling" = yes; then # We are cross compiling so can't run the test, so we # assume the worst. cat >> confdefs.h <<\EOF #define DOUBLE_ALIGNMENT sizeof(double) EOF echo "$ac_t""sizeof(double) byte boundaries" 1>&6 else cat > conftest.$ac_ext < struct foo { union align { double d; long l; void *p; } u; char c; }; int main() { struct foo f[2]; FILE *fp; int n; if ((fp = fopen("conftestalignoutput", "w")) == NULL) exit(1); if( 2*sizeof(union align) != sizeof(f) ) { n = fprintf(fp, "%ld\n", (long)(sizeof(struct foo) - sizeof(union align))); } else { n = fprintf(fp, "%ld\n", (long)sizeof(union align)); } /* If fprintf didn't complete successfully, exit code 1 */ if (n < 0) exit(1); if (fclose(fp) != 0) exit(1); /* All OK - exit code 0 */ exit(0); } EOF if { (eval echo configure:5595: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # The code compiled, linked, executed and had exit code 0, # so we can read the alignment value written to the temporary # file. aw_alignment=`cat conftestalignoutput` cat >> confdefs.h <&6 else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* # The test failed in some way, so assume the worst. cat >> confdefs.h <<\EOF #define DOUBLE_ALIGNMENT sizeof(double) EOF echo "$ac_t""sizeof(double) byte boundaries" 1>&6 fi rm -fr conftest* fi ######################################################################### # dmalloc (tool for checking for memory leaks etc) ######################################################################### # I'm trusting the user to get this right, so no checks are done to see # if the arguments provided are correct. If they want to run it with a # memory debugger, they should know what they are doing... I hope. DMALLOC_INCLUDE= DMALLOC_LIB= # Check whether --with-dmalloc-include or --without-dmalloc-include was given. if test "${with_dmalloc_include+set}" = set; then withval="$with_dmalloc_include" cat >> confdefs.h <<\EOF #define HAVE_DMALLOC 1 EOF DMALLOC_INCLUDE=-I$withval fi # Check whether --with-dmalloc-lib or --without-dmalloc-lib was given. if test "${with_dmalloc_lib+set}" = set; then withval="$with_dmalloc_lib" cat >> confdefs.h <<\EOF #define HAVE_DMALLOC 1 EOF DMALLOC_LIB="-L$withval -ldmalloc" fi ######################################################################### # Other bits ######################################################################### # Do we have ANSI C header files? Declares STDC_HEADERS if we do. Also # (undocumented) sets $ac_cv_header_stdc to "yes". # Check other headers and stop if we can't find them # Might define HAVE_MALLOC_H ac_safe=`echo "malloc.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for malloc.h""... $ac_c" 1>&6 echo "configure:5674: checking for malloc.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:5684: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 { echo "configure: error: can't find malloc.h" 1>&2; exit 1; } fi # Might define HAVE_SYS_TIME_H ac_safe=`echo "sys/time.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/time.h""... $ac_c" 1>&6 echo "configure:5709: checking for sys/time.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:5719: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 { echo "configure: error: can't find sys/time.h" 1>&2; exit 1; } fi # Define const to be empty if the compiler does not support it echo $ac_n "checking for working const""... $ac_c" 1>&6 echo "configure:5744: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; } ; return 0; } EOF if { (eval echo configure:5798: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_c_const=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_c_const" 1>&6 if test $ac_cv_c_const = no; then cat >> confdefs.h <<\EOF #define const EOF fi # Deal with problems due to two header files time.h and sys/time.h # Might define TIME_WITH_SYS_TIME echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 echo "configure:5822: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #include int main() { struct tm *tp; ; return 0; } EOF if { (eval echo configure:5836: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_header_time=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_header_time" 1>&6 if test $ac_cv_header_time = yes; then cat >> confdefs.h <<\EOF #define TIME_WITH_SYS_TIME 1 EOF fi # Might define TM_IN_SYS_TIME, "which means that including sys/time.h # had better define struct tm." (from Autoconf manual - huh?). echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 echo "configure:5860: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF if { (eval echo configure:5873: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_struct_tm=sys/time.h fi rm -f conftest* fi echo "$ac_t""$ac_cv_struct_tm" 1>&6 if test $ac_cv_struct_tm = sys/time.h; then cat >> confdefs.h <<\EOF #define TM_IN_SYS_TIME 1 EOF fi # Check for how to get alloca. Might defined HAVE_ALLOCA_H, HAVE_ALLOCA, # ALLOCA, C_ALLOCA... # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 echo "configure:5899: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF if { (eval echo configure:5911: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_header_alloca_h=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_header_alloca_h" 1>&6 if test $ac_cv_header_alloca_h = yes; then cat >> confdefs.h <<\EOF #define HAVE_ALLOCA_H 1 EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 echo "configure:5932: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < # define alloca _alloca # else # if HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ char *alloca (); # endif # endif # endif # endif #endif int main() { char *p = (char *) alloca(1); ; return 0; } EOF if { (eval echo configure:5965: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_func_alloca_works=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_func_alloca_works" 1>&6 if test $ac_cv_func_alloca_works = yes; then cat >> confdefs.h <<\EOF #define HAVE_ALLOCA 1 EOF fi if test $ac_cv_func_alloca_works = no; then # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=alloca.${ac_objext} cat >> confdefs.h <<\EOF #define C_ALLOCA 1 EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 echo "configure:5997: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5 | egrep "webecray" >/dev/null 2>&1; then rm -rf conftest* ac_cv_os_cray=yes else rm -rf conftest* ac_cv_os_cray=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:6027: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else $ac_func(); #endif ; return 0; } EOF if { (eval echo configure:6055: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <&6 fi done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 echo "configure:6082: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext < addr) ? 1 : -1; } main () { exit (find_stack_direction() < 0); } EOF if { (eval echo configure:6109: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* ac_cv_c_stack_direction=-1 fi rm -fr conftest* fi fi echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 cat >> confdefs.h <&6 echo "configure:6133: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #ifdef signal #undef signal #endif #ifdef __cplusplus extern "C" void (*signal (int, void (*)(int)))(int); #else void (*signal ()) (); #endif int main() { int i; ; return 0; } EOF if { (eval echo configure:6155: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_type_signal=int fi rm -f conftest* fi echo "$ac_t""$ac_cv_type_signal" 1>&6 cat >> confdefs.h <&6 echo "configure:6176: checking for gettimeofday" >&5 if eval "test \"`echo '$''{'ac_cv_func_gettimeofday'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gettimeofday(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_gettimeofday) || defined (__stub___gettimeofday) choke me #else gettimeofday(); #endif ; return 0; } EOF if { (eval echo configure:6204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gettimeofday=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_gettimeofday=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'gettimeofday`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 { echo "configure: error: don't have gettimeofday" 1>&2; exit 1; } fi echo $ac_n "checking for putenv""... $ac_c" 1>&6 echo "configure:6225: checking for putenv" >&5 if eval "test \"`echo '$''{'ac_cv_func_putenv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char putenv(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_putenv) || defined (__stub___putenv) choke me #else putenv(); #endif ; return 0; } EOF if { (eval echo configure:6253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_putenv=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_putenv=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'putenv`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 { echo "configure: error: don't have putenv" 1>&2; exit 1; } fi echo $ac_n "checking for select""... $ac_c" 1>&6 echo "configure:6274: checking for select" >&5 if eval "test \"`echo '$''{'ac_cv_func_select'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char select(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_select) || defined (__stub___select) choke me #else select(); #endif ; return 0; } EOF if { (eval echo configure:6302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_select=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_select=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'select`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 { echo "configure: error: don't have select" 1>&2; exit 1; } fi echo $ac_n "checking for strdup""... $ac_c" 1>&6 echo "configure:6323: checking for strdup" >&5 if eval "test \"`echo '$''{'ac_cv_func_strdup'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char strdup(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_strdup) || defined (__stub___strdup) choke me #else strdup(); #endif ; return 0; } EOF if { (eval echo configure:6351: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_strdup=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_strdup=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'strdup`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 { echo "configure: error: don't have strdup" 1>&2; exit 1; } fi ######################################################################### # Create the Makefiles ######################################################################### # Substitute the following variables in the Makefiles # Done - write the output Makefiles trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs. It is not useful on other systems. # If it contains results you don't want to keep, you may remove or edit it. # # By default, configure uses ./config.cache as the cache file, # creating it if it does not exist already. You can give configure # the --cache-file=FILE option to use a different cache file; that is # what configure does when it calls configure scripts in # subdirectories, so they share the cache. # Giving --cache-file=/dev/null disables caching, for debugging configure. # config.status only pays attention to the cache file if you give it the # --recheck option to rerun configure. # EOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). sed -n \ -e "s/'/'\\\\''/g" \ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' ;; esac >> confcache if cmp -s $cache_file confcache; then : else if test -w $cache_file; then echo "updating cache $cache_file" cat confcache > $cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Any assignment to VPATH causes Sun make to only execute # the first set of double-colon rules, so remove it if not needed. # If there is a colon in the path, we need to keep it. if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' fi trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 DEFS=-DHAVE_CONFIG_H # Without the "./", some shells look in PATH for config.status. : ${CONFIG_STATUS=./config.status} echo creating $CONFIG_STATUS rm -f $CONFIG_STATUS cat > $CONFIG_STATUS </dev/null | sed 1q`: # # $0 $ac_configure_args # # Compiler output produced by configure, useful for debugging # configure, is in ./config.log if it exists. ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" for ac_option do case "\$ac_option" in -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) echo "$CONFIG_STATUS generated by autoconf version 2.13" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; *) echo "\$ac_cs_usage"; exit 1 ;; esac done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" trap 'rm -fr `echo "generic.mk Misc/Makefile Eden/Makefile EX/Makefile Scout/Makefile Makefile Donald/Makefile LSD/Makefile Sasami/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF $ac_vpsub $extrasub s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g s%@FFLAGS@%$FFLAGS%g s%@DEFS@%$DEFS%g s%@LDFLAGS@%$LDFLAGS%g s%@LIBS@%$LIBS%g s%@exec_prefix@%$exec_prefix%g s%@prefix@%$prefix%g s%@program_transform_name@%$program_transform_name%g s%@bindir@%$bindir%g s%@sbindir@%$sbindir%g s%@libexecdir@%$libexecdir%g s%@datadir@%$datadir%g s%@sysconfdir@%$sysconfdir%g s%@sharedstatedir@%$sharedstatedir%g s%@localstatedir@%$localstatedir%g s%@libdir@%$libdir%g s%@includedir@%$includedir%g s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g s%@host@%$host%g s%@host_alias@%$host_alias%g s%@host_cpu@%$host_cpu%g s%@host_vendor@%$host_vendor%g s%@host_os@%$host_os%g s%@CC@%$CC%g s%@CPP@%$CPP%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@LEX@%$LEX%g s%@LEXLIB@%$LEXLIB%g s%@SET_MAKE@%$SET_MAKE%g s%@RANLIB@%$RANLIB%g s%@X_CFLAGS@%$X_CFLAGS%g s%@X_PRE_LIBS@%$X_PRE_LIBS%g s%@X_LIBS@%$X_LIBS%g s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g s%@ALLOCA@%$ALLOCA%g s%@AW_X_LIBS@%$AW_X_LIBS%g s%@CURSES_TYPE@%$CURSES_TYPE%g s%@CURSES_INCLUDE@%$CURSES_INCLUDE%g s%@CURSES_LIB@%$CURSES_LIB%g s%@CURSES_LIB_PATH@%$CURSES_LIB_PATH%g s%@TCL_INCLUDE@%$TCL_INCLUDE%g s%@TCL_LIB@%$TCL_LIB%g s%@TK_INCLUDE@%$TK_INCLUDE%g s%@TK_LIB@%$TK_LIB%g s%@DMALLOC_INCLUDE@%$DMALLOC_INCLUDE%g s%@DMALLOC_LIB@%$DMALLOC_LIB%g s%@READLINE_INCLUDE@%$READLINE_INCLUDE%g s%@READLINE_LIB@%$READLINE_LIB%g s%@OPENGL_INCLUDE@%$OPENGL_INCLUDE%g s%@OPENGL_LIB@%$OPENGL_LIB%g s%@PNG_INCLUDE@%$PNG_INCLUDE%g s%@PNG_LIB@%$PNG_LIB%g s%@DEPEND_MAKEDEFS@%$DEPEND_MAKEDEFS%g CEOF EOF cat >> $CONFIG_STATUS <<\EOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. ac_file=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_cmds # Line after last line for current file. ac_more_lines=: ac_sed_cmds="" while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file else sed "${ac_end}q" conftest.subs > conftest.s$ac_file fi if test ! -s conftest.s$ac_file; then ac_more_lines=false rm -f conftest.s$ac_file else if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f conftest.s$ac_file" else ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" fi ac_file=`expr $ac_file + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_cmds` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" # A "../" for each directory in $ac_dir_suffix. ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` else ac_dir_suffix= ac_dots= fi case "$ac_given_srcdir" in .) srcdir=. if test -z "$ac_dots"; then top_srcdir=. else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; *) # Relative path. srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" top_srcdir="$ac_dots$ac_given_srcdir" ;; esac case "$ac_given_INSTALL" in [/$]*) INSTALL="$ac_given_INSTALL" ;; *) INSTALL="$ac_dots$ac_given_INSTALL" ;; esac echo creating "$ac_file" rm -f "$ac_file" configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." case "$ac_file" in *Makefile*) ac_comsub="1i\\ # $configure_input" ;; *) ac_comsub= ;; esac ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` sed -e "$ac_comsub s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g s%@top_srcdir@%$top_srcdir%g s%@INSTALL@%$INSTALL%g " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done rm -f conftest.s* # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' ac_dC='\3' ac_dD='%g' # ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='\([ ]\)%\1#\2define\3' ac_uC=' ' ac_uD='\4%g' # ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_eB='$%\1#\2define\3' ac_eC=' ' ac_eD='%g' if test "${CONFIG_HEADERS+set}" != set; then EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF fi for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac echo creating $ac_file rm -f conftest.frag conftest.in conftest.out ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` cat $ac_file_inputs > conftest.in EOF # Transform confdefs.h into a sed script conftest.vals that substitutes # the proper values into config.h.in to produce config.h. And first: # Protect against being on the right side of a sed subst in config.status. # Protect against being in an unquoted here document in config.status. rm -f conftest.vals cat > conftest.hdr <<\EOF s/[\\&%]/\\&/g s%[\\$`]%\\&%g s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp s%ac_d%ac_u%gp s%ac_u%ac_e%gp EOF sed -n -f conftest.hdr confdefs.h > conftest.vals rm -f conftest.hdr # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >> conftest.vals <<\EOF s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% EOF # Break up conftest.vals because some shells have a limit on # the size of here documents, and old seds have small limits too. rm -f conftest.tail while : do ac_lines=`grep -c . conftest.vals` # grep -c gives empty output for an empty file on some AIX systems. if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi # Write a limited-size here document to conftest.frag. echo ' cat > conftest.frag <> $CONFIG_STATUS sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS echo 'CEOF sed -f conftest.frag conftest.in > conftest.out rm -f conftest.in mv conftest.out conftest.in ' >> $CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail rm -f conftest.vals mv conftest.tail conftest.vals done rm -f conftest.vals cat >> $CONFIG_STATUS <<\EOF rm -f conftest.frag conftest.h echo "/* $ac_file. Generated automatically by configure. */" > conftest.h cat conftest.in >> conftest.h rm -f conftest.in if cmp -s $ac_file conftest.h 2>/dev/null; then echo "$ac_file is unchanged" rm -f conftest.h else # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" fi rm -f $ac_file mv conftest.h $ac_file fi fi; done EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF exit 0 EOF chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 # Give warnings if test -z "$aw_want_sasami"; then echo "configure: warning: Cannot build Sasami - only possible on Windoz presently" 1>&2 fi if test -z "$aw_finished_tcl"; then echo "configure: warning: Could not locate tcl - can probably only build ttyeden" 1>&2 fi if test -z "$aw_finished_tk"; then echo "configure: warning: Could not locate tk - can probably only build ttyeden" 1>&2 fi if test -z "$aw_finished_readline"; then echo "configure: warning: Could not locate readline - ttyeden will not have line editing" 1>&2 fi if test -z "$HAVE_CURSES"; then echo "configure: warning: Could not locate curses - probably cannot build ttyeden" 1>&2 fi if test -z "$aw_finished_gl"; then echo "configure: warning: Could not locate GL - probably cannot build Sasami" 1>&2 fi if test -z "$aw_finished_png"; then echo "configure: warning: Could not locate PNG - probably cannot build Sasami" 1>&2 fi echo "configure: warning: Type 'make' for further instructions" 1>&2 utoconf version 2.13" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; *) echo "\$ac_cs_usage"; exit 1 ;; esac done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" trap 'rm -fr `echo "generic.mk Misc/Makefile Eden/Makefile EX/Makefile Scout/Makefile Makefile Donald/Makefile LSD/Makefile Sasami/Matkeden1.32/config.guess010070000025250000147000000641160727406557400163670ustar00ashleydcsother00001250000011#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. # # 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 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Written by Per Bothner . # The master version of this file is at the FSF in /home/gd/gnu/lib. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit system type (host/target name). # # Only a few systems have been added to this list; please add others # (but try to keep the structure clean). # # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 8/24/94.) 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 trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15 # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi # 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. cat <dummy.s .globl main .ent main main: .frame \$30,0,\$26,0 .prologue 0 .long 0x47e03d80 # implver $0 lda \$2,259 .long 0x47e20c21 # amask $2,$1 srl \$1,8,\$2 sll \$2,2,\$2 sll \$0,3,\$0 addl \$1,\$0,\$0 addl \$2,\$0,\$0 ret \$31,(\$26),1 .end main EOF ${CC-cc} dummy.s -o dummy 2>/dev/null if test "$?" = 0 ; then ./dummy case "$?" in 7) UNAME_MACHINE="alpha" ;; 15) UNAME_MACHINE="alphaev5" ;; 14) UNAME_MACHINE="alphaev56" ;; 10) UNAME_MACHINE="alphapca56" ;; 16) UNAME_MACHINE="alphaev6" ;; esac fi rm -f dummy.s dummy echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]` exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-cbm-sysv4 exit 0;; amiga:NetBSD:*:*) echo m68k-cbm-netbsd${UNAME_RELEASE} exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; arc64:OpenBSD:*:*) echo mips64el-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hkmips:OpenBSD:*:*) echo mips-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mips-unknown-openbsd${UNAME_RELEASE} exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; arm32:NetBSD:*:*) echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; SR2?01:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; 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 0 ;; NILE:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; 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 0 ;; 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 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(head -1 /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 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; atari*:NetBSD:*:*) echo m68k-atari-netbsd${UNAME_RELEASE} exit 0 ;; atari*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3*:NetBSD:*:*) echo m68k-sun-netbsd${UNAME_RELEASE} exit 0 ;; sun3*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:NetBSD:*:*) echo m68k-apple-netbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; macppc:NetBSD:*:*) echo powerpc-apple-netbsd${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) sed 's/^ //' << EOF >dummy.c int main (argc, argv) int argc; char **argv; { #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-cc} dummy.c -o dummy \ && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && rm dummy.c dummy && exit 0 rm -f dummy.c dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ -o ${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 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????: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 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i?86:AIX:*:*) echo i386-ibm-aix exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then sed 's/^ //' << EOF >dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 rm -f dummy.c dummy echo rs6000-ibm-aix3.2.5 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 0 ;; *:AIX:*:4) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=4.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/6?? | 9000/7?? | 9000/80[24] | 9000/8?[13679] | 9000/892 ) sed 's/^ //' << EOF >dummy.c #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 (${CC-cc} dummy.c -o dummy 2>/dev/null ) && HP_ARCH=`./dummy` rm -f dummy.c dummy esac HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) 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-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 rm -f dummy.c dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i?86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*X-MP:*:*:*) echo xmp-cray-unicos exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; F300:UNIX_System_V:*:*) FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; F301:UNIX_System_V:*:*) echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` exit 0 ;; hp3[0-9][05]:NetBSD:*:*) echo m68k-hp-netbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; i?86:BSD/386:*:* | *:BSD/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; *:NetBSD:*:*) echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; *:Linux:*:*) # uname on the ARM produces all sorts of strangeness, and we need to # filter it out. case "$UNAME_MACHINE" in arm* | sa110*) UNAME_MACHINE="arm" ;; esac # The BFD linker knows what the default object file format is, so # first see if it will tell us. ld_help_string=`ld --help 2>&1` ld_supported_emulations=`echo $ld_help_string \ | sed -ne '/supported emulations:/!d s/[ ][ ]*/ /g s/.*supported emulations: *// s/ .*// p'` case "$ld_supported_emulations" in i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;; i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;; sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;; esac if test "${UNAME_MACHINE}" = "alpha" ; then sed 's/^ //' <dummy.s .globl main .ent main main: .frame \$30,0,\$26,0 .prologue 0 .long 0x47e03d80 # implver $0 lda \$2,259 .long 0x47e20c21 # amask $2,$1 srl \$1,8,\$2 sll \$2,2,\$2 sll \$0,3,\$0 addl \$1,\$0,\$0 addl \$2,\$0,\$0 ret \$31,(\$26),1 .end main EOF LIBC="" ${CC-cc} dummy.s -o dummy 2>/dev/null if test "$?" = 0 ; then ./dummy case "$?" in 7) UNAME_MACHINE="alpha" ;; 15) UNAME_MACHINE="alphaev5" ;; 14) UNAME_MACHINE="alphaev56" ;; 10) UNAME_MACHINE="alphapca56" ;; 16) UNAME_MACHINE="alphaev6" ;; esac objdump --private-headers dummy | \ grep ld.so.1 > /dev/null if test "$?" = 0 ; then LIBC="libc1" fi fi rm -f dummy.s dummy echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 elif test "${UNAME_MACHINE}" = "mips" ; then cat >dummy.c </dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 rm -f dummy.c dummy else # Either a pre-BFD a.out linker (linux-gnuoldld) # or one that does not give us useful --help. # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. # If ld does not provide *any* "supported emulations:" # that means it is gnuoldld. echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 case "${UNAME_MACHINE}" in i?86) VENDOR=pc; ;; *) VENDOR=unknown; ;; esac # Determine whether the default compiler is a.out or elf cat >dummy.c < main(argc, argv) int argc; char *argv[]; { #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); # else printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); # endif # else printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); # endif #else printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); #endif return 0; } EOF ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 rm -f dummy.c dummy fi ;; # 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. i?86:DYNIX/ptx:4*:*) echo i386-sequent-sysv4 exit 0 ;; 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 0 ;; i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} fi exit 0 ;; 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|egrep Release|sed -e 's/.*= //')` (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; i?86:UnixWare:*:*) if /bin/uname -X 2>/dev/null >/dev/null ; then (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 fi echo ${UNAME_MACHINE}-unixware-${UNAME_RELEASE}-${UNAME_VERSION} exit 0 ;; pc:*:*:*) # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; 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 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*: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 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; i?86:LynxOS:2.*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *: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 0 ;; PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:*:6*) echo mips-sony-newsos6 exit 0 ;; R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 cat >dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) #if !defined (ultrix) printf ("vax-dec-bsd\n"); exit (0); #else printf ("vax-dec-ultrix\n"); exit (0); #endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0 rm -f dummy.c dummy # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi #echo '(Unable to guess system type)' 1>&2 exit 1 ; exit 0 ;; i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;; sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;; esac if test "${UNAME_MACHINE}" = "alpha" ; then tkeden1.32/config.h.in010060000025250000147000000047210733204513200160470ustar00ashleydcsother00001250000011/* * $Id: config.h.in,v 1.5 2001/08/01 18:28:42 cssbz Exp $ */ /* Define if using alloca.c. */ #undef C_ALLOCA /* Define to empty if the keyword does not work. */ #undef const /* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. This function is required for alloca.c support on those systems. */ #undef CRAY_STACKSEG_END /* Define if you have alloca, as a function or macro. */ #undef HAVE_ALLOCA /* Define if you have and it should be used (not on Ultrix). */ #undef HAVE_ALLOCA_H /* Define as the return type of signal handlers (int or void). */ #undef RETSIGTYPE /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION /* Define if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define if your declares struct tm. */ #undef TM_IN_SYS_TIME /* Define if the X Window System is missing or not being used. */ #undef X_DISPLAY_MISSING /* Define if you have the dl library (-ldl). */ #undef HAVE_LIBDL /* Define if you have the m library (-lm). */ #undef HAVE_LIBM /* Define if your C compiler has protos */ #undef CC_HAS_PROTOS /* Define if you want to enable debugging */ #undef DEBUG /* Define to be (in bytes) to what boundary doubles should be aligned */ #undef DOUBLE_ALIGNMENT /* Define if you have the curses library */ #undef HAVE_CURSES /* Define if you have the ncurses library */ #undef HAVE_NCURSES /* Define if you want to use the dcc function for disabling circular checking */ #undef NO_CHECK_CIRCULAR /* Define to be something resembling the type of the system to enable configure to stop cached results being used on the wrong system */ #undef SYSTEM_NAME /* Define if you want to enable eden parser debugging */ #undef YYDEBUG /* Define if you have the dmalloc library (-ldmalloc) */ #undef HAVE_DMALLOC /* Define if you have the GNU readline library (-lreadline) */ #undef HAVE_READLINE /* Define if you want the Sasami facilities (a notation using OpenGL graphics) to be included */ #undef WANT_SASAMI /* Define if your version of Tcl has Tcl_EvalEX */ #undef HAVE_TCL_EVALEX /* Define if you want to use Eden's IPC functions (send_msg...) */ #undef ipc tkeden1.32/configure.in010060000025250000147000000662440733227744400163620ustar00ashleydcsother00001250000011dnl dnl Process this file with autoconf to produce a configure script. dnl dnl Autoconf setup for {tk|tty|dtk}eden dnl dnl Ashley Ward (ashley@dcs.warwick.ac.uk) June 1999 dnl dnl $Id: configure.in,v 1.20 2001/08/02 16:26:11 cssbz Exp $ dnl dnl ##################################################################### dnl Initial setup dnl ##################################################################### dnl Write this revision information to the created configure script AC_REVISION($Revision: 1.20 $) # Check this file exists to make sure we are in the correct directory AC_INIT(Eden/main.c) dnl C preprocessor symbols get written to this file AC_CONFIG_HEADER(config.h) dnl ##################################################################### dnl Functions for use later on dnl ##################################################################### AC_DEFUN([CF_CHECK_CACHE], [ # # Check if we're accidentally using a cache from a different machine. # Derive the system name, as a check for reusing the autoconf cache. # # If we've packaged config.guess and config.sub, run that (since it does a # better job than uname). # if test -f $srcdir/config.guess ; then AC_CANONICAL_HOST system_name="$host_os" else system_name="`(uname -s -r) 2>/dev/null`" if test -z "$system_name" ; then system_name="`(hostname) 2>/dev/null`" fi fi test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name") AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) test -z "$system_name" && system_name="$cf_cv_system_name" test -n "$cf_cv_system_name" && AC_MSG_RESULT("Configuring for $cf_cv_system_name") if test ".$system_name" != ".$cf_cv_system_name" ; then AC_MSG_RESULT("Cached system name does not agree with actual") AC_ERROR("Please remove config.cache and try again.") fi ])dnl AC_DEFUN([CF_ANSI_CC_CHECK], [ AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) AC_CACHE_VAL(cf_cv_ansi_cc,[ cf_cv_ansi_cc=no cf_save_CFLAGS="$CFLAGS" # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX -Aa -D_HPUX_SOURCE # SVR4 -Xc # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) for cf_arg in "-DCC_HAS_PROTOS" "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -Xc do CFLAGS="$cf_save_CFLAGS $cf_arg" AC_TRY_COMPILE( [ #ifndef CC_HAS_PROTOS #if !defined(__STDC__) || __STDC__ != 1 choke me #endif #endif ],[ int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);};], [cf_cv_ansi_cc="$cf_arg"; break]) done CFLAGS="$cf_save_CFLAGS" ]) AC_MSG_RESULT($cf_cv_ansi_cc) if test "$cf_cv_ansi_cc" != "no"; then if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then CFLAGS="$CFLAGS $cf_cv_ansi_cc" else AC_DEFINE(CC_HAS_PROTOS) fi fi ])dnl dnl ##################################################################### dnl End functions - carry on with the work dnl ##################################################################### # Sanity check CF_CHECK_CACHE # !@!@ Not sure if all of these are required AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL dnl Sets LEX and LEXLIB, to, eg flex and -lfl AC_PROG_LEX dnl Does make set ${MAKE}? Defines @SET_MAKE@ AC_PROG_MAKE_SET dnl Sets RANLIB output variable to 'ranlib' or ':' if it is not found AC_PROG_RANLIB # Find options to use ANSI C CF_ANSI_CC_CHECK # Is the math library OK? AC_CHECK_LIB(m, tan,, AC_MSG_ERROR(can't find math functions)) # Tcl on Linux on PC seems to require -ldl AC_CHECK_LIB(dl, dlerror) ######################################################################### # Compile time switches ######################################################################### AC_ARG_ENABLE(debug, [ --enable-debug enable debugging], [ AC_DEFINE(DEBUG) AC_DEFINE(YYDEBUG) # parser debugging wrapped into general debug now ]) AC_ARG_ENABLE(dcc, [ --enable-dcc enable dcc function for disabling circular checking], [ AC_DEFINE(NO_CHECK_CIRCULAR) ]) AC_ARG_ENABLE(depend, [ --enable-depend enable Makefile source dependency checking], [ DEPEND_MAKEDEFS="include ../depend.mk" ], [ DEPEND_MAKEDEFS="#include ../depend.mk" ]) AC_ARG_ENABLE(disable-sasami, [ --enable-disable-sasami don't try to build the Sasami OpenGL notation], [ AC_MSG_WARN(Disabling Sasami) aw_want_sasami="no" ], [ aw_want_sasami="yes" AC_DEFINE(WANT_SASAMI) ]) AC_ARG_ENABLE(ipc, [ --enable-ipc enable support for Eden IPC functions (send_msg...)], [ AC_DEFINE(ipc) ]) ######################################################################### # X ######################################################################### dnl Sets $X_CFLAGS, $X_LIBS, $X_EXTRA_LIBS, $X_PRE_LIBS AC_PATH_XTRA # Bit of a bodge but I can't think of a better way of detecting Windoz if test "$no_x" = "yes"; then # Probably Windoz AW_X_LIBS="-lGDI32 -lUSER32 -lCOMDLG32 -lKERNEL32" else AW_X_LIBS="-lXt -lX11" if test "$aw_want_sasami" = "yes"; then AW_X_LIBS="$AW_X_LIBS -lXmu -lXext" fi fi ######################################################################### # Run time linker ######################################################################### # The Solaris implementation of dynamic linking means that the run-time # linker needs to know where to locate the (dynamically linked) libraries. # This means when we are linking, for each -L option, we need to pass a # similar -R option. # Apparently some versions of Sun CC require a space after the -R, and # some no space, which seems incredibly dumb. I haven't bothered to check # for this yet though. dnl See the stuff in the AC_PATH_XTRA macro for how to implement a test dnl for this. I can't be bothered at the moment because in order to do it dnl properly it looks like I need to choose a functioning library to test. dnl (And possibly even *run* the test, not just link it to test completely dnl that -R works: note that -R on linux is for something else! Duh!). dnl See /gnu/share/autoconf/acspecific.m4 for AC_PATH_XTRA. AC_MSG_CHECKING(whether we need -R) case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) aw_need_r=yes AC_MSG_RESULT(yes) ;; *) aw_need_r=no AC_MSG_RESULT(no) ;; esac ######################################################################### # curses ######################################################################### # # Prefer "new" curses: ncurses. # # Examples: # bax and holst: /usr/include/ncurses/curses.h: # -I/usr/include/ncurses -L/usr/lib -L/usr/lib/ncurses -lncurses # gem: /gnu/include/ncurses.h: # -I/gnu/include -L/gnu/lib -lncurses # gem: /usr/include/curses.h: # -lcurses # # Possible include directories: /usr/include /gnu/include /usr/local/include # # One of these directories might include # ncurses/curses.h: -Iinc_dir/ncurses -Llib_dir -Llib_dir/ncurses -lncurses # ncurses.h: -Iinc_dir -Llib_dir -lcurses # curses.h: -Iinc_dir -Llib_dir -lcurses # # Everything set up already (eg in LIBS) is not an option as we want # this to apply only to ttyeden. # # Sets Example # CURSES_TYPE curses # CURSES_INCLUDE -I/usr/local/include # CURSES_LIB -lcurses # CURSES_LIB_PATH -L/usr/local/lib # HAVE_CURSES "" # dnl AW_LIB_CURSES2 dnl Don't call this directly - use AW_LIB_CURSES dnl Parameters: dnl $1 include directory to try dnl $2 header filename to look for dnl $3 CURSES_TYPE: curses or ncurses, used for the header file to include dnl $4 CURSES_INCLUDE if it works dnl $5 CURSES_LIB_PATH if it works AC_DEFUN([AW_LIB_CURSES2], [ aw_curses_include_dir=$1 aw_curses_header_look=$2 aw_curses_type=$3 aw_curses_include=$4 aw_curses_lib_path=$5 if test -z "$aw_finished_curses"; then AC_MSG_CHECKING(for ${aw_curses_include_dir}/${aw_curses_header_look}) if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then AC_MSG_RESULT(yes) # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" AC_MSG_CHECKING(whether we can link curses using $LIBS) AC_TRY_LINK( [#include ], [initscr()], [ # Link succeeded LIBS=$aw_save_libs AC_MSG_RESULT(yes) aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type ], [ # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs AC_MSG_RESULT(no) ] ) else AC_MSG_RESULT(no) fi fi ]) dnl AW_LIB_CURSES dnl $1 include directory to try dnl $2 corresponding lib directory AC_DEFUN([AW_LIB_CURSES], [ # Three possible cases # ncurses/curses.h: -Iinc_dir/ncurses -Llib_dir -Llib_dir/ncurses -lncurses # ncurses.h: -Iinc_dir -Llib_dir -lcurses # curses.h: -Iinc_dir -Llib_dir -lcurses if test "$aw_need_r" = "yes"; then # We need the -R for runtime linking # Note this code is repeated below with -R taken away AW_LIB_CURSES2($1, ncurses/curses.h, ncurses, -I$1/ncurses, "-L$2 -L$2/ncurses -R$2 -R$2/ncurses") AW_LIB_CURSES2($1, ncurses.h, ncurses, -I$1, "-L$2 -R$2") AW_LIB_CURSES2($1, curses.h, curses, -I$1, "-L$2 -R$2") else # We don't need the -R option # Note this code is repeated above with -R added AW_LIB_CURSES2($1, ncurses/curses.h, ncurses, -I$1/ncurses, "-L$2 -L$2/ncurses") AW_LIB_CURSES2($1, ncurses.h, ncurses, -I$1, -L$2) AW_LIB_CURSES2($1, curses.h, curses, -I$1, -L$2) fi ]) # See if the user supplied some arguments AC_ARG_WITH(curses-include, [ --with-curses-include=DIR (n)curses include files are in DIR], [ aw_user_supplied_curses_include=$withval # Try and find this with the lib variable unset - the user # should really provide --with-curses-lib as well. AW_LIB_CURSES($aw_user_supplied_curses_include,) ] ) AC_ARG_WITH(curses-lib, [ --with-curses-lib=DIR (n)curses library files are in DIR], [ aw_user_supplied_curses_lib_dir=$withval AW_LIB_CURSES($aw_user_supplied_curses_include, $aw_user_supplied_curses_lib_dir) ] ) # Attempt to guess where it might be AW_LIB_CURSES(/usr/local/include, /usr/local/lib) AW_LIB_CURSES(/gnu/include, /gnu/lib) AW_LIB_CURSES(/usr/include, /usr/lib) # Declare the type of curses found so that we can include the # appropriate header file, and include the curses object in the list # of objects to be built in the appropriate Makefiles if test "$CURSES_TYPE" = "ncurses"; then AC_DEFINE(HAVE_NCURSES) HAVE_CURSES="ncurses" elif test "$CURSES_TYPE" = "curses"; then AC_DEFINE(HAVE_CURSES) HAVE_CURSES="curses" else HAVE_CURSES="" fi # Print results AC_MSG_CHECKING(for curses) AC_MSG_RESULT([$CURSES_TYPE $CURSES_INCLUDE $CURSES_LIB $CURSES_LIB_PATH $CURSES_IF_ENABLED]) ######################################################################### # tcl ######################################################################### # # Sets Example # TCL_INCLUDE -I/usr/local/include # TCL_LIB -L/usr/local/lib -ltcl # AC_DEFUN([AW_CHECK_TCL], [ aw_tcl_include=$1 aw_tcl_lib=$2 if test "$aw_need_r" = "yes"; then # !@!@ This bit should really be an AC function # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_tcl_lib=[`echo $aw_tcl_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'`] fi # If we haven't already found an answer... if test -z "$aw_finished_tcl"; then aw_save_libs=$LIBS LIBS="$aw_tcl_include $aw_tcl_lib $LIBS" AC_MSG_CHECKING(whether we can link tcl using $LIBS) AC_TRY_LINK( [#include ], [Tcl_AsyncReady()], [ # Link succeeded AC_MSG_RESULT(yes) # Don't do any more tests - we have the answer aw_finished_tcl="yes" TCL_INCLUDE=$aw_tcl_include TCL_LIB=$aw_tcl_lib AC_MSG_CHECKING(whether tcl has Tcl_EvalEx) AC_TRY_LINK( [#include ], [ Tcl_Interp *interp; Tcl_EvalEx(interp, "", -1, 0) ], [ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_TCL_EVALEX) ], [ AC_MSG_RESULT(no) ] ) LIBS=$aw_save_libs ], [ # Link failed - do nothing. LIBS=$aw_save_libs AC_MSG_RESULT(no) ] ) fi ]) AC_ARG_WITH(tcl-include, [ --with-tcl-include=compiler options to enable location of tcl.h eg \"-I/usr/local/include\"], [aw_user_tcl_include=$withval] ) AC_ARG_WITH(tcl-lib, [ --with-tcl-lib=linker options to enable location of the tcl library eg \"-L/usr/local/lib -R/usr/local/lib -ltcl\"], [aw_user_tcl_lib=$withval] ) # If the user provided both or either option, then try it first if test -n "$aw_user_tcl_include" -o -n "$aw_user_tcl_lib"; then AW_CHECK_TCL($aw_user_tcl_include, $aw_user_tcl_lib) fi # Else can we use tcl with just -ltcl? AW_CHECK_TCL(, "-ltcl") # Now we're guessing... :) # This works at DCS, University of ÌÇÐÄTV AW_CHECK_TCL("-I/usr/local/include", "-L/usr/local/lib -ltcl") # This works at ITS, University of ÌÇÐÄTV AW_CHECK_TCL(, "-L/usr/local/lib -ltcl8.0") # This works on ride, a Sparc Solaris 7 machine with packages # from sunfreeware.com AW_CHECK_TCL(, "-L/usr/local/lib -ltcl") # I give a warning if tcl is not found at the end of the script ######################################################################### # tk ######################################################################### # # Sets Example # TK_INCLUDE -I/usr/local/include # TK_LIB -L/usr/local/lib -ltk # AC_DEFUN([AW_CHECK_TK], [ aw_tk_include=$1 aw_tk_lib=$2 if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_tk_lib=[`echo $aw_tk_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'`] fi # If we haven't already found an answer... if test -z "$aw_finished_tk"; then aw_save_libs=$LIBS # Also add X stuff and tcl stuff. Existing LIBS must go at the # end: -lm must come after -ltk for example. # NB don't seem to need $AW_X_LIBS and -lglPNG may cause an error LIBS="$aw_tk_include $aw_tk_lib $X_CFLAGS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $TCL_INCLUDE $TCL_LIB $LIBS" AC_MSG_CHECKING(whether we can link tk using $LIBS) AC_TRY_LINK( [#include ], [Tk_GetNumMainWindows();], [ # Link succeeded LIBS=$aw_save_libs AC_MSG_RESULT(yes) # Don't do any more tests - we have the answer aw_finished_tk="yes" TK_INCLUDE=$aw_tk_include TK_LIB=$aw_tk_lib ], [ # Link failed - do nothing. LIBS=$aw_save_libs AC_MSG_RESULT(no) ] ) fi ]) AC_ARG_WITH(tk-include, [ --with-tk-include=compiler options to enable location of tk.h eg \"-I/usr/local/include\"], [aw_user_tk_include=$withval] ) AC_ARG_WITH(tk-lib, [ --with-tk-lib=linker options to enable location of the tk library eg \"-L/usr/local/lib -R/usr/local/lib -ltk\"], [aw_user_tk_lib=$withval] ) # If the user provided both or either option, then try it first if test -n "$aw_user_tk_include" -o -n "$aw_user_tk_lib"; then AW_CHECK_TK($aw_user_tk_include, $aw_user_tk_lib) fi # Else can we use tk with just -ltk? AW_CHECK_TK(, "-ltk") # Now we're guessing... :) # This works at DCS, University of ÌÇÐÄTV AW_CHECK_TK("-I/usr/local/include", "-L/usr/local/lib -ltk") # This works at ITS, University of ÌÇÐÄTV AW_CHECK_TK(, "-L/usr/local/lib -ltk8.0") # This works on ride, a Sparc Solaris 7 machine with packages from # sunfreeware.com AW_CHECK_TK(, "-L/usr/local/lib -ltk8.2") # I give a warning if tk is not found at the end of the script ######################################################################### # Readline ######################################################################### # # Sets Example # READLINE_INCLUDE -I/gnu/include/readline # READLINE_LIB -L/gnu/lib -R/gnu/lib -lreadline # AC_DEFUN([AW_CHECK_READLINE], [ aw_readline_include=$1 aw_readline_lib=$2 if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_readline_lib=[`echo $aw_readline_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'`] fi # If we haven't already found an answer... if test -z "$aw_finished_readline"; then aw_save_libs=$LIBS # Need curses as well as the supplied settings LIBS="$aw_readline_include $aw_readline_lib $CURSES_INCLUDE $CURSES_LIB_PATH $CURSES_LIB $LIBS" AC_MSG_CHECKING(whether we can link readline using $LIBS) AC_TRY_LINK( [ #include #include #include ], [readline("test");], [ # Link succeeded LIBS=$aw_save_libs AC_MSG_RESULT(yes) # Don't do any more tests - we have the answer aw_finished_readline="yes" READLINE_INCLUDE=$aw_readline_include READLINE_LIB=$aw_readline_lib ], [ # Link failed - do nothing. LIBS=$aw_save_libs AC_MSG_RESULT(no) ] ) fi ] ) AC_ARG_WITH(readline-include, [ --with-readline-include=compiler options to enable location of GNU readline header files eg \"-I/gnu/include/readline\"], [aw_user_readline_include=$withval] ) AC_ARG_WITH(readline-lib, [ --with-readline-lib=linker options to enable location of the GNU readline library eg \"-L/gnu/lib -R/gnu/lib -lreadline\"], [aw_user_readline_lib=$withval] ) # If the user provided both or either option, then try it first if test -n "$aw_user_readline_include" -o -n "$aw_user_readline_lib"; then AW_CHECK_READLINE($aw_user_readline_include, $aw_user_readline_lib) fi # Else can we use readline with just -lreadline? AW_CHECK_READLINE(, "-lreadline") # Now we're guessing... :) # This works on cygwin AW_CHECK_READLINE("-I/usr/include/readline", "-L/usr/lib -lreadline") # This works at DCS, University of ÌÇÐÄTV AW_CHECK_READLINE("-I/gnu/include/readline -I/gnu/include", "-L/gnu/lib -R/gnu/lib -lreadline") # This works on a newly installed Solaris 7 machine with standard GNU install AW_CHECK_READLINE("-I/usr/local/include/readline", "-L/usr/local/lib -R/usr/local/lib -lreadline") # If we found an answer, then we HAVE_READLINE if test -n "$aw_finished_readline"; then AC_DEFINE(HAVE_READLINE) fi ######################################################################### # OpenGL ######################################################################### # # Sets Example # OPENGL_INCLUDE -I/usr/openwin/include # OPENGL_LIB -L/usr/openwin/lib -R/usr/openwin/lib -lGL AC_DEFUN([AW_CHECK_GL], [ aw_gl_include=$1 aw_gl_lib=$2 if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_gl_lib=[`echo $aw_gl_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'`] fi # If we haven't already found an answer... if test -z "$aw_finished_gl"; then aw_save_libs=$LIBS # Debian seems to require -lm... LIBS="$aw_gl_include $aw_gl_lib -lm" AC_MSG_CHECKING(whether we can link GL using $LIBS) # !@!@ should put a test for the Solaris GL implementation in here, # because I can't get it to use the correct colormap on 8-bit GFX # hardware: the workaround is to use Mesa instead AC_TRY_LINK( [ #include ], [glLoadIdentity();], [ # Link succeeded LIBS=$aw_save_libs AC_MSG_RESULT(yes) # Don't do any more tests - we have the answer aw_finished_gl="yes" OPENGL_INCLUDE=$aw_gl_include OPENGL_LIB=$aw_gl_lib ], [ # Link failed - do nothing. LIBS=$aw_save_libs AC_MSG_RESULT(no) ] ) fi ] ) AC_ARG_WITH(gl-include, [ --with-gl-include=compiler options to enable location of GL header files eg \"-I/usr/openwin/include\"], [aw_user_gl_include=$withval] ) AC_ARG_WITH(gl-lib, [ --with-gl-lib=linker options to enable location of the GL library eg \"-L/usr/openwin/lib -R/usr/openwin/lib -lGL\"], [aw_user_gl_lib=$withval] ) if test "$aw_want_sasami" = "yes"; then # We want to build Sasami - so figure out OpenGL # If the user provided both or either option, then try it first if test -n "$aw_user_gl_include" -o -n "$aw_user_gl_lib"; then AW_CHECK_GL($aw_user_gl_include, $aw_user_gl_lib) fi # Else can we use GL with just -lGL? AW_CHECK_GL(, "-lGL") else OPENGL_INCLUDE="" OPENGL_LIB="" fi ######################################################################### # PNG library ######################################################################### # # Sets Example # PNG_INCLUDE -I/usr/local/include # PNG_LIB -L/usr/local/lib -R/usr/local/lib -lpng AC_DEFUN([AW_CHECK_PNG], [ aw_png_include=$1 aw_png_lib=$2 if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_png_lib=[`echo $aw_png_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'`] fi # If we haven't already found an answer... if test -z "$aw_finished_png"; then aw_save_libs=$LIBS # -lpng needs -lm LIBS="$aw_png_include $aw_png_lib -lm" AC_MSG_CHECKING(whether we can link png using $LIBS) AC_TRY_LINK( [ #include ], [ png_structp png; png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); ], [ # Link succeeded LIBS=$aw_save_libs AC_MSG_RESULT(yes) # Don't do any more tests - we have the answer aw_finished_png="yes" PNG_INCLUDE=$aw_png_include PNG_LIB=$aw_png_lib ], [ # Link failed - do nothing. LIBS=$aw_save_libs AC_MSG_RESULT(no) ] ) fi ] ) AC_ARG_WITH(png-include, [ --with-png-include=compiler options to enable location of PNG header files eg \"-I/usr/local/include\"], [aw_user_png_include=$withval] ) AC_ARG_WITH(png-lib, [ --with-png-lib=linker options to enable location of the PNG library eg \"-L/usr/local/lib -R/usr/local/lib -lpng\"], [aw_user_png_lib=$withval] ) if test "$aw_want_sasami" = "yes"; then # We want to build Sasami - so figure out PNG # If the user provided both or either option, then try it first if test -n "$aw_user_png_include" -o -n "$aw_user_png_lib"; then AW_CHECK_PNG($aw_user_png_include, $aw_user_png_lib) fi # Else can we use PNG with just -lpng? AW_CHECK_PNG(, "-lpng") # Try this... AW_CHECK_PNG("-I/usr/local/include", "-L/usr/local/lib -lpng") else PNG_INCLUDE="" PNG_LIB="" fi ######################################################################### # Memory alignment ######################################################################### # I could use the gcc __alignof__ function, but then this would # restrict us to using gcc only. So we attempt to detect the alignment # required instead. AC_MSG_CHECKING(how doubles should be aligned) AC_TRY_RUN( [ #include struct foo { union align { double d; long l; void *p; } u; char c; }; int main() { struct foo f[2]; FILE *fp; int n; if ((fp = fopen("conftestalignoutput", "w")) == NULL) exit(1); if( 2*sizeof(union align) != sizeof(f) ) { n = fprintf(fp, "%ld\n", (long)(sizeof(struct foo) - sizeof(union align))); } else { n = fprintf(fp, "%ld\n", (long)sizeof(union align)); } /* If fprintf didn't complete successfully, exit code 1 */ if (n < 0) exit(1); if (fclose(fp) != 0) exit(1); /* All OK - exit code 0 */ exit(0); } ], [ # The code compiled, linked, executed and had exit code 0, # so we can read the alignment value written to the temporary # file. aw_alignment=`cat conftestalignoutput` AC_DEFINE_UNQUOTED(DOUBLE_ALIGNMENT, $aw_alignment) AC_MSG_RESULT($aw_alignment byte boundaries) ], [ # The test failed in some way, so assume the worst. AC_DEFINE(DOUBLE_ALIGNMENT, sizeof(double)) AC_MSG_RESULT([sizeof(double) byte boundaries]) ], [ # We are cross compiling so can't run the test, so we # assume the worst. AC_DEFINE(DOUBLE_ALIGNMENT, sizeof(double)) AC_MSG_RESULT([sizeof(double) byte boundaries]) ] ) ######################################################################### # dmalloc (tool for checking for memory leaks etc) ######################################################################### # I'm trusting the user to get this right, so no checks are done to see # if the arguments provided are correct. If they want to run it with a # memory debugger, they should know what they are doing... I hope. DMALLOC_INCLUDE= DMALLOC_LIB= AC_ARG_WITH(dmalloc-include, [ --with-dmalloc-include=DIR dmalloc include file is in DIR], [ AC_DEFINE(HAVE_DMALLOC) DMALLOC_INCLUDE=-I$withval ] ) AC_ARG_WITH(dmalloc-lib, [ --with-dmalloc-lib=DIR dmalloc lib file is in DIR], [ AC_DEFINE(HAVE_DMALLOC) DMALLOC_LIB="-L$withval -ldmalloc" ] ) ######################################################################### # Other bits ######################################################################### # Do we have ANSI C header files? Declares STDC_HEADERS if we do. Also # (undocumented) sets $ac_cv_header_stdc to "yes". dnl AC_HEADER_STDC dnl if test "$ac_cv_header_stdc" != "yes"; then dnl AC_MSG_ERROR(we don't have ANSI C header files) dnl fi # Check other headers and stop if we can't find them # Might define HAVE_MALLOC_H AC_CHECK_HEADER(malloc.h,, AC_MSG_ERROR(can't find malloc.h)) # Might define HAVE_SYS_TIME_H AC_CHECK_HEADER(sys/time.h,, AC_MSG_ERROR(can't find sys/time.h)) # Define const to be empty if the compiler does not support it AC_C_CONST # Deal with problems due to two header files time.h and sys/time.h # Might define TIME_WITH_SYS_TIME AC_HEADER_TIME # Might define TM_IN_SYS_TIME, "which means that including sys/time.h # had better define struct tm." (from Autoconf manual - huh?). AC_STRUCT_TM # Check for how to get alloca. Might defined HAVE_ALLOCA_H, HAVE_ALLOCA, # ALLOCA, C_ALLOCA... AC_FUNC_ALLOCA # Find out what a signal handler should return AC_TYPE_SIGNAL # Check other functions and stop if we can't find them AC_CHECK_FUNC(gettimeofday,, AC_MSG_ERROR(don't have gettimeofday)) AC_CHECK_FUNC(putenv,, AC_MSG_ERROR(don't have putenv)) AC_CHECK_FUNC(select,, AC_MSG_ERROR(don't have select)) AC_CHECK_FUNC(strdup,, AC_MSG_ERROR(don't have strdup)) ######################################################################### # Create the Makefiles ######################################################################### # Substitute the following variables in the Makefiles AC_SUBST(AW_X_LIBS) AC_SUBST(CURSES_TYPE) AC_SUBST(CURSES_INCLUDE) AC_SUBST(CURSES_LIB) AC_SUBST(CURSES_LIB_PATH) AC_SUBST(TCL_INCLUDE) AC_SUBST(TCL_LIB) AC_SUBST(TK_INCLUDE) AC_SUBST(TK_LIB) AC_SUBST(DMALLOC_INCLUDE) AC_SUBST(DMALLOC_LIB) AC_SUBST(READLINE_INCLUDE) AC_SUBST(READLINE_LIB) AC_SUBST(OPENGL_INCLUDE) AC_SUBST(OPENGL_LIB) AC_SUBST(PNG_INCLUDE) AC_SUBST(PNG_LIB) AC_SUBST(DEPEND_MAKEDEFS) # Done - write the output Makefiles AC_OUTPUT(generic.mk Misc/Makefile Eden/Makefile EX/Makefile Scout/Makefile Makefile Donald/Makefile LSD/Makefile Sasami/Makefile) # Give warnings if test -z "$aw_want_sasami"; then AC_MSG_WARN(Cannot build Sasami - only possible on Windoz presently) fi if test -z "$aw_finished_tcl"; then AC_MSG_WARN(Could not locate tcl - can probably only build ttyeden) fi if test -z "$aw_finished_tk"; then AC_MSG_WARN(Could not locate tk - can probably only build ttyeden) fi if test -z "$aw_finished_readline"; then AC_MSG_WARN(Could not locate readline - ttyeden will not have line editing) fi if test -z "$HAVE_CURSES"; then AC_MSG_WARN(Could not locate curses - probably cannot build ttyeden) fi if test -z "$aw_finished_gl"; then AC_MSG_WARN(Could not locate GL - probably cannot build Sasami) fi if test -z "$aw_finished_png"; then AC_MSG_WARN(Could not locate PNG - probably cannot build Sasami) fi AC_MSG_WARN(Type 'make' for further instructions) e_include, $aw_user_readline_lib) fi # Else can we use readline with just -lreadline? AW_CHECK_READLINE(, "-lreadline") # Now we're guessing... :) # This works on cygwin AW_CHECK_READLINE("-I/usr/include/readline", "-L/usr/lib -lreadline") # This works at DCS, University of ÌÇÐÄTV AW_CHECK_READLINE("-I/gnu/include/readline -I/gnu/include", "tkeden1.32/cscope010070000025250000147000000026740735441324000152340ustar00ashleydcsother00001250000011#!/bin/sh # # cscope # # $Id: cscope,v 1.7 2001/09/26 17:55:44 cssbz Exp $ # # Ashley Ward, April 1999 # # Call cscope (a program by Sun - sort of an intelligent front end to # grep) with the right sort of settings for tkeden. # # This is of course, only of some use on a Sun platform which has the cscope # tool installed :) # # Name of temporary file to use - uses the PID of this shell to make the # name unique. TEMPFILE=/var/tmp/cscope.ash.$$ # Create the temporary file. Actually a little bit of shell so we can call # emacsclient with the correct arguments (can't set EDITOR to # 'emacsclient someargs' unfortunately). Note need to escape the $* # (which means all arguments passed to this shell). The sleep is so that # we have time to see any error messages. cat > $TEMPFILE < main.o main.d : main.c defs.h. %.d: %.c set -e; $(CC) -M $(CPPFLAGS) $(ALLCFLAGS) $< \ | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ [ -s $@ ] || rm -f $@ # Make all the .d files depend: $(DEPENDS) # Include all the .d files here to give make knowledge of source dependencies # but not if the macro INHIBIT_DEPEND is set to something (set this in the # call to make using something like make INHIBIT_DEPEND=y generate) ifeq (,$(INHIBIT_DEPEND)) include $(DEPENDS) endif tkeden1.32/generic.mk.in010060000025250000147000000055210733204527600164060ustar00ashleydcsother00001250000011# (Note generic.mk is generated automatically from generic.mk.in by configure) # # $Id: generic.mk.in,v 1.1 2001/08/01 18:30:21 cssbz Exp $ # # This Makefile snippet is included from other Makefiles, one for almost each # subdirectory in the distribution. SHELL=/bin/sh AR = ar ARFLAGS = cq INSTALL = install CC = @CC@ CPP = @CPP@ CONF_CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ DEFS = @DEFS@ X_CFLAGS = @X_CFLAGS@ RANLIB = @RANLIB@ AW_X_LIBS = @AW_X_LIBS@ CURSES_TYPE = @CURSES_TYPE@ CURSES_INCLUDE = @CURSES_INCLUDE@ CURSES_LIB_PATH = @CURSES_LIB_PATH@ TCL_INCLUDE = @TCL_INCLUDE@ TK_INCLUDE = @TK_INCLUDE@ DMALLOC_INCLUDE = @DMALLOC_INCLUDE@ READLINE_INCLUDE = @READLINE_INCLUDE@ OPENGL_INCLUDE = @OPENGL_INCLUDE@ PNG_INCLUDE = @PNG_INCLUDE@ # Explicitly set the SUFFIXES list in case it already has a silly setting .SUFFIXES: .SUFFIXES: .c .o # Implicit rule to make .o files from .c files .c.o: $(CC) -c $(CPPFLAGS) $(ALLCFLAGS) $< -o $@ # CFLAGS should go at the end here, so the user is free to define # CFLAGS and override any of our settings ALLCFLAGS = -g -D$(VARIANT) \ $(CURSES_INCLUDE) $(TCL_INCLUDE) $(TK_INCLUDE) \ $(DMALLOC_INCLUDE) $(READLINE_INCLUDE) $(OPENGL_INCLUDE) \ $(DEFS) $(X_CFLAGS) $(CONF_CFLAGS) $(CFLAGS) PARSER_SKEL = ../bison/bison.simple PARSER_OBJ = $(PARSER_OUT:.c=.o) LEXER_OUT = $(NOTATION_PREFIX)$(LEXER_SOURCE) SOURCES += $(PARSER_OUT) $(LEXER_OUT) OBJS = $(SOURCES:.c=.o) # This is used in depends.mk and in the clean targets below DEPENDS = $(SOURCES:.c=.d) default: $(LIB) $(LIB): $(OBJS) -rm -f $@ $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ # We definately have to use bison, not yacc, as we use BISON_SIMPLE # Make bison use st as the output prefix to avoid clashing with the # other parsers. --name-prefix doesn't seem to work on ARMLinux, using # -p instead. If NOTATION_PREFIX is blank, don't do the -p option. $(PARSER_OUT): $(PARSER_SOURCE) $(PARSER_SKEL) if test -z "$(NOTATION_PREFIX)"; \ then BISON_SIMPLE=$(PARSER_SKEL) \ bison --defines -o $@ $(PARSER_SOURCE); \ else BISON_SIMPLE=$(PARSER_SKEL) \ bison -p $(NOTATION_PREFIX) \ --defines -o $@ $(PARSER_SOURCE); fi # Bison's -p fails to translate the yyrestart name, so do it here... $(PARSER_OBJ): $(PARSER_OUT) $(CC) -c $(CPPFLAGS) $(ALLCFLAGS) \ -Dyyrestart=$(NOTATION_PREFIX)restart $(PARSER_OUT) \ -o $@ # Make the generated sources generate: $(PARSER_OUT) $(LEXER_OUT) $(LEXER_OUT): $(LEXER_SOURCE) sed -e 's/yy/$(NOTATION_PREFIX)/g' \ -e 's/YY/Y$(NOTATION_PREFIX)/g' \ $(LEXER_SOURCE) > $(LEXER_OUT) clean: -rm $(LIB) $(OBJS) # Even remove the generated sources reallyclean: -rm $(LIB) $(OBJS) $(PARSER_OUT) $(PARSER_HEADERS_OUT) \ $(LEXER_OUT) $(DEPENDS) # Include a Makefile giving instructions about dependencies if enabled by # passing --enable-depend to ./configure @DEPEND_MAKEDEFS@ = @CPP@ CONF_CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ DEFS = @DEFS@ X_CFLAGS = @X_CFLAGS@ RANLIB = @RANLIB@ AW_X_LIBS = @AW_X_LIBS@ CURSES_TYPE = @CURSES_TYPE@ CURSEStkeden1.32/install-sh010070000025250000147000000112450727406554000160370ustar00ashleydcsother00001250000011#! /bin/sh # # install - install a program, script, or datafile # This comes from X11R5. # # 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. # # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 tkeden1.32/Makefile.in010060000025250000147000000170220736260453300161000ustar00ashleydcsother00001250000011# # $Id: Makefile.in,v 1.25 2001/10/15 16:05:47 cssbz Exp $ # SHELL=/bin/sh # configure will replace the following non-comment line with 'MAKE=make' if # the make utility being used does not support $(MAKE) (!). # The $(MAKE) macro is used to recursively call make (see the 'clean' target # for an example). @SET_MAKE@ CC = @CC@ CPPFLAGS = @CPPFLAGS@ INSTALL = install LDFLAGS = @LDFLAGS@ TCL_LIB = @TCL_LIB@ TK_LIB = @TK_LIB@ CURSES_LIB = @CURSES_LIB@ CURSES_LIB_PATH = @CURSES_LIB_PATH@ READLINE_LIB = @READLINE_LIB@ LIBS = @LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ X_LIBS = @X_LIBS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ AW_X_LIBS = @AW_X_LIBS@ DMALLOC_LIB = @DMALLOC_LIB@ OPENGL_LIB = @OPENGL_LIB@ PNG_LIB = @PNG_LIB@ # !@!@ This still needs installation and distribution targets. Perhaps also # make depends. ######################################################################## # Add any C compiler options that *must* be used at the start of the # definition here, so the user is free to define CFLAGS and override # any of our settings ALLCFLAGS = $(CFLAGS) EDENOBJS = Eden/libeden.a MISCOBJS = Misc/libmisc.a DONALDOBJS = Donald/libdonald.a EXOBJS = EX/libex.a SCOUTOBJS = Scout/libscout.a LSDOBJS = LSD/liblsd.a SASAMIOBJS = Sasami/libsasami.a TKEDENOBJS = $(EDENOBJS) $(MISCOBJS) $(DONALDOBJS) $(SASAMIOBJS) $(EXOBJS) \ $(SCOUTOBJS) DTKEDENOBJS = $(EDENOBJS) $(MISCOBJS) $(DONALDOBJS) $(SASAMIOBJS) $(EXOBJS) \ $(SCOUTOBJS) $(LSDOBJS) TTYEDENOBJS = $(EDENOBJS) $(MISCOBJS) default: help help:: @echo "Compiling a tkeden variant:" @echo "Use make tkeden, make dtkeden or make ttyeden." @echo "Important note: do make clean between making variants." @echo "" # tkeden uses Tcl, Tk and X but doesn't use curses # Note: double colon used here with no dependencies to always force these # actions to be performed. # Note: the link line must be in this order - for item A to be able to # reference item B, they must be specified in the order A B. # OPENGL_LIB must come before X_LIBS if we are to get the specified GL lib. tkeden:: cd Eden; VARIANT=TKEDEN $(MAKE) libeden.a cd Misc; VARIANT=TKEDEN $(MAKE) libmisc.a cd Donald; VARIANT=TKEDEN $(MAKE) libdonald.a cd EX; VARIANT=TKEDEN $(MAKE) libex.a cd Scout; VARIANT=TKEDEN $(MAKE) libscout.a cd Sasami; VARIANT=TKEDEN $(MAKE) libsasami.a $(CC) -o $@ $(ALLCFLAGS) $(LDFLAGS) $(TKEDENOBJS) $(TK_LIB) $(TCL_LIB) $(OPENGL_LIB) $(X_LIBS) $(X_PRE_LIBS) $(PNG_LIB) $(AW_X_LIBS) $(X_EXTRA_LIBS) $(LIBS) $(DMALLOC_LIB) nothing.c # dtkeden uses Tcl, Tk and X but doesn't use curses (same as tkeden) # Almost all the code needs compiling specially with -DDISTRIB, except the # code in Misc. Additionally, LSD must be made. dtkeden:: cd Eden; VARIANT=DISTRIB $(MAKE) libeden.a cd Misc; VARIANT=DISTRIB $(MAKE) libmisc.a cd Donald; VARIANT=DISTRIB $(MAKE) libdonald.a cd EX; VARIANT=DISTRIB $(MAKE) libex.a cd Scout; VARIANT=DISTRIB $(MAKE) libscout.a cd LSD; VARIANT=DISTRIB $(MAKE) liblsd.a cd Sasami; VARIANT=DISTRIB $(MAKE) libsasami.a $(CC) -o $@ $(ALLCFLAGS) $(LDFLAGS) $(DTKEDENOBJS) $(TK_LIB) $(TCL_LIB) $(OPENGL_LIB) $(X_LIBS) $(X_PRE_LIBS) $(PNG_LIB) $(AW_X_LIBS) $(X_EXTRA_LIBS) $(LIBS) $(DMALLOC_LIB) nothing.c # ttyeden uses curses and readline, but not Tcl, Tk or X ttyeden:: cd Eden; VARIANT=TTYEDEN $(MAKE) libeden.a cd Misc; VARIANT=TTYEDEN $(MAKE) libmisc.a $(CC) -o $@ $(ALLCFLAGS) $(LDFLAGS) $(TTYEDENOBJS) $(CURSES_LIB_PATH) $(READLINE_LIB) $(CURSES_LIB) $(LIBS) $(DMALLOC_LIB) nothing.c DIRS = Eden Misc EX Scout Donald LSD Sasami # create the generated sources (using bison etc)... generate:: TOP=`pwd`; \ for DIR in $(DIRS); do cd $$TOP/$$DIR; \ $(MAKE) INHIBIT_DEPEND=y generate; done # clean and reallyclean do not remove the compiled executables # ttyeden, tkeden etc, as the new system requires the compiler to do a # 'make clean' between making variants. clean:: TOP=`pwd`; \ for DIR in $(DIRS); do cd $$TOP/$$DIR; \ $(MAKE) INHIBIT_DEPEND=y clean; done # reallyclean removes the generated (by bison etc) sources as well reallyclean:: TOP=`pwd`; \ for DIR in $(DIRS); do cd $$TOP/$$DIR; \ $(MAKE) INHIBIT_DEPEND=y reallyclean; done # Create a totally clean source directory that someone would want to # receive :). Leave the platform-independent generated sources in, # though (so the receiver doesn't have to have bison etc). maintainerclean:: TOP=`pwd`; \ for DIR in $(DIRS); do cd $$TOP/$$DIR; \ $(MAKE) INHIBIT_DEPEND=y clean; rm Makefile; done -rm -r tkeden ttyeden dtkeden tkeden.exe dtkeden.exe \ config.cache config.log \ config.status config.h cscope.out Makefile \ core Windist eden-* generic.mk */cscope.out \ *~ */*~ */*.d */TAGS @echo "" @echo "Suggest you check the list in MAKING.A.RELEASE" @echo "" # Make all the .d (dependency) files. TKEDEN is the most common case: # avoiding using DISTRIB as it causes problems if making tkeden. depend:: TOP=`pwd`; \ for DIR in $(DIRS); do cd $$TOP/$$DIR; \ VARIANT=TKEDEN $(MAKE) INHIBIT_DEPEND=y depend; done # Use this target to record the state of the files when you make a # release. The version number is read from version.h, and translated # (cvs tags must start with a letter and not contain any periods, so # 1.21 -> Rel-1-21). Then we remove any existing tags in cvs with # that name (as cvs won't automatically move tags to more recent # versions in the circumstance where we do setcvstag more than once). # Then we get cvs to recursively tag each file. Tags make it easy in # the future to see which version of a file is in use, given a # particular release number. Use 'cvs status -v filename' to query # the tags on a particular file, or view the information on cvsweb. # Note this target is all one long line. setcvstag:: VERSION=Rel-`grep '#define TKEDEN_VERSION ' version.h | \ awk -F'"' '{print $$2}' | sed 's/\./-/g'`; \ echo Removing any $$VERSION tags from cvs...; \ cvs tag -d $$VERSION .; \ echo Tagging everything with $$VERSION; \ cvs tag $$VERSION . # Re-generate each Makefile from its Makefile.in, as long as configure has # been run. make:: ./config.status # Make a directory with just the files required for a Windoz binary # distribution. Use 'cygcheck tkeden.exe' to find which DLLs to copy. windist:: rm -rf Windist mkdir -p Windist/share/tcl8.0 Windist/Docs cp -R /cygdrive/c/cygwin/bin/cygwin1.dll \ /cygdrive/c/cygwin/bin/cygpng2.dll \ /cygdrive/c/cygwin/bin/cygz.dll \ /cygdrive/c/cygwin/bin/cygtcl80.dll \ /cygdrive/c/cygwin/bin/cygtk80.dll \ /cygdrive/c/cygwin/bin/cygncurses5.dll \ /cygdrive/c/cygwin/bin/cygreadline4.dll \ lib-tkeden tkeden.exe ttyeden.exe Windist cp ttyeden.exe Windist cp /usr/share/tcl8.0/init.tcl Windist/share/tcl8.0 cp /usr/share/tcl8.0/word.tcl Windist/share/tcl8.0 cp /usr/share/tcl8.0/tclIndex Windist/share/tcl8.0 cp -R /usr/share/tk8.0 Windist/share ./Windows/unix2dos.sh Docs/CHANGE.LOG Windist/Docs/CHANGE.LOG ./Windows/unix2dos.sh Docs/COPYING.TXT Windist/Docs/COPYING.TXT ./Windows/unix2dos.sh Docs/GPL.TXT Windist/Docs/GPL.TXT ./Windows/unix2dos.sh Docs/LICENSE_GLPNG.TXT Windist/Docs/LICENSE_GLPNG.TXT ./Windows/unix2dos.sh Docs/LICENSE_TOGL.TXT Windist/Docs/LICENSE_TOGL.TXT ./Windows/unix2dos.sh Docs/README.TXT Windist/Docs/README.TXT ./Windows/unix2dos.sh Docs/TODO Windist/Docs/TODO strip Windist/tkeden.exe Windist/ttyeden.exe rm -rf Windist/lib-tkeden/CVS rm -rf Windist/share/tk8.0/demos VERSION=`grep '#define TKEDEN_VERSION ' version.h | \ awk -F'"' '{print $$2}'`; \ ln -s Windist eden-$${VERSION}; \ rm eden-$${VERSION}.zip; \ zip -T9r eden-$${VERSION}.zip eden-$${VERSION} tkeden1.32/nothing.c010060000025250000147000000001550727406556000156470ustar00ashleydcsother00001250000011/* * This is a dummy empty file to satisfy some compilers' demand for * at least one file to link with */ tkeden1.32/version.h010060000025250000147000000022520737050764100156710ustar00ashleydcsother00001250000011/* * $Id: version.h,v 1.22 2001/10/15 16:06:09 cssbz Exp $ */ /* This is the version number of the entire {tty|tk|dtk}eden package, which must be incremented whenever a release is given out for use. This number is centrally defined here, so it only needs to be changed once here. The version number can contain letters as well as numbers, but no spaces. [Ash] */ #define TKEDEN_VERSION "1.32" #define TKEDEN_VERSION_MAX_LEN 10 #if defined DISTRIB #define TKEDEN_VARIANT "dtkeden" #elif defined TTYEDEN #define TKEDEN_VARIANT "ttyeden" #elif defined TKEDEN #define TKEDEN_VARIANT "tkeden" #else #error Variant not defined #endif #define TKEDEN_VARIANT_MAX_LEN 10 #define TKEDEN_WEB_SITE "http://www.dcs.warwick.ac.uk/modelling/" #define TKEDEN_WEB_SITE_MAX_LEN 60 /* [Ben] Set the version number of the Win32 port */ /* [Ben] Check for Win32 */ #ifndef __WIN32__ # if defined(_WIN32) || defined(WIN32) # define __WIN32__ # endif #endif #define TKEDEN_WIN32_VERSION_MAX_LEN 10 #ifdef __WIN32__ #define TKEDEN_WIN32_VERSION "0.6" #else #define TKEDEN_WIN32_VERSION "0.0" /* 0.0 indicates that this is not a WIN32 version */ #endif tkeden1.32/Windows/004070000025250000147000000000000735463305000154615ustar00ashleydcsother00001250000011tkeden1.32/Windows/cygwinX11.tar.gz010060000025250000147000001104700731247167600204140ustar00ashleydcsother00001250000011‹¾s*;cygwinX11.tarä~ó'Úí^û¢ß‡Ûí‹AÿuD¿«Ï7í‹ö`ÐëtûýÀ/úoXÿÏV ?yšy cßxé!à§ÿÿO}aý?þÔ1`µÛƒ^ï•õïu/XóÁ Û†?N·ƒô³öŸª•úü?_ÿ?4Ù¿<ºQ˜FI&òã ü¡õÄœƒ»¼üØþô±=`NÿÇ>ü°_Å‘_böàûØl~üøN„" í¢„eÎÙ³·Ñ3KOiÆ,_ypbYÄ6œå)߲͉yqß“œ(ì;± ·|ǹi~·E±œ~†Qþ矦ŧDìs>]^àÀ#±™°ñ¿ry˜17Jâ(!UZìÖ;…^²ÅÒÔó o–¥­¦nir˜MÃ4YžqíØšû‡0 ¢ý©Å\ï¸IÄvÏ+‚>4›ì•Ï0ر«²ÑÙ’§ŠœÍ`ňŠõvèþ²vgÍï Æ(inž@Àgò_³ä{d”ÿ6¿ã!„Šô“¢<ñ¹ŒÖÙ)æ(<S±a3l•Çéè§¿±: ~²`£Ä{ö6·¡“(ÌlÈx9z± “W`s“å5œj©Èü™ŸV§ãO¯Mbõ×W‘Ã,zó³Hs/°æo¬Å‘ŸC¦g¨—m‘àwêÐc?à¦/?Cd€÷Kpk ¸uרh<™Î§¸V@ýÇ»ðÓyU?í:j ôNˆÅa'C¢ü ã.<0/3eÝyèØK@€ÒR’µñü¯û$Ê!äÇä%ÌÝ„{—×lÀéñTp^¸Wˆa¦ŽÊÔ ó„I嘖ޛ(Ùòä¿çw‡ÒTtD€´³‹>×ú¤,†¿ðܬmKE|=QKû-‡ %”ç¾JË` +Ø×ã'œ©c¦aœg8TScíœWJU™eeU1;n ÈŒAM!Ãðt—Dx ŸÖ°cÌi{ávlÖ¹æ™f©Š‚Ý¥Œj‹8Ãmg‰I¼ Â+"®ò,ƒÉ×¼Z‹RøsÒÊk~Ĭ39½"PÇ[nRÊûYˆªÍ]y`ŒyMAÂÙ["á& ^1 U’ÿG? ’L8Œ¸ÃÞ&ð€ÒäBL:"ðô»Gsy)ã| ö:OoJÚ{@â%{Ê"SLÌÕŠApúW.’ÀL™ººøQ¸£Ä3>)Zæ™@e–tAU`/·g¬za/U˜¿:³¿ý­ý’BƒÂ÷Rn’8&‰t¦š˜NÆ’DD]“h\F SPϤ™qï‰×iú&Úî·c°Á«D7B‡/êª;5i—u¢NèS¨[#rÀâ¢^È©õëDQ¦ûÎZ^8BVpa±×·÷®\•¸‘å‰ï2àèÀE5æXƒn•%¹Ÿ$ð_¸(šdDñ_ò­H¸o®Šsi Ë7éëò>½BiI•^jÚž‚¾9 Ecš^ôÚ\;¦íuX§2­¿xyRÆc“ œž"ÉØÚÓ÷ê’ø-ælß²àýþ(ÉŠyZQ¢y.J`Jå…h×8^°ò·mH9XØ|xX›‚’ÓÄke¢j8"Þh‹ÛÞÞy’D‰¼V'<†ót0CŽ4FçLpi4ºçâI£Ñ;B~. ÑØáDƒ/ì¢Á—öÚOCXóO6l‘g†Ó®l-Àqìš5œr†°¸ñAø©Æ9å4!&k`ïÌ^R8å: N•êS¥%vÛuœÙuj¿@¡$éÜÚÛ£ÃwMÃÇ"Ü<¥9fÃÕšö6@û˜óËEl#ö{ŽÅM/¤Â™ÜÕßіøùâÑÎ<¨>'ླ§É±ç˪³…µ÷<2ªSý3çÉI“-LER<&pó?y‰ˆ =þÊOï±î⽬vmHäûoH0*iU «ƒØa³r²‘ÿµD8ïLWJ\§ÄÝF[§Dt-D§Dô,D·Dô-D¯D ,D¿D\¼# ksÚÁ#n. *{x•¸U4juL•ÚÁ–FÒëWIepN1Õƒ|:£ÆÀrHQ\j¹ÕÑܸ?)[ÇÓpË_ ñ«˜Zú¥5ªS1´†w+vÖð^ÅÌÞ¯XYÃ#kø…tcéOÚ“‹ó/“0„ã=»pvm‚z†ŒÖ¢ãOI”ÕØ ¢gÛ=uºW,÷å» ÎðªOUœáXN»Š4œËqªHÃÁ ‹³.zÚ5s],^([”;¹eÝ ó)Õ ¸_œ ºSæ‰E'qSU¬S¸Øß¯^IÌõS‹ƒ’€œËÊxKû^€ûàd;2ªòmqÍý¶r£QËÔ0W-OÃôZµ,z‚ÑkÔ³‹~=-'c1nòJYF"æäsGI8ZÓTIBïÃ=Á;øÃAY6| úU°x)Y²J‘XiŽ2<*V”f ­Õ ÖÕ†>Ä”(©+þY$YŽ3ªê> w›uíçQÀoxpv_Ci±½ :V̸`!°TcĉѴ°ž‡á¦[fKÔ–ÙÙ%’{F›Ô‡TdkN¼ÄßAâ+¼ 8-4™s†j’›`TAgX†ÒÑÝ*=žÏá:ŠÍ¡ô*§;¢ÍQT™N{G ´%h‚@X 0NÈ3S˜ÄŒÆ.Á n Qªµ-ªQd.Õì´õÕÙþì97•V¨lþŒk­)áÁ æu™:'ºE9D€ùÚ5ì´ÀIÁ¸/töq.Èm"jŠêw[Û©ˆAèêú¦½4|˜â•Ñôt›¡ËQ–×å¯rß§{J)~(ƒ™ÞÖÆ‚ h>yØbéËÜQˆ'ÿ,8õ!Ì…¨IýÆCŒW¨ë0€Sk,#@=@Ñ´Šýed­&¸T ²ûÀ+÷cÇ–£­`*´²à½Š¤Ó·E³Ìó~UÀäfÖg»UmajôJAvɱSºŽ( 4þ x‡?ÖðfH!*P'¦«ŽÚ/ôCUÆå’:”£ñ[Õˆò=¬•â)S8eÈ¿‡þ«w2SÁ+o«¯2Xü–-‹m³|𣠹Üÿ@ÜAbí@/LLǰ» W„«6YœC¾.ò•<ØèöXÙ+0xd_ yzçx$ºÂ3¤Ð ,ý3,!Õâ+²S‡,ƒs£¨¤Íƒ=@åâ b+ ·^æáÒf8Šôˆ¨ ¹î<"ǧߙ;(vÖrCé°¢mÙ‰±?ŠoBLÅ°Ýø£là¼ÇëÚG•éŒk/£”¦ð²ŒcJåv Ç‚4’÷^ÀtÈGm`‹$' ²˜0·À"üèÑÝæ=$§’—ΊB¤‚5 ò‰|ÍAS£YÀ•DËDªŠT;ô ɃÈ5Ü™ˆ¶b'ˆ™>šÉ‘Μæ;8«¨k‘˜mdÓ]P[d!ÿav9,Ÿ¯Ž« ñµ‹Ú9g]þÚ­OGî!>.ºCïÓ¯DPî*|£V‰òi[ÄÜÃøû2? ñR© Œé>ÛF< ¿ÏiÕGg<Ügè¤mX@`Ѐîš~•kzŒ^>ÙqhGPE0Á$±*òd·t&"I³ñKÆC|0Æ"aÃ1J03¯†îôûo|¦óÑâáÏéñ¨íHQðýЬÚ•Y¹ºíTzºç®>)–\éþcš‘ŽÀEžÅ¹•âI0l1à=TZJò œ¥Ó¿Û~~¸òü¯*0ëÆP˃¢%d"©Am1wÎây`´/UGȤ™*½  úÛØ~UA„+ Iöƒ3t’‡:Ýø1°#Øé˜ˆ{{XQ[ Ç2±N«Ë®‰,NBƒ½÷N%ôªn«ü¥h*TÜã±Q+à¹_õâ¬ÓÓ¼jåÎ}¸áøÚ®V¹Óþ¡ø*å;°ŸØÀír_«ß&ƒEÂܾ(áÑ”ÀtÉÙNQ²ç¥‡™wâ$;<@LÔ8ÇF,>öJ–2a6ù²Ë1 -eºlJ1fHº,¥.lTÁriÃMqFø_ð8m3~앱þƒmÀtú·zX¢þ‚a?3·‚F¡Ü@ïe’p•%u—›ž”v<ðË£ ßú”‹3 ž½SÊjŸŽ¥\)j¡OÞò¬›Òìb»h€Ð§â–fDâ´¼»Ù£ÉX‹{n6v%œª¾.¾põ8;cE!oÜÖŒë#¸A”òQôÞªT¾¢úCøš÷Ë.±²âË^‚afŒcSÔ_ˆXÇNšÉ%fý¢-ƒÛÕpòξ«’GÕ?¥fWX¡=CQj¶Žâéî …Q¤2K¨Ü¡‹8ŽR‘ÕTéÕj<2¨W+KO¤|=cu~ˆLn ÜUH».S¿Î# W”n×>?#ZSÜ%”üŸ1‘¦Æ{³Kîõrxw3uWoÿŠŒ³W=T¶ËC2}ÚÂ4 7²û¹×¾ìå5Ú/ò5jÛLc¯!ý!¤|èš&>=°äÜÚ92‘Q±õû³ÏîŽE<_¬ë øxœw ÚªÀiˆ5Š'/=¢BIçU€‰„ ¶O´µ_"9ÍA1àãbY'STÕ9¢PQ]ÖÔ:;Y¸0ˆ'bød1œU@д‘Ø+ˆÏhi˜{cêúªµMsú–É&áÖ"%ÊLÄqÀ-í¾ˆ=¸ÃØn1à2¯Œ‡éõb»E¸9"žN0y –A9Í7ê…Þ±z¢ºˆ¯NîAÛë²F~úAŽgºìš¤JäȳÃYàA0ÃųÒΧð[OvÆñe¥@†)¾Žtî‡G_œöpœ¦/®i„‡—†R%ö²CÊŽÞ‰Qù6­T(æQ¹Æõ³UÁFrÔ-lGR‘EÚ³¬ *ö<¢ÒÁ’ŒÊîäùŒ¶D½Ñó†2Þ”)M⻇ëߤ4î"‡.Í™žUxv€ú;ÁW–ƒ¤â°œO7ƒ™:.èé&léªÅš[É÷µÛ¢’ýKI"þ´X~ODY„­X8Cé]‡ÄW:îD¹vZT­\»t{ÆKkÎ1éàÆÅÕ+ù*]Ǥ»*_ÓWéº&†Hº&ÖÇíUédì©ÑõM:W×:ÝÀ¤û‡ŽÅ‹Qs’:Ð/E+HeôQ‰1¯q¦*píªÐv¦& ¹ÿ¨vn­P’|±HºöÒÀ¦<÷בP_­åPƒÂzç†õ· ‡QPëY<þ¬à¿ØøË*Þ~éi ñ˜„s”Ždýº³‚ž‰´@ZF„}hÌ®c>Á÷ƒõJdô¾ím2æÉb¾~Ãb¤Þ÷ôf‹Vòý{ ÷¯\XdÆwÙ:ZÊLÛBp!†&NŠÆ[–iÙôvx_Ž{»øGoÏ'X#KÜåAd;²¬ñø—jeº‰Åi\‰0¿ööE—5’öï'cãõ_A ŽÿÔ òlùŽ·2§»˜Aºz;¼c«õýdòvfÅd×hƒå— òe;– é)5|è5ÉØøv«…¸à/eQE6 ß•Ü ¤œd+ý²ixûò¸£"/¶DdÓ¦%ô³}¢¢%¥R•Âå(ºN8&rÕâå(ºÂ&hQ»|£rï—+X!Z7[ÚûW<ÍVâ7LQñ›Z•oä@v¹ÂÆW,‚'†H IOÛž¼Û¦Bòµ“Î+­‡V¢®P‰SØ5p‚ù¦6vA¾„ãÿw‘™•ø5”]nç­–õf±‚TP}ZýwoW=-CÅM”fö‰€Ù}0]¡ö¿R†|nr.ØŒC\Jõ¥áÈ]V]éañZŽþ§yÊ-ôâ8b.ÿŸ‹½'U‹Æ*{éˆL©‰…/7‹´aË"¬là÷•ð‘, óã†'ØY—ÿ] ÙžBï¨ø|šåc´Ý–|–ƒè¦™Õ-ÄßW ÍjIRù†Ä¨ÒÜ¥<ßF \6 ÖIΰgí¿Ú{Ûî6rQx¿:¿¢nöžÝÄ«N,ÛñK{îÜ#Ëv¢ßÆv:î™gNI*Ù5–Tê*)¶{ºïo€d,–ŠŽ%'3mîX"¾€ ’ª»L~'¯2ï!² ºkrÅ ÐBÆ ¦£ê³B«¥$vy¾‹FLšé´º3HÃãà±(Á É@Á6ý²ýê|xüŒÿn÷ Œ5;þÓÊúæªÿ©¾²ºöÿé)>:äRãâäÈ »D¿åu ÿ5‚÷ûÇûg‹}ˆ&s¸/æ6Ldùpfÿ¯€DÉ“8ƒSáHLtQ ÂÜêZ‚¿à;ÃFûôLìNÏ~^½“Âס‰Üó}!´÷ÌüU–ß8kêœ5ž#z¤³ÖYÖnë6o*óËl ·uÜ8ÔÙ<ö~&ö&Ϧ‡Êܲ2/Ú»B­Ø?[ÑÛ%õœ +% «9H½d-Y-YÏAÖJ@Þå ë% 9Ȼ̈́“tï¬ñƒé|NS8ËÉó8Iaò~?'xÓó´uiŽÕ*'%ncòLND~Ô8~o4kuÕ 8+í£ÆqÃlÃ*§ãÙû]âš6kÊzhwÿü‚ü+Â~Úç0˜½ýƒÆ§C«¨ÍØû³ÆÏfË#4b´]:Ûßc kœÊçgpö¤s9™jj¶öò|Neib¨s9m? Òr§!Ömˆ-8 Ôùï %¶ö\M™÷Ú† ز¨}Ü82`60ç­¿0[6 /b» æÐjöúŠ •Ø@uè¯''6Ö9Z¢½§fÞ¢uNchŽ Ái|Ô¸´8‘÷÷lNÜóO§ûgbÿÕ:½h_æ@›¥@ùz°¾eíËÙ.ÉKyÇÉûéxoÿìPpƒçho‘CÖK ŪÙü×rÐÕÂDø¸"bã¼¹oHžwk%p{û §;Äpk5Û\J½ã¤ªâ~ëý£ Nù¿|jì‰I¶wñ!‡°˜ÚÂçôFÊþ%"„œ<üÄh¸a-i'§?Ÿ±J6ê ^´ æÙàt…õÏ© NЃÆQëðg „“òàÓá¡`«§6%7 ¢yØ0†£ .ÎÇç(l %acë5ÓˆÀ)]¨Eûh쳿ÇàŒ=€TÙ´@ýì|P-[Ì& Bÿ_[Ý\±ôÿÕ•ÍgýÿI>‚o¬à¯3¸¿ØÍ¸¿»þ±¹åÝÛúšÐ–~°Àßþ±çµ¤·•÷xÄn†YÝ®‰·ë¸¿Ÿï1±«²Ô&æî½¤Ç;…Òó4ÈcžB³Û³å÷Ôµ÷´Üèž#ô)÷è²ÑëÍÅñ4±è¶Ù<…‚ô4˜ôJ+|*3 oeFŠa ndÐ[}J͇r²i< ¥¯1Öl޲5˜o‚ …ÎzÄ^‚½bö$›ÝAu`$7£büÃÆü¢–áŒÁ?J4WBÒæb]Ì(¼ÊïÈÔFº}yð鸉‘:ÛÚZŠ[Éü8ŠzÊæãT®ÑÜÙ`iªÅ~ ˆÙ&ù)LÃô*+©£ '±¬Š"„¬¡¬ ¬öã(Sª¤r;³Ð½'xW ÕÄ 4þdª.H¥Û„ùƒ%UÞ0:Œ;nœ|ÆñbmåÐH¥AÍ!»×kŽÂ«Š4OÞQ˜Åtd(Ïõxç­â°ùžƒäiwǃiÿ»˜qwÿ}ëXÌ ðr^6_ÿpA u=ø=?v,²:SZ~I‘lp¬ñnòÙóu'Ï×õ¿AÜYä3õ¿µ:¼`èë¿!ÔÀgýï >Eý™4¿ú›U¡êm¯½]Ù|»²Ô׬¯ý¸º\Ń^ÎÖÿÞþ·µÿn>ë‚Ϻà?›.\*«szÁ\‡ƒ‹4ìEÃ0½A‚¶.rÅñ=¤A³'ø!ø…pØÓÊ$Åy¦a£+õVF ߥ…8”ªA\Daèûõ Š}­,Âí–ª •W?Õ믡IK:ò'±]†A~3 8 ÉÆa/Û/ñòUŒÎ0ÿ’ÅËJß`¿ò¥þ°µËõY™ŸSÄs9ü!ò£˜Uïœ7œ1Ùíº|sýç¯ Lš+‹^³ù³´ž½2’‰áôpPäÛ0Áxo“ÛDÌz5ST’Åöþ—¤ëB^§±aþ³jo‘Áµ¨Ëöçæ‡Æ™ªàζÚç{ÍöþñO9u”©"º Qg“žÈÈ›„¾äцóY@ƒ+ʨô‚^B/Mc` `Ñûdšªg\Ü‘ío»×aÚžìè†)0H–/¥mÎŽO,I äÙ¯¯éú~ªBë¡£µ‰lg–Ö¼¿ºKŽ‘˜çç‰=0©§ù `Q®‰yªj‡ðGœB™Á^…Šï½jÃ5ÂÚj»ý:øí·<_¿ÈÑ'²];–ž/[ íW#bfL¨uÍûý—i4z2f‘aï"Óû'GdÿÕ]™B‘¿ ƒŸ¦¶×8F ŠW½ñýë`éþýáÏý^~æxˆVY ²nŠ4C“›ìo¯ ý^¿I¸a™I;²Ë±*‘»›6•PÀáõ:«t•SÖ otafÚ_¼PÊû¦T“®ºFÁŠÅàUDÀÛc€ÏËø|O"ÿ2nÜ.£1P…`I`²ùúÿ­æ€¡$’úzØ~°Á"ë ôîðk@ð)Æ€Ïè\#¤»GGy ¥ gµÀ¯„’6Y½Y Ê …4£Á c”ä Œ%Ö,I”< Çmi­EÓ­™LGkÎdK X ó“G‰-¾`bªt†Ÿè­ תö0ü{’¶åk2EÔ³HL¬R\x‰¦ˆKm“Š…˜RjŠB—ÂÐ8”×å¶0³÷`4¼%\að¨eoïÁD¡Éh öIh}V›ÉD¬=96´²scˆ?m´@³ÑNÞ=¥%Ê84Ä~‹™«Ùuˆt»ôãèn"c!”1F¸è¿L£ðÕù8JnUäfÁ `tõœ¸2–oØM2«&j‚Ÿ#8Ýõ¸¾öj"Ô„A0féŽ'}É ÆýGÉ•¬b¬1Ç‹èîe©À£'}¹,fÐß,gP×Ú[æ«\¾º!+–’"‚sݰXÜÀ"$ÎÐæ¬r·½d ½o:èâXN™T,4ƹ†ãáè-_h!(‚ÙB_®8E@{Q+‹Ò.“V?záBÁ@Ý$YeëÄQ)Ë!3‘Öžb"6£@|K©m E“#èÐK%tŠ!ÜV\0^Ëv c—eÁ(q!vîø°$Xê½l/œ„°µÃƒñJà s Céb++ÊÜ„¼€Í·´DÞÁs{ú.¶NDÇpÿ)ö©n †.”¶<‚§Ç°ñ%ˆa%`1ž^Ò§&¢4ã=a^-C0À¶ìÌëW¯±”.kÕ¡UW¤Ò¿nIí³Tf*Ad¬íôÅ0RÀˆÜ¿ªé;ŠØÚ~‚†1ì ó£ N tQÁ0ÃÎ8:‰ý¤*1A;4^ \¡äáY†ö4=4I^—GK2†ØšØkL’ñm3̤‚,Ú,Ãè)Ì>³¦·1È3"Å¥õ¾±«¢Ž°ì"6ê2ÄÒ3‘á÷L»å"8<•iŠ#çäx‚÷Ä\ÿB'ýDžÉ·Èúè/)»@l|hšˆgGÿZBÖG)- yz&ÆâHƒþ°í#OJrÊÄð¤ÐÒò¦Â™.´SG‘1ݬ ©'¯¯hlÉø €GBª/ñÆ1ˆV” ;ÀKð Ý´ }íþ¾CnQþd\4p ä¯Êí¼µß˜“Ðh$.²Ù Íð7ÉÀ+}g)XRJ ðFG ©YqGt ]!èUXBt¤¦BÔt¬Og¤Æ£‹èÒ ÊkŽ,RËã‰Ôò("{ QG©åqCòv˜QCj*VH”Ç áå¦Ó¼{F¤šDc„i·=Ĺ½Dá!0ðCÍ é€°2„+¸J(|3f üÆ­ŠÉ2M:L¦üÔ%Ÿ…`–Ia1§îÚ¯å@‚žñªBžÒ©ÙÜŽ”Î ‘…Qž©êLàWÑÚaŒvWTg‘‡"›@Ó!“‘¡sr¨¡ÁdœøN÷:yG¨…u2“’³;ÉéÐs«Mc²#Û`l÷Þ[È“D,H;%zð2”ˆï›Z’|oË:|@„~É$ta¡%%ºÇ,¶+Þáày´H4 ؈¤« æݺ1Vi‚qw¬×³1˜´µè†Ë±¤PæmÙÉv³ã´Ä¨È»82bp³XH¨2Qž«=‚¹Þq$7ô\•^ù”®†* X?…IZ~ÜCLúÄ=MA™R8ÊÕì0·ÛÖÉ’§Úè÷Fóºù_ÿ%ßÖ¥Ë-è«a2Jº×©ÐkA4龡]'üJ®Ôø¾¸x6l­1iÔC&®‰™%på÷ެœ·q=û"P2°^µÓ«ÎŽ\,Å•EÁ**”1<ÐÙ•ãf#»Ò&Yhh!àwÉ ¹:‚‘ªØÇ7ì^k&!}Ye©dÙ'„¤ó5F3†š^ýõµº[ÔAH'§ÁϘV. %C“Ù Þxê²rÖ –56®Õ¤€Ë´¼Ñôß©ÿš­ÂÁKPä¯i…ð™oM{ÚÍšúPDéìŸë´Ôå6º,5”fDq¥ $x¢X›yQ {98|V=þÚ{£‡U§Z@›hl!)Sp{I‰Æ\Ó,-±†hpÏ=ÊFŒ1Âó)1Â.°¥ælà4–MÅFàk„Éä¢ÝØ|ßOè0™áJÜP,³'Ø'øm¿%±6äÇ(TšHR[ „¶Qtô8ÚÙai¹ (jÃÆéÑNAS΢°•x EO 9°_)D µ@KHiw‡˜CŒ_*Ûc>óôŽ!vaÍP[S¡hµÖbœPì,½X"ÉËv(4} oÑÉ0Oo&~—óQ ƇbïÖMãŽèâ_e&΃nçÔŽ‰èã&ª%NI|)ùƒ¾Êr›X\Iòფ·4fE1ZØ¢j,è‰<‘Ú‹zúha(X+ÓìQd$ÍÚêªý£ýP¯ûà†¶·R5Ì·jmÒÑw¬GÂEñø29„’㯊‹’t±voM"9öƒfðÕOžãrI»ÕAêõi\U—~s\M#…(G°-ÃDÓ¨c×ú,|t>÷–h€Ëh\9²5 qªÒeSÑMW(·S™ÞÀgò534Â'OûLÏ() #ÒˆìÄðU|y+Vº=–tû<¹â‚TÆdh õþoðjœŒ§ãìµ*«Ç³!)Eè]\ ä;ah}•¯âXCï%í‘EcY>—GåÁé˜F`½Id üv*ƒàKš$ Ì/÷ƒ‚S¥äëƒü"µ\½6Ðè7鯍 ]ghi¹ÓÅ?²J"ì<ÈÑ+9_Ëc°ób€ð§Ywµø—T`© ’ñÖ8ÔŠ2¡ˆ(g£qÂ#§#¡;qHçA ™,æà\-UZ0£ïk§¦PM•ʬ —¯\G’zº!L¿bÛ¤zVØ9¯cÔò71ôfIãI,@›‚{¤?„`K)Ù”áæ­hÓÃä›}ZãtóØ Øtê'謆ęQ¢°$î n ÐBEMTDþP@=P3`ÂV”×Îåuæ³`§;ŽPX®-È=nºã‘YØÂµMɺë½ñ·‡Œ¾•Œ—{Ëe’r4¬mœzˆ(ß¼éìÍ¥<¥Ô¸àJês*þqn/[r€/(RÓHé a·l½Å˜±£U“ÜŽÑ[J°!ëõÀ¸·:X7dù9Þ²Ì#£ß·`ïWk1E-Ê1 @SCbÎèûKÔµ_¢b^Ó·c¤€ÃQ<ÖïVäp\GR¼ÌÌZÅ0²Ÿèk¬Bkê¥Qpò=-Š’LHÃöËiQ^¿÷艣ԬWvÙ¯ ‡"¯–…È“æ6IüP©.8ŒPùgjÓJ*v:›vT½J*üÊ(d¦_ekŒs›’¯fSì•‹*¯*;èj*޳<}ÿ=èãÕ â¢J$øåYd=ŸS~î 7"%rÚ½—0uøŒžÕ2®ßá9º¥Ë×]'¾láQË éRùõ_É1“u“nŸì -$…{òn‚®%väòÙ‡À;t™´Jü•€â[GR´²!@u²ŒìtQ§íòö¿ ‚“Q0ubv¯a~פ§†B¥â”´°ô¶Ta1`ÑF‚+àY;à(„÷ ®Fè¶KZ%פ ’=×d²®X:Ÿjêx—¹Ó8e®¢ (rçu®¶â㔑rÔx1i_¸d.¥FyÌÍ-@âè6¹‰¾PK` åýS ó˜Åƒ—Œá‚ŠÐùý0X½ë~˜IÍLSI™C"ŸëOEuŒ£jîF‚ËÊ"ñ@N5” Y ®é9WÝIPfx¹Â¥2„’ MaEˆbäB¡¢›$ýù¥Î#ÊÇI• ÎÍÙ±¹[ú^´MI\p¾Pœ¨K6'ÑE†´6!¹¥¾å.<ÒøFðYÏYPh—ºí'`hNî×ûñìR.>O 0zu îÈ„†x‹ §¢gRüÕ¨=¾a·Eo„ú| fÚrK ¶7‰ÓLäÝÿ"Ø^>‚“àˆ*GãŸÕÕÎXùBâ „Ø|Dp¨ pÒdzuÍKÄ2pšš÷Ëé©M ÚZÊK'ÌîP¢»1÷W}8"½7I :ŵõ”©Ô«eºÓ]ú[}uëPñ Pì¢Ú“¤t´;_äñð’Œðj²8.G%¸e‰S6Q…ZuÓF!¬fhà.¯}.…b?“ç/g¨Cf˜bUßä>~DK8>Q!8Bq€YÃRF5`Q–CøÓ–ÒŸÚ %YH`EO‘øJ¬BlÅÒSä©%*+¶ÿt[8ì|D5JA‘ýô#³6"h! ȑɠCÈ¥x3`ÜENÞ~G9¬+‹ŒÃZ"Æ`’†P:tÈÝ"ïq Ð :ÚÚ%AAÓ#eø\™|°ºäV¢ÖŠú๠£"ÈãTFé/¤i;»ÅC¬ìF!`†5æ[â¼¾&™âïíËÒ*¿-”@ÉÛ;²ÒÓ›9 –Ñe 8™&€ÜĹ&úvê²;d&Ñrvåç®q!"å|³Ù”‡©Æ2-D›Þï+M ÀX¢YNw.ÓèÊY(GpÆ º4ЪE@Ô‹¬bÄÂ%-ðG(,&÷GP¢ôçy»ì*ËÅD*;¨?:ˆPür á~L^È‹õR¬$°VÉM}†oP㻫t¦JË÷B1ËK;Ķd "çédrÛ‘5MÇò F2öάH˜¸Pç±å6MIE8Ÿé!GÁ"f*c.íÿ‘¡u„‹I¦çÁŽÂ» ˜ËM¡(dÁzn½Ÿ— +¼:ò¡Å©äD›œ‘Dª4¤é"ßR'â¨Fü»½ÉW>ËÛ’¬SD oË Ä̉å‰Sâ•¡çŽØD EìÑ¡ •ˆK*¢Ü†@l±"`a˹9:ª0ª—ˆòR›¦c±4ã£ÏìQe£2k7JI ëv“t…ä$%Ç(A»f‘.¾X†ÍR~²¹Dªò@ÌA¸¡êåú´´…3f?¤9§£Æý’¤H^4¢¶¡ÁºM=Añ˜£™½Æž¤³´É!± »ÏÎt2à‚3¦T”µß‹`Ÿm0„ts“¿õIìÌÓ&Ô†qéjÃ×ìoœýÿ‡$²•H 8À°Ë­ÿYK#—íäÞS* ¿¦ÈÉ3adPô<¯žçÕÍ+Êüêi%øK°ÙÛHU?J&‚òy:xL‡ç‰ð؉€kAœµ¯áê|éSÀ¸p4ÛHÕúò‘Øc=³õ3[?Œ­ÕfV›—ÇýûcØ-jò×û4ì¨ïŸFWâ—F$žÞÑ»MjŒºh®~ŠÓÉ4/O9ò×ç8AÉ0­Y¿%²y*ä3s²Ÿt§3捻‡Oh0JÁ8~teÏE–\îØ;T@FbÇ +§í´¾AÉèëÉô_qšdm&§þIxU!K¹\3PeÒNSJÚÃv¡ 1¹`5[2K²yÈÎ’)­ÂQ(8F1› aCðºÁ¹xÓ«˜ŽÄVâ(£…Œ`“AÔ•A4f°ì¿_ÊUN%éèÍ´†c¢ëÒÌYü/G’ÜÚÔá/¯¬P¦J  %£~Ҥ‹K§^¼&©ô̽Ä7»#ÁøOOÒ½4”~úòËÂÈj#ëj9Ú…L ï$4DË`qï(мeX©œ®:ã‘| [žŠ=ó<ˆOAíãäCg—ü1\ð~Š3u©„©’ByòˆFcŒ& l±Ð­àï?Cõ¢GòGWÚKw)@û;+ˆbäu iíZ¸Kó[Ë£YÓÒífˆí‚jsÓN ØÓn‚tè­hÿ« ?U\˜1‚ {äûòL)Ch¯(€ÛÚÉé„Þ¼Ïô™5ÿL¯in¶oިЭG(J™ëšuGpË5ýèQÆR6¹ }·„ÛÈoˆž è³Aàþ}ª´Ò™M榒‚Ït6èLÛš/,’ÑÁåÈJÝO¬•‰ùÇOK㨒‚ wÐtn7$·µà"·úâW2™$Cøv2¿xâ2êÇÈÒ)ΜԼњ5·ÑR™H} _OF‚Æ5õ­öqÚ×þ?’XœÉè_C»?÷i’¡%)ؘî˜7…#Œãè$ƒwî ’›npÃNÁã¹ú éèÖ¼ ú¡?»ÌiŠÍHú"Pr;‚Ç õ6 Q Š$ÄI˜^Eõk,Yªœ ¼éúÕ4¤åúâäHGôäWþŒ® ‚êIìß&Jjžžœ5NMª=8Œ:v³ÛE·y,Àe"s!OG^±D®jYKÅx«é¤O#øM-e2ç8„ÈñCÑÊð*jË.¢'ºŒ +ú ‡±‚tWÚùÛê Ú½RüƒìouúI1þöüŽN¤¤¢çÀUðÇ#02ãt„Ž›êx\ûæ¢ÙE”¡ ”Ÿ`M%¨85õæ‰LWªLzÈ´{¦§lGãŠQ9®A .l½…ܾá¥éC¿qn*3{¿šv¦ ~ÜSŽÕÒa?îÍ6Œ¡¯†7d?„çbبjdäerÂÑ#W$—¶r$ÖøGì (Ÿ"ÌKA(ã'Ì,®Ñ¡™ÿÌ3éë&’aA4‚hñÚ/‘0±>ºK¥dÃΫ1Ò*6y«`ËI°Å™¾†Íòº§Ï¯B|gtçGƒ4ðtª W¢ø÷5t¬‚èNB¦“ô^t'¼ÒaLÞ0?j€ŒÒaÅÖÉ Ä0ä9­lG½ûEÞJ4uT'ƒ»pê_î3p‡A„–˜íô4åFßäÜòôŽü¯!™›¶ÝuåOÈ*"Ý‘YFOÑ×ÖÁ¾ÓŒè²îT(®Œ]{w£$ϲî{ƒ»/:ZkÝB‹!I/tŽ;²àNÆŒËò ¢àn:ÂX7KúÂ#¸ËL5Ó•TÙìP;¸K#½ç¶bE#óë©%v‰äù"{W<”ƒR!ͨÕydÔ`‚²s£~³L«•l”Ã6°Á±ùpmà‚;­xw!‘ñÊ4 Q×´ 꼡ÂA§¥> Y DäcšÊqÎåò "äd-f#ãƒ{4§òJnd0$Ò}Æaïo«ëd=&¥z¡^;Ï5Àé°µ'߀}µ¬ß«å±`0ùµ~‡Â:i¯"z„kõuM7Ð7Aã–Arô~~«Äïͨ/I4€4̤R‘ã¥n“Q!úë’ŽL5ÃZHïåA„)DüÆo,êŠØ0vm¡_Aˆ¤Õ­çS©€Þ‘PMš#*غ¡t§Ê¹ º‹¥[~¡ž‡ô07 ¨_KS=Û˜‰=£ø_21 ¸²D}¥@^%¤GCˆ^ÜãTîú0T;)D…^Çù£vΦ28µèZ'æ9ƒË24.-à|3|Ó•cºsV¨’ò©Gï¥ÈW~d¨JÂKQ¤{TW102F12ÌC‹Y†-šÄ´›R„ÆKäLÄßÿ“^b"p\½¡i7‘Ñ´pÃWlÆaWMÐè¦$Dt™ñÅ•áKñ`‰²Ódp";ÞD*j)„ú¸š¢Çü éD1eÈÖŽÜé Š¿F ­$õfŽ»Õ*à^4ÐñÀñ»èääß5Â3&›(”„ ù>šäl΢£Võ’ÑNÔ^˜èhM¢¡ClJ[NðXê9Êh)°ýä6É#¼3éLç)(J2Hjc­vJe6e3«:K¨ö“¸¾Á%ùéAa ùb ž&»êÂë…‘b=? SÜÁáD¶ÁùÁ2v!-–ÂŒ^J|÷–„"ÈxtÓ¦»S #ßÖpjòE c4q¼IÓVÁ²úVÖ*äŸü#9£ ÁQŠÏÈ£‘Ï…6Ô­–÷Ã`PˇÑoqUÕØ‹nÐm×Ñ Ü”¿Z¾l‰Åî8HÜ: bǑӄœæŽÉœ¦–%°ÎñáâXª&žÃÑSDz³ªÁ¶Ó1y5êüßu.0†ÞN@W¢H,`v¾´´r·²²R?tä7Å¢ïod³ê‚9«1ÝdÝrœ`\ ‚ØrCŒ"jH}…åS'ÝÎúŠ+›5sÕ b4a½@¶` ²óüãŸÂc«Áð§ ÷>J`_x¯È¼¼²RXû0PîTE¡}ã— %Çõ"8æåŽ©¬=1$3Ñ…“†·E#ÑÓël±u,Õ•¿2£Qò$žË"AVL,âpd…4ë~VH+b˜ÝȬ]S^ š„v*Ä‚ óè;«eœL•+ÀËÌøÅfº |‰G/Gᘷ´—dò‡#çH>x(¦‹únBìæO"¾ÌŸGtCȇR 8Já5Òò²O_̼Cñçƒ÷½¨¯¬¿zì%){iš] jx"¶ }¡n/-ýPÏó(Љ¨B2†”YZZµÓ)‚ÝÒÒš±+dáÒÒú¬€P|õ[¾4…žz>Cû—ª;¥b¹ !ŒÎ Ôz -¾‘£ W±¦þY¾ˆ¾HC¾ŸEˆ72 ×:úïŠÁ-½ªÿéOõ×™ù!¾ºÀ9f®¾æ V<„ƒÌzDzÎÑ_dbÞË»€¨ÆÛ|íÔ!pÃä\öe8LE ÕQ¡tê.CÞºD£nòÚqÖFj'EÊ YÚWaDB'ia‚ÂEéÓ¸¦¿ï%·#{, ’§&›ù%N¦&(”K@µšúµ?Õ©ìF'KBò+eNãíA¸D$–š†P·>k+ëx+kð¢eÕä%.ºD"};oƒCÎ,„ÿÔÒ·k”#ŸpU(yÛK”mƒ…Ùú_àaÅj‚áè ýظ@½ühr'/ âcfÅ—ÏXóÔïw°Z(ÎÆRT—Ë»T:tÀö"G³½°Ij?Ê…Øt]ì¢eQ+a”,#¯ž™œ²æà’\›e”x% ´ÅHy¥¢¯büé¸yzvrq²»ÿ¾uüâl¡ÓQÀ¶ðb {™Fé=¤¾šµ@Båòxa™Î8tL`¢\ûR0§<^ÆPÖ—õk¢°t¶aNõ_¶öòó”6=?`T­ëÖˆª­gM×Ú¶g¨N„ÚèF®äd¬SÅ|£¢GxsžµéJ£„ˆv¬ìK2š=ÊCfïÄž¦²SVA8väGµkû³X)-L3Ž `IC˜võ²~|V¾°²Tg¾8Kãh¾ÐRÙý%9˜ìÁ˜¯O¯êZÍô_‘ÚîÅpÇÑ­ÑÿÊ®çuQy Ðïé¸I.–“6 øëq3”N@)O>欲lâÒ‘ÆÄT²…NFít¹ ªt’XÝû¹+Q~Þî\ùv¡®ü±G{¿’ÓÕ&«˜/s ©Šþ@™ÅÝ“îçC¶Âë$Ñ–öLe7› çÓÎ&j…žËÁžzÕBÃâ,¸Ç¿L‡-ýÒAe-€â(‰v–—Ѥ{½ Sïq|“¯ÿ4]Ë¿«fÓìú±d¨¨I2QµXº?jÇbm¼—t4ꪞÑy-Œ®.¤‡ÅMƶõ~#ý¢.¬w‹8­(ÌÅþUy^Ç‘g±C‘XÒdDëßA¦´¹)2tà·Ø¿Ël3bÊ úQØÀòüÜ `%áüCùŠœ€{ýœöoÚÅcÿ#hœ™ŒgÝEC¦‡œ^ÎXùÄžŠ“›½ÈM„¶‹1‡'(¨çË—`ç ÅUú"nMòÓˆé°ú„ªÌ#ÛR<ĉ\Ç Ãðôœ¬Øâ° ÐÛd·ø¦Ž'×ðŒâ·ï‚ÕvÉ?ùÝ2 Vù>R=ÂÉõ¼Ž¨DŸ®=NLj¸ûú½ÍyUŸ¿à9« ôz"6áT{d,z®€ïǬF]~H²IC>ºJƒ”¹‘^c.¡IJºD³Ú'_!…3-¸³ºHèpëë›÷ðû´ ò&-(»C‹ñ%îYýÒ–j>ÒžÉ˪vr./ÎåÊŠqª ¼}QY„„¤uÁ ¬®2•é’Å~ŽwŸ}˜N½yí!G´d©wÞI·ÝóGœ£–•Ž®õU‹_ÇxÔ÷íZÐ NÁJ¤z`YAT‘tÁc—SnÁµ¹Ô¬æ'¢¬:Ãlòq”ܪø.§*ÎÔü5, Zõ“Èýú §*S‡y+‡ù± ó¹#~Àœ)mÁ¼y/·‚’ßæ]rú–ªöIß×Òj^¤Ô ”œS;J·G°e> ³›¹Ò4³Õ¹ß<Æîίåa ía0ÆÒ‡pÔDéëà^ ÔϳãÖñû…‰ €(>[6Žèfð1Võyx'Ôî) :†p*ùF[ñÔ™%xh¿8ž¯KL˜ߢPëÄ¢ÑSÈi´|R €•TMŽ0ƒªRyUˆöœ?É;m:y42æuÈWy´ CBÕïÁõÆãëuKïfÁf©Õl6øF ä3Š&D‘6 ˆZ,¶LÀ"3uÓ^ôc(…Âv ¶VÌŠ·YW±˜ÈW¢ŠÁ›ë`Ö'߇‘ ƾPñç>ÍùìÖ—–.{˜\P‰äGWGäU˜¹g‚êÙûhòù[ÞM‹8‡ƒv¹c«jö«žÌ«š}þ$Íæ­.Ž“öÑ,mgKðMÜ¿z–)oÜdÁ[ßS›6“áPˆÑ´Ͼ$ †éÕ—Rî™]æÃ9£4Lªr,H‰²áÛs^3çÉ/ÛFµµe'2‘¤A–`$ÚµxÑшcɃ8›U° ÆE Á*4&±ˆkp7ƒJš(:—Á 1á´˜­[á`|v¢ Ä[ ”A‰å3Ñ­ýÖ68ïÎÃ/_o#Rê—ÑèõàJò‘ΠÆ='.Up1éQë#ÕY­ƒáªVeAƬf]$;>ÖNÉùa¶ó,[çc‹"Dz‚F ºàé¹òð í#Á¢0YŒ9zÑ‚W®)ñ¨ Ñ4=׌Uf· û•úˆ£I\bRGvÚñ« Òm5o„°Ù¬Âà”mf9„p¾Dóa±h×LN£ž+ù ˜È•Ñ‘Çe IѽŒÒìʬÃÁª†\”z Ÿm…+C„àŽ,Ž)vû£$*º »T.É`œ‡Ï¿W<_æ¼ ÚÇÞÀ™Ùšé$9‹ÆQ89é÷翞æ¥Ï㦕¾+äÞœ(8ŽÒn驵‘´ø÷´“9öÅ(ý4œÇ‰»£àO£x·¬d\uæ~¬I#Kû|Tø"»ê}væë¢"gyÌ@ž0$8ÈMæÁó‰š>WïŠy:˜¸«L³ÀÕ$M9¥ÜÍäd¾´j\þšÖ>ÚŒ €¢ Ëvwi ²äbF`n¥»Kæ'U” ?—ÑÐ:H/i‡Ýn4pæL®Åžá:8¢ œqDi8IÒ2€^4J†ñÈ b_Õwù8ł޼ôê(æà }‘5JÂn°õV©,Òù´s»°ÓáÜÃÊŒ,ø€6A¼ÉEr•Vþi¾ÁÊ«†ç¥ ´ñ"G`q¾vZÂçϦi…j]ÀÔŒ “,šŸU‹U¸¾.^Ô-›M|×.¢x'¬÷<|ß·&£MJ²›Yq¾ýR{³.À‘5Ï Hqŧ‘=T]ƒÖúÁ坨ã&ãûÇO\枥]wF^¨,Ýç×±i× ’ç4ã¿.Yró:0Iæ¡0+4IЙMÄÃñçÑ-Ý’ãEÆŒ3iqˆfI‹·w,­z1–ˆÌœrî"ucMÏ#Ns±qûÍh º}⃊­1ÞK}ÍBV¹ º”Á’(ƒ`íñèê\,ZÕÒÉɾQºŸ*à°Ÿ+¨îÕÃŽ´÷(({£ –õ<Ûs™a‘dÂ1TÀªß²î££§«]-” ÝÆçeé %Ê£ær»(ÌØª Ó<®¾¿vŒ>Ã’ü «þÜ!ôFÚ]Hð¤YÓâv¾ùÙ?¼—W/I_õ Ê#™ÐŸ*—¢2eÙu]ÏÈä™ ÆÅó.ZÌh–°P艖ô³¾ñ}öT¾§9‡ÎÂë,OßGǤ¹w¤Ý­:à*'tééfÞH[røêš]eUNÐ ,ÿ{áÂê–þë^¿ˆú½ÿQK—_WŸnôt•Ëò4NµÀ1Š,sfGΣ«áã ËÐ Y¡ÜÉÚ]0²fwà_yý£¬¬ðœÔ÷ÕGý€5U‹o.^U镽ûÞÆÐx {ùQÜ-ä¬ÂÜ”‘ì_¦Ñôëà x/jÊÎ_¬xüã3ü°(óѦØãNú  ž7ˆn¢üól¡Á§Éàþê±~O¤ªíT ¡›ÅuõŸY1Äxïs¿“9H FÞã}ñÊ€>ƒ¨¬§Â­ Š›O<7GJª^¨R™·‘KTð ÷çlNƒ.Íá–îArPéü‹´:³‚9<jÄ0†||)TúKVô0½¢3ãá• •‹RÛDÙ±61¤}êT5ÏôYvì´ùå.êÕ‹bMy›r泜3k™ÇÃÆ?cz¢\k%ÃÈç¥Ñ‡\¢”o´§ÆK zdwÐ.@BáÏVúÙeî]ØëEŸ‡ûB:‘â®ô*ï¾4›VšK-óØg¼—ÑÀïºfÑã÷çeáWKr…œÈÌGKÓ:wÈŸ¡Ke«Ï% ß÷ÜwÂt™KSÉA…®÷54™½¾Põö«†e*Y[úxîŠV*§³ïÆãÍ»ásf%ª½!$M’‚WÈ×HS*-—J†”-!JÀÌÇB*ñí_BC˜ ÅŸºÄ¢ß3hÔh<3¬;‹ýåõ¡¸ÒñL#° nOÜ/W8W·Lír Ã-{NÝ–yú$jzX¾…å‹lÃRHíiXm “wj.ޤE¿?ˆTÑ¡BµƒÇ渳–ĉ‡Q2-DH Á¥ã4‚%­#¶`†W>^à ­Ý"|¥Ä“E*R½Ñ¡Š¼¸…p¿‰ƒªö‚‚/më¹wž©õ Ê̽|ÑjµXWýÂÁòÈpr#¹3¦&‹luDºyðˆ‚Ï@‡ð o)°”üj$=™ì œW//]IN˽S}ovv§“Éc” {!,³4{(w£™«ŸW¢My„/‹Ëx¸´:ΑâÒ¸ Z0ŽI$óX&:÷F®a<Ûh†±Eb‰ýº£$ ¸X(ç´3°,˜Î_IÄR‘G´@ع͒'ëe{x4é¾Jmàvõû›(ÞŢExŸ÷m±2í^Œó •¾ X6ÏAÔçqAp¤Ð4uWhóŽÂ$ÇŠÞ—|ò !ùîÒ²û!¾KÇã@i”@Èà%¶ò®ŒE¿ñã9µµ·$5Ký–¼£Ò'|ÂÖé¼ï.М#„\È®tH“ÛèI}ÎÅNú,Œ1j®îéœÐt•OKÐï,š á£ð® oï.f1>ŠG‹)]’4ùEYüëâb|sèØ7ëRi«àù¢Åê?åU''_½‚ÏX>NÃ4‹ž~õ…x­eS ›î}ëáxÍY m‚¿Õ5FéÀŸFÑ<¤æ×ðTý=+üžú¾Ÿº¿pmÿ’çò”/혹¾@NiP€˜ÒgÑ—xNoŒ:Ëÿ)JçU¼ÅÆÓ øÚ/‚gΞé7xOfk‰µÉÛ¡iš[¨øÄÑÉ ò°¥©œãþrˆçþ Xîþ2Òû]ÑþyØõ• ‹å.?þdYô¢R ÄcÞj¶Ga–¹ÉƒOé¶- ©G™å?%‰&ñx;Œ€hÝ^˜]/’+z¢|Û¡¨è– @îý_wc éc÷ø³z ¶õƒv*ªðhÉùä~áMÉ Žª¶<:˜ˆ£P¨>%óh¶Ä°Â³æÊ³¦õeó|°¿±á§d¹ø(¤–ïU±]Âáǽø•-ßݰ°­6¸¿Œ#Ë«³óÈû4³åÇݱô³å²â³Õν·¡´Ü‰»’Uµ½·:³å¨‹·É´¡¾±³Òïª6ÍÕÃ[Î-²ÏšcϤ<»u–·ÏŒh'Äkž—Gâ,Η{Ý8þðí°îæ)f/©á¸,ëïI<š%ùh£MTœ›¹¸\]ÔÑ ´ÿZˆ®ê™5cg¦3OWôòXóJ:—ÎÕ›”7é‹^̈¥z1Çò>w¨SÜí¼ªOê9µpÅ{\·Ð›:Ÿ·®§Ú ‚®_%'0tÃby6(¬Œ>ûÂòåì+§…Ñå9ØÍÞ°Õ´Ú°Õ·¡±«°ä”£Éb°¿2±«ÏÖåâ|ÑûÜI6³¦Ë(2=÷¸7š=´´¸rµ³ÎëäÄïÑÂáãj°ä+>°‰óˆíæ±ô¨A9ÞÄê•°ª¶1²âŒ÷¶Æ±á±á1‰°ª>¶Ù³æÒé¦=Œl²õ³æéAÕíš»«ûe½‡·¡Å·Ýèµþ³¦Î¦³¾³æÍì±Ê´³Ò)´Ê°Ú³Ü³§ï­²?¸¥³[ô¤³Õ–•°ÂÞy“žÌÀɨÕû™V}ª]¬$Þ«²Ñ¸øä±kgÝ0y‚óSCŸŠÿ †…>Äò°'|¹þõ¬qïó[ÑçÊ[3¢3óf}ƒQœÑ6²¬Æ@o±—m&B#‚~s´Ï,§a ú`9<š}=¼–óRÊí¥ÉÑë¶Ü¥3¡]УÇ3ê¼úî#ŽU4þ»ŒÞUÝæ9DÙò>I¢JçâÙðÀ:çJ£¸=ªþAö©ç}ƒ÷ ÎlŸ:ô Vú„Fâ?‰ä$=‹Q˜}µB^Ú›Ïa:ž·sÏb–[î`-3¢,^}¥‡ré%-Š|Cy1‘_°ð…}¡ÑX”ñÛœì|NãI4/‰jGóP +­²¹•(ç ”Û.Æx|§å ;ó-©èËßye#mÌš9–Šò¨u$XûÑݦӛƒx ~ù’_ZÑHìò·ÊÂiæ)½Å๚ˆ>±á'#„ëÇèþ4ŧ"Êäý&+Çí֮ÌCáq±ô´¥’°ò"¿ûœ7OÏN.Nö÷^@a½¨5ší‹æá‹àÚRÈ®ÂH8‹®áUYò/Ì™öåak·ý¡ ú·õÏe½þör:‰o®VÇJ}eec}ýßVÄgsÿÖWÖWð÷ÊÊ;ñuõßV66ÖVÄõ5‘_¯¯¬­þ[°²°Ÿ©`â4þM¨fƒèþ)jü®>‚ßÿ7œâ‹¹1‰§ÃÉ µ/A½þfs-Ø®¿]Ù|»¶Ô7~\­ÿ¸¶¤·Y°7þ7Lo—¿þ󢙌ïS¼D¬oom ,4ëx‚ý_¦ñ¸ƒf’Ž“4)Y ŽÂûQ˜öàK–…Ýk!&“¬ö"õ‚ÉuÄ“xÞ)žL'Qôƒ‹¨{=JÉÕ}-h†ÃN÷®"« 7/Pæ¸>Á 8ƒ¦f¨é—¨÷âÅi”â-Z2 &I ʨ]Ñ¥]Š¿Ð.±’¾ž¢‰qdIr¦fÆ¢¼=¡lA_±“àŽ%²îƒñTt<#°Ûxr þsý( D×Q b]¥áHˆÑZðbœ&_â^D'H‰°“|‰°5DàQ2‰»"y<Ž¿Ç#pŸƒlðà&ê…“drMEFÔ=Îû\(óEFw·pUÈ:UÓu`ã`o“Á ¨á]>Âá±Õ°ªA'³ú²›Ø7Û²Ô)²ú<í ân<¹‡6LÂxé‚îšÀÐ&Q¨¨á…&²¢¼§÷ãn-¸MãÉ$ã4†BuwÞÁ‹{­÷­‹Æa°×:o6ZGçAãð0øÜ8;k_´öσϭ‹ÁÙþûÆÙ^pq\|hç'd¿´Ž›‡ŸöZÇï_Zëèô°µ¿g¢ŸGûgÍâgc·uغø9hï­‹ãýós( 8> öÚ?¾Î?ˆBt‹v÷ƒÃVc÷p?889H?ç§ûÍVãöZgûÍ‹@d4OŽÏ÷ÿòIà· £Æ{¨öì`¨ŸŸ?4.ÎOD-g¢+çŸ/D‹ƒƒ³“£àðäùé\ôf¯qÑ€2Åò*x^{ñùÃþÅ$ZÙÿ5/Z'Ç-*½8?kÁñþûÃÖûýãæ> ž ôÅÉ™üt.j/g­s¨ñäÓ`Ÿ`¢Œã}*i,P¡Xÿþ™èóQK=@š¿P4SöH~Þ¢â€jAûòÓEëP,ÿ/þ 2!삟“i0‹†àÏî`Ú‹‚?á:ˆ;o®ÿ,˜œ)e²'L™¾ôWsi'²ÒFà@ši%¢ÂÁr€¶!ÙM@š–˜bò[¯»¼ì»/˜t“h0È‚§‚˜Ê©PÇÉ¥áCàÁ«»Z $šxÔ¤-Çëà6ÍE7O1ÿéIãß7/PË“m>Npo³´´r ¹N¿Ää  ôºNÿÙ_ÕÉhÄPÖu½ÔÈ2·t¦É´¹’9y Ž£+!w„ÄœzÞ¶ŸyÎê Ј2Šnƒ/ô¾¼–©Ä š\Háw"TMJåQ[Èà/ ’úq4èe;PŠ/;Áç£ö10®àžÖñÅ9‘t[ày0ô\r–Ð])vÐ8#Lo2 ü.‹¦õñ¦°€ˆÿ©_豺2Œê]ft²†º'÷gë4«….’’.ãlF&dç@Œ~$h$âëíð?3!ÛGÿ9 „ Ï‚éX£9dðU#óÂ;'¾ª<캮º-檾 \M¤%êÝŽ<¸£'ä±j̸ß!Kýfïµqô° ¤­D71"“`8EøàUwšbõöãµ*à|Ò3Lc4¨D¡íêý®nšû²`ÄÚqé_¹]šµU‚ª…=ÇY%q§²,Ø1МKhÂ7¼æ%ƒ•³›&´#Áù$„ÂLNœ½Ùô*uSzWQ3z–èMÊ(Œq”@ô%(iG%bg"˜x‚Ozà,… ù9ƒ¾2Ç·"ï°†×b)Yzõjù•úýßûozצ”×:ïu¾zÁì)Ä1y5Ü´8Kš¢1Jª¯îàŸ{VæéÔQfâ%8‹bnFÑâ™iÔq>í˜ýWuXÇ7®Ê²i§@V–_d)fµ^w e„³Sb÷ëê!¼~­ §°`©,úe*f`$os™^ Ôù¯˜Œ˜Ÿ—æå©S·/e±ÒüEŠéñL™íñ$ÝQ—Q@L7–0†´¥«Q!X»×b­"gø‘«¿¼B=]è9_dOÄjFɸ˜ŠÅ|B{r˜kt .ò:É c\ßÊÒ8„'_^ÑU,P=^½z¥$ûkñçÿ\~lÅbßY`¼} ¤^°T·ò ¬Öè Ð/XZµ2Õ.wiiíq&.dçHÍeƒ#d}8 §ŒÇ_^ÃÊ×Ȳ¤ÓÝæõe©à2*›–—ÍóOb³z~NçDÇI€/õ¾a{¯æñÉÑþ‘X×ë  0X(Å´Ò)€ f A°*A¡ÄÑD@ÁA+¶Å\ªÐ0RÒđ̃s/ÚÁ•_m.žžñ¨M¯xÍà‰#¸)×b¦»¢#~ZéxWQLVf-{Õlt‚¥~ÝæÐn§+kÉì"çlÜ^ék«ÇÕ^)cƉÄi2¸¿J|k§ÆÒâ}ºß{Áo¹âìa—w ¡B[KÅ }ZúÆ_øåéNJbÀàEêìßhK^Ѫ§Ù‰ó¸C–ȸ¨%êní7PO*è÷ä{î¥|Ëí<À¬§ª‘¿È÷ÔÚÓ×·T’åT[¡>ýûB%@æSºbƒ6ü¸®AÍšù¨ù×3éb¶ï>;¯àoºÑ­lÛÂ&‰,šPn‡^"ü[íx+›õ=6é»[@>-T†‰åbE¨¢{œ˜!áÛ\ê—²û£´šagñd×ÒðOCÔóorºòÕˇçfff3q}o'Ï¿ƒÃÿ¯¦ÝÓ7ÍlÐunžü€@µÐ™DѺH¤F3{öžçq§·’HÓÎ$ ¿³8ŠŠü›ÉM%§í"DÛ¦ûÁ¬5Ïâqš~ÞTÁ律~ªµ`‚˜Ï‚Ê:û0c‚™­»HP‘Ï®Ã|?ä‘&oçÍULðÈó§oÐÜþôD3È\:£Ÿ«ƒƒÔîü’}T–døÓ-»¢ä á‹ö~û7öÛKêÏG:´Ñv"5LÓä60#´ÁÓ¥Gm±Eëe¹Óq°Áò’plñ”+ˆ4rÔWxòDì:Ûƒ¨Þ¥#±ÔWÿRC¬; ²¸ ª8r&‘Ȱs×ÎÆq‚UÖœnÖ à›¬²ftã´+VüUVs#…­²:»I¿çÐU°Êê'ä,X[)¤ É ?Q°¶ZÈ»ã4Xc•öâp˜ŒzªxÇj%öêÁ»-;m5Ø`µ\GàºÁjÁ¸.¬Š8ºÑrƒÕƒ, Œ°±UHF^Û\)¤§m®ÚÉòîMVï`Ð&%r“ךªdVë0[¬¾aÜë "Yô«s˜€»Þ«nºñ Øb•Á ˜HV8Û¬®_¦Bo•8f›ÕF3µ½^LGJmo3€TÛ[…tÙ!ÓŸ²&øT"ÒYÝYPÔÔWXÝYå•lo}eÃʼæS ¾²eàhÊL.°D&u@å®Z¹Ó±Î²ÛôŪ–K«ìZô]Œ|˪,þê\P éÕCYÉ«§á}WðJ *\Wë\PM`Ž Êq)5¡©Pçrj’ŒI¸¤Ò¹J×oq\‡_ Æ»('L;ñ$ Óûà•œW]ˆT-fÅÿÁprvƒûRh- ô†bÆÞ »7:’ú¼²…W—"QÌ‘Z£ïb„iEagIâl3 Gü¢ª'óPžJ«‡V1Í v×Ì x~2gJ¡”Z©¨ôi(D×1ê6&Ô‚kx¹„ƒžwÓd0À`„écç÷™¨û™õÎÌÚϺáXÕÂKSÛ@ý”R ÒiG:ÎQ°&tP¡hÒï?úÿ Ö^¤qØÍƒ–ê—-˜. àmNu­®`¸¥£ÒB"¹NÿŽÃôÕO H‰m×ð1ý=–¥ctL¨ÑbVBb­ºŽF7¡­ÕUlT3=(tóW: Ø$¢`I‰·†xçsüíù$Wá2´Æ )–˜Q°…v– CݹuDƒ¨“˜j×§áU8 %ð;¬Ò-ðá$¼ÉÁ7¸J/)=ÇC´MDS™o5ò$¹ºØù+tóf*kÜR5Êd»ÂÐÞÖ½ ]À²„8 Ä‘Yo¢³eÉ4Mte»4<=Œ½£l ­b‚…„*vŸH”&¢Ð¢˜¥xŠù\^ÝCTH Õ±P%ø~ŽÉü~œMüäµñuˆoÅÝr<¢ !®­sÚÁ¥(¼èÓ'äH†Ä% ö®”»æÁ±»4’2pÞ'å5ü7 ÓtÞÎOc…²ªQ¦ã¼íäGX"¬i„”ÞÅ"Ñ…¶—ÜŽT=ë îLjø¯é”4‰ô%:$ÔÄâ}‰“©½I? ¯"ì!˜YÇè/IPÒ±Š7e¡S; Žæ¨§ð7ÿäÐBß®b…Š+è.àÈB€à\+°”âî†ã£”¾=S$ÊHÁ²³‡ý»¨;U+ЦL‚%él%öGBKLJ© •þâFÃf—Q/‘”ØÀ1„Z$c{8΢rƒìØRȵؖåGÑhª@7ÍŒƒXÓ}‰ µ  C÷ÚV#p±‘ÀÛKzùàb!©ÁžºÝÅöȈjl ² µàÿÚ# q˜%[ú8È”½¹Õë…ŸPÃ|«È¬›Æã‰ÄU[M*ÁZцyV*¬²¬C¯>ÜTDo(…Là²*½´ ÈèâTÉ2)j‡¶t=%­¡¶­œ}P|dªs.5#~Ð6 ±ÓƒºP=NÛ |ÿÙ½*¡WíŒ5™±fg¬ËŒu+ƒ$+f½³²H¶bÖ†•¥DÎö¦•aÈJóæórA³m“É{Û ;Ï”q…\s˜µëB4*µóQÀaNÓÊ1Ûöž•gJí}»‹†F¼}`×aò(o—xáŒs]^TlÇ©í6ì. ¥BæØ=:Æ!>(ó›È³*Qˆ¬>ÀãxMN K¿‰k÷{/êÆCÕþF¡ã1ÇÈÌ{­HQ³»beÔUFÝÊXU6‡¯© ›Ã×U†ÍáïT†Íß*ÃæîM•as÷–ʰY{[el¿ÐÑ~Ó;ˆ Ê›–I;päáÞµ7¥—ƒ¢Â{O¤·Œz¤[@Q}‰§•;Ap>é|1èG·A" Æ÷¦ýß–ÈhûœM»×v9ôrX¦cS•¾ ì2y¾¤k{ƒo Eÿù…^“¢§SÃ|{…OšàC'¡òkïxÛ…°„ƒâ~ü@3c¬Íl.(&h2~:P,ÐdÜt  Éxé@ “qÒü&ã£5ôMÆEjà›¼;Šã›|m¯«~6º“êªÿM~ØàN†3™ÎDÆ¡;ù ®éÅäÈ¡;ù ®éÈÄå¡;ù ®éË$É¡;ù ®éÎ8àÐ|P×ãÁ8ãÐ|PWã´ÇwîäƒU5|{üª«îN‡#™ÎXìÌ|°ªÆo±Þ™;YlõU:cÉ3w²Øâ«tƪgîd±ÉW錅ÏÜÉb“¯ÒgŸ¹“Åæ^¥3Î>s'‹ ½Jgœ}æN[z•Î8ûÌ,¶£*Ÿ¹ÕÝékzüšÞ~°¦pûÓÖôîsxwúÁšÂïN?XSc¸¿ÂátܪɧUŠ»4z?E£j Ja96ÿ{&aq/vF눸Iû}]ôš.Z¸áUñëyñ%á83¶ûïhs$Ö»Añ|Dv3‡Æ½p(p¾w›„ºé›ºéÃhb«U©½•7ÚÚä”ÞÖe†›t§Jlä%ϧðò‡*r7”1~j•1~úï ÆOK€?–1~:*büt\Äøé¤ˆñÓ©ˆ_³ü¥ˆñÓY ã§ó ÆO%@ŒŸ>•1~ú©ˆñÓç ÆO—%@ŒŸ~.büô× ÆO4ìÞD¶Àã'°R°!ê:Jb«01~ÂppÀ›YIŒŸÀÍ8ͺpºÃ€?OµCëÚ`ü„*GQy › R•Ã^ÚãÂN ãÂn ×ÕJ€Ú]U@Œ û%@Œ ¯J€Úê†b\—1.ü{ ã› ¾J–q­«ˆq¡½j+ Æ…I ã±h“sa ã§´ˆñSAK@ŒŸ 71~š–1~úRÄøé¶ˆñÓ] ã§û ÆO¿–¤šcÞoZR­Hs*H5Ǧe³(Õ&ñ ÇÖfĶó£¤לl»( BÇ>ïíÍ¢BÆ+æ®mÉâ¼"ô@|æ™w/d¼B/´wïm Æ+÷QqÂÐ;N¨ä&qšãˆo)žÄx¥‡Qeqf1^Éíh9ã•$íõ…þ=‚Ÿ&ã•«i<DÃÄ\¨ƒ‘jèº,I`-!;b‡éÀ(™ð¹,„ñÒõ½Ø [¤ ÆKR†.êq &›ðlGIL6õ"x,³Ôaüû]{§ @Œß&· Ѐa¯ Äømr-j³Àˆñ[F¼IÄømèNÄø .…0¶t’ã7Ú^S$EPÚ䳩ƒc©]ã·dd÷€¶ù°dÝéÀä6ró›Á¾„ü&Í|ªN´GìS¶×ƒRºÐu8àZõ ã&ËÊ ç–ÑLÄ®áÐÉP—o,@Œá¤"öÑb ×°$®b ×pHb ×H-9)Ã5Kb ×t01†Û/¡c¸ý:1†Û/¡c¸ý°Å°UÒ&ÆO­’61~j•´‰ñS«¤MŒŸö/Š›kÔcü´?)êª4SÅ?vóNqቛ&=Æ…'nšôž¸iÒc\xRÒ&Æ…'nÂõ¥a‡]㓤3€Ç^m Æ…ŸJHÀ¸ðS ~*!ãÂO%½c\øsIuŒ />œœÙ‡ĸðâ:I'x½h&ï@(—t\ÄâÇgnÂEŒwCwO"Æ…¡›pãÂÐÍ;_|ÝÔ†nYñKÇv€vݲ0b\•ЉqaTB'Æ…Q F%$`\—´‰qa\Ò&Æ…qI›Æ%mbü¹Å\ŸñÓÈÍ}ÆO‰»w}ÆO‰»w}ÆO‰»w}ÆOII›?%nô?õâ/qV<¶î3~J—%ÄøiZBÆOÓ0~š–€ñÓ´¤wŒŸîKª³t5§Àê3~º/©®Ïï@é"Ó¼ÿ” «ôC߀Ö_XŽYEWìFr%tÍ«]u¾kí@p¬Bãë|×z÷ˆ7QˆûywCÇö§Î7¤çN‚Öù†ô¼¤¤mädu¾¼()‰qÂ_KÚÄ8á¯%%E¼$ðC… aˆ/BîaéXò ƒ@lXîaá›»»á|ß–¹IÀ÷mŽ‚ˆMõ¬¤ºmä;¾%›””ÄÆî×’†³±£ P€Ø,þµ¤ºˆWç`¾ã:s·ÉÚq9&ñ)UR»f µröÎÚݸ9ÓÚ¸””Ä(¾WÄè´çf_¾“8v÷Žï ŽÝÕY{7”+)‰ëßNm¬néß%Õu¸|rN®§nXZ«›Ÿ¸®9()éŸæn KtÒÉÒÝüd)%%ñ\ÄÖÜüdicîÞqmlä®ÎÒÆÜÌu¨i ã‚´¤:®¹™Ž«G7?qUÄ!ÃÈ¥Š¬:T‘5KYuª"Œñ>8‡f•«"œjÛ*× ZN ¼Êuƒ÷Îɰʗýÿ.©ŽŸ»ÎëkwI|õŒ{p˜ÍMJˆ5üÊÝp¾æý½¤:Öð¦›NÖÒá.‰/ïÝ%q¹ùÞ]’%7ݽãgç%%E\F9Ûd 2wI\]¹Kâ³øÊ]’5Aݽã{…¬¤¤È1÷Ö”;¥9ùÖ­É·æœ|l³w“ïÎWîÖ¸ŠŽÇEë94óÔåÌ)oÖøÆ åÜl®ñÁaIIÜ+ÕqÅ@!gEwI|áuîH×øäOÝ%qýÚ¾bT@¬wƒ’’Xï"wï¬‹Š’’Xï&îÞq ±\4¥ ƯQaÍ! ~Åàn8Wx[Ne`Í:„wÎÆ5ëÀ»¤:Ö¦c7¬³dwI\oüXRã‚OîÞY*¡›U¸üûTÒ&¾„»¸J»Ûdõ¹)n«•TÇ(>°ùÓÉ:çr—Ä5«›’’ŧîÞ³ÛÇE²ÔŠs™<-i“K&¯úŠUßµ<^·åñÇÆEãcã˜9£$_Ð ¢ä–ë›lˆ¡äv:€7w0û#¹*…ÈÉ8‚¨QÒl&òj¹;H2Oäµ"²Ã»yÝ<ú;º Î¥ Èï ȵÛRnKÑã¼tiÃâ>»¬(ÝÅm=( 7 È.3®ä­²Ëލy»€<“ê9,òœ?r§€|ïG1@î‘ý: Ƚ"²_»¹8I'™WÕ€Ü/"û7»?›aÇ)X´_E½ ýr«Šã'Ø—áx rQÚ¸¬©K‹ÒÆeÎ[‚\”6.Ûò䢴ñ›àˆ\”6ý(ÈEñðÑb€\ý(ÈEñðÑb€\½Eb§(Îý Vç¼(ÈEñpîO°¢x8÷'XQ<œû¬(.¼ Ö-Îç¦7ÁºÅù|á͞ݺÇJzá7P\Q<\x^wÕ§-ÞÃÙ-J› ïáì¥Í±ÿp¥Í±ÿˆ¥Í±? ‹ÒæØŸ`EisìO°¢´ùàO°¢´ñcD.J›‚¥Í‡ {0ìú…×ú…ב?ý‹ÂëÈ›þ½¢ð:ò&a¯(¼Ž¼ Ö+J›#o‚õŠâágo‚õŠâágÿ>ÅÃÏþÍ.Ї3ÿfÅÙÿ8ÅÙŸ‹âáÌœ‹âáÌŸ`EñðÙŸ`Eñàrà+AfóùKw½ô{‰Ì–£aì[ ç3ÛPÛÌ#ub^*5Ò°w¹{ÿ;û¥qÖØm±x„æwÒ°r÷Žo%²Ë Ø…ÌuQ‰¬ßìB;ðÈ}òu8üÕ§Ù–6!Ã^/„Xº‘˵Ì@^-«Ùy­ù6t¹™ÈëeÈèE8£r@~W^ó}äò3‘7ȳ;k o:;3«4·È“èZ°Gg:™5Ø€¼íFö«9t!_{`²‹·ÿE.—½"²kV]‡žÍî9o|°9r ÷ ®ø%È®)9¹öÀÈ\U‘ÈŽ67²k>ÿ B}]ó9‹~`.d×|ή=°Ù5Ÿ³°zBd×|îù"»æóÄ“Ãz®ùü«/²k>ûŒ"»æóÕµ: ;çs8¹¢ È‘‹=ûž’$r±ç/aµðDd{Þø"»Ø³›§ ÙÅžCO¹Øs”ÌV 4²‹=¯=…AäbO±Mȳ÷²¸ÙKµQœ“Ûź9 o²é,ñÈ.nŸ½TÈ.nï‡ð|J8{ ÙµzõB¡ú »V¯›0K½]«6Û§ÏîÕËO•\«6Û¹ïÙ5h”È.ñMo¦>¸é­ï°À½Úܰ¿Ð¶ÀزÑ4ïS»Ú±ð°Â²³Õ°°æÏ²µ­Ã°ä¾8Ò±·ŽÚ½¿°Â³å­Ü³¾ðÛÖ£±Ê±ôª’²Ï¶¯*Ñ™ÇÕê²Ñ²ÔÇշɱʶÄÌÍ²Ô¸é³æ±á4<®l7 ¯ÛȈëÙçõÙ'§B/ó¡Â»’ŽxµeÃÙKSDžÝ‘¼-÷•Bq›Î¶Tãòì¶hîð£-S{à²g[ÕBqÛ®¶xà²g[F~m ]mñÀ%äÙmQÅM²k¯¶tܳæÆKv°5k÷>$é4Ë úì:IgÜ&rä$aï×Êvrß)/õ#aÅÝ5¾’‚5”Çï®U[öþ»ú4Kd÷ûJt@vËîVõQ" —ÈîVe»Ù-»=ûì-»÷*ï:¡¸Ù]} ÈnÙíq†ŒÈ¾²ûçÊ¡8·ì®Æ%dOå9FNÙíKÈžm9¬.ŠsÊn\Böl˱_[œ²Û—ýd÷ÅyõW"»?zÉŽrÙ}þáälÆ%7 »e÷Þ_+Û ÈNÙ½÷W?VÈnÝ ,Q·SÐÈ^æ‚ü<\#w¼¡®[vO*µUD^s¯~5¯;‘«uvD~çDö:ÒÞ°¼ò•—¦ÂÏÃ5²Çù o¹û\‰‹ÈÛNdTqf—È¡ùƯÙ7µ}Ά7øyxŽìsµÁÏÃsdŸƒ¨®[{Ør²{>G®¸{Ed÷|Ž\ñøŠÈîù\ˆƒåFvÏgSN@vÏçj%‘Ýóy¶©´FvÏgx>¸Bõd÷|¾Òªn²{>ûmzîùœùµmôJæseňìžÏÙu·ªn@vÏç®ß8»çó5¼ùS=Tîùìa]"#÷|ö0wd÷|ÞõR4"÷|¾¨¶¾d÷|Þó«Ù=Ÿ«÷eˆìžÏû®hÖEd÷|~ï¥Fîùìa3Èîùì· ‹ÜóÕØÙ%²{>µ÷³§²{>ﻢk‘Ýóyܻ߳ˆìžÏûÕÆ<€ìžÏH€ìžÏ§^ìÙwÏg;5@vÏç}W´ï"²{>ﻢ€‘ÝóÙÃtÝóÙÃÒ Ýó¹z£…Èîùü“_³ÝóÞ?o½ŸÅg€ìžÏ?ïWز{>ûmûîù|^-‡¹d>WVŒÈîù|þ¡YU7 »çsÓoœÝóùCãlÏc¨¬H êBʸÈzŸFÑ »ÅÚ´mâÞŸíï4[8íÆáé‡FØ-¼!c·b“ßaòþéyëðä¸WÈÕõòZ¹u⃠ÈëndW€â"ò»"òÉQ«yæÕçÍ"ò'o‚m•"÷â™ ämW³÷ßûs§ˆLx#rTD›ðøWWœîrßQ3<îÓ쎃=£q’Q5µ;öŒ&Õõ²ƒ=ãÄì ÈU´&d{æ5Ï*7ŠÈÉ0×f‚9x{êMmoKäjÞî8x›Õ\Z ‡®>GW~æ˜(=g i䮃=w÷}ܵÙÁžïG΀ì`ϽýCªÙÁžRè{ ;Øó¯Þ}v°§.";Øóâƒ: ;ØV ¿šìù±qzêW³ƒ=G{~ÈöÈ»ÕØ%È~5€Ü-"ûùr¯ˆ|é釸Ùu,7r}ö@v,7§¾5ócLB>órd‡0j ß|î9„ÁEÇ܀ì˜ÏŸ|çsÏ1ŸO½œæÙ1ŸýNÙ1ŸE«=‘óµ!/dÇ|FÄ9rŒs'šiÜo ;ÆùÊÇæ‘B¿ <ªd“HUÊÙÁ$¿z÷ÙÁ$^¸ˆì`’ɵ: ;˜T)¿šLâ åFv}x=ÆÙ!·r§»Ùõl‡Ù!ôGÞÈ¡çÂB_*®È¡?ö­¹ïúéµO,@vƒ,¾ò›Ï}‡0¿ÂA6 ƒYŲCLBŸ±d‡0˜ú ƒ¾CŒ¯}È ÈaÐõFvÑjOd‡0Àm‚²CXž6\Ƴã¸ç"ê^ân8`G>[ö‘ÏÅ~óÃq«Ù84[¯!¥bÙõò_ÚâÇ>“dìÈŒmñ  ›ŒFQw’TlñcQs<šÀK~ÍflÛI&Bæ¨EéijՈ¼á XöKUd,‰¼i5ûAÈ[VÍø‘6 o[5?9tôßs®º\䎣ÏÞÈ]WŸ}°¹çê³/rdÏ* &Ö¦ƒ{|qn2[†°ZOlÌÍY‡MÁ‹Å~—Í\wq˜/òªU3Ì OG~|­ÙP ’+ XèØ‘#r¥2£ùc¹a:‰ÃA/Jã/aEÐMÌ÷[} Ôé×mÌw°P…išxx¨"2¾gì‹JÈÝ‚Ð÷Äd6TðÚâCšm…‘Õ:¼å|ucÒþsõÛVÿÏO÷›-®ü ¡6*>RhÌ6ú,ˆ…/‡I5Û dnֽބ™v’0õBæó+â³ÚÈL”÷½¤aŽÌßÖõ™$2SS¬™-"#?q¨‘Ù"òåÛæòá9¾›¤£*ÓZ@æi½qÙš¥0ɽp¹k5Û{|œ“ C˜åêmÇ6?ƒÂ-bvÃQ½¹_мV‰ÌÏ ò»jäz)òf5rq3¯·«‘×lQîË¡€¼^ƞ؀l+ÿÞSíÍüƒ™ò»J+y‹¯R˜›«Àé´3ˆ³kÁµ|!í…àôÓîaëüCëø½Ù hÈ^1¯hPÈ‚ÄùAÈ«¼æ5ol@^ãÈëBf¼Ó‹¯â‰': óתA{y2ç1N¾ídÆ;×aœ>™?«4ì^w˜…Ìä= ™­`z÷ýt@fâ< âñL ŽÌ$2<£Ô ³TUtw@f9Eb´ªÕ‰lÇÜ&ˆìÓn@®[5÷ã¾ã•ÐäU«fDö­™¯Ââžè€ÌfU?™¦¾Uò;«ÏY|çßg6«úb‚Øž5ó7ãÅ.;ñTÑy‹×|å=3¹c¯ø>¼×Ánh=O(tÿa8'q…mšDîOϪ™Í*]èák¥‘íYAå>$ÈÝ"{zåHòºÍ$ž¸ˆÌŸºŒ¾D£ÔÌ…~ö¢Y-äm[z†“iêS ‡Îšã- ù™]u“‘×IÈü^6à ›2›U×Ñ<ëî)ŽC.Iƒ¨Ö™ŠoUr›Ÿ2n}Ò¸»ŽšqëS… ÈÖ¬"tŸyÈ‘ z]A/Dæ/žÔ|ö"?2"äì—©X§«Ð™«RRT×KÈ«6²&ótösJ€¼VŠ §Èë6r6ñÛ&ò;N°|œ}¶áBÎ~ñªÍ"{ú‘ ·f Ï$ oÛÒU!/'ðVÑ}¯6 ³ùÜL;•UÈ\‰ó;FÕÈ=.ÃÂÔÿø$Œ,%n Ävä%?2?oê…WWÐùy-S~E2›’x~ì¯Jñó¦N8$¿%ùB7Íàº$»Óª‡Õù¹/Ö,¯š7¬¡Š²ûa'ñŠSòó¦~äÈÜx$Dãk¡²WWŒÈÛNd!“´7s°™MI@LÄ=¾î&ã{œ 3‘ù”+Å&¿å!ýmÜV«aˆÜ+ò¶?2žvšf^·qÙòÌ÷X üÓC~,Ø)DÉ?-†ùpå®ÃOåèÐß78ñnG©™¿£;öu@f¬ /+úÊv¸u4{"6Ѿȫ¼ÙÙuâýv^‡o‡¡ælWï‘$2“gS߳Ӏ̆êïUO%ZÈln MÎoÅ“Èü¾|ìKkBæ3ÌkG™#÷­¡ò¤5"÷ŠCå9Ò€\´6òÄä-{>?¤æÐF~o÷ŠGžØÄ0 Ó{j^s|ˆ:itË ]»¶$û°¿{¶ÿ™«H€•‹e8.oB—ïZ$rËXuû»|×"‘;~’°k]tkdŸg òìXk²¸«xX Š[u#Wc#²W[zaåvŒŠ[+C®¢ "{µ¥:´Ž,nÝì*½Ë·hÙó ‡.ߢiä{Ÿ‡²„fí£›vùŽO“ГÍ+‚_Êâ&¾Åm¹‘ýfMEðKYÜ}âe\Õ¶È}pθ gË@ÈUx¹ã@„ÃÈæË÷£f³‡è¹ç@®ÂÓÈQYÍ£ŠÐð€ì’ÔUx ¹ï’Ô™ X×C¨ô]’o¼½xÎgfcq.I$¬ŠÂÈ.Ñê½]²kþ5œÝ]²P!ÏtÎAd/V5Cç­³›‘#{µå—Äo"÷]¢õfêõŠ@öjKyÜVBq.Ñ V&^È.Y8ñ\)û.Y8ñ{F ϦÂّǽ AŠ&jŸÿöüyþ<ž?ÏŸçÏóçùóüyþ<ž?ÏŸçÏóçùóüyþ<ž?ÏŸçÏóçùóüyþ<ž?ÏŸ’Ïÿ& yH&UÓ„yzªu“-z=ɘÉåÆÜ£ K+jvOÌ›ªùõBù2Õò»$UIîjMýÊ¡0ŽÈS,ÿý¸NèØd_bQ–›,¯d9™DÃñÀ|À3®€Wƒ¾SüóQ·ïGaW0é"‚j{ Ãl]Û9ÿ¹*ƒšU°ê磾›õµÄaíû®Ûö-W·|rÉ•{ –‘Ú·rì¿ù*1«õ_»Ž€ýÈSuê×jƒð(¦™Ø}=\ ÏÒÐ¥…giÇ•ÜK«}?æùù1ºtkeden1.32/Windows/Notes.txt010060000025250000147000000024700731544631400173160ustar00ashleydcsother00001250000011 Eden on PC notes ================ Using latest cygwin (setup.exe version 2.57, but packages vary). Use this to configure: ./configure --enable-debug --enable-depend \ --with-tcl-lib="-ltcl80" \ --with-tk-lib="-ltk80" \ --with-gl-lib="-lopengl32" ln -s x11includeslocation /usr/include/X11 as /usr/include/tk.h tries to include X11/Xlib.h, and it looks like X11 includes are not provided with cygwin any more (thus breaking their installation of Tk). Keeping a copy of the X11 includes in Windows/cygwinX11.tar.gz just in case. I got the X11 includes from an earlier version of cygwin. ln -s tkPlatDecls.hlocation /usr/include/ as cygwin doesn't seem to include this header, we can't find Tk_GetHWND. Keeping a copy in Windows/tkPlatDecls.h just in case. I got this file from the Scriptics Tcl/Tk Windows distribution (which is designed to be used with the Microsoft compiler presently :<). Hints on using cygwin: Had to add these lines to C:\CYGWIN\CYGWIN.BAT: REM added by Ash to get the pipe symbol working keyb us,,c:\windows\COMMAND\keyboard.sys ... this doesn't work on Windows ME, so had to set the keyboard to US globally (grrr) Can use cygcheck [filename] to give ldd-like functionality (ie show the the dynamic libraries that an executable will use). gdb --nw to avoid the annoying windowing interface tkeden1.32/Windows/run.bat010070000025250000147000000030620733031763000167530ustar00ashleydcsother00001250000011@echo off REM This script starts tkeden on Windows REM $Id: run.bat,v 1.10 2001/07/27 17:06:32 cssbz Exp $ REM This file should no longer be required as tkeden attempts some REM guessing at runtime about this configuration. It might be required REM if you are attempting to set up file extensions to be associated REM with tkeden however (as the current directory might not then be REM the tkeden installation directory). REM INSTALLATION CONFIGURATION REQUIRED HERE! REM REM Here, the directory containing tkeden.exe and its support REM files must be specified. REM REM Don't install tkeden in "Program Files" or any place where REM a space would be in the pathname. REM REM The directory must be specified as a full DOS pathname and REM must not have a trailing slash: for example, REM set INSTALL_BASE=C:\eden-1.15 REM set INSTALL_BASE=C:\cygwin\home\ashley\tkeden1.15\Windist REM You shouldn't need to configure anything beneath this point. set TKEDEN_LIB=%INSTALL_BASE%\lib-tkeden set TCL_LIBRARY=%INSTALL_BASE%\share\tcl8.0 echo TKEDEN_LIB is %TKEDEN_LIB% echo TCL_LIBRARY is %TCL_LIBRARY% if exist .\tkeden.exe goto DIST if exist ..\tkeden.exe goto DEVEL echo "Cannot find tkeden.exe" exit :DIST REM tkeden is in the current directory - so this is the minimal version .\tkeden.exe -l%TKEDEN_LIB% goto END :DEVEL REM tkeden is in the directory below, so this script is probably in the REM Windows subdirectory and is probably the development version ..\tkeden.exe -l%TKEDEN_LIB% goto END :END echo tkeden has finished tkeden1.32/Windows/tkPlatDecls.h010060000025250000147000000145520733031773600200560ustar00ashleydcsother00001250000011/* * tkPlatDecls.h -- * * Declarations of functions in the platform-specific public Tcl API. * * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tkPlatDecls.h,v 1.1 2001/07/27 17:07:41 cssbz Exp $ */ #ifndef _TKPLATDECLS #define _TKPLATDECLS #ifdef BUILD_tk #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLEXPORT #endif /* * WARNING: This file is automatically generated by the tools/genStubs.tcl * script. Any modifications to the function declarations below should be made * in the generic/tk.decls script. */ /* !BEGIN!: Do not edit below this line. */ /* * Exported function declarations: */ #ifdef __WIN32__ /* 0 */ EXTERN Window Tk_AttachHWND _ANSI_ARGS_((Tk_Window tkwin, HWND hwnd)); /* 1 */ EXTERN HINSTANCE Tk_GetHINSTANCE _ANSI_ARGS_((void)); /* 2 */ EXTERN HWND Tk_GetHWND _ANSI_ARGS_((Window window)); /* 3 */ EXTERN Tk_Window Tk_HWNDToWindow _ANSI_ARGS_((HWND hwnd)); /* 4 */ EXTERN void Tk_PointerEvent _ANSI_ARGS_((HWND hwnd, int x, int y)); /* 5 */ EXTERN int Tk_TranslateWinEvent _ANSI_ARGS_((HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT * result)); #endif /* __WIN32__ */ #ifdef MAC_TCL /* 0 */ EXTERN void Tk_MacSetEmbedHandler _ANSI_ARGS_(( Tk_MacEmbedRegisterWinProc * registerWinProcPtr, Tk_MacEmbedGetGrafPortProc * getPortProcPtr, Tk_MacEmbedMakeContainerExistProc * containerExistProcPtr, Tk_MacEmbedGetClipProc * getClipProc, Tk_MacEmbedGetOffsetInParentProc * getOffsetProc)); /* 1 */ EXTERN void Tk_MacTurnOffMenus _ANSI_ARGS_((void)); /* 2 */ EXTERN void Tk_MacTkOwnsCursor _ANSI_ARGS_((int tkOwnsIt)); /* 3 */ EXTERN void TkMacInitMenus _ANSI_ARGS_((Tcl_Interp * interp)); /* 4 */ EXTERN void TkMacInitAppleEvents _ANSI_ARGS_(( Tcl_Interp * interp)); /* 5 */ EXTERN int TkMacConvertEvent _ANSI_ARGS_(( EventRecord * eventPtr)); /* 6 */ EXTERN int TkMacConvertTkEvent _ANSI_ARGS_(( EventRecord * eventPtr, Window window)); /* 7 */ EXTERN void TkGenWMConfigureEvent _ANSI_ARGS_((Tk_Window tkwin, int x, int y, int width, int height, int flags)); /* 8 */ EXTERN void TkMacInvalClipRgns _ANSI_ARGS_((TkWindow * winPtr)); /* 9 */ EXTERN int TkMacHaveAppearance _ANSI_ARGS_((void)); /* 10 */ EXTERN GWorldPtr TkMacGetDrawablePort _ANSI_ARGS_((Drawable drawable)); #endif /* MAC_TCL */ typedef struct TkPlatStubs { int magic; struct TkPlatStubHooks *hooks; #ifdef __WIN32__ Window (*tk_AttachHWND) _ANSI_ARGS_((Tk_Window tkwin, HWND hwnd)); /* 0 */ HINSTANCE (*tk_GetHINSTANCE) _ANSI_ARGS_((void)); /* 1 */ HWND (*tk_GetHWND) _ANSI_ARGS_((Window window)); /* 2 */ Tk_Window (*tk_HWNDToWindow) _ANSI_ARGS_((HWND hwnd)); /* 3 */ void (*tk_PointerEvent) _ANSI_ARGS_((HWND hwnd, int x, int y)); /* 4 */ int (*tk_TranslateWinEvent) _ANSI_ARGS_((HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT * result)); /* 5 */ #endif /* __WIN32__ */ #ifdef MAC_TCL void (*tk_MacSetEmbedHandler) _ANSI_ARGS_((Tk_MacEmbedRegisterWinProc * registerWinProcPtr, Tk_MacEmbedGetGrafPortProc * getPortProcPtr, Tk_MacEmbedMakeContainerExistProc * containerExistProcPtr, Tk_MacEmbedGetClipProc * getClipProc, Tk_MacEmbedGetOffsetInParentProc * getOffsetProc)); /* 0 */ void (*tk_MacTurnOffMenus) _ANSI_ARGS_((void)); /* 1 */ void (*tk_MacTkOwnsCursor) _ANSI_ARGS_((int tkOwnsIt)); /* 2 */ void (*tkMacInitMenus) _ANSI_ARGS_((Tcl_Interp * interp)); /* 3 */ void (*tkMacInitAppleEvents) _ANSI_ARGS_((Tcl_Interp * interp)); /* 4 */ int (*tkMacConvertEvent) _ANSI_ARGS_((EventRecord * eventPtr)); /* 5 */ int (*tkMacConvertTkEvent) _ANSI_ARGS_((EventRecord * eventPtr, Window window)); /* 6 */ void (*tkGenWMConfigureEvent) _ANSI_ARGS_((Tk_Window tkwin, int x, int y, int width, int height, int flags)); /* 7 */ void (*tkMacInvalClipRgns) _ANSI_ARGS_((TkWindow * winPtr)); /* 8 */ int (*tkMacHaveAppearance) _ANSI_ARGS_((void)); /* 9 */ GWorldPtr (*tkMacGetDrawablePort) _ANSI_ARGS_((Drawable drawable)); /* 10 */ #endif /* MAC_TCL */ } TkPlatStubs; #ifdef __cplusplus extern "C" { #endif extern TkPlatStubs *tkPlatStubsPtr; #ifdef __cplusplus } #endif #if defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) /* * Inline function declarations: */ #ifdef __WIN32__ #ifndef Tk_AttachHWND #define Tk_AttachHWND \ (tkPlatStubsPtr->tk_AttachHWND) /* 0 */ #endif #ifndef Tk_GetHINSTANCE #define Tk_GetHINSTANCE \ (tkPlatStubsPtr->tk_GetHINSTANCE) /* 1 */ #endif #ifndef Tk_GetHWND #define Tk_GetHWND \ (tkPlatStubsPtr->tk_GetHWND) /* 2 */ #endif #ifndef Tk_HWNDToWindow #define Tk_HWNDToWindow \ (tkPlatStubsPtr->tk_HWNDToWindow) /* 3 */ #endif #ifndef Tk_PointerEvent #define Tk_PointerEvent \ (tkPlatStubsPtr->tk_PointerEvent) /* 4 */ #endif #ifndef Tk_TranslateWinEvent #define Tk_TranslateWinEvent \ (tkPlatStubsPtr->tk_TranslateWinEvent) /* 5 */ #endif #endif /* __WIN32__ */ #ifdef MAC_TCL #ifndef Tk_MacSetEmbedHandler #define Tk_MacSetEmbedHandler \ (tkPlatStubsPtr->tk_MacSetEmbedHandler) /* 0 */ #endif #ifndef Tk_MacTurnOffMenus #define Tk_MacTurnOffMenus \ (tkPlatStubsPtr->tk_MacTurnOffMenus) /* 1 */ #endif #ifndef Tk_MacTkOwnsCursor #define Tk_MacTkOwnsCursor \ (tkPlatStubsPtr->tk_MacTkOwnsCursor) /* 2 */ #endif #ifndef TkMacInitMenus #define TkMacInitMenus \ (tkPlatStubsPtr->tkMacInitMenus) /* 3 */ #endif #ifndef TkMacInitAppleEvents #define TkMacInitAppleEvents \ (tkPlatStubsPtr->tkMacInitAppleEvents) /* 4 */ #endif #ifndef TkMacConvertEvent #define TkMacConvertEvent \ (tkPlatStubsPtr->tkMacConvertEvent) /* 5 */ #endif #ifndef TkMacConvertTkEvent #define TkMacConvertTkEvent \ (tkPlatStubsPtr->tkMacConvertTkEvent) /* 6 */ #endif #ifndef TkGenWMConfigureEvent #define TkGenWMConfigureEvent \ (tkPlatStubsPtr->tkGenWMConfigureEvent) /* 7 */ #endif #ifndef TkMacInvalClipRgns #define TkMacInvalClipRgns \ (tkPlatStubsPtr->tkMacInvalClipRgns) /* 8 */ #endif #ifndef TkMacHaveAppearance #define TkMacHaveAppearance \ (tkPlatStubsPtr->tkMacHaveAppearance) /* 9 */ #endif #ifndef TkMacGetDrawablePort #define TkMacGetDrawablePort \ (tkPlatStubsPtr->tkMacGetDrawablePort) /* 10 */ #endif #endif /* MAC_TCL */ #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */ /* !END!: Do not edit above this line. */ #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT #endif /* _TKPLATDECLS */ tkeden1.32/Windows/unix2dos.sh010070000025250000147000000004260733031773600175760ustar00ashleydcsother00001250000011#!/bin/sh # # $Id: unix2dos.sh,v 1.1 2001/07/27 17:07:41 cssbz Exp $ # # unix2dos.sh by Ashley Ward for cygwin # (the line should include some nasty control characters - this # appears to be the only way to force cygwin to perform this task) sed 's/$//' $1 | tr '' '\r' > $2 tkeden1.32/Windows/CVS/004070000025250000147000000000000735463305000161145ustar00ashleydcsother00001250000011tkeden1.32/Windows/CVS/Entries010060000025250000147000000003400733031774000174430ustar00ashleydcsother00001250000011/Notes.txt/1.2/Sun Jun 24 20:25:48 2001// /run.bat/1.10/Fri Jul 27 17:06:32 2001// /cygwinX11.tar.gz/1.1/Fri Jun 15 20:44:46 2001// /tkPlatDecls.h/1.1/Fri Jul 27 17:07:41 2001// /unix2dos.sh/1.1/Fri Jul 27 17:07:41 2001// D tkeden1.32/Windows/CVS/Repository010060000025250000147000000000170727406551400202200ustar00ashleydcsother00001250000011tkeden/Windows tkeden1.32/Windows/CVS/Root010060000025250000147000000000550733030417600167570ustar00ashleydcsother00001250000011cssbz@cvs.eden.sourceforge.net:/cvsroot/eden tkeden1.32/Scout/004070000025250000147000000000000737051041400151205ustar00ashleydcsother00001250000011tkeden1.32/Scout/lex.c010060000025250000147000000275520736260534500160770ustar00ashleydcsother00001250000011/* * $Id: lex.c,v 1.16 2001/10/15 16:12:21 cssbz Exp $ */ static char rcsid[] = "$Id: lex.c,v 1.16 2001/10/15 16:12:21 cssbz Exp $"; #include #include #include #include #include "../config.h" #include "symbol.h" #include "tree.h" #include "parser.h" #include "../EX/script.h" #include "../Eden/emalloc.h" #ifdef HAVE_DMALLOC #include #endif extern void yyparse(int); extern char agentName[128]; /* for distributed Tkeden --sun */ extern int appAgentName; extern int append_NoAgentName; /* [Patrick] we are within a window definition, so don't prepend the agent name. [Ash] now thinks that this is 0 when a reference to variable explicitly in the root context is made (eg ~ON), which then stops the prepending of the agent name. */ extern char *libLocation; /* function prototypes */ static int search_constant(char *); static int search_token(char *); static int search_field(char *); void yyrestart(void); static void save(int); static void action_A(void); void yylex(int); void init_scout(void); static int ScoutAppAgentName; /* for agency -- sun */ Script *st_script; char *st_prompt; #define NCONSTANTS 16 static struct { char *name; int val; int token; } constants[NCONSTANTS] = { /* This table must be in alphabetical order. Note you need to adjust the pre-processor size if you add or delete items and possibly change stuff in print.c and store.c... [Ash] */ { "ARCA" , 2, CONTENT }, { "CENTRE" , 3, JUST }, { "DONALD" , 1, CONTENT }, { "ENTER" , 4, INTEGERHONEST }, { "EXPAND" , 4, JUST }, { "IMAGE" , 3, CONTENT }, { "LEAVE" , 8, INTEGERHONEST }, { "LEFT" , 1, JUST }, { "MOTION" , 2, INTEGERHONEST }, { "NOADJ" , 0, JUST }, { "OFF" , 0, INTEGERHONEST }, { "ON" , 1, INTEGERHONEST }, { "RIGHT" , 2, JUST }, { "TEXT" , 0, CONTENT }, { "TEXTBOX" , 4, CONTENT }, { 0, 0 } }; #define NTOKENS 47 static struct { char *name; int token; } tokens[NTOKENS] = { { "ImageFile" , ImageFile }, { "ImageScale" , ImageScale }, { "alignment" , ALIGN }, { "all" , ALL }, { "append" , APPEND }, { "bdcolor" , BDCOLOR }, { "bdcolour" , BDCOLOR }, { "bgcolor" , BG }, { "bgcolour" , BG }, { "border" , BORDER }, { "bordercolor" , BDCOLOR }, { "bordercolour", BDCOLOR }, { "box" , BOX }, { "centre" , BOXCENTRE }, { "delete" , DELETE }, { "display" , DISPLAY }, { "else" , ELSE }, { "enclose" , BOXENCLOSING }, { "endif" , ENDIF }, { "fgcolor" , FG }, { "fgcolour" , FG }, { "font" , FONT }, { "frame" , FRAME }, { "if" , IF }, { "image" , IMAGE }, { "integer" , INTEGER }, { "intersect" , BOXINTERSECT }, { "itos" , TOSTRING }, { "pict" , PICT }, { "point" , POINT }, { "real" , INTEGER }, { "reduce" , BOXREDUCE }, { "relief" , BDTYPE }, { "sensitive" , SENSITIVE }, { "shift" , BOXSHIFT }, { "strcat" , STRCAT }, { "string" , STRING }, { "strlen" , STRLEN }, { "substr" , SUBSTR }, { "then" , THEN }, { "type" , TYPE }, { "window" , WINDOW }, { "xmax" , XMAX }, { "xmin" , XMIN }, { "ymax" , YMAX }, { "ymin" , YMIN }, { 0, 0 } }; #define NFIELDS 33 static struct { char *name; int token; } fields[NFIELDS] = { { "alignment" , DOTALIGN }, { "bdcolor" , DOTBDCOLOR }, { "bdcolour" , DOTBDCOLOR }, { "bgcolor" , DOTBG }, { "bgcolour" , DOTBG }, { "border" , DOTBORDER }, { "bordercolor" , DOTBDCOLOR }, { "bordercolour", DOTBDCOLOR }, { "box" , DOTBOX }, { "c" , DOTC }, { "e" , DOTE }, { "fgcolor" , DOTFG }, { "fgcolour" , DOTFG }, { "font" , DOTFONT }, { "frame" , DOTFRAME }, { "n" , DOTN }, { "ne" , DOTNE }, { "nw" , DOTNW }, { "pict" , DOTPICT }, { "r" , DOTR }, { "relief" , DOTBDTYPE }, { "s" , DOTS }, { "se" , DOTSE }, { "sensitive" , DOTSENSITIVE }, { "string" , DOTSTR }, { "sw" , DOTSW }, { "type" , DOTTYPE }, { "w" , DOTW }, { "xmax" , DOTXMAX }, { "xmin" , DOTXMIN }, { "ymax" , DOTYMAX }, { "ymin" , DOTYMIN }, { 0, 0 } }; static int search_constant(char *name) { int i, start, end, cmp; start = 0; end = NCONSTANTS - 1; for (i = (NCONSTANTS - 1) >> 1; start <= i && i <= end; i = (start + end) >> 1) { if (constants[i].name == 0) return -1; cmp = strcmp(name, constants[i].name); if (cmp == 0) return i; else if (cmp > 0) start = i + 1; else /* cmp < 0 */ end = i - 1; } return -1; } static int search_token(char *name) { int i, start, end, cmp; start = 0; end = NTOKENS - 1; for (i = (NTOKENS - 1) >> 1; start <= i && i <= end; i = (start + end) >> 1) { if (tokens[i].name == 0) return -1; cmp = strcmp(name, tokens[i].name); if (cmp == 0) return i; else if (cmp > 0) start = i + 1; else /* cmp < 0 */ end = i - 1; } return -1; } static int search_field(char *name) { int i, start, end, cmp; start = 0; end = NFIELDS - 1; for (i = (NFIELDS - 1) >> 1; start <= i && i <= end; i = (start + end) >> 1) { if (fields[i].name == 0) return -1; cmp = strcmp(name, fields[i].name); if (cmp == 0) return i; else if (cmp > 0) start = i + 1; else /* cmp < 0 */ end = i - 1; } return -1; } enum { _S_, _A_, _D_, _DOT_, _DDOT_, _DDOTD_, _DOTA_, _QUOTE_, _QBSLASH_, _HASH_, _AND_, _OR_, _EQ_, _NOT_, _LT_, _GT_, _SLASH_ }; static char *yytext = 0; static int bufsize = 256; static int yyleng = 0; static int state = _S_; /* start state */ #define clearbuf() (yytext[yyleng=0] = '\0') void yyrestart(void) { clearbuf(); state = _S_; } static void save(int c) { if (yyleng == bufsize - 1) { bufsize *= 2; yytext = (char *) erealloc(yytext, bufsize * sizeof(int)); } yytext[yyleng++] = c; yytext[yyleng] = '\0'; } static void action_A(void) { int pos; char new_yytext[256]; extern int inPrefix; /* which mode of VA are we in: SUN_A or A_SUN... */ if ((pos = search_constant(yytext)) != -1) { yylval.i = constants[pos].val; yyparse(constants[pos].token); } else if ((pos = search_token(yytext)) != -1) { yyparse(tokens[pos].token); } else { /* it is a variable */ /* printf("yytext= %s %s %i %i %i\n", yytext, agentName, appAgentName, append_NoAgentName, ScoutAppAgentName); */ if (*agentName != 0 && appAgentName > 0 && append_NoAgentName > 0 && ScoutAppAgentName > 0) { /* for distributed tkEden -- sun */ new_yytext[0] = '\0'; if (yytext[0] == '_' && inPrefix) { strcat(new_yytext, "_"); yytext++; } if (inPrefix) strcat(new_yytext, agentName); else strcat(new_yytext, yytext); strcat(new_yytext, "_"); if (inPrefix) strcat(new_yytext, yytext); else strcat(new_yytext, agentName); strcpy(yytext, new_yytext); } yylval.v = lookUp(yytext); yyparse((yylval.v)->type); } } void yylex(int c) { switch (state) { case _S_: if (isalpha(c) || c == '_') { save(c); state = _A_; ScoutAppAgentName = 1; } else if (isdigit(c)) { save(c); state = _D_; } else if (c == ' ' || c == '\t') { state = _S_; } else if (c == '\n') { state = _S_; } else if (c == '\r') { state = _S_; } else if (c == '.') { state = _DOT_; } else if (c == '"') { state = _QUOTE_; } else if (c == '#') { state = _HASH_; } else if (c == '&') { state = _AND_; } else if (c == '|') { state = _OR_; } else if (c == '=') { state = _EQ_; } else if (c == '!') { state = _NOT_; } else if (c == '<') { state = _LT_; } else if (c == '>') { state = _GT_; } else if (c == '/') { state = _SLASH_; } else if (c == '~') { /* for agency -- sun */ state = _A_; ScoutAppAgentName = 0; } else { yyparse(c); state = _S_; } break; case _A_: if (isalnum(c) || c == '_') { save(c); state = _A_; } else { action_A(); clearbuf(); state = _S_; yylex(c); } break; case _D_: if (isdigit(c)) { save(c); state = _D_; } else if (c == '.') { save(c); state = _DDOT_; } else { yylval.d = atof(yytext); yyparse(NUMBER); clearbuf(); state = _S_; yylex(c); } break; case _DDOT_: if (isdigit(c)) { save(c); state = _DDOTD_; } else if (c == '.') { yylval.d = atof(yytext); yyparse(NUMBER); clearbuf(); state = _DOT_; } else { yylval.d = atof(yytext); yyparse(NUMBER); clearbuf(); state = _DOT_; yylex(c); } break; case _DDOTD_: if (isdigit(c)) { save(c); state = _DDOTD_; } else { yylval.d = atof(yytext); yyparse(NUMBER); clearbuf(); state = _S_; yylex(c); } break; case _DOT_: if (c == ' ' || c == '\t') { state = _DOT_; } else if (isalpha(c)) { save(c); state = _DOTA_; } else { yyparse('.'); clearbuf(); state = _S_; yylex(c); } break; case _DOTA_: if (isalpha(c)) { save(c); state = _DOTA_; } else { int pos = search_field(yytext); clearbuf(); yyparse(pos == -1 ? ERROR : fields[pos].token); state = _S_; yylex(c); } break; case _QUOTE_: if (c == '"') { yylval.s = strdup(yytext); yyparse(STR); clearbuf(); state = _S_; } else if (c == '\\') { state = _QBSLASH_; } else { save(c); state = _QUOTE_; } break; case _QBSLASH_: switch (c) { case 'n': save('\n'); break; case '\n': /* ignore \newline */ break; default: save(c); break; } state = _QUOTE_; break; case _HASH_: state = c == '\n' ? _S_ : _HASH_; break; case _AND_: if (c == '&') { yyparse(AND); state = _S_; } else { yyparse('&'); state = _S_; yylex(c); } break; case _OR_: if (c == '|') { yyparse(OR); state = _S_; } else { yyparse('|'); state = _S_; yylex(c); } break; case _EQ_: if (c == '=') { yyparse(EQ); state = _S_; } else { yyparse('='); state = _S_; yylex(c); } break; case _NOT_: if (c == '=') { yyparse(NE); state = _S_; } else { yyparse('!'); state = _S_; yylex(c); } break; case _LT_: if (c == '=') { yyparse(LE); state = _S_; } else { yyparse(LT); state = _S_; yylex(c); } break; case _GT_: if (c == '=') { yyparse(GE); state = _S_; } else { yyparse(GT); state = _S_; yylex(c); } break; case _SLASH_: if (c == '/') { yyparse(CONCAT); state = _S_; } else { yyparse('/'); state = _S_; yylex(c); } break; } } #define FILE_DEV 1 void init_scout(void) { char *name = "/scout.init.e"; char fullname[255]; FILE *initFile; extern char *progname; extern int run(short, void *, char *); char *envcontents; if (yytext == 0) yytext = (char *) emalloc(bufsize * sizeof(int)); strcpy(fullname, libLocation); strcat(fullname, name); if ((initFile = fopen(fullname, "r")) == 0) { fprintf(stderr, "%s: can't open %s\n", progname, fullname); exit(1); } lookUp("screen")->type = DISPVAR; /* screen is of type display */ run(FILE_DEV, initFile, name); /* pre-define these: if you change these, change also the corresponding values in the Eden namespace in scout.init.e [Ash] */ /* These need to be in the constants table if VA is not to mess them up, so removed again. [Ash] */ /* installIntVar("OFF", 0); installIntVar("ON", 1); installIntVar("MOTION", 2); installIntVar("ENTER", 4); installIntVar("LEAVE", 8); */ } "frame" , DOTFRAME }, { "n" , DOTN }, { "ne" , DOTNE }, { "nw" , DOTNW }, { "pict" , DOTPICT }, { "r" , DOTR }, { "relief" , DOTBDTYPEtkeden1.32/Scout/Makefile.in010060000025250000147000000005110733031246200171600ustar00ashleydcsother00001250000011# # $Id: Makefile.in,v 1.13 2001/07/27 16:22:10 cssbz Exp $ # # Need to find the original lexer source... where oh where? LEXER_SOURCE = lex.c NOTATION_PREFIX = st_ PARSER_SOURCE = parser.y PARSER_OUT = parser.c PARSER_HEADERS_OUT = parser.h SOURCES = symbol.c tree.c print.c store.c LIB = libscout.a include ../generic.mk tkeden1.32/Scout/parser.c010060000025250000147000002551210733230566400165740ustar00ashleydcsother00001250000011 /* A Bison parser, made from parser.y by GNU Bison version 1.27 */ #define YYBISON 1 /* Identify Bison output. */ #define yyparse st_parse #define yylex st_lex #define yyerror st_error #define yylval st_lval #define yychar st_char #define yydebug st_debug #define yynerrs st_nerrs #define STR 257 #define NUMBER 258 #define ROW 259 #define COLUMN 260 #define CONTENT 261 #define JUST 262 #define SWITCH 263 #define INTEGERHONEST 264 #define STRING 265 #define INTEGER 266 #define POINT 267 #define BOX 268 #define FRAME 269 #define WINDOW 270 #define DISPLAY 271 #define IMAGE 272 #define TYPE 273 #define PICT 274 #define XMIN 275 #define YMIN 276 #define XMAX 277 #define YMAX 278 #define FONT 279 #define BG 280 #define FG 281 #define BDCOLOR 282 #define BORDER 283 #define ALIGN 284 #define SENSITIVE 285 #define BDTYPE 286 #define ALL 287 #define STRVAR 288 #define INTVAR 289 #define PTVAR 290 #define BOXVAR 291 #define FRAMEVAR 292 #define WINVAR 293 #define DISPVAR 294 #define UNKNOWN 295 #define IMGVAR 296 #define FORMPT 297 #define FORMBOX 298 #define TEXTBOX 299 #define FORMFRAME 300 #define FORMWIN 301 #define FORMDISP 302 #define SUBSTR 303 #define STRCAT 304 #define CONCAT 305 #define STRLEN 306 #define TOSTRING 307 #define DOTFRAME 308 #define DOTSTR 309 #define DOTBOX 310 #define DOTTYPE 311 #define DOTPICT 312 #define DOTXMIN 313 #define DOTYMIN 314 #define DOTXMAX 315 #define DOTYMAX 316 #define DOTFONT 317 #define DOTBG 318 #define DOTFG 319 #define DOTBDCOLOR 320 #define DOTBORDER 321 #define DOTBDTYPE 322 #define DOTALIGN 323 #define DOTSENSITIVE 324 #define DOTNE 325 #define DOTNW 326 #define DOTSE 327 #define DOTSW 328 #define DOTN 329 #define DOTE 330 #define DOTS 331 #define DOTW 332 #define BOXSHIFT 333 #define BOXINTERSECT 334 #define BOXCENTRE 335 #define BOXENCLOSING 336 #define BOXREDUCE 337 #define APPEND 338 #define DELETE 339 #define IMGFUNC 340 #define IF 341 #define THEN 342 #define ELSE 343 #define ENDIF 344 #define ImageFile 345 #define ImageScale 346 #define ERROR 347 #define OR 348 #define AND 349 #define EQ 350 #define NE 351 #define LT 352 #define LE 353 #define GT 354 #define GE 355 #define UMINUS 356 #define DOTR 357 #define DOTC 358 #line 1 "parser.y" /* * $Id: parser.y,v 1.16 2001/08/02 16:26:11 cssbz Exp $ */ /* This is from the Autoconf manual. Note the pragma directive is indented so that pre-ANSI C compilers will ignore it. [Ash] */ /* AIX requires this to be the first thing in the file */ #ifdef __GNUC__ # define alloca __builtin_alloca #else # if HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ char *alloca (); # endif # endif # endif #endif static char rcsid[] = "$Id: parser.y,v 1.16 2001/08/02 16:26:11 cssbz Exp $"; #include #include #include "../config.h" #include "symbol.h" #include "tree.h" #include "../Eden/error.h" #include "../EX/script.h" #include "../Eden/emalloc.h" #ifdef HAVE_DMALLOC #include #endif #define YYERROR_VERBOSE 1 extern Script *st_script; /* function prototypes */ static WinStruct subst(WinStruct, WinField); void initDefaultWindow(void); void scout_err(char *); void yyerror(char *); extern void printdef(tree *, FILE *); extern void printsym(symbol *, FILE *); int useOldTree = 0; extern char scoutErrorStr[]; WinStruct defaultWindow; void initDefaultWindow(void) { defaultWindow.type = 0; defaultWindow.frame = 0; defaultWindow.string = 0; defaultWindow.box = 0; defaultWindow.pict = 0; defaultWindow.xmin = 0; defaultWindow.ymin = 0; defaultWindow.xmax = 0; defaultWindow.ymax = 0; defaultWindow.font = 0; defaultWindow.bgcolor = 0; defaultWindow.fgcolor = 0; defaultWindow.bdcolor = 0; defaultWindow.border = 0; defaultWindow.bdtype = 0; defaultWindow.align = -1; defaultWindow.sensitive = 0; } static WinStruct subst(WinStruct w, WinField f) { switch (f.change) { case TYPE: w.type = f.f.type; break; case FRAME: if (w.frame) freetree(w.frame); w.frame = f.f.frame; break; case STRING: if (w.string) freetree(w.string); w.string = f.f.string; break; case BOX: if (w.box) freetree(w.box); w.box = f.f.box; break; case PICT: if (w.pict) freetree(w.pict); w.pict = f.f.pict; break; case XMIN: if (w.xmin) freetree(w.xmin); w.xmin = f.f.xmin; break; case YMIN: if (w.ymin) freetree(w.ymin); w.ymin = f.f.ymin; break; case XMAX: if (w.xmax) freetree(w.xmax); w.xmax = f.f.xmax; break; case YMAX: if (w.ymax) freetree(w.ymax); w.ymax = f.f.ymax; break; case FONT: if (w.font) freetree(w.font); w.font = f.f.font; break; case BG: if (w.bgcolor) freetree(w.bgcolor); w.bgcolor = f.f.bgcolor; break; case FG: if (w.fgcolor) freetree(w.fgcolor); w.fgcolor = f.f.fgcolor; break; case BDCOLOR: if (w.bdcolor) freetree(w.bdcolor); w.bdcolor = f.f.bdcolor; break; case BORDER: w.border = f.f.border; break; case BDTYPE: if (w.bdtype) freetree(w.bdtype); w.bdtype = f.f.bdtype; break; case ALIGN: w.align = f.f.align; break; case SENSITIVE: w.sensitive = f.f.sensitive; break; }; return w; } #line 165 "parser.y" typedef union { char *s; /* character string */ double d; /* double value */ int i; /* integer value */ symbol *v; /* variables */ tree *t; /* parse tree */ WinStruct w; /* window */ WinField f; /* window attributes */ } YYSTYPE; #include #ifndef __cplusplus #ifndef __STDC__ #define const #endif #endif #define YYFINAL 483 #define YYFLAG -32768 #define YYNTBASE 123 #define YYTRANSLATE(x) ((unsigned)(x) <= 358 ? yytranslate[x] : 143) static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 107, 112, 2, 116, 117, 105, 103, 114, 104, 111, 106, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 122, 113, 2, 94, 2, 115, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 120, 2, 121, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 118, 2, 119, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 95, 96, 97, 98, 99, 100, 101, 102, 108, 109, 110 }; #if YYDEBUG != 0 static const short yyprhs[] = { 0, 0, 2, 5, 7, 9, 11, 13, 16, 20, 24, 28, 32, 36, 40, 44, 48, 53, 59, 64, 70, 75, 81, 86, 92, 97, 103, 108, 114, 119, 125, 131, 136, 142, 144, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 170, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 200, 207, 216, 221, 224, 227, 230, 233, 236, 239, 242, 250, 252, 254, 257, 260, 262, 266, 270, 274, 278, 282, 286, 290, 294, 298, 302, 306, 310, 314, 318, 322, 326, 330, 334, 338, 342, 346, 350, 354, 358, 362, 365, 369, 374, 378, 381, 384, 387, 390, 398, 400, 406, 410, 414, 417, 420, 423, 426, 429, 432, 435, 438, 446, 448, 454, 462, 466, 469, 478, 485, 492, 499, 506, 514, 516, 520, 522, 526, 529, 538, 545, 549, 557, 559, 563, 567, 575, 577, 580, 584, 588, 592, 596, 600, 604, 608, 612, 616, 620, 624, 628, 632, 636, 640, 644, 648, 652, 654, 658, 660, 664, 673, 680, 684, 692, 694, 701 }; static const short yyrhs[] = { 124, 0, 123, 124, 0, 113, 0, 125, 0, 126, 0, 129, 0, 1, 113, 0, 11, 127, 113, 0, 12, 127, 113, 0, 13, 127, 113, 0, 14, 127, 113, 0, 15, 127, 113, 0, 16, 127, 113, 0, 17, 127, 113, 0, 18, 127, 113, 0, 35, 94, 132, 113, 0, 12, 128, 94, 132, 113, 0, 34, 94, 131, 113, 0, 11, 128, 94, 131, 113, 0, 36, 94, 133, 113, 0, 13, 128, 94, 133, 113, 0, 37, 94, 134, 113, 0, 14, 128, 94, 134, 113, 0, 38, 94, 136, 113, 0, 15, 128, 94, 136, 113, 0, 39, 94, 137, 113, 0, 16, 128, 94, 137, 113, 0, 40, 94, 141, 113, 0, 40, 112, 94, 40, 113, 0, 17, 128, 94, 141, 113, 0, 42, 94, 142, 113, 0, 18, 128, 94, 142, 113, 0, 128, 0, 127, 114, 128, 0, 34, 0, 35, 0, 36, 0, 37, 0, 38, 0, 39, 0, 40, 0, 41, 0, 42, 0, 115, 33, 113, 0, 115, 130, 113, 0, 34, 0, 35, 0, 36, 0, 37, 0, 38, 0, 39, 0, 40, 0, 41, 0, 42, 0, 3, 0, 34, 0, 131, 51, 131, 0, 50, 116, 131, 114, 131, 117, 0, 49, 116, 131, 114, 132, 114, 132, 117, 0, 53, 116, 132, 117, 0, 137, 55, 0, 137, 58, 0, 137, 64, 0, 137, 65, 0, 137, 66, 0, 137, 68, 0, 137, 63, 0, 87, 132, 88, 131, 89, 131, 90, 0, 4, 0, 10, 0, 132, 109, 0, 132, 110, 0, 35, 0, 132, 103, 132, 0, 132, 104, 132, 0, 132, 105, 132, 0, 132, 106, 132, 0, 132, 107, 132, 0, 132, 97, 132, 0, 132, 98, 132, 0, 132, 99, 132, 0, 132, 100, 132, 0, 132, 101, 132, 0, 132, 102, 132, 0, 131, 97, 131, 0, 131, 98, 131, 0, 131, 99, 131, 0, 131, 100, 131, 0, 131, 101, 131, 0, 131, 102, 131, 0, 133, 97, 133, 0, 133, 98, 133, 0, 133, 99, 133, 0, 133, 100, 133, 0, 133, 101, 133, 0, 133, 102, 133, 0, 132, 95, 132, 0, 132, 96, 132, 0, 104, 132, 0, 116, 132, 117, 0, 52, 116, 131, 117, 0, 133, 111, 132, 0, 137, 59, 0, 137, 60, 0, 137, 61, 0, 137, 62, 0, 87, 132, 88, 132, 89, 132, 90, 0, 36, 0, 118, 132, 114, 132, 119, 0, 133, 103, 133, 0, 133, 104, 133, 0, 134, 71, 0, 134, 72, 0, 134, 73, 0, 134, 74, 0, 134, 75, 0, 134, 76, 0, 134, 77, 0, 134, 78, 0, 87, 132, 88, 133, 89, 133, 90, 0, 37, 0, 120, 133, 114, 133, 121, 0, 120, 133, 114, 132, 114, 132, 121, 0, 136, 111, 132, 0, 137, 56, 0, 79, 116, 134, 114, 132, 114, 132, 117, 0, 80, 116, 134, 114, 134, 117, 0, 81, 116, 134, 114, 134, 117, 0, 82, 116, 134, 114, 134, 117, 0, 83, 116, 134, 114, 134, 117, 0, 87, 132, 88, 134, 89, 134, 90, 0, 134, 0, 135, 114, 134, 0, 38, 0, 116, 135, 117, 0, 137, 54, 0, 84, 116, 136, 114, 132, 114, 134, 117, 0, 85, 116, 136, 114, 132, 117, 0, 136, 112, 136, 0, 87, 132, 88, 136, 89, 136, 90, 0, 39, 0, 118, 138, 119, 0, 141, 111, 132, 0, 87, 132, 88, 137, 89, 137, 90, 0, 139, 0, 138, 139, 0, 138, 114, 139, 0, 19, 122, 7, 0, 15, 122, 136, 0, 11, 122, 131, 0, 14, 122, 134, 0, 20, 122, 131, 0, 21, 122, 132, 0, 22, 122, 132, 0, 23, 122, 132, 0, 24, 122, 132, 0, 25, 122, 131, 0, 26, 122, 131, 0, 27, 122, 131, 0, 28, 122, 131, 0, 29, 122, 132, 0, 32, 122, 131, 0, 30, 122, 8, 0, 31, 122, 132, 0, 137, 0, 140, 106, 137, 0, 40, 0, 99, 140, 101, 0, 84, 116, 141, 114, 132, 114, 137, 117, 0, 85, 116, 141, 114, 132, 117, 0, 141, 112, 141, 0, 87, 132, 88, 141, 89, 141, 90, 0, 42, 0, 91, 116, 131, 114, 131, 117, 0, 92, 116, 142, 114, 132, 114, 132, 117, 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, 219, 221, 224, 226, 227, 228, 229, 232, 240, 247, 254, 261, 268, 275, 282, 291, 293, 302, 303, 312, 313, 322, 323, 332, 333, 342, 343, 352, 353, 367, 376, 377, 388, 390, 393, 395, 396, 397, 398, 399, 400, 401, 402, 405, 407, 410, 412, 413, 414, 415, 416, 417, 418, 419, 422, 424, 425, 426, 428, 430, 431, 432, 433, 434, 435, 436, 437, 438, 442, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 485, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 502, 504, 506, 508, 510, 512, 514, 516, 518, 520, 522, 526, 528, 531, 533, 534, 535, 537, 539, 541, 545, 547, 548, 549, 553, 556, 557, 560, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 578, 581, 583, 586, 588, 589, 591, 593, 595, 599, 601, 604 }; #endif #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) static const char * const yytname[] = { "$","error","$undefined.","STR","NUMBER", "ROW","COLUMN","CONTENT","JUST","SWITCH","INTEGERHONEST","STRING","INTEGER", "POINT","BOX","FRAME","WINDOW","DISPLAY","IMAGE","TYPE","PICT","XMIN","YMIN", "XMAX","YMAX","FONT","BG","FG","BDCOLOR","BORDER","ALIGN","SENSITIVE","BDTYPE", "ALL","STRVAR","INTVAR","PTVAR","BOXVAR","FRAMEVAR","WINVAR","DISPVAR","UNKNOWN", "IMGVAR","FORMPT","FORMBOX","TEXTBOX","FORMFRAME","FORMWIN","FORMDISP","SUBSTR", "STRCAT","CONCAT","STRLEN","TOSTRING","DOTFRAME","DOTSTR","DOTBOX","DOTTYPE", "DOTPICT","DOTXMIN","DOTYMIN","DOTXMAX","DOTYMAX","DOTFONT","DOTBG","DOTFG", "DOTBDCOLOR","DOTBORDER","DOTBDTYPE","DOTALIGN","DOTSENSITIVE","DOTNE","DOTNW", "DOTSE","DOTSW","DOTN","DOTE","DOTS","DOTW","BOXSHIFT","BOXINTERSECT","BOXCENTRE", "BOXENCLOSING","BOXREDUCE","APPEND","DELETE","IMGFUNC","IF","THEN","ELSE","ENDIF", "ImageFile","ImageScale","ERROR","'='","OR","AND","EQ","NE","LT","LE","GT","GE", "'+'","'-'","'*'","'/'","'%'","UMINUS","DOTR","DOTC","'.'","'&'","';'","','", "'?'","'('","')'","'{'","'}'","'['","']'","':'","program","statement","declaration", "definition","var_list","unknown","enquiry","var_name","str_exp","int_exp","point_exp", "box_exp","box_list","frame_exp","win_exp","win_field_list","win_field","win_list", "display_exp","image_exp", NULL }; #endif static const short yyr1[] = { 0, 123, 123, 124, 124, 124, 124, 124, 125, 125, 125, 125, 125, 125, 125, 125, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 127, 127, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 130, 130, 130, 130, 130, 130, 130, 130, 130, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 135, 135, 136, 136, 136, 136, 136, 136, 136, 137, 137, 137, 137, 138, 138, 138, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 140, 140, 141, 141, 141, 141, 141, 141, 142, 142, 142 }; static const short yyr2[] = { 0, 1, 2, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 5, 4, 5, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 6, 8, 4, 2, 2, 2, 2, 2, 2, 2, 7, 1, 1, 2, 2, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 4, 3, 2, 2, 2, 2, 7, 1, 5, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 7, 1, 5, 7, 3, 2, 8, 6, 6, 6, 6, 7, 1, 3, 1, 3, 2, 8, 6, 3, 7, 1, 3, 3, 7, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 3, 1, 3, 8, 6, 3, 7, 1, 6, 8 }; static const short yydefact[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 1, 4, 5, 6, 7, 35, 36, 37, 38, 39, 40, 41, 42, 43, 0, 33, 0, 33, 0, 33, 0, 33, 0, 33, 0, 33, 0, 33, 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, 47, 48, 49, 50, 51, 52, 53, 54, 0, 2, 8, 0, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 15, 0, 55, 56, 141, 167, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 69, 70, 73, 108, 121, 134, 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, 173, 0, 0, 0, 44, 45, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 145, 0, 18, 61, 62, 67, 63, 64, 65, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 0, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 71, 72, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, 113, 114, 115, 116, 117, 118, 119, 0, 0, 136, 125, 103, 104, 105, 106, 0, 132, 20, 0, 22, 0, 24, 0, 26, 0, 28, 0, 0, 0, 31, 19, 17, 21, 23, 25, 27, 30, 32, 0, 0, 0, 0, 0, 0, 168, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 142, 146, 57, 143, 171, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 0, 135, 0, 0, 85, 86, 87, 88, 89, 90, 97, 98, 79, 80, 81, 82, 83, 84, 74, 75, 76, 77, 78, 91, 92, 93, 94, 95, 96, 110, 111, 102, 124, 139, 0, 0, 0, 0, 0, 29, 0, 0, 0, 0, 60, 0, 0, 0, 0, 0, 166, 150, 151, 149, 148, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 163, 164, 162, 147, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 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, 109, 0, 122, 0, 0, 0, 58, 0, 170, 0, 0, 0, 0, 127, 128, 129, 130, 0, 138, 0, 0, 0, 0, 0, 174, 0, 0, 0, 68, 144, 172, 0, 0, 107, 120, 131, 140, 123, 0, 59, 169, 126, 137, 175, 0, 0 }; static const short yydefgoto[] = { 20, 21, 22, 23, 35, 36, 24, 70, 123, 124, 125, 126, 208, 127, 128, 183, 184, 165, 103, 146 }; static const short yypact[] = { 708, -89, 676, 676, 676, 676, 676, 676, 676, 676, -38, -33, -31, -9, 7, 11, 27, 47,-32768, 726, 470, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768, 16, 64, 131, 81, 144, 97, 198, 119, 222, 124, 227, 133, 229, 142, 249, 147, 175, 15, 521, 717, -27, 41, 19, 159, 20, -21, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 163, -32768,-32768, 676, 175,-32768, 15,-32768, 521,-32768, 717, -32768, -27,-32768, 41,-32768, 19,-32768, 20,-32768,-32768, -32768,-32768, 156, 197, 205, 217, 232, 15, 41, 1182, -29, 410, 254,-32768,-32768,-32768,-32768,-32768,-32768, 234, 239, 259, 275, 285, 289, 294, 315, 15, 15, 15, 654, 521, 72, 1300, 166, 624, 258, 1395, 15, 717, 130, -24, 15, 178, 15, 25, 284, 15, 319, 15, 276, 394,-32768, 320, 321, 322,-32768,-32768,-32768, -25, 1319, 148, 325, 296, 328, 300, 329, 175, 175, 15, 19, 19, 812,-32768, 26, 317, 323, 335, 336, 344, 345, 347, 350, 357, 358, 367, 368, 370, 375, 376, 377, 378, 762,-32768, 175,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768, 15, 19, 175, 717, 717, 717, 717, 717, -27, -27, 832, 305, 848, 624, 115, 1160, 108, 175, 175, 175, 175, 175, 175, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,-32768, -32768,-32768, 521, 521, 521, 521, 521, 521, 521, 521, 15,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 15, -27,-32768,-32768,-32768,-32768,-32768,-32768, 871,-32768,-32768, 891,-32768, 911,-32768, 931,-32768, 951,-32768, 334, 175, 20,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -45, -37, 967, 167, 180, 175,-32768, 41, 175, 717, -27, 441, 175, 15, 15, 15, 15, 175, 175, 175, 175, 15, 442, 15, 175, 1182,-32768,-32768,-32768, 710, -32768, -43, 397, 399, 400, 401, 402, 184, 65, 215, 109, 15,-32768, 717,-32768, 15, 15, 451, 451, 451, 451, 451, 451, 525, 1367, 1379, 1379, 179, 179, 179, 179, 251, 251, 305, 305, 305, 326, 326, 326, 326, 326, 326,-32768,-32768,-32768, 1338,-32768, 521, 717, -27, 41, 19,-32768, -36, 403, 15, 175,-32768, 15, 15, -23, 388, 4,-32768, 451,-32768, 407,-32768, 451, 1338, 1338, 1338, 1338, 451, 451, 451, 451, 1338,-32768, 1338, 451,-32768,-32768, 15, 717, 717, 717, 717, 15, 15, 298, 1126, 279, 121, 31, 784,-32768, 787, 1180, 475, 77, -19, 431, -2, 28, 433, 24, 175, 15, 1200, -42, 1220, 990, 175, 41, 19, 1240, 406, 415, 416, 418, 1260, 1013, 15, 521, 717, -27,-32768, 15,-32768, -34, 1280, 15,-32768, 41,-32768, -17, 434, -74, 15, -32768,-32768,-32768,-32768, 717,-32768, 1144, 127, 446, 32, 758,-32768, 15, 1036, 421,-32768,-32768,-32768, 1059, 422, -32768,-32768,-32768,-32768,-32768, 1082,-32768,-32768,-32768,-32768, -32768, 540,-32768 }; static const short yypgoto[] = {-32768, 522,-32768,-32768, 297, 36,-32768,-32768, 248, 199, -32, -44,-32768, -35, -51,-32768, -182,-32768, 169, -81 }; #define YYLAST 1489 static const short yytable[] = { 102, 308, 132, 132, 137, 139, 185, 157, 185, 185, 134, 109, 91, 92, 185, 185, 468, 185, 89, 104, 136, 131, 185, 102, 25, 105, 185, 132, 185, 132, 252, 137, 253, 155, 185, 252, 153, 253, 195, 38, 40, 42, 44, 46, 48, 50, 152, 154, 164, 90, 106, 107, 108, 109, 91, 92, 51, 116, 117, 92, 135, 52, 143, 53, 93, 94, 424, 110, 95, 366, 425, 132, 99, 466, 393, 444, 207, 367, 418, 132, 91, 92, 252, 462, 186, 54, 259, 437, 273, 130, 210, 100, 147, 426, 111, 112, 113, 114, 115, 116, 117, 55, 118, 96, 97, 56, 140, 102, 102, 149, 251, 144, 145, 426, 99, 194, 195, 425, 99, 119, 437, 57, 474, 185, 392, 96, 97, 287, 138, 72, 73, 120, 288, 121, 102, 122, 195, 251, 264, 58, 99, 59, 250, 251, 251, 102, 132, 132, 132, 132, 132, 137, 137, 313, 314, 315, 316, 317, 74, 100, 102, 102, 102, 102, 102, 102, 435, 318, 320, 211, 212, 213, 214, 215, 216, 76, 194, 195, 89, 369, 239, 240, 132, 132, 132, 132, 132, 132, 132, 132, 365, 78, 242, 243, 244, 245, 246, 247, 248, 249, 137, 347, 348, 349, 350, 351, 352, 353, 354, 90, 436, 239, 240, 80, 91, 92, 357, 472, 82, 102, 194, 195, 327, 370, 93, 94, 141, 84, 95, 324, 239, 240, 325, 239, 240, 372, 86, 374, 102, 132, 137, 88, 102, 260, 75, 73, 376, 102, 102, 102, 102, 239, 240, 142, 102, 156, 377, 77, 73, 96, 97, 275, 98, 233, 234, 235, 236, 237, 238, 239, 240, 406, 158, 132, 99, 151, 148, 241, 404, 195, 407, 369, 225, 226, 227, 228, 229, 405, 230, 231, 403, 262, 195, 100, 370, 410, 251, 163, 399, 101, 37, 39, 41, 43, 45, 47, 49, 412, 412, 415, 416, 79, 73, 159, 404, 413, 102, 204, 205, 206, 209, 160, 150, 405, 405, 414, 411, 251, 258, 400, 284, 285, 261, 161, 263, 81, 73, 265, 252, 267, 83, 73, 85, 73, 132, 132, 132, 132, 162, 185, 196, 428, 429, 430, 431, 197, 227, 228, 229, 283, 230, 231, 87, 73, 311, 194, 195, 102, 435, 250, 251, 319, 321, 102, 448, 198, 233, 234, 235, 236, 237, 238, 239, 240, 132, 132, 137, 424, 195, 268, 241, 199, 459, 310, 465, 211, 212, 213, 214, 215, 216, 200, 460, 458, 132, 201, 281, 282, 251, 277, 202, 470, 195, 279, 230, 231, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 239, 240, 203, 266, 309, 269, 272, 270, 271, 276, 289, 355, 278, 280, 187, 312, 290, 188, 363, 378, 356, 389, 189, 190, 191, 192, 373, 193, 291, 292, 328, 329, 330, 331, 332, 333, 187, 293, 294, 188, 295, 482, 1, 296, 189, 190, 191, 192, 425, 193, 297, 298, 2, 3, 4, 5, 6, 7, 8, 9, 299, 300, 373, 301, 380, 381, 382, 383, 302, 303, 304, 305, 388, 185, 390, 10, 11, 12, 13, 14, 15, 16, 394, 17, 395, 396, 397, 398, 419, 364, 251, 436, 402, 425, 451, 467, 408, 409, 373, 373, 373, 373, 417, 452, 453, 371, 454, 473, 375, 478, 480, 483, 379, 71, 0, 0, 0, 384, 385, 386, 387, 0, 0, 0, 391, 0, 0, 0, 107, 108, 109, 91, 92, 0, 0, 0, 420, 0, 0, 422, 423, 401, 0, 233, 234, 235, 236, 237, 238, 239, 240, 0, 0, 0, 18, 0, 19, 241, 0, 0, 0, 0, 0, 0, 427, 0, 449, 440, 0, 432, 433, 111, 112, 113, 114, 115, 116, 117, 0, 129, 0, 0, 0, 0, 0, 0, 421, 0, 0, 442, 0, 99, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 457, 230, 231, 0, 130, 461, 121, 0, 122, 464, 0, 0, 0, 0, 0, 0, 469, 0, 0, 0, 0, 0, 0, 0, 89, 104, 0, 0, 0, 476, 0, 105, 166, 441, 0, 167, 168, 0, 0, 447, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 0, 90, 106, 107, 108, 109, 91, 92, 242, 243, 244, 245, 246, 247, 248, 249, 93, 94, 0, 110, 95, 0, 1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 111, 112, 113, 114, 115, 116, 117, 0, 118, 10, 11, 12, 13, 14, 15, 16, 0, 17, 0, 0, 99, 108, 109, 91, 92, 119, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 0, 120, 0, 121, 166, 122, 0, 167, 168, 0, 0, 0, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 0, 111, 112, 113, 114, 115, 116, 117, 0, 133, 217, 218, 219, 220, 221, 222, 0, 224, 225, 226, 227, 99, 229, 0, 230, 231, 18, 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 130, 0, 100, 0, 122, 252, 187, 253, 0, 188, 254, 255, 256, 257, 189, 190, 191, 192, 0, 193, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 0, 230, 231, 0, 0, 0, 0, 425, 0, 0, 306, 0, 0, 475, 0, 307, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 0, 230, 231, 0, 0, 286, 0, 0, 0, 0, 0, 438, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 322, 230, 231, 0, 0, 0, 0, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 0, 230, 231, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 0, 230, 231, 358, 0, 0, 0, 0, 0, 323, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 359, 230, 231, 0, 0, 0, 0, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 360, 230, 231, 0, 0, 0, 0, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 361, 230, 231, 0, 0, 0, 0, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 362, 230, 231, 0, 0, 0, 0, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 0, 230, 231, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 0, 230, 231, 0, 0, 0, 0, 0, 0, 368, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 0, 230, 231, 0, 0, 0, 0, 0, 0, 446, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 0, 230, 231, 0, 0, 0, 0, 0, 0, 456, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 0, 230, 231, 0, 0, 0, 0, 0, 0, 477, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 0, 230, 231, 0, 0, 0, 0, 0, 0, 479, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 0, 230, 231, 166, 0, 0, 167, 168, 0, 481, 0, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 434, 0, 0, 0, 0, 0, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 471, 230, 231, 0, 0, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 0, 230, 231, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 0, 230, 231, 0, 0, 0, 326, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 0, 230, 231, 0, 0, 0, 439, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 0, 230, 231, 0, 0, 0, 443, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 0, 230, 231, 0, 0, 0, 445, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 0, 230, 231, 0, 0, 0, 450, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 0, 230, 231, 0, 0, 0, 455, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 0, 230, 231, 0, 0, 0, 463, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 0, 230, 231, 0, 0, 232, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 0, 230, 231, 0, 0, 274, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 0, 230, 231, 252, 187, 253, 0, 188, 254, 255, 256, 257, 189, 190, 191, 192, 0, 193, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 0, 230, 231, 221, 222, 223, 224, 225, 226, 227, 228, 229, 0, 230, 231 }; static const short yycheck[] = { 51, 183, 53, 54, 55, 56, 51, 88, 51, 51, 54, 38, 39, 40, 51, 51, 90, 51, 3, 4, 55, 53, 51, 74, 113, 10, 51, 78, 51, 80, 54, 82, 56, 84, 51, 54, 80, 56, 112, 3, 4, 5, 6, 7, 8, 9, 78, 82, 99, 34, 35, 36, 37, 38, 39, 40, 94, 84, 85, 40, 87, 94, 42, 94, 49, 50, 89, 52, 53, 114, 89, 122, 99, 90, 117, 117, 120, 114, 114, 130, 39, 40, 54, 117, 113, 94, 130, 89, 113, 116, 122, 118, 113, 89, 79, 80, 81, 82, 83, 84, 85, 94, 87, 84, 85, 94, 87, 158, 159, 73, 112, 91, 92, 89, 99, 111, 112, 89, 99, 104, 89, 94, 90, 51, 306, 84, 85, 101, 87, 113, 114, 116, 106, 118, 185, 120, 112, 112, 113, 112, 99, 94, 111, 112, 112, 196, 197, 198, 199, 200, 201, 202, 203, 197, 198, 199, 200, 201, 94, 118, 211, 212, 213, 214, 215, 216, 89, 202, 203, 97, 98, 99, 100, 101, 102, 94, 111, 112, 3, 114, 103, 104, 233, 234, 235, 236, 237, 238, 239, 240, 271, 94, 71, 72, 73, 74, 75, 76, 77, 78, 251, 233, 234, 235, 236, 237, 238, 239, 240, 34, 89, 103, 104, 94, 39, 40, 251, 90, 94, 270, 111, 112, 114, 114, 49, 50, 57, 94, 53, 114, 103, 104, 117, 103, 104, 286, 94, 288, 289, 290, 291, 94, 293, 113, 113, 114, 290, 298, 299, 300, 301, 103, 104, 94, 305, 86, 291, 113, 114, 84, 85, 113, 87, 97, 98, 99, 100, 101, 102, 103, 104, 322, 116, 324, 99, 76, 113, 111, 322, 112, 324, 114, 103, 104, 105, 106, 107, 322, 109, 110, 322, 113, 112, 118, 114, 327, 112, 98, 114, 51, 3, 4, 5, 6, 7, 8, 9, 358, 359, 360, 361, 113, 114, 116, 358, 359, 367, 118, 119, 120, 121, 116, 74, 358, 359, 360, 358, 112, 129, 114, 161, 162, 133, 116, 135, 113, 114, 138, 54, 140, 113, 114, 113, 114, 395, 396, 397, 398, 116, 51, 116, 395, 396, 397, 398, 116, 105, 106, 107, 160, 109, 110, 113, 114, 195, 111, 112, 418, 89, 111, 112, 202, 203, 424, 425, 116, 97, 98, 99, 100, 101, 102, 103, 104, 435, 436, 437, 89, 112, 113, 111, 116, 436, 194, 445, 97, 98, 99, 100, 101, 102, 116, 437, 435, 455, 116, 158, 159, 112, 113, 116, 455, 112, 113, 109, 110, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 103, 104, 116, 113, 185, 40, 113, 116, 116, 113, 122, 241, 113, 113, 55, 196, 122, 58, 113, 7, 250, 8, 63, 64, 65, 66, 286, 68, 122, 122, 211, 212, 213, 214, 215, 216, 55, 122, 122, 58, 122, 0, 1, 122, 63, 64, 65, 66, 89, 68, 122, 122, 11, 12, 13, 14, 15, 16, 17, 18, 122, 122, 322, 122, 294, 295, 296, 297, 122, 122, 122, 122, 302, 51, 304, 34, 35, 36, 37, 38, 39, 40, 114, 42, 114, 114, 114, 114, 114, 270, 112, 89, 322, 89, 117, 90, 326, 327, 358, 359, 360, 361, 362, 117, 117, 286, 117, 90, 289, 117, 117, 0, 293, 20, -1, -1, -1, 298, 299, 300, 301, -1, -1, -1, 305, -1, -1, -1, 36, 37, 38, 39, 40, -1, -1, -1, 366, -1, -1, 369, 370, 322, -1, 97, 98, 99, 100, 101, 102, 103, 104, -1, -1, -1, 113, -1, 115, 111, -1, -1, -1, -1, -1, -1, 394, -1, 426, 121, -1, 399, 400, 79, 80, 81, 82, 83, 84, 85, -1, 87, -1, -1, -1, -1, -1, -1, 367, -1, -1, 419, -1, 99, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 434, 109, 110, -1, 116, 439, 118, -1, 120, 443, -1, -1, -1, -1, -1, -1, 450, -1, -1, -1, -1, -1, -1, -1, 3, 4, -1, -1, -1, 463, -1, 10, 11, 418, -1, 14, 15, -1, -1, 424, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, -1, 34, 35, 36, 37, 38, 39, 40, 71, 72, 73, 74, 75, 76, 77, 78, 49, 50, -1, 52, 53, -1, 1, 34, 35, 36, 37, 38, 39, 40, 41, 42, 11, 12, 13, 14, 15, 16, 17, 18, -1, -1, -1, -1, -1, -1, 79, 80, 81, 82, 83, 84, 85, -1, 87, 34, 35, 36, 37, 38, 39, 40, -1, 42, -1, -1, 99, 37, 38, 39, 40, 104, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, -1, 116, -1, 118, 11, 120, -1, 14, 15, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, -1, 79, 80, 81, 82, 83, 84, 85, -1, 87, 95, 96, 97, 98, 99, 100, -1, 102, 103, 104, 105, 99, 107, -1, 109, 110, 113, -1, 115, -1, -1, -1, -1, -1, -1, -1, -1, -1, 116, -1, 118, -1, 120, 54, 55, 56, -1, 58, 59, 60, 61, 62, 63, 64, 65, 66, -1, 68, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, 109, 110, -1, -1, -1, -1, 89, -1, -1, 114, -1, -1, 121, -1, 119, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, 109, 110, -1, -1, 88, -1, -1, -1, -1, -1, 119, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 88, 109, 110, -1, -1, -1, -1, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, 109, 110, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, 109, 110, 88, -1, -1, -1, -1, -1, 117, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 88, 109, 110, -1, -1, -1, -1, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 88, 109, 110, -1, -1, -1, -1, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 88, 109, 110, -1, -1, -1, -1, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 88, 109, 110, -1, -1, -1, -1, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, 109, 110, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, 109, 110, -1, -1, -1, -1, -1, -1, 117, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, 109, 110, -1, -1, -1, -1, -1, -1, 117, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, 109, 110, -1, -1, -1, -1, -1, -1, 117, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, 109, 110, -1, -1, -1, -1, -1, -1, 117, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, 109, 110, -1, -1, -1, -1, -1, -1, 117, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, 109, 110, 11, -1, -1, 14, 15, -1, 117, -1, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 89, -1, -1, -1, -1, -1, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 90, 109, 110, -1, -1, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, 109, 110, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, 109, 110, -1, -1, -1, 114, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, 109, 110, -1, -1, -1, 114, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, 109, 110, -1, -1, -1, 114, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, 109, 110, -1, -1, -1, 114, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, 109, 110, -1, -1, -1, 114, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, 109, 110, -1, -1, -1, 114, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, 109, 110, -1, -1, -1, 114, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, 109, 110, -1, -1, 113, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, 109, 110, -1, -1, 113, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, 109, 110, 54, 55, 56, -1, 58, 59, 60, 61, 62, 63, 64, 65, 66, -1, 68, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, 109, 110, 99, 100, 101, 102, 103, 104, 105, 106, 107, -1, 109, 110 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ /* MODIFICATION 1: fix all #line directives as they have the wrong * filename and line numbers. Note #line no = actual number + 1 * #line 3 "/usr/local/share/bison.simple" */ #line 7 "bison/bison.simple" /* END MODIFICATION 1 */ /* This file comes from bison-1.28. */ /* This is a MODIFIED version of bison's Skeleton output parser The change is such that the parser only process one token at each call to yyparse(). The token is the argument to yyparse(). This means that this parser is token driven. Example use: while (token = yylex()) { yyparse(token); } Additionally: error handling patched to show expected when there are > 5 expected during an error. [Ash, May 2001]. There are 13 patches of MODIFICATION in the Skeleton (not including this comment) */ /* Skeleton output parser for bison, Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ /* This is the parser code that is written into each bison parser when the %semantic_parser declaration is not specified in the grammar. It was written by Richard Stallman by simplifying the hairy parser used when %semantic_parser is specified. */ #ifndef YYSTACK_USE_ALLOCA #ifdef alloca #define YYSTACK_USE_ALLOCA #else /* alloca not defined */ #ifdef __GNUC__ #define YYSTACK_USE_ALLOCA #define alloca __builtin_alloca #else /* not GNU C. */ #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) #define YYSTACK_USE_ALLOCA #include #else /* not sparc */ /* We think this test detects Watcom and Microsoft C. */ /* This used to test MSDOS, but that is a bad idea since that symbol is in the user namespace. */ #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) #if 0 /* No need for malloc.h, which pollutes the namespace; instead, just don't use alloca. */ #include #endif #else /* not MSDOS, or __TURBOC__ */ #if defined(_AIX) /* I don't know what this was needed for, but it pollutes the namespace. So I turned it off. rms, 2 May 1997. */ /* #include */ #pragma alloca #define YYSTACK_USE_ALLOCA #else /* not MSDOS, or __TURBOC__, or _AIX */ #if 0 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, and on HPUX 10. Eventually we can turn this on. */ #define YYSTACK_USE_ALLOCA #define alloca __builtin_alloca #endif /* __hpux */ #endif #endif /* not _AIX */ #endif /* not MSDOS, or __TURBOC__ */ #endif /* not sparc */ #endif /* not GNU C */ #endif /* alloca not defined */ #endif /* YYSTACK_USE_ALLOCA not defined */ #ifdef YYSTACK_USE_ALLOCA #define YYSTACK_ALLOC alloca #else #define YYSTACK_ALLOC malloc #endif /* Note: there must be only one dollar sign in this file. It is replaced by the list of actions, each action as one case of the switch. */ #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY -2 #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrlab1 /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(token, value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { yychar = (token), yylval = (value); \ yychar1 = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ { yyerror ("syntax error: cannot back up"); YYERROR; } \ while (0) #define YYTERROR 1 #define YYERRCODE 256 #ifndef YYPURE #define YYLEX yylex() #endif #ifdef YYPURE #ifdef YYLSP_NEEDED #ifdef YYLEX_PARAM #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) #else #define YYLEX yylex(&yylval, &yylloc) #endif #else /* not YYLSP_NEEDED */ #ifdef YYLEX_PARAM #define YYLEX yylex(&yylval, YYLEX_PARAM) #else #define YYLEX yylex(&yylval) #endif #endif /* not YYLSP_NEEDED */ #endif /* If nonreentrant, generate the variables here */ #ifndef YYPURE int yychar; /* the lookahead symbol */ YYSTYPE yylval; /* the semantic value of the */ /* lookahead symbol */ #ifdef YYLSP_NEEDED YYLTYPE yylloc; /* location data for the lookahead */ /* symbol */ #endif int yynerrs; /* number of parse errors so far */ #endif /* not YYPURE */ #if YYDEBUG != 0 int yydebug; /* nonzero means print parse trace */ /* Since this is uninitialized, it does not stop multiple parsers from coexisting. */ #endif /* YYINITDEPTH indicates the initial size of the parser's stacks */ #ifndef YYINITDEPTH #define YYINITDEPTH 200 #endif /* YYMAXDEPTH is the maximum size the stacks can grow to (effective only if the built-in stack extension method is used). */ #if YYMAXDEPTH == 0 #undef YYMAXDEPTH #endif #ifndef YYMAXDEPTH #define YYMAXDEPTH 10000 #endif /* Define __yy_memcpy. Note that the size argument should be passed with type unsigned int, because that is what the non-GCC definitions require. With GCC, __builtin_memcpy takes an arg of type size_t, but it can handle unsigned int. */ #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) #else /* not GNU C or C++ */ #ifndef __cplusplus /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void __yy_memcpy (to, from, count) char *to; char *from; unsigned int count; { register char *f = from; register char *t = to; register int i = count; while (i-- > 0) *t++ = *f++; } #else /* __cplusplus */ /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void __yy_memcpy (char *to, char *from, unsigned int count) { register char *t = to; register char *f = from; register int i = count; while (i-- > 0) *t++ = *f++; } #endif #endif /* MODIFICATION 2: same as MODIFICATION 1 * #line 217 "/usr/local/share/bison.simple" */ #line 241 "bison/bison.simple" /* END MODIFICATION 2 */ /* The user can define YYPARSE_PARAM as the name of an argument to be passed into yyparse. The argument should have type void *. It should actually point to an object. Grammar actions can access the variable by casting it to the proper pointer type. */ #ifdef YYPARSE_PARAM #ifdef __cplusplus #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM #define YYPARSE_PARAM_DECL #else /* not __cplusplus */ #define YYPARSE_PARAM_ARG YYPARSE_PARAM #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; #endif /* not __cplusplus */ #else /* not YYPARSE_PARAM */ #define YYPARSE_PARAM_ARG #define YYPARSE_PARAM_DECL #endif /* not YYPARSE_PARAM */ /* Prevent warning if -Wstrict-prototypes. */ #ifdef __GNUC__ /* MODIFICATION 3: yyparse() takes an argument that is the lex token * #ifdef YYPARSE_PARAM * int yyparse (void *); * #else * int yyparse (void); * #endif */ int yyparse(int); /* END MODIFICATION 3 */ #endif /* MODIFICATION 4: add a variable yy_parse_init to control the initialisation of the parser and an accessor function */ static int yy_parse_init = 1; #ifdef WANT_SETYYPARSEINIT /* Added this function to allow Eden to use this bison.simple. Needs conditional compilation as we can only have one function with this name otherwise the linker moans (can't compile this into Donald, Scout etc). The name here doesn't get automatically translated by the sed or bison -p. [Ash] */ void setyyparseinit(int setto) { yy_parse_init = setto; } #endif /* END MODIFICATION 4 */ /* MODIFICATION 5: turning the local variables of yyparse() into static, global variables so that the parser can be reentered */ static int yystate; static int yyn; static short *yyssp; static YYSTYPE *yyvsp; static int yyerrstatus; /* number of tokens to shift before error messages enabled */ static int yychar1 = 0; /* lookahead token as an internal (translated) token number */ static short yyssa[YYINITDEPTH]; /* the state stack */ static YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ static short *yyss = yyssa; /* refer to the stacks thru separate pointers */ static YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ #ifdef YYLSP_NEEDED static YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ static YYLTYPE *yyls = yylsa; static YYLTYPE *yylsp; #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) #else #define YYPOPSTACK (yyvsp--, yyssp--) #endif static int yystacksize = YYINITDEPTH; static int yyfree_stacks = 0; #ifdef YYPURE static int yychar; static YYSTYPE yylval; static int yynerrs; #ifdef YYLSP_NEEDED static YYLTYPE yylloc; #endif #endif static YYSTYPE yyval; /* the variable used to return */ /* semantic values from the action */ /* routines */ static int yylen; /* END MODIFICATION 5 */ /* MODIFICATION 6: yyparse() takes an argument that is the lex token * int * yyparse(YYPARSE_PARAM_ARG) * YYPARSE_PARAM_DECL * { */ int yyparse(token) int token; { /* END MODIFICATION 6 */ /* MODIFICATION 7: deal with initialisation */ int yy_token_read = 0; if (!yy_parse_init) goto lex; yy_parse_init = 0; /* END MODIFICATION 7 */ #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Starting parse\n"); #endif yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss - 1; yyvsp = yyvs; #ifdef YYLSP_NEEDED yylsp = yyls; #endif /* Push a new state, which is found in yystate . */ /* In all cases, when you get here, the value and location stacks have just been pushed. so pushing a state here evens the stacks. */ yynewstate: *++yyssp = yystate; if (yyssp >= yyss + yystacksize - 1) { /* Give user a chance to reallocate the stack */ /* Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; short *yyss1 = yyss; #ifdef YYLSP_NEEDED YYLTYPE *yyls1 = yyls; #endif /* Get the current used size of the three stacks, in elements. */ int size = yyssp - yyss + 1; #ifdef yyoverflow /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. */ #ifdef YYLSP_NEEDED /* This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow("parser stack overflow", &yyss1, size * sizeof (*yyssp), &yyvs1, size * sizeof (*yyvsp), &yyls1, size * sizeof (*yylsp), &yystacksize); #else yyoverflow("parser stack overflow", &yyss1, size * sizeof (*yyssp), &yyvs1, size * sizeof (*yyvsp), &yystacksize); #endif yyss = yyss1; yyvs = yyvs1; #ifdef YYLSP_NEEDED yyls = yyls1; #endif #else /* no yyoverflow */ /* Extend the stack our own way. */ if (yystacksize >= YYMAXDEPTH) { yyerror("parser stack overflow"); if (yyfree_stacks) { free (yyss); free (yyvs); #ifdef YYLSP_NEEDED free (yyls); #endif } return 2; } yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; #ifndef YYSTACK_USE_ALLOCA yyfree_stacks = 1; #endif yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); __yy_memcpy ((char *)yyss, (char *)yyss1, size * (unsigned int) sizeof (*yyssp)); yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * (unsigned int) sizeof (*yyvsp)); #ifdef YYLSP_NEEDED yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); __yy_memcpy ((char *)yyls, (char *)yyls1, size * (unsigned int) sizeof (*yylsp)); #endif #endif /* no yyoverflow */ yyssp = yyss + size - 1; yyvsp = yyvs + size - 1; #ifdef YYLSP_NEEDED yylsp = yyls + size - 1; #endif #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Stack size increased to %d\n", yystacksize); #endif if (yyssp >= yyss + yystacksize - 1) YYABORT; } #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Entering state %d\n", yystate); #endif goto yybackup; yybackup: /* Do appropriate processing given the current state. */ /* Read a lookahead token if we need one and don't already have one. */ /* yyresume: */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYFLAG) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* yychar is either YYEMPTY or YYEOF or a valid token in external form. */ if (yychar == YYEMPTY) { #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Reading a token: "); #endif /* MODIFICATION 8: consume the argument token * yychar = YYLEX; */ lex: if (yy_token_read) return -1; /* token consumed */ yy_token_read = 1; yychar = token; /* END MODIFICATION 8 */ } /* Convert token to internal form (in yychar1) for indexing tables with */ if (yychar <= 0) /* This means end of input. */ { yychar1 = 0; yychar = YYEOF; /* Don't call YYLEX any more */ #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Now at end of input.\n"); #endif } else { yychar1 = YYTRANSLATE(yychar); #if YYDEBUG != 0 if (yydebug) { fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); /* Give the individual parser a way to print the precise meaning of a token, for further debugging info. */ #ifdef YYPRINT YYPRINT (stderr, yychar, yylval); #endif fprintf (stderr, ")\n"); } #endif } yyn += yychar1; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) goto yydefault; yyn = yytable[yyn]; /* yyn is what to do for this token type in this state. Negative => reduce, -yyn is rule number. Positive => shift, yyn is new state. New state is final state => don't bother to shift, just return success. 0, or most negative number => error. */ if (yyn < 0) { if (yyn == YYFLAG) goto yyerrlab; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; /* Shift the lookahead token. */ #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); #endif /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; #ifdef YYLSP_NEEDED *++yylsp = yylloc; #endif /* count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; yystate = yyn; goto yynewstate; /* Do the default action for the current state. */ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; /* Do a reduction. yyn is the number of a rule to reduce with. */ yyreduce: yylen = yyr2[yyn]; if (yylen > 0) yyval = yyvsp[1-yylen]; /* implement default value of the action */ #if YYDEBUG != 0 if (yydebug) { int i; fprintf (stderr, "Reducing via rule %d (line %d), ", yyn, yyrline[yyn]); /* Print the symbols being reduced, and their result. */ for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) fprintf (stderr, "%s ", yytname[yyrhs[i]]); fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); } #endif switch (yyn) { case 5: #line 227 "parser.y" { if (yyvsp[0].t) define(yyvsp[0].t); st_script->ready = 1; ; break;} case 7: #line 229 "parser.y" { yyerrok; ; break;} case 8: #line 234 "parser.y" { if (!declare(STRVAR, yyvsp[-1].t)) { /* declaration error */ freetree(yyvsp[-1].t); scout_err(scoutErrorStr); } ; break;} case 9: #line 241 "parser.y" { if (!declare(INTVAR, yyvsp[-1].t)) { /* declaration error */ freetree(yyvsp[-1].t); scout_err(scoutErrorStr); } ; break;} case 10: #line 248 "parser.y" { if (!declare(PTVAR, yyvsp[-1].t)) { /* declaration error */ freetree(yyvsp[-1].t); scout_err(scoutErrorStr); } ; break;} case 11: #line 255 "parser.y" { if (!declare(BOXVAR, yyvsp[-1].t)) { /* declaration error */ freetree(yyvsp[-1].t); scout_err(scoutErrorStr); } ; break;} case 12: #line 262 "parser.y" { if (!declare(FRAMEVAR, yyvsp[-1].t)) { /* declaration error */ freetree(yyvsp[-1].t); scout_err(scoutErrorStr); } ; break;} case 13: #line 269 "parser.y" { if (!declare(WINVAR, yyvsp[-1].t)) { /* declaration error */ freetree(yyvsp[-1].t); scout_err(scoutErrorStr); } ; break;} case 14: #line 276 "parser.y" { if (!declare(DISPVAR, yyvsp[-1].t)) { /* declaration error */ freetree(yyvsp[-1].t); scout_err(scoutErrorStr); } ; break;} case 15: #line 283 "parser.y" { if (!declare(IMGVAR, yyvsp[-1].t)) { /* declaration error */ freetree(yyvsp[-1].t); scout_err(scoutErrorStr); } ; break;} case 16: #line 292 "parser.y" { yyval.t = def_tree(yyvsp[-3].v, yyvsp[-1].t); ; break;} case 17: #line 293 "parser.y" { if (declare(INTVAR, yyvsp[-3].t)) yyval.t = def_tree(yyvsp[-3].t->l.v, yyvsp[-1].t); else { freetree(yyvsp[-3].t); freetree(yyvsp[-1].t); scout_err(scoutErrorStr); } ; break;} case 18: #line 302 "parser.y" { yyval.t = def_tree(yyvsp[-3].v, yyvsp[-1].t); ; break;} case 19: #line 303 "parser.y" { if (declare(STRVAR, yyvsp[-3].t)) yyval.t = def_tree(yyvsp[-3].t->l.v, yyvsp[-1].t); else { freetree(yyvsp[-3].t); freetree(yyvsp[-1].t); scout_err(scoutErrorStr); } ; break;} case 20: #line 312 "parser.y" { yyval.t = def_tree(yyvsp[-3].v, yyvsp[-1].t); ; break;} case 21: #line 313 "parser.y" { if (declare(PTVAR, yyvsp[-3].t)) yyval.t = def_tree(yyvsp[-3].t->l.v, yyvsp[-1].t); else { freetree(yyvsp[-3].t); freetree(yyvsp[-1].t); scout_err(scoutErrorStr); } ; break;} case 22: #line 322 "parser.y" { yyval.t = def_tree(yyvsp[-3].v, yyvsp[-1].t); ; break;} case 23: #line 323 "parser.y" { if (declare(BOXVAR, yyvsp[-3].t)) yyval.t = def_tree(yyvsp[-3].t->l.v, yyvsp[-1].t); else { freetree(yyvsp[-3].t); freetree(yyvsp[-1].t); scout_err(scoutErrorStr); } ; break;} case 24: #line 332 "parser.y" { yyval.t = def_tree(yyvsp[-3].v, yyvsp[-1].t); ; break;} case 25: #line 333 "parser.y" { if (declare(FRAMEVAR, yyvsp[-3].t)) yyval.t = def_tree(yyvsp[-3].t->l.v, yyvsp[-1].t); else { freetree(yyvsp[-3].t); freetree(yyvsp[-1].t); scout_err(scoutErrorStr); } ; break;} case 26: #line 342 "parser.y" { yyval.t = def_tree(yyvsp[-3].v, yyvsp[-1].t); ; break;} case 27: #line 343 "parser.y" { if (declare(WINVAR, yyvsp[-3].t)) yyval.t = def_tree(yyvsp[-3].t->l.v, yyvsp[-1].t); else { freetree(yyvsp[-3].t); freetree(yyvsp[-1].t); scout_err(scoutErrorStr); } ; break;} case 28: #line 352 "parser.y" { yyval.t = def_tree(yyvsp[-3].v, yyvsp[-1].t); ; break;} case 29: #line 353 "parser.y" { if (yyvsp[-4].v) { if (yyvsp[-4].v->def) { useOldTree = 1; yyval.t = def_tree(yyvsp[-4].v, tree3(yyvsp[-1].v->def, '&', yyvsp[-4].v->def)); } else { yyval.t = def_tree(yyvsp[-4].v, yyvsp[-1].v->def); } } else { freetree(yyvsp[-4].v); freetree(yyvsp[-1].v); scout_err(scoutErrorStr); } ; break;} case 30: #line 367 "parser.y" { if (declare(DISPVAR, yyvsp[-3].t)) yyval.t = def_tree(yyvsp[-3].t->l.v, yyvsp[-1].t); else { freetree(yyvsp[-3].t); freetree(yyvsp[-1].t); scout_err(scoutErrorStr); } ; break;} case 31: #line 376 "parser.y" { yyval.t = def_tree(yyvsp[-3].v, yyvsp[-1].t); ; break;} case 32: #line 377 "parser.y" { if (declare(IMGVAR, yyvsp[-3].t)) yyval.t = def_tree(yyvsp[-3].t->l.v, yyvsp[-1].t); else { freetree(yyvsp[-3].t); freetree(yyvsp[-1].t); scout_err(scoutErrorStr); } ; break;} case 34: #line 390 "parser.y" { yyval.t = tree3(yyvsp[-2].t, ',', yyvsp[0].t); ; break;} case 35: #line 394 "parser.y" { yyval.t = sym_tree(yyvsp[0].v, STRVAR); ; break;} case 36: #line 395 "parser.y" { yyval.t = sym_tree(yyvsp[0].v, INTVAR); ; break;} case 37: #line 396 "parser.y" { yyval.t = sym_tree(yyvsp[0].v, PTVAR); ; break;} case 38: #line 397 "parser.y" { yyval.t = sym_tree(yyvsp[0].v, BOXVAR); ; break;} case 39: #line 398 "parser.y" { yyval.t = sym_tree(yyvsp[0].v, FRAMEVAR); ; break;} case 40: #line 399 "parser.y" { yyval.t = sym_tree(yyvsp[0].v, WINVAR); ; break;} case 41: #line 400 "parser.y" { yyval.t = sym_tree(yyvsp[0].v, DISPVAR); ; break;} case 42: #line 401 "parser.y" { yyval.t = sym_tree(yyvsp[0].v, UNKNOWN); ; break;} case 43: #line 402 "parser.y" { yyval.t = sym_tree(yyvsp[0].v, IMGVAR); ; break;} case 44: #line 406 "parser.y" { listsym(0); ; break;} case 45: #line 407 "parser.y" { listsym(yyvsp[-1].v->name); ; break;} case 55: #line 423 "parser.y" { yyval.t = str_tree(yyvsp[0].s); ; break;} case 56: #line 424 "parser.y" { yyval.t = sym_tree(yyvsp[0].v, STRVAR); ; break;} case 57: #line 425 "parser.y" { yyval.t = tree3(yyvsp[-2].t, CONCAT, yyvsp[0].t); ; break;} case 58: #line 427 "parser.y" { yyval.t = tree3(yyvsp[-3].t, STRCAT, yyvsp[-1].t); ; break;} case 59: #line 429 "parser.y" { yyval.t = tree3(yyvsp[-5].t, SUBSTR, tree3(yyvsp[-3].t, 0, yyvsp[-1].t)); ; break;} case 60: #line 430 "parser.y" { yyval.t = tree2(yyvsp[-1].t, TOSTRING); ; break;} case 61: #line 431 "parser.y" { yyval.t = tree2(yyvsp[-1].t, DOTSTR); ; break;} case 62: #line 432 "parser.y" { yyval.t = tree2(yyvsp[-1].t, DOTPICT); ; break;} case 63: #line 433 "parser.y" { yyval.t = tree2(yyvsp[-1].t, DOTBG); ; break;} case 64: #line 434 "parser.y" { yyval.t = tree2(yyvsp[-1].t, DOTFG); ; break;} case 65: #line 435 "parser.y" { yyval.t = tree2(yyvsp[-1].t, DOTBDCOLOR); ; break;} case 66: #line 436 "parser.y" { yyval.t = tree2(yyvsp[-1].t, DOTBDTYPE); ; break;} case 67: #line 437 "parser.y" { yyval.t = tree2(yyvsp[-1].t, DOTFONT); ; break;} case 68: #line 439 "parser.y" { yyval.t = tree3(yyvsp[-5].t, IF, tree3(yyvsp[-3].t, STRVAR, yyvsp[-1].t)); ; break;} case 69: #line 443 "parser.y" { yyval.t = int_tree(yyvsp[0].d); ; break;} case 70: #line 444 "parser.y" { yyval.t = inthonest_tree(yyvsp[0].i); ; break;} case 71: #line 445 "parser.y" { yyval.t = tree2(yyvsp[-1].t, ROW); ; break;} case 72: #line 446 "parser.y" { yyval.t = tree2(yyvsp[-1].t, COLUMN); ; break;} case 73: #line 447 "parser.y" { yyval.t = sym_tree(yyvsp[0].v, INTVAR); ; break;} case 74: #line 448 "parser.y" { yyval.t = tree3(yyvsp[-2].t, '+', yyvsp[0].t); ; break;} case 75: #line 449 "parser.y" { yyval.t = tree3(yyvsp[-2].t, '-', yyvsp[0].t); ; break;} case 76: #line 450 "parser.y" { yyval.t = tree3(yyvsp[-2].t, '*', yyvsp[0].t); ; break;} case 77: #line 451 "parser.y" { yyval.t = tree3(yyvsp[-2].t, '/', yyvsp[0].t); ; break;} case 78: #line 452 "parser.y" { yyval.t = tree3(yyvsp[-2].t, '%', yyvsp[0].t); ; break;} case 79: #line 453 "parser.y" { yyval.t = tree3(yyvsp[-2].t, EQ, yyvsp[0].t); ; break;} case 80: #line 454 "parser.y" { yyval.t = tree3(yyvsp[-2].t, NE, yyvsp[0].t); ; break;} case 81: #line 455 "parser.y" { yyval.t = tree3(yyvsp[-2].t, LT, yyvsp[0].t); ; break;} case 82: #line 456 "parser.y" { yyval.t = tree3(yyvsp[-2].t, LE, yyvsp[0].t); ; break;} case 83: #line 457 "parser.y" { yyval.t = tree3(yyvsp[-2].t, GT, yyvsp[0].t); ; break;} case 84: #line 458 "parser.y" { yyval.t = tree3(yyvsp[-2].t, GE, yyvsp[0].t); ; break;} case 85: #line 459 "parser.y" { yyval.t = tree3(yyvsp[-2].t, EQ, yyvsp[0].t); ; break;} case 86: #line 460 "parser.y" { yyval.t = tree3(yyvsp[-2].t, NE, yyvsp[0].t); ; break;} case 87: #line 461 "parser.y" { yyval.t = tree3(yyvsp[-2].t, LT, yyvsp[0].t); ; break;} case 88: #line 462 "parser.y" { yyval.t = tree3(yyvsp[-2].t, LE, yyvsp[0].t); ; break;} case 89: #line 463 "parser.y" { yyval.t = tree3(yyvsp[-2].t, GT, yyvsp[0].t); ; break;} case 90: #line 464 "parser.y" { yyval.t = tree3(yyvsp[-2].t, GE, yyvsp[0].t); ; break;} case 91: #line 465 "parser.y" { yyval.t = tree3(yyvsp[-2].t, EQ, yyvsp[0].t); ; break;} case 92: #line 466 "parser.y" { yyval.t = tree3(yyvsp[-2].t, NE, yyvsp[0].t); ; break;} case 93: #line 467 "parser.y" { yyval.t = tree3(yyvsp[-2].t, LT, yyvsp[0].t); ; break;} case 94: #line 468 "parser.y" { yyval.t = tree3(yyvsp[-2].t, LE, yyvsp[0].t); ; break;} case 95: #line 469 "parser.y" { yyval.t = tree3(yyvsp[-2].t, GT, yyvsp[0].t); ; break;} case 96: #line 470 "parser.y" { yyval.t = tree3(yyvsp[-2].t, GE, yyvsp[0].t); ; break;} case 97: #line 471 "parser.y" { yyval.t = tree3(yyvsp[-2].t, OR, yyvsp[0].t); ; break;} case 98: #line 472 "parser.y" { yyval.t = tree3(yyvsp[-2].t, AND, yyvsp[0].t); ; break;} case 99: #line 473 "parser.y" { yyval.t = tree2(yyvsp[0].t, UMINUS); ; break;} case 100: #line 474 "parser.y" { yyval.t = tree2(yyvsp[-1].t, '('); ; break;} case 101: #line 475 "parser.y" { yyval.t = tree2(yyvsp[-1].t, STRLEN); ; break;} case 102: #line 476 "parser.y" { yyval.t = tree3(yyvsp[-2].t, '.', yyvsp[0].t); ; break;} case 103: #line 477 "parser.y" { yyval.t = tree2(yyvsp[-1].t, DOTXMIN); ; break;} case 104: #line 478 "parser.y" { yyval.t = tree2(yyvsp[-1].t, DOTYMIN); ; break;} case 105: #line 479 "parser.y" { yyval.t = tree2(yyvsp[-1].t, DOTXMAX); ; break;} case 106: #line 480 "parser.y" { yyval.t = tree2(yyvsp[-1].t, DOTYMAX); ; break;} case 107: #line 482 "parser.y" { yyval.t = tree3(yyvsp[-5].t, IF, tree3(yyvsp[-3].t, INTVAR, yyvsp[-1].t)); ; break;} case 108: #line 486 "parser.y" { yyval.t = sym_tree(yyvsp[0].v, PTVAR); ; break;} case 109: #line 487 "parser.y" { yyval.t = tree3(yyvsp[-3].t, FORMPT, yyvsp[-1].t); ; break;} case 110: #line 488 "parser.y" { yyval.t = tree3(yyvsp[-2].t, '+', yyvsp[0].t); ; break;} case 111: #line 489 "parser.y" { yyval.t = tree3(yyvsp[-2].t, '-', yyvsp[0].t); ; break;} case 112: #line 490 "parser.y" { yyval.t = tree2(yyvsp[-1].t, DOTNE); ; break;} case 113: #line 491 "parser.y" { yyval.t = tree2(yyvsp[-1].t, DOTNW); ; break;} case 114: #line 492 "parser.y" { yyval.t = tree2(yyvsp[-1].t, DOTSE); ; break;} case 115: #line 493 "parser.y" { yyval.t = tree2(yyvsp[-1].t, DOTSW); ; break;} case 116: #line 494 "parser.y" { yyval.t = tree2(yyvsp[-1].t, DOTN); ; break;} case 117: #line 495 "parser.y" { yyval.t = tree2(yyvsp[-1].t, DOTE); ; break;} case 118: #line 496 "parser.y" { yyval.t = tree2(yyvsp[-1].t, DOTS); ; break;} case 119: #line 497 "parser.y" { yyval.t = tree2(yyvsp[-1].t, DOTW); ; break;} case 120: #line 499 "parser.y" { yyval.t = tree3(yyvsp[-5].t, IF, tree3(yyvsp[-3].t, PTVAR, yyvsp[-1].t)); ; break;} case 121: #line 503 "parser.y" { yyval.t = sym_tree(yyvsp[0].v, BOXVAR); ; break;} case 122: #line 505 "parser.y" { yyval.t = tree3(yyvsp[-3].t, FORMBOX, yyvsp[-1].t); ; break;} case 123: #line 507 "parser.y" { yyval.t = tree3(yyvsp[-5].t, TEXTBOX, tree3(yyvsp[-3].t, 0, yyvsp[-1].t)); ; break;} case 124: #line 509 "parser.y" { yyval.t = tree3(yyvsp[-2].t, '.', yyvsp[0].t); ; break;} case 125: #line 511 "parser.y" { yyval.t = tree2(yyvsp[-1].t, DOTBOX); ; break;} case 126: #line 513 "parser.y" { yyval.t = tree3(yyvsp[-5].t, BOXSHIFT, tree3(yyvsp[-3].t, 0, yyvsp[-1].t)); ; break;} case 127: #line 515 "parser.y" { yyval.t = tree3(yyvsp[-3].t, BOXINTERSECT, yyvsp[-1].t); ; break;} case 128: #line 517 "parser.y" { yyval.t = tree3(yyvsp[-3].t, BOXCENTRE, yyvsp[-1].t); ; break;} case 129: #line 519 "parser.y" { yyval.t = tree3(yyvsp[-3].t, BOXENCLOSING, yyvsp[-1].t); ; break;} case 130: #line 521 "parser.y" { yyval.t = tree3(yyvsp[-3].t, BOXREDUCE, yyvsp[-1].t); ; break;} case 131: #line 523 "parser.y" { yyval.t = tree3(yyvsp[-5].t, IF, tree3(yyvsp[-3].t, BOXVAR, yyvsp[-1].t)); ; break;} case 133: #line 528 "parser.y" { yyval.t = tree3(yyvsp[-2].t, ',', yyvsp[0].t); ; break;} case 134: #line 532 "parser.y" { yyval.t = sym_tree(yyvsp[0].v, FRAMEVAR); ; break;} case 135: #line 533 "parser.y" { yyval.t = tree2(yyvsp[-1].t, FORMFRAME); ; break;} case 136: #line 534 "parser.y" { yyval.t = tree2(yyvsp[-1].t, DOTFRAME); ; break;} case 137: #line 536 "parser.y" { yyval.t = tree3(yyvsp[-5].t, APPEND, tree3(yyvsp[-3].t, 0, yyvsp[-1].t)); ; break;} case 138: #line 538 "parser.y" { yyval.t = tree3(yyvsp[-3].t, DELETE, yyvsp[-1].t); ; break;} case 139: #line 540 "parser.y" { yyval.t = tree3(yyvsp[-2].t, '&', yyvsp[0].t); ; break;} case 140: #line 542 "parser.y" { yyval.t = tree3(yyvsp[-5].t, IF, tree3(yyvsp[-3].t, FRAMEVAR, yyvsp[-1].t)); ; break;} case 141: #line 546 "parser.y" { yyval.t = sym_tree(yyvsp[0].v, WINVAR); ; break;} case 142: #line 547 "parser.y" { yyval.t = win_tree(yyvsp[-1].w); ; break;} case 143: #line 548 "parser.y" { yyval.t = tree3(yyvsp[-2].t, '.', yyvsp[0].t); ; break;} case 144: #line 550 "parser.y" { yyval.t = tree3(yyvsp[-5].t, IF, tree3(yyvsp[-3].t, WINVAR, yyvsp[-1].t)); ; break;} case 145: #line 554 "parser.y" { initDefaultWindow(); yyval.w = subst(defaultWindow, yyvsp[0].f);; break;} case 146: #line 556 "parser.y" { yyval.w = subst(yyvsp[-1].w, yyvsp[0].f); ; break;} case 147: #line 557 "parser.y" { yyval.w = subst(yyvsp[-2].w, yyvsp[0].f); ; break;} case 148: #line 561 "parser.y" { yyval.f.f.type = yyvsp[0].i; yyval.f.change = TYPE; ; break;} case 149: #line 562 "parser.y" { yyval.f.f.frame = yyvsp[0].t; yyval.f.change = FRAME; ; break;} case 150: #line 563 "parser.y" { yyval.f.f.string = yyvsp[0].t; yyval.f.change = STRING; ; break;} case 151: #line 564 "parser.y" { yyval.f.f.box = yyvsp[0].t; yyval.f.change = BOX; ; break;} case 152: #line 565 "parser.y" { yyval.f.f.pict = yyvsp[0].t; yyval.f.change = PICT; ; break;} case 153: #line 566 "parser.y" { yyval.f.f.xmin = yyvsp[0].t; yyval.f.change = XMIN; ; break;} case 154: #line 567 "parser.y" { yyval.f.f.ymin = yyvsp[0].t; yyval.f.change = YMIN; ; break;} case 155: #line 568 "parser.y" { yyval.f.f.xmax = yyvsp[0].t; yyval.f.change = XMAX; ; break;} case 156: #line 569 "parser.y" { yyval.f.f.ymax = yyvsp[0].t; yyval.f.change = YMAX; ; break;} case 157: #line 570 "parser.y" { yyval.f.f.font = yyvsp[0].t; yyval.f.change = FONT; ; break;} case 158: #line 571 "parser.y" { yyval.f.f.bgcolor = yyvsp[0].t; yyval.f.change = BG; ; break;} case 159: #line 572 "parser.y" { yyval.f.f.fgcolor = yyvsp[0].t; yyval.f.change = FG; ; break;} case 160: #line 573 "parser.y" { yyval.f.f.bdcolor = yyvsp[0].t; yyval.f.change = BDCOLOR; ; break;} case 161: #line 574 "parser.y" { yyval.f.f.border = yyvsp[0].t; yyval.f.change = BORDER; ; break;} case 162: #line 575 "parser.y" { yyval.f.f.bdtype = yyvsp[0].t; yyval.f.change = BDTYPE; ; break;} case 163: #line 576 "parser.y" { yyval.f.f.align = yyvsp[0].i; yyval.f.change = ALIGN; ; break;} case 164: #line 578 "parser.y" { yyval.f.f.sensitive = yyvsp[0].t; yyval.f.change = SENSITIVE; ; break;} case 166: #line 583 "parser.y" { yyval.t = tree3(yyvsp[-2].t, '>', yyvsp[0].t); ; break;} case 167: #line 587 "parser.y" { yyval.t = sym_tree(yyvsp[0].v, DISPVAR); ; break;} case 168: #line 588 "parser.y" { yyval.t = tree2(yyvsp[-1].t, FORMDISP); ; break;} case 169: #line 590 "parser.y" { yyval.t = tree3(yyvsp[-5].t, APPEND, tree3(yyvsp[-3].t, 0, yyvsp[-1].t)); ; break;} case 170: #line 592 "parser.y" { yyval.t = tree3(yyvsp[-3].t, DELETE, yyvsp[-1].t); ; break;} case 171: #line 594 "parser.y" { yyval.t = tree3(yyvsp[-2].t, '&', yyvsp[0].t); ; break;} case 172: #line 596 "parser.y" { yyval.t = tree3(yyvsp[-5].t, IF, tree3(yyvsp[-3].t, DISPVAR, yyvsp[-1].t)); ; break;} case 173: #line 600 "parser.y" { yyval.t = sym_tree(yyvsp[0].v, IMGVAR); ; break;} case 174: #line 602 "parser.y" { yyval.t = tree3(strdup("ImageFile"), IMGFUNC, tree3(yyvsp[-3].t, STRVAR, tree3(yyvsp[-1].t, STRVAR, tree3(0, 0, 0)))); ; break;} case 175: #line 605 "parser.y" { yyval.t = tree3(strdup("ImageScale"), IMGFUNC, tree3(yyvsp[-5].t, IMGVAR, tree3(yyvsp[-3].t, INTVAR, tree3(yyvsp[-1].t, INTVAR, tree3(0, 0, 0))))); ; break;} } /* the action file gets copied in in place of this dollarsign */ /* MODIFICATION 9: same as MODIFICATION 1 * #line 543 "/usr/local/share/bison.simple" */ #line 617 "bison/bison.simple" /* END MODIFICATION 9 */ yyvsp -= yylen; yyssp -= yylen; #ifdef YYLSP_NEEDED yylsp -= yylen; #endif #if YYDEBUG != 0 if (yydebug) { short *ssp1 = yyss - 1; fprintf (stderr, "state stack now"); while (ssp1 != yyssp) fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); } #endif *++yyvsp = yyval; #ifdef YYLSP_NEEDED yylsp++; if (yylen == 0) { yylsp->first_line = yylloc.first_line; yylsp->first_column = yylloc.first_column; yylsp->last_line = (yylsp-1)->last_line; yylsp->last_column = (yylsp-1)->last_column; yylsp->text = 0; } else { yylsp->last_line = (yylsp+yylen-1)->last_line; yylsp->last_column = (yylsp+yylen-1)->last_column; } #endif /* Now "shift" the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTBASE] + *yyssp; if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTBASE]; goto yynewstate; yyerrlab: /* here on detecting error */ if (! yyerrstatus) /* If not already recovering from an error, report this error. */ { ++yynerrs; #ifdef YYERROR_VERBOSE yyn = yypact[yystate]; if (yyn > YYFLAG && yyn < YYLAST) { int size = 0; char *msg; int x, count; count = 0; /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ for (x = (yyn < 0 ? -yyn : 0); x < (sizeof(yytname) / sizeof(char *)); x++) if (yycheck[x + yyn] == x) size += strlen(yytname[x]) + 15, count++; /* MODIFICATION 10: increase space for error message * msg = (char *) malloc(size + 15); */ msg = (char *) malloc(size + 100); /* END MODIFICATION 10 */ if (msg != 0) { strcpy(msg, "parse error"); /* MODIFICATION 11: print expected even when there are > 5 expected, * and print what was encountered * if (count < 5) */ sprintf(msg + strlen(msg), ", encountered `%s'", yytname[yychar1]); if (1) /* END MODIFICATION 11 */ { count = 0; for (x = (yyn < 0 ? -yyn : 0); x < (sizeof(yytname) / sizeof(char *)); x++) if (yycheck[x + yyn] == x) { /* MODIFICATION 12: indicate when there are > 5 expected but not printed */ if (count > 5) count++; else { /* END MODIFICATION 12 */ strcat(msg, count == 0 ? ", expecting `" : " or `"); strcat(msg, yytname[x]); strcat(msg, "'"); count++; /* MODIFICATION 13: indicate when there are > 5 expected but not printed * } */ } } if (count > 5) { sprintf(msg + strlen(msg), " or... (%d other possibilities)", count - 6); } /* END MODIFICATION 13 */ } yyerror(msg); free(msg); } else yyerror ("parse error; also virtual memory exceeded"); } else #endif /* YYERROR_VERBOSE */ yyerror("parse error"); } goto yyerrlab1; yyerrlab1: /* here on error raised explicitly by an action */ if (yyerrstatus == 3) { /* if just tried and failed to reuse lookahead token after an error, discard it. */ /* return failure if at end of input */ if (yychar == YYEOF) YYABORT; #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); #endif yychar = YYEMPTY; } /* Else will try to reuse lookahead token after shifting the error token. */ yyerrstatus = 3; /* Each real token shifted decrements this */ goto yyerrhandle; yyerrdefault: /* current state does not do anything special for the error token. */ #if 0 /* This is wrong; only states that explicitly want error tokens should shift them. */ yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ if (yyn) goto yydefault; #endif yyerrpop: /* pop the current state because it cannot handle the error token */ if (yyssp == yyss) YYABORT; yyvsp--; yystate = *--yyssp; #ifdef YYLSP_NEEDED yylsp--; #endif #if YYDEBUG != 0 if (yydebug) { short *ssp1 = yyss - 1; fprintf (stderr, "Error: state stack now"); while (ssp1 != yyssp) fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); } #endif yyerrhandle: yyn = yypact[yystate]; if (yyn == YYFLAG) goto yyerrdefault; yyn += YYTERROR; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) goto yyerrdefault; yyn = yytable[yyn]; if (yyn < 0) { if (yyn == YYFLAG) goto yyerrpop; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrpop; if (yyn == YYFINAL) YYACCEPT; #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Shifting error token, "); #endif *++yyvsp = yylval; #ifdef YYLSP_NEEDED *++yylsp = yylloc; #endif yystate = yyn; goto yynewstate; yyacceptlab: /* YYACCEPT comes here. */ if (yyfree_stacks) { free (yyss); free (yyvs); #ifdef YYLSP_NEEDED free (yyls); #endif } return 0; yyabortlab: /* YYABORT comes here. */ if (yyfree_stacks) { free (yyss); free (yyvs); #ifdef YYLSP_NEEDED free (yyls); #endif } return 1; } #line 609 "parser.y" #include extern Tcl_Interp *interp; void scout_err(char *s) { extern void yyrestart(void); extern int yy_parse_init; yyrestart(); /* reset lexical analyzer */ yy_parse_init = 1; /* reset bison */ deleteScript(st_script); errorf("SCOUT: %s", s); } void yyerror(char *s) { #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "yyerror: %s\n", s); #endif scout_err(s); } sym_tree(yyvsp[0].v, FRAMEVAR); ; break;} case 135: #line 533 "parser.y" { yyval.t = tree2(yyvsp[-1].t, FORMFRAME); ; break;} case 136: #line 534 "parser.y" { yyval.t = tree2(yyvsp[-1].t, DOTFRAME); ; break;} case 137: #line 536 "parser.y" { yyval.t = tree3(yyvsp[-5].t, APPEND, tree3(yyvsp[-3].t, 0, yyvsp[-1].t)); ; break;} case 138: #line 538 "parser.y" { yyval.t = tree3(yyvsp[-3].t, DELETE, yyvsp[-1].t); ; tkeden1.32/Scout/parser.h010060000025250000147000000042210733230566400165720ustar00ashleydcsother00001250000011typedef union { char *s; /* character string */ double d; /* double value */ int i; /* integer value */ symbol *v; /* variables */ tree *t; /* parse tree */ WinStruct w; /* window */ WinField f; /* window attributes */ } YYSTYPE; #define STR 257 #define NUMBER 258 #define ROW 259 #define COLUMN 260 #define CONTENT 261 #define JUST 262 #define SWITCH 263 #define INTEGERHONEST 264 #define STRING 265 #define INTEGER 266 #define POINT 267 #define BOX 268 #define FRAME 269 #define WINDOW 270 #define DISPLAY 271 #define IMAGE 272 #define TYPE 273 #define PICT 274 #define XMIN 275 #define YMIN 276 #define XMAX 277 #define YMAX 278 #define FONT 279 #define BG 280 #define FG 281 #define BDCOLOR 282 #define BORDER 283 #define ALIGN 284 #define SENSITIVE 285 #define BDTYPE 286 #define ALL 287 #define STRVAR 288 #define INTVAR 289 #define PTVAR 290 #define BOXVAR 291 #define FRAMEVAR 292 #define WINVAR 293 #define DISPVAR 294 #define UNKNOWN 295 #define IMGVAR 296 #define FORMPT 297 #define FORMBOX 298 #define TEXTBOX 299 #define FORMFRAME 300 #define FORMWIN 301 #define FORMDISP 302 #define SUBSTR 303 #define STRCAT 304 #define CONCAT 305 #define STRLEN 306 #define TOSTRING 307 #define DOTFRAME 308 #define DOTSTR 309 #define DOTBOX 310 #define DOTTYPE 311 #define DOTPICT 312 #define DOTXMIN 313 #define DOTYMIN 314 #define DOTXMAX 315 #define DOTYMAX 316 #define DOTFONT 317 #define DOTBG 318 #define DOTFG 319 #define DOTBDCOLOR 320 #define DOTBORDER 321 #define DOTBDTYPE 322 #define DOTALIGN 323 #define DOTSENSITIVE 324 #define DOTNE 325 #define DOTNW 326 #define DOTSE 327 #define DOTSW 328 #define DOTN 329 #define DOTE 330 #define DOTS 331 #define DOTW 332 #define BOXSHIFT 333 #define BOXINTERSECT 334 #define BOXCENTRE 335 #define BOXENCLOSING 336 #define BOXREDUCE 337 #define APPEND 338 #define DELETE 339 #define IMGFUNC 340 #define IF 341 #define THEN 342 #define ELSE 343 #define ENDIF 344 #define ImageFile 345 #define ImageScale 346 #define ERROR 347 #define OR 348 #define AND 349 #define EQ 350 #define NE 351 #define LT 352 #define LE 353 #define GT 354 #define GE 355 #define UMINUS 356 #define DOTR 357 #define DOTC 358 extern YYSTYPE st_lval; tkeden1.32/Scout/parser.y010060000025250000147000000405610733227744400166260ustar00ashleydcsother00001250000011%{ /* * $Id: parser.y,v 1.16 2001/08/02 16:26:11 cssbz Exp $ */ /* This is from the Autoconf manual. Note the pragma directive is indented so that pre-ANSI C compilers will ignore it. [Ash] */ /* AIX requires this to be the first thing in the file */ #ifdef __GNUC__ # define alloca __builtin_alloca #else # if HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ char *alloca (); # endif # endif # endif #endif static char rcsid[] = "$Id: parser.y,v 1.16 2001/08/02 16:26:11 cssbz Exp $"; #include #include #include "../config.h" #include "symbol.h" #include "tree.h" #include "../Eden/error.h" #include "../EX/script.h" #include "../Eden/emalloc.h" #ifdef HAVE_DMALLOC #include #endif #define YYERROR_VERBOSE 1 extern Script *st_script; /* function prototypes */ static WinStruct subst(WinStruct, WinField); void initDefaultWindow(void); void scout_err(char *); void yyerror(char *); extern void printdef(tree *, FILE *); extern void printsym(symbol *, FILE *); int useOldTree = 0; extern char scoutErrorStr[]; WinStruct defaultWindow; void initDefaultWindow(void) { defaultWindow.type = 0; defaultWindow.frame = 0; defaultWindow.string = 0; defaultWindow.box = 0; defaultWindow.pict = 0; defaultWindow.xmin = 0; defaultWindow.ymin = 0; defaultWindow.xmax = 0; defaultWindow.ymax = 0; defaultWindow.font = 0; defaultWindow.bgcolor = 0; defaultWindow.fgcolor = 0; defaultWindow.bdcolor = 0; defaultWindow.border = 0; defaultWindow.bdtype = 0; defaultWindow.align = -1; defaultWindow.sensitive = 0; } static WinStruct subst(WinStruct w, WinField f) { switch (f.change) { case TYPE: w.type = f.f.type; break; case FRAME: if (w.frame) freetree(w.frame); w.frame = f.f.frame; break; case STRING: if (w.string) freetree(w.string); w.string = f.f.string; break; case BOX: if (w.box) freetree(w.box); w.box = f.f.box; break; case PICT: if (w.pict) freetree(w.pict); w.pict = f.f.pict; break; case XMIN: if (w.xmin) freetree(w.xmin); w.xmin = f.f.xmin; break; case YMIN: if (w.ymin) freetree(w.ymin); w.ymin = f.f.ymin; break; case XMAX: if (w.xmax) freetree(w.xmax); w.xmax = f.f.xmax; break; case YMAX: if (w.ymax) freetree(w.ymax); w.ymax = f.f.ymax; break; case FONT: if (w.font) freetree(w.font); w.font = f.f.font; break; case BG: if (w.bgcolor) freetree(w.bgcolor); w.bgcolor = f.f.bgcolor; break; case FG: if (w.fgcolor) freetree(w.fgcolor); w.fgcolor = f.f.fgcolor; break; case BDCOLOR: if (w.bdcolor) freetree(w.bdcolor); w.bdcolor = f.f.bdcolor; break; case BORDER: w.border = f.f.border; break; case BDTYPE: if (w.bdtype) freetree(w.bdtype); w.bdtype = f.f.bdtype; break; case ALIGN: w.align = f.f.align; break; case SENSITIVE: w.sensitive = f.f.sensitive; break; }; return w; } %} %union { char *s; /* character string */ double d; /* double value */ int i; /* integer value */ symbol *v; /* variables */ tree *t; /* parse tree */ WinStruct w; /* window */ WinField f; /* window attributes */ } %token STR %token NUMBER ROW COLUMN %token CONTENT JUST SWITCH INTEGERHONEST %token STRING INTEGER POINT BOX FRAME WINDOW DISPLAY IMAGE %token TYPE PICT XMIN YMIN XMAX YMAX FONT BG FG BDCOLOR BORDER ALIGN SENSITIVE %token BDTYPE %token ALL %token STRVAR INTVAR PTVAR BOXVAR FRAMEVAR WINVAR DISPVAR UNKNOWN IMGVAR %token FORMPT FORMBOX TEXTBOX FORMFRAME FORMWIN FORMDISP %token SUBSTR STRCAT CONCAT STRLEN TOSTRING %token DOTFRAME DOTSTR DOTBOX %token DOTTYPE DOTPICT DOTXMIN DOTYMIN DOTXMAX DOTYMAX DOTFONT %token DOTBG DOTFG DOTBDCOLOR DOTBORDER DOTBDTYPE DOTALIGN DOTSENSITIVE %token DOTNE DOTNW DOTSE DOTSW DOTN DOTE DOTS DOTW %token BOXSHIFT BOXINTERSECT BOXCENTRE BOXENCLOSING BOXREDUCE %token APPEND DELETE IMGFUNC %token IF THEN ELSE ENDIF %token ImageFile ImageScale %token ERROR %type var_name %type definition var_list unknown %type str_exp int_exp point_exp box_exp %type frame_exp win_exp display_exp image_exp %type box_list win_list %type win_field_list %type win_field %nonassoc '=' %left OR %left AND %left EQ NE %left LT LE GT GE %left '+' '-' %left '*' '/' '%' %left UMINUS %left DOTR DOTC %left '.' %left CONCAT %left '&' %expect 0 %% program : statement | program statement ; statement : ';' | declaration | definition { if ($1) define($1); st_script->ready = 1; } | enquiry | error ';' { yyerrok; } ; declaration : STRING var_list ';' { if (!declare(STRVAR, $2)) { /* declaration error */ freetree($2); scout_err(scoutErrorStr); } } | INTEGER var_list ';' { if (!declare(INTVAR, $2)) { /* declaration error */ freetree($2); scout_err(scoutErrorStr); } } | POINT var_list ';' { if (!declare(PTVAR, $2)) { /* declaration error */ freetree($2); scout_err(scoutErrorStr); } } | BOX var_list ';' { if (!declare(BOXVAR, $2)) { /* declaration error */ freetree($2); scout_err(scoutErrorStr); } } | FRAME var_list ';' { if (!declare(FRAMEVAR, $2)) { /* declaration error */ freetree($2); scout_err(scoutErrorStr); } } | WINDOW var_list ';' { if (!declare(WINVAR, $2)) { /* declaration error */ freetree($2); scout_err(scoutErrorStr); } } | DISPLAY var_list ';' { if (!declare(DISPVAR, $2)) { /* declaration error */ freetree($2); scout_err(scoutErrorStr); } } | IMAGE var_list ';' { if (!declare(IMGVAR, $2)) { /* declaration error */ freetree($2); scout_err(scoutErrorStr); } } ; definition : INTVAR '=' int_exp ';' { $$ = def_tree($1, $3); } | INTEGER unknown '=' int_exp ';' { if (declare(INTVAR, $2)) $$ = def_tree($2->l.v, $4); else { freetree($2); freetree($4); scout_err(scoutErrorStr); } } | STRVAR '=' str_exp ';' { $$ = def_tree($1, $3); } | STRING unknown '=' str_exp ';' { if (declare(STRVAR, $2)) $$ = def_tree($2->l.v, $4); else { freetree($2); freetree($4); scout_err(scoutErrorStr); } } | PTVAR '=' point_exp ';' { $$ = def_tree($1, $3); } | POINT unknown '=' point_exp ';' { if (declare(PTVAR, $2)) $$ = def_tree($2->l.v, $4); else { freetree($2); freetree($4); scout_err(scoutErrorStr); } } | BOXVAR '=' box_exp ';' { $$ = def_tree($1, $3); } | BOX unknown '=' box_exp ';' { if (declare(BOXVAR, $2)) $$ = def_tree($2->l.v, $4); else { freetree($2); freetree($4); scout_err(scoutErrorStr); } } | FRAMEVAR '=' frame_exp ';' { $$ = def_tree($1, $3); } | FRAME unknown '=' frame_exp ';' { if (declare(FRAMEVAR, $2)) $$ = def_tree($2->l.v, $4); else { freetree($2); freetree($4); scout_err(scoutErrorStr); } } | WINVAR '=' win_exp ';' { $$ = def_tree($1, $3); } | WINDOW unknown '=' win_exp ';' { if (declare(WINVAR, $2)) $$ = def_tree($2->l.v, $4); else { freetree($2); freetree($4); scout_err(scoutErrorStr); } } | DISPVAR '=' display_exp ';' { $$ = def_tree($1, $3); } | DISPVAR '&' '=' DISPVAR ';' { if ($1) { if ($1->def) { useOldTree = 1; $$ = def_tree($1, tree3($4->def, '&', $1->def)); } else { $$ = def_tree($1, $4->def); } } else { freetree($1); freetree($4); scout_err(scoutErrorStr); } } | DISPLAY unknown '=' display_exp ';' { if (declare(DISPVAR, $2)) $$ = def_tree($2->l.v, $4); else { freetree($2); freetree($4); scout_err(scoutErrorStr); } } | IMGVAR '=' image_exp ';' { $$ = def_tree($1, $3); } | IMAGE unknown '=' image_exp ';' { if (declare(IMGVAR, $2)) $$ = def_tree($2->l.v, $4); else { freetree($2); freetree($4); scout_err(scoutErrorStr); } } ; var_list : unknown | var_list ',' unknown { $$ = tree3($1, ',', $3); } ; unknown : STRVAR { $$ = sym_tree($1, STRVAR); } | INTVAR { $$ = sym_tree($1, INTVAR); } | PTVAR { $$ = sym_tree($1, PTVAR); } | BOXVAR { $$ = sym_tree($1, BOXVAR); } | FRAMEVAR { $$ = sym_tree($1, FRAMEVAR); } | WINVAR { $$ = sym_tree($1, WINVAR); } | DISPVAR { $$ = sym_tree($1, DISPVAR); } | UNKNOWN { $$ = sym_tree($1, UNKNOWN); } | IMGVAR { $$ = sym_tree($1, IMGVAR); } ; enquiry : '?' ALL ';' { listsym(0); } | '?' var_name ';' { listsym($2->name); } ; var_name : STRVAR | INTVAR | PTVAR | BOXVAR | FRAMEVAR | WINVAR | DISPVAR | UNKNOWN | IMGVAR ; str_exp : STR { $$ = str_tree($1); } | STRVAR { $$ = sym_tree($1, STRVAR); } | str_exp CONCAT str_exp { $$ = tree3($1, CONCAT, $3); } | STRCAT '(' str_exp ',' str_exp ')' { $$ = tree3($3, STRCAT, $5); } | SUBSTR '(' str_exp ',' int_exp ',' int_exp ')' { $$ = tree3($3, SUBSTR, tree3($5, 0, $7)); } | TOSTRING '(' int_exp ')' { $$ = tree2($3, TOSTRING); } | win_exp DOTSTR { $$ = tree2($1, DOTSTR); } | win_exp DOTPICT { $$ = tree2($1, DOTPICT); } | win_exp DOTBG { $$ = tree2($1, DOTBG); } | win_exp DOTFG { $$ = tree2($1, DOTFG); } | win_exp DOTBDCOLOR { $$ = tree2($1, DOTBDCOLOR); } | win_exp DOTBDTYPE { $$ = tree2($1, DOTBDTYPE); } | win_exp DOTFONT { $$ = tree2($1, DOTFONT); } | IF int_exp THEN str_exp ELSE str_exp ENDIF { $$ = tree3($2, IF, tree3($4, STRVAR, $6)); } ; int_exp : NUMBER { $$ = int_tree($1); } | INTEGERHONEST { $$ = inthonest_tree($1); } | int_exp DOTR { $$ = tree2($1, ROW); } | int_exp DOTC { $$ = tree2($1, COLUMN); } | INTVAR { $$ = sym_tree($1, INTVAR); } | int_exp '+' int_exp { $$ = tree3($1, '+', $3); } | int_exp '-' int_exp { $$ = tree3($1, '-', $3); } | int_exp '*' int_exp { $$ = tree3($1, '*', $3); } | int_exp '/' int_exp { $$ = tree3($1, '/', $3); } | int_exp '%' int_exp { $$ = tree3($1, '%', $3); } | int_exp EQ int_exp { $$ = tree3($1, EQ, $3); } | int_exp NE int_exp { $$ = tree3($1, NE, $3); } | int_exp LT int_exp { $$ = tree3($1, LT, $3); } | int_exp LE int_exp { $$ = tree3($1, LE, $3); } | int_exp GT int_exp { $$ = tree3($1, GT, $3); } | int_exp GE int_exp { $$ = tree3($1, GE, $3); } | str_exp EQ str_exp { $$ = tree3($1, EQ, $3); } | str_exp NE str_exp { $$ = tree3($1, NE, $3); } | str_exp LT str_exp { $$ = tree3($1, LT, $3); } | str_exp LE str_exp { $$ = tree3($1, LE, $3); } | str_exp GT str_exp { $$ = tree3($1, GT, $3); } | str_exp GE str_exp { $$ = tree3($1, GE, $3); } | point_exp EQ point_exp { $$ = tree3($1, EQ, $3); } | point_exp NE point_exp { $$ = tree3($1, NE, $3); } | point_exp LT point_exp { $$ = tree3($1, LT, $3); } | point_exp LE point_exp { $$ = tree3($1, LE, $3); } | point_exp GT point_exp { $$ = tree3($1, GT, $3); } | point_exp GE point_exp { $$ = tree3($1, GE, $3); } | int_exp OR int_exp { $$ = tree3($1, OR, $3); } | int_exp AND int_exp { $$ = tree3($1, AND, $3); } | '-' int_exp %prec UMINUS { $$ = tree2($2, UMINUS); } | '(' int_exp ')' { $$ = tree2($2, '('); } | STRLEN '(' str_exp ')' { $$ = tree2($3, STRLEN); } | point_exp '.' int_exp { $$ = tree3($1, '.', $3); } | win_exp DOTXMIN { $$ = tree2($1, DOTXMIN); } | win_exp DOTYMIN { $$ = tree2($1, DOTYMIN); } | win_exp DOTXMAX { $$ = tree2($1, DOTXMAX); } | win_exp DOTYMAX { $$ = tree2($1, DOTYMAX); } | IF int_exp THEN int_exp ELSE int_exp ENDIF { $$ = tree3($2, IF, tree3($4, INTVAR, $6)); } ; point_exp : PTVAR { $$ = sym_tree($1, PTVAR); } | '{' int_exp ',' int_exp '}' { $$ = tree3($2, FORMPT, $4); } | point_exp '+' point_exp { $$ = tree3($1, '+', $3); } | point_exp '-' point_exp { $$ = tree3($1, '-', $3); } | box_exp DOTNE { $$ = tree2($1, DOTNE); } | box_exp DOTNW { $$ = tree2($1, DOTNW); } | box_exp DOTSE { $$ = tree2($1, DOTSE); } | box_exp DOTSW { $$ = tree2($1, DOTSW); } | box_exp DOTN { $$ = tree2($1, DOTN); } | box_exp DOTE { $$ = tree2($1, DOTE); } | box_exp DOTS { $$ = tree2($1, DOTS); } | box_exp DOTW { $$ = tree2($1, DOTW); } | IF int_exp THEN point_exp ELSE point_exp ENDIF { $$ = tree3($2, IF, tree3($4, PTVAR, $6)); } ; box_exp : BOXVAR { $$ = sym_tree($1, BOXVAR); } | '[' point_exp ',' point_exp ']' { $$ = tree3($2, FORMBOX, $4); } | '[' point_exp ',' int_exp ',' int_exp ']' { $$ = tree3($2, TEXTBOX, tree3($4, 0, $6)); } | frame_exp '.' int_exp { $$ = tree3($1, '.', $3); } | win_exp DOTBOX { $$ = tree2($1, DOTBOX); } | BOXSHIFT '(' box_exp ',' int_exp ',' int_exp ')' { $$ = tree3($3, BOXSHIFT, tree3($5, 0, $7)); } | BOXINTERSECT '(' box_exp ',' box_exp ')' { $$ = tree3($3, BOXINTERSECT, $5); } | BOXCENTRE '(' box_exp ',' box_exp ')' { $$ = tree3($3, BOXCENTRE, $5); } | BOXENCLOSING '(' box_exp ',' box_exp ')' { $$ = tree3($3, BOXENCLOSING, $5); } | BOXREDUCE '(' box_exp ',' box_exp ')' { $$ = tree3($3, BOXREDUCE, $5); } | IF int_exp THEN box_exp ELSE box_exp ENDIF { $$ = tree3($2, IF, tree3($4, BOXVAR, $6)); } ; box_list : box_exp | box_list ',' box_exp { $$ = tree3($1, ',', $3); } ; frame_exp : FRAMEVAR { $$ = sym_tree($1, FRAMEVAR); } | '(' box_list ')' { $$ = tree2($2, FORMFRAME); } | win_exp DOTFRAME { $$ = tree2($1, DOTFRAME); } | APPEND '(' frame_exp ',' int_exp ',' box_exp ')' { $$ = tree3($3, APPEND, tree3($5, 0, $7)); } | DELETE '(' frame_exp ',' int_exp ')' { $$ = tree3($3, DELETE, $5); } | frame_exp '&' frame_exp { $$ = tree3($1, '&', $3); } | IF int_exp THEN frame_exp ELSE frame_exp ENDIF { $$ = tree3($2, IF, tree3($4, FRAMEVAR, $6)); } ; win_exp : WINVAR { $$ = sym_tree($1, WINVAR); } | '{' win_field_list '}' { $$ = win_tree($2); } | display_exp '.' int_exp { $$ = tree3($1, '.', $3); } | IF int_exp THEN win_exp ELSE win_exp ENDIF { $$ = tree3($2, IF, tree3($4, WINVAR, $6)); } ; win_field_list : win_field { initDefaultWindow(); $$ = subst(defaultWindow, $1);} | win_field_list win_field { $$ = subst($1, $2); } | win_field_list ',' win_field { $$ = subst($1, $3); } ; win_field : TYPE ':' CONTENT { $$.f.type = $3; $$.change = TYPE; } | FRAME ':' frame_exp { $$.f.frame = $3; $$.change = FRAME; } | STRING ':' str_exp { $$.f.string = $3; $$.change = STRING; } | BOX ':' box_exp { $$.f.box = $3; $$.change = BOX; } | PICT ':' str_exp { $$.f.pict = $3; $$.change = PICT; } | XMIN ':' int_exp { $$.f.xmin = $3; $$.change = XMIN; } | YMIN ':' int_exp { $$.f.ymin = $3; $$.change = YMIN; } | XMAX ':' int_exp { $$.f.xmax = $3; $$.change = XMAX; } | YMAX ':' int_exp { $$.f.ymax = $3; $$.change = YMAX; } | FONT ':' str_exp { $$.f.font = $3; $$.change = FONT; } | BG ':' str_exp { $$.f.bgcolor = $3; $$.change = BG; } | FG ':' str_exp { $$.f.fgcolor = $3; $$.change = FG; } | BDCOLOR ':' str_exp { $$.f.bdcolor = $3; $$.change = BDCOLOR; } | BORDER ':' int_exp { $$.f.border = $3; $$.change = BORDER; } | BDTYPE ':' str_exp { $$.f.bdtype = $3; $$.change = BDTYPE; } | ALIGN ':' JUST { $$.f.align = $3; $$.change = ALIGN; } /* | SENSITIVE ':' SWITCH { $$.f.sensitive = $3; $$.change = SENSITIVE; } */ | SENSITIVE ':' int_exp { $$.f.sensitive = $3; $$.change = SENSITIVE; } ; win_list : win_exp | win_list '/' win_exp { $$ = tree3($1, '>', $3); } ; display_exp : DISPVAR { $$ = sym_tree($1, DISPVAR); } | LT win_list GT { $$ = tree2($2, FORMDISP); } | APPEND '(' display_exp ',' int_exp ',' win_exp ')' { $$ = tree3($3, APPEND, tree3($5, 0, $7)); } | DELETE '(' display_exp ',' int_exp ')' { $$ = tree3($3, DELETE, $5); } | display_exp '&' display_exp { $$ = tree3($1, '&', $3); } | IF int_exp THEN display_exp ELSE display_exp ENDIF { $$ = tree3($2, IF, tree3($4, DISPVAR, $6)); } ; image_exp : IMGVAR { $$ = sym_tree($1, IMGVAR); } | ImageFile '(' str_exp ',' str_exp ')' { $$ = tree3(strdup("ImageFile"), IMGFUNC, tree3($3, STRVAR, tree3($5, STRVAR, tree3(0, 0, 0)))); } | ImageScale '(' image_exp ',' int_exp ','int_exp ')' { $$ = tree3(strdup("ImageScale"), IMGFUNC, tree3($3, IMGVAR, tree3($5, INTVAR, tree3($7, INTVAR, tree3(0, 0, 0))))); } ; %% #include extern Tcl_Interp *interp; void scout_err(char *s) { extern void yyrestart(void); extern int yy_parse_init; yyrestart(); /* reset lexical analyzer */ yy_parse_init = 1; /* reset bison */ deleteScript(st_script); errorf("SCOUT: %s", s); } void yyerror(char *s) { #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "yyerror: %s\n", s); #endif scout_err(s); } .v, $4); else { freetree($2); freetree($4); scout_err(scoutErrorStr); } } | BOXVAR '=' box_exp ';' { $$ = def_tree($1, $3); }tkeden1.32/Scout/print.c010060000025250000147000000214270733031667200164330ustar00ashleydcsother00001250000011/* * $Id: print.c,v 1.8 2001/07/27 16:58:33 cssbz Exp $ */ static char rcsid[] = "$Id: print.c,v 1.8 2001/07/27 16:58:33 cssbz Exp $"; #include "../config.h" #include #include "symbol.h" #include "tree.h" #include "parser.h" /* function prototypes */ char *scoutType(int); char *just_name(int); void printdef(tree *, FILE *); void printsym(symbol *, FILE *); #ifdef __STDC__ #define show(field)\ if (w.field) {\ fprintf(fp, "\n %s: ", #field);\ printdef(w.field, fp);\ } #define dot(x) \ printdef(t->l.t, fp); \ fprintf(fp, ".%s", #x) #else #define show(field)\ if (w.field) {\ fprintf(fp, "\n field: ");\ printdef(w.field, fp);\ } #define dot(x) \ printdef(t->l.t, fp); \ fprintf(fp, ".x") #endif /* scoutType - return the type name of type */ char * scoutType(int type) { switch (type) { case STRVAR:return "string"; case INTVAR: return "integer"; case PTVAR: return "point"; case BOXVAR: return "box"; case FRAMEVAR: return "frame"; case WINVAR: return "window"; case DISPVAR: return "display"; case UNKNOWN: return "unknown"; case IMGVAR: return "image"; default: return "error !!!"; } } /* just_name - return the corresponding string of just */ char * just_name(int just) { switch (just) { case 0:return "NOADJ"; case 1: return "LEFT"; case 2: return "RIGHT"; case 3: return "CENTRE"; case 4: return "EXPAND"; default: return "error !!!"; } } /* printdef - unparse the tree t and print the result on fp */ void printdef(tree * t, FILE * fp) { WinStruct w; tree *arg; if (!t) { fprintf(fp, "@"); return; } switch (t->op) { case '=': if (t->r.t) { fprintf(fp, "%s = ", t->l.v->name); printdef(t->r.t, fp); } else { fprintf(fp, "%s", t->l.v->name); } break; case NUMBER: fprintf(fp, "%g", t->l.i); break; case ROW: printdef(t->l.t, fp); fprintf(fp, ".r"); break; case COLUMN: printdef(t->l.t, fp); fprintf(fp, ".c"); break; case STR: fprintf(fp, "\"%s\"", t->l.s); break; case IMGVAR: case UNKNOWN: case STRVAR: case INTVAR: case PTVAR: case BOXVAR: case FRAMEVAR: case WINVAR: case DISPVAR: fprintf(fp, "%s", t->l.v->name); break; case FORMPT: fprintf(fp, "{"); printdef(t->l.t, fp); fprintf(fp, ", "); printdef(t->r.t, fp); fprintf(fp, "}"); break; case FORMBOX: fprintf(fp, "["); printdef(t->l.t, fp); fprintf(fp, ", "); printdef(t->r.t, fp); fprintf(fp, "]"); break; case TEXTBOX: fprintf(fp, "["); printdef(t->l.t, fp); fprintf(fp, ", "); printdef(t->r.t->l.t, fp); fprintf(fp, ", "); printdef(t->r.t->r.t, fp); fprintf(fp, "]"); break; case '(': case FORMFRAME: fprintf(fp, "("); printdef(t->l.t, fp); fprintf(fp, ")"); break; case FORMWIN: w = t->l.w; fprintf(fp, "{\n type: "); /* !@!@ This should really use the constants array [Ash] */ switch (w.type) { case 0: fprintf(fp, "TEXT"); break; case 1: fprintf(fp, "DONALD"); break; case 2: fprintf(fp, "ARCA"); break; case 3: fprintf(fp, "IMAGE"); break; case 4: fprintf(fp, "TEXTBOX"); break; default: fprintf(fp, "UNKNOWN"); break; }; show(frame); show(string); show(box); show(pict); show(xmin); show(ymin); show(xmax); show(ymax); show(font); show(bgcolor); show(fgcolor); show(bdcolor); show(border); if (w.bdtype) { fprintf(fp, "\n relief: "); printdef(w.bdtype, fp); } if (w.align != -1) fprintf(fp, "\n alignment: %s", just_name(w.align)); if (w.sensitive) fprintf(fp, "\n sensitive: ON"); fprintf(fp, "\n}"); break; case FORMDISP: fprintf(fp, "<"); printdef(t->l.t, fp); fprintf(fp, ">"); break; case CONCAT: printdef(t->l.t, fp); fprintf(fp, " // "); printdef(t->r.t, fp); break; case STRCAT: fprintf(fp, "strcat("); printdef(t->l.t, fp); fprintf(fp, ", "); printdef(t->r.t, fp); fprintf(fp, ")"); break; case STRLEN: fprintf(fp, "strlen("); printdef(t->l.t, fp); fprintf(fp, ")"); break; case SUBSTR: fprintf(fp, "substr("); printdef(t->l.t, fp); fprintf(fp, ", "); printdef(t->r.t->l.t, fp); fprintf(fp, ", "); printdef(t->r.t->r.t, fp); fprintf(fp, ")"); break; case TOSTRING: fprintf(fp, "itos("); printdef(t->l.t, fp); fprintf(fp, ")"); break; case BOXSHIFT: fprintf(fp, "shift("); printdef(t->l.t, fp); fprintf(fp, ", "); printdef(t->r.t->l.t, fp); fprintf(fp, ", "); printdef(t->r.t->r.t, fp); fprintf(fp, ")"); break; case BOXINTERSECT: fprintf(fp, "intersect("); printdef(t->l.t, fp); fprintf(fp, ", "); printdef(t->r.t, fp); fprintf(fp, ")"); break; case BOXCENTRE: fprintf(fp, "centre("); printdef(t->l.t, fp); fprintf(fp, ", "); printdef(t->r.t, fp); fprintf(fp, ")"); break; case BOXENCLOSING: fprintf(fp, "enclose("); printdef(t->l.t, fp); fprintf(fp, ", "); printdef(t->r.t, fp); fprintf(fp, ")"); break; case BOXREDUCE: fprintf(fp, "reduce("); printdef(t->l.t, fp); fprintf(fp, ", "); printdef(t->r.t, fp); fprintf(fp, ")"); break; case DOTNE: dot(ne); break; case DOTNW: dot(nw); break; case DOTSE: dot(se); break; case DOTSW: dot(sw); break; case DOTN: dot(n); break; case DOTE: dot(e); break; case DOTS: dot(s); break; case DOTW: dot(w); break; case '.': printdef(t->l.t, fp); fprintf(fp, "."); printdef(t->r.t, fp); break; case DOTFRAME: dot(frame); break; case DOTSTR: dot(string); break; case DOTBOX: dot(box); break; case DOTTYPE: dot(type); break; case DOTPICT: dot(pict); break; case DOTXMIN: dot(xmin); break; case DOTYMIN: dot(ymin); break; case DOTXMAX: dot(xmax); break; case DOTYMAX: dot(ymax); break; case DOTFONT: dot(font); break; case DOTBG: dot(bgcolor); break; case DOTFG: dot(fgcolor); break; case DOTBDCOLOR: dot(bdcolor); break; case DOTBORDER: dot(border); break; case DOTBDTYPE: dot(relief); break; case DOTALIGN: dot(alignment); break; case DOTSENSITIVE: dot(sensitive); break; case IMGFUNC: fprintf(fp, "%s(", t->l.s); for (arg = t->r.t; arg->op; arg = arg->r.t) { printdef(arg->l.t, fp); if (arg->r.t->op) fprintf(fp, ", "); } fprintf(fp, ")"); break; case APPEND: fprintf(fp, "append("); printdef(t->l.t, fp); fprintf(fp, ", "); printdef(t->r.t->l.t, fp); fprintf(fp, ", "); printdef(t->r.t->r.t, fp); fprintf(fp, ")"); break; case DELETE: fprintf(fp, "delete("); printdef(t->l.t, fp); fprintf(fp, ", "); printdef(t->r.t, fp); fprintf(fp, ")"); break; case '&': printdef(t->l.t, fp); fprintf(fp, " & "); printdef(t->r.t, fp); break; case ',': printdef(t->l.t, fp); fprintf(fp, ", "); printdef(t->r.t, fp); break; case '>': printdef(t->l.t, fp); fprintf(fp, " / "); printdef(t->r.t, fp); break; case UMINUS: fprintf(fp, "-"); printdef(t->l.t, fp); break; case '+': printdef(t->l.t, fp); fprintf(fp, " + "); printdef(t->r.t, fp); break; case '-': printdef(t->l.t, fp); fprintf(fp, " - "); printdef(t->r.t, fp); break; case '*': printdef(t->l.t, fp); fprintf(fp, " * "); printdef(t->r.t, fp); break; case '/': printdef(t->l.t, fp); fprintf(fp, " / "); printdef(t->r.t, fp); break; case '%': printdef(t->l.t, fp); fprintf(fp, " %% "); printdef(t->r.t, fp); break; case EQ: printdef(t->l.t, fp); fprintf(fp, " == "); printdef(t->r.t, fp); break; case NE: printdef(t->l.t, fp); fprintf(fp, " != "); printdef(t->r.t, fp); break; case LT: printdef(t->l.t, fp); fprintf(fp, " < "); printdef(t->r.t, fp); break; case LE: printdef(t->l.t, fp); fprintf(fp, " <= "); printdef(t->r.t, fp); break; case GT: printdef(t->l.t, fp); fprintf(fp, " > "); printdef(t->r.t, fp); break; case GE: printdef(t->l.t, fp); fprintf(fp, " >= "); printdef(t->r.t, fp); break; case OR: printdef(t->l.t, fp); fprintf(fp, " || "); printdef(t->r.t, fp); break; case AND: printdef(t->l.t, fp); fprintf(fp, " && "); printdef(t->r.t, fp); break; case IF: fprintf(fp, "if "); printdef(t->l.t, fp); fprintf(fp, " then "); printdef(t->r.t->l.t, fp); fprintf(fp, " else "); printdef(t->r.t->r.t, fp); fprintf(fp, " endif"); break; default: fprintf(fp, "Unknown operator!"); break; } } /* printsym - print the type, variable name and the definition of the variable pointed by v on file fp */ void printsym(symbol * v, FILE * fp) { if (v->type != UNKNOWN) { if (v->def) { /* print the type and variable name */ fprintf(fp, "%s %s = ", scoutType(v->type), v->name); /* print the definition */ printdef(v->def, fp); fprintf(fp, ";\n"); } else { /* print the type and variable name */ fprintf(fp, "%s %s;\n", scoutType(v->type), v->name); } } } ; } else { fprintf(fp, "%s", t->l.v->name); } break; case NUMBER: fprintf(fp, "%g", t->l.i); break; case ROW: printdef(t->l.t, fp); fprintf(fp, ".r"); break; case COLUMN: printdef(t->l.t, fp); fprintf(fp, "tkeden1.32/Scout/store.c010060000025250000147000000272620733031705600164330ustar00ashleydcsother00001250000011/* * $Id: store.c,v 1.11 2001/07/27 17:00:29 cssbz Exp $ */ static char rcsid[] = "$Id: store.c,v 1.11 2001/07/27 17:00:29 cssbz Exp $"; #include "../config.h" #include #include "symbol.h" #include "tree.h" #include "parser.h" #include extern Tcl_Interp *interp; static char ScoutDefn[4096]; static char *store; extern char *just_name(int); extern char *scoutType(int); /* function prototypes */ void storeDefn(tree *); void storeSym(symbol *); #ifdef DISTRIB void propagateScoutDef(tree *); #endif /* DISTRIB */ #ifdef __STDC__ #define show(field)\ if (w.field) {\ sprintf(store, "\n %s: ", #field);\ store += strlen(store);\ storeDefn(w.field);\ } #define dot(x) \ storeDefn(t->l.t); \ sprintf(store, ".%s", #x);\ store += strlen(store) #else #define show(field)\ if (w.field) {\ sprintf(store, "\n field: ");\ store += strlen(store);\ storeDefn(w.field);\ } #define dot(x) \ storeDefn(t->l.t); \ sprintf(store, ".x");\ store += strlen(store) #endif #ifdef DISTRIB static int printStoreDefn = 1; /* something to do with \"s [Ash] */ #endif /* DISTRIB */ /* * storeDefn - unparse the tree t and print the result on fp */ void storeDefn(tree * t) { WinStruct w; #ifdef DISTRIB /* !@!@ Perhaps we don't need this [Ash] */ /* char *s; */ #endif /* DISTRIB */ tree *arg; if (!t) { sprintf(store, "@"); store++; return; } switch (t->op) { case '=': if (t->r.t) { sprintf(store, "%s = ", t->l.v->name); store += strlen(store); storeDefn(t->r.t); } else { sprintf(store, "%s", t->l.v->name); store += strlen(store); } break; case NUMBER: if (t->l.i == (int) t->l.i) sprintf(store, "%d", (int)t->l.i); else sprintf(store, "%f", t->l.i); store += strlen(store); break; case ROW: storeDefn(t->l.t); sprintf(store, ".r"); store += 2; break; case COLUMN: storeDefn(t->l.t); sprintf(store, ".c"); store += 2; break; case STR: #ifdef DISTRIB if (printStoreDefn) sprintf(store, "\"%s\"", t->l.s); /* "%s" */ else { /* This is only done when doing propagation [Ash] */ sprintf(store, "\\\"%s\\\"", t->l.s); /* \"%s\" */ } store += strlen(store); #else sprintf(store, "\"%s\"", t->l.s); store += strlen(store); #endif /* DISTRIB */ break; case IMGVAR: case UNKNOWN: case STRVAR: case INTVAR: case PTVAR: case BOXVAR: case FRAMEVAR: case WINVAR: case DISPVAR: sprintf(store, "%s", t->l.v->name); store += strlen(store); break; case FORMPT: sprintf(store, "{"); store++; storeDefn(t->l.t); sprintf(store, ", "); store += 2; storeDefn(t->r.t); sprintf(store, "}"); store++; break; case FORMBOX: sprintf(store, "["); store++; storeDefn(t->l.t); sprintf(store, ", "); store += 2; storeDefn(t->r.t); sprintf(store, "]"); store++; break; case TEXTBOX: sprintf(store, "["); store++; storeDefn(t->l.t); sprintf(store, ", "); store += 2; storeDefn(t->r.t->l.t); sprintf(store, ", "); store += 2; storeDefn(t->r.t->r.t); sprintf(store, "]"); store++; break; case '(': case FORMFRAME: sprintf(store, "("); store++; storeDefn(t->l.t); sprintf(store, ")"); store++; break; case FORMWIN: w = t->l.w; sprintf(store, "{\n type: "); store += strlen(store); switch (w.type) { /* !@!@ This should really use the constants array [Ash] */ case 0: sprintf(store, "TEXT"); break; case 1: sprintf(store, "DONALD"); break; case 2: sprintf(store, "ARCA"); break; case 3: sprintf(store, "IMAGE"); break; case 4: sprintf(store, "TEXTBOX"); break; default: sprintf(store, "UNKNOWN"); break; }; store += strlen(store); show(frame); show(string); show(box); show(pict); show(xmin); show(ymin); show(xmax); show(ymax); show(font); show(bgcolor); show(fgcolor); show(bdcolor); show(border); if (w.bdtype) { sprintf(store, "\n relief: "); store += strlen(store); storeDefn(w.bdtype); } if (w.align != -1) { sprintf(store, "\n alignment: %s", just_name(w.align)); store += strlen(store); } if (w.sensitive) { sprintf(store, "\n sensitive: ON"); store += strlen(store); } sprintf(store, "\n}"); store += strlen(store); break; case FORMDISP: sprintf(store, "<"); store++; storeDefn(t->l.t); sprintf(store, ">"); store++; break; case CONCAT: storeDefn(t->l.t); sprintf(store, " // "); store += 4; storeDefn(t->r.t); break; case STRCAT: sprintf(store, "strcat("); store += 7; storeDefn(t->l.t); sprintf(store, ", "); store += 2; storeDefn(t->r.t); sprintf(store, ")"); store++; break; case STRLEN: sprintf(store, "strlen("); store += 7; storeDefn(t->l.t); sprintf(store, ")"); store++; break; case SUBSTR: sprintf(store, "substr("); store += 7; storeDefn(t->l.t); sprintf(store, ", "); store += 2; storeDefn(t->r.t->l.t); sprintf(store, ", "); store += 2; storeDefn(t->r.t->r.t); sprintf(store, ")"); store++; break; case TOSTRING: sprintf(store, "itos("); store += 5; storeDefn(t->l.t); sprintf(store, ")"); store++; break; case BOXSHIFT: sprintf(store, "shift("); store += 6; storeDefn(t->l.t); sprintf(store, ", "); store += 2; storeDefn(t->r.t->l.t); sprintf(store, ", "); store += 2; storeDefn(t->r.t->r.t); sprintf(store, ")"); store++; break; case BOXINTERSECT: sprintf(store, "intersect("); store += strlen(store); storeDefn(t->l.t); sprintf(store, ", "); store += 2; storeDefn(t->r.t); sprintf(store, ")"); store++; break; case BOXCENTRE: sprintf(store, "centre("); store += strlen(store); storeDefn(t->l.t); sprintf(store, ", "); store += strlen(store); storeDefn(t->r.t); sprintf(store, ")"); store++; break; case BOXENCLOSING: sprintf(store, "enclose("); store += strlen(store); storeDefn(t->l.t); sprintf(store, ", "); store += strlen(store); storeDefn(t->r.t); sprintf(store, ")"); store++; break; case BOXREDUCE: sprintf(store, "reduce("); store += strlen(store); storeDefn(t->l.t); sprintf(store, ", "); store += strlen(store); storeDefn(t->r.t); sprintf(store, ")"); store++; break; case DOTNE: dot(ne); break; case DOTNW: dot(nw); break; case DOTSE: dot(se); break; case DOTSW: dot(sw); break; case DOTN: dot(n); break; case DOTE: dot(e); break; case DOTS: dot(s); break; case DOTW: dot(w); break; case '.': storeDefn(t->l.t); sprintf(store, "."); store++; storeDefn(t->r.t); break; case DOTFRAME: dot(frame); break; case DOTSTR: dot(string); break; case DOTBOX: dot(box); break; case DOTTYPE: dot(type); break; case DOTPICT: dot(pict); break; case DOTXMIN: dot(xmin); break; case DOTYMIN: dot(ymin); break; case DOTXMAX: dot(xmax); break; case DOTYMAX: dot(ymax); break; case DOTFONT: dot(font); break; case DOTBG: dot(bgcolor); break; case DOTFG: dot(fgcolor); break; case DOTBDCOLOR: dot(bdcolor); break; case DOTBORDER: dot(border); break; case DOTBDTYPE: dot(relief); break; case DOTALIGN: dot(alignment); break; case DOTSENSITIVE: dot(sensitive); break; case IMGFUNC: sprintf(store, "%s(", t->l.s); store += strlen(store); for (arg = t->r.t; arg->op; arg = arg->r.t) { storeDefn(arg->l.t); if (arg->r.t->op) { sprintf(store, ", "); store += strlen(store); } } sprintf(store, ")"); store++; break; case APPEND: sprintf(store, "append("); store += strlen(store); storeDefn(t->l.t); sprintf(store, ", "); store += strlen(store); storeDefn(t->r.t->l.t); sprintf(store, ", "); store += strlen(store); storeDefn(t->r.t->r.t); sprintf(store, ")"); store++; break; case DELETE: sprintf(store, "delete("); store += strlen(store); storeDefn(t->l.t); sprintf(store, ", "); store += strlen(store); storeDefn(t->r.t); sprintf(store, ")"); store++; break; case '&': storeDefn(t->l.t); sprintf(store, " & "); store += strlen(store); storeDefn(t->r.t); break; case ',': storeDefn(t->l.t); sprintf(store, ", "); store += strlen(store); storeDefn(t->r.t); break; case '>': storeDefn(t->l.t); sprintf(store, " / "); store += strlen(store); storeDefn(t->r.t); break; case UMINUS: sprintf(store, "-"); store++; storeDefn(t->l.t); break; case '+': storeDefn(t->l.t); sprintf(store, " + "); store += strlen(store); storeDefn(t->r.t); break; case '-': storeDefn(t->l.t); sprintf(store, " - "); store += strlen(store); storeDefn(t->r.t); break; case '*': storeDefn(t->l.t); sprintf(store, " * "); store += strlen(store); storeDefn(t->r.t); break; case '/': storeDefn(t->l.t); sprintf(store, " / "); store += strlen(store); storeDefn(t->r.t); break; case '%': storeDefn(t->l.t); sprintf(store, " %% "); store += strlen(store); storeDefn(t->r.t); break; case EQ: storeDefn(t->l.t); sprintf(store, " == "); store += strlen(store); storeDefn(t->r.t); break; case NE: storeDefn(t->l.t); sprintf(store, " != "); store += strlen(store); storeDefn(t->r.t); break; case LT: storeDefn(t->l.t); sprintf(store, " < "); store += strlen(store); storeDefn(t->r.t); break; case LE: storeDefn(t->l.t); sprintf(store, " <= "); store += strlen(store); storeDefn(t->r.t); break; case GT: storeDefn(t->l.t); sprintf(store, " > "); store += strlen(store); storeDefn(t->r.t); break; case GE: storeDefn(t->l.t); sprintf(store, " >= "); store += strlen(store); storeDefn(t->r.t); break; case OR: storeDefn(t->l.t); sprintf(store, " || "); store += strlen(store); storeDefn(t->r.t); break; case AND: storeDefn(t->l.t); sprintf(store, " && "); store += strlen(store); storeDefn(t->r.t); break; case IF: sprintf(store, "if "); store += strlen(store); storeDefn(t->l.t); sprintf(store, " then "); store += strlen(store); storeDefn(t->r.t->l.t); sprintf(store, " else "); store += strlen(store); storeDefn(t->r.t->r.t); sprintf(store, " endif"); store += strlen(store); break; default: sprintf(store, "Unknown operator!"); store += strlen(store); break; } } /* printsym - print the type, variable name and the definition of the variable pointed by v on file fp */ void storeSym(symbol * v) { Tcl_DString command; Tcl_DStringInit(&command); if (v->type != UNKNOWN) { store = ScoutDefn; if (v->def) { /* print the type and variable name */ sprintf(store, "%s %s = ", scoutType(v->type), v->name); store += strlen(store); /* print the definition */ storeDefn(v->def); sprintf(store, ";\n"); store += strlen(store); } else { /* print the type and variable name */ sprintf(store, "%s %s;\n", scoutType(v->type), v->name); store += strlen(store); } Tcl_DStringAppendElement(&command, "scoutDefn"); Tcl_DStringAppendElement(&command, v->name); Tcl_DStringAppendElement(&command, ScoutDefn); Tcl_EvalEC(interp, command.string); Tcl_DStringFree(&command); } } #ifdef DISTRIB void propagateScoutDef(tree * t) { extern void propagateScoutScr(char *, char *); if (t->l.v->type != UNKNOWN) { store = ScoutDefn; if (t->l.v->def) { /* print the type and variable name */ sprintf(store, "%%scout\n%s %s = ", scoutType(t->l.v->type), t->l.v->name); store += strlen(store); /* print the definition */ printStoreDefn = 0; storeDefn(t->l.v->def); printStoreDefn = 1; sprintf(store, ";\n%%eden\n"); store += strlen(store); } else { /* print the type and variable name */ sprintf(store, "%%scout\n%s %s;\n%%eden\n", scoutType(t->l.v->type), t->l.v->name); store += strlen(store); } propagateScoutScr(t->l.v->name, ScoutDefn); } } #endif /* DISTRIB */ store += strlen(store); } sprintf(store, "\n}"); store += strlen(store); break; case FORMDISP: sprintf(store, "<"); store++; storeDefn(t->l.t); sprintf(store, ">"); store++; break; case CONCAT: storeDefn(t->l.t); sprintf(store, " // "); store += 4; storeDefn(t->r.t); break; case STRCAT: sprintf(store, "sttkeden1.32/Scout/st_lex.c010060000025250000147000000277030736260763000166020ustar00ashleydcsother00001250000011/* * $Id: lex.c,v 1.16 2001/10/15 16:12:21 cssbz Exp $ */ static char rcsid[] = "$Id: lex.c,v 1.16 2001/10/15 16:12:21 cssbz Exp $"; #include #include #include #include #include "../config.h" #include "symbol.h" #include "tree.h" #include "parser.h" #include "../EX/script.h" #include "../Eden/emalloc.h" #ifdef HAVE_DMALLOC #include #endif extern void st_parse(int); extern char agentName[128]; /* for distributed Tkeden --sun */ extern int appAgentName; extern int append_NoAgentName; /* [Patrick] we are within a window definition, so don't prepend the agent name. [Ash] now thinks that this is 0 when a reference to variable explicitly in the root context is made (eg ~ON), which then stops the prepending of the agent name. */ extern char *libLocation; /* function prototypes */ static int search_constant(char *); static int search_token(char *); static int search_field(char *); void st_restart(void); static void save(int); static void action_A(void); void st_lex(int); void init_scout(void); static int ScoutAppAgentName; /* for agency -- sun */ Script *st_script; char *st_prompt; #define NCONSTANTS 16 static struct { char *name; int val; int token; } constants[NCONSTANTS] = { /* This table must be in alphabetical order. Note you need to adjust the pre-processor size if you add or delete items and possibly change stuff in print.c and store.c... [Ash] */ { "ARCA" , 2, CONTENT }, { "CENTRE" , 3, JUST }, { "DONALD" , 1, CONTENT }, { "ENTER" , 4, INTEGERHONEST }, { "EXPAND" , 4, JUST }, { "IMAGE" , 3, CONTENT }, { "LEAVE" , 8, INTEGERHONEST }, { "LEFT" , 1, JUST }, { "MOTION" , 2, INTEGERHONEST }, { "NOADJ" , 0, JUST }, { "OFF" , 0, INTEGERHONEST }, { "ON" , 1, INTEGERHONEST }, { "RIGHT" , 2, JUST }, { "TEXT" , 0, CONTENT }, { "TEXTBOX" , 4, CONTENT }, { 0, 0 } }; #define NTOKENS 47 static struct { char *name; int token; } tokens[NTOKENS] = { { "ImageFile" , ImageFile }, { "ImageScale" , ImageScale }, { "alignment" , ALIGN }, { "all" , ALL }, { "append" , APPEND }, { "bdcolor" , BDCOLOR }, { "bdcolour" , BDCOLOR }, { "bgcolor" , BG }, { "bgcolour" , BG }, { "border" , BORDER }, { "bordercolor" , BDCOLOR }, { "bordercolour", BDCOLOR }, { "box" , BOX }, { "centre" , BOXCENTRE }, { "delete" , DELETE }, { "display" , DISPLAY }, { "else" , ELSE }, { "enclose" , BOXENCLOSING }, { "endif" , ENDIF }, { "fgcolor" , FG }, { "fgcolour" , FG }, { "font" , FONT }, { "frame" , FRAME }, { "if" , IF }, { "image" , IMAGE }, { "integer" , INTEGER }, { "intersect" , BOXINTERSECT }, { "itos" , TOSTRING }, { "pict" , PICT }, { "point" , POINT }, { "real" , INTEGER }, { "reduce" , BOXREDUCE }, { "relief" , BDTYPE }, { "sensitive" , SENSITIVE }, { "shift" , BOXSHIFT }, { "strcat" , STRCAT }, { "string" , STRING }, { "strlen" , STRLEN }, { "substr" , SUBSTR }, { "then" , THEN }, { "type" , TYPE }, { "window" , WINDOW }, { "xmax" , XMAX }, { "xmin" , XMIN }, { "ymax" , YMAX }, { "ymin" , YMIN }, { 0, 0 } }; #define NFIELDS 33 static struct { char *name; int token; } fields[NFIELDS] = { { "alignment" , DOTALIGN }, { "bdcolor" , DOTBDCOLOR }, { "bdcolour" , DOTBDCOLOR }, { "bgcolor" , DOTBG }, { "bgcolour" , DOTBG }, { "border" , DOTBORDER }, { "bordercolor" , DOTBDCOLOR }, { "bordercolour", DOTBDCOLOR }, { "box" , DOTBOX }, { "c" , DOTC }, { "e" , DOTE }, { "fgcolor" , DOTFG }, { "fgcolour" , DOTFG }, { "font" , DOTFONT }, { "frame" , DOTFRAME }, { "n" , DOTN }, { "ne" , DOTNE }, { "nw" , DOTNW }, { "pict" , DOTPICT }, { "r" , DOTR }, { "relief" , DOTBDTYPE }, { "s" , DOTS }, { "se" , DOTSE }, { "sensitive" , DOTSENSITIVE }, { "string" , DOTSTR }, { "sw" , DOTSW }, { "type" , DOTTYPE }, { "w" , DOTW }, { "xmax" , DOTXMAX }, { "xmin" , DOTXMIN }, { "ymax" , DOTYMAX }, { "ymin" , DOTYMIN }, { 0, 0 } }; static int search_constant(char *name) { int i, start, end, cmp; start = 0; end = NCONSTANTS - 1; for (i = (NCONSTANTS - 1) >> 1; start <= i && i <= end; i = (start + end) >> 1) { if (constants[i].name == 0) return -1; cmp = strcmp(name, constants[i].name); if (cmp == 0) return i; else if (cmp > 0) start = i + 1; else /* cmp < 0 */ end = i - 1; } return -1; } static int search_token(char *name) { int i, start, end, cmp; start = 0; end = NTOKENS - 1; for (i = (NTOKENS - 1) >> 1; start <= i && i <= end; i = (start + end) >> 1) { if (tokens[i].name == 0) return -1; cmp = strcmp(name, tokens[i].name); if (cmp == 0) return i; else if (cmp > 0) start = i + 1; else /* cmp < 0 */ end = i - 1; } return -1; } static int search_field(char *name) { int i, start, end, cmp; start = 0; end = NFIELDS - 1; for (i = (NFIELDS - 1) >> 1; start <= i && i <= end; i = (start + end) >> 1) { if (fields[i].name == 0) return -1; cmp = strcmp(name, fields[i].name); if (cmp == 0) return i; else if (cmp > 0) start = i + 1; else /* cmp < 0 */ end = i - 1; } return -1; } enum { _S_, _A_, _D_, _DOT_, _DDOT_, _DDOTD_, _DOTA_, _QUOTE_, _QBSLASH_, _HASH_, _AND_, _OR_, _EQ_, _NOT_, _LT_, _GT_, _SLASH_ }; static char *st_text = 0; static int bufsize = 256; static int st_leng = 0; static int state = _S_; /* start state */ #define clearbuf() (st_text[st_leng=0] = '\0') void st_restart(void) { clearbuf(); state = _S_; } static void save(int c) { if (st_leng == bufsize - 1) { bufsize *= 2; st_text = (char *) erealloc(st_text, bufsize * sizeof(int)); } st_text[st_leng++] = c; st_text[st_leng] = '\0'; } static void action_A(void) { int pos; char new_st_text[256]; extern int inPrefix; /* which mode of VA are we in: SUN_A or A_SUN... */ if ((pos = search_constant(st_text)) != -1) { st_lval.i = constants[pos].val; st_parse(constants[pos].token); } else if ((pos = search_token(st_text)) != -1) { st_parse(tokens[pos].token); } else { /* it is a variable */ /* printf("st_text= %s %s %i %i %i\n", st_text, agentName, appAgentName, append_NoAgentName, ScoutAppAgentName); */ if (*agentName != 0 && appAgentName > 0 && append_NoAgentName > 0 && ScoutAppAgentName > 0) { /* for distributed tkEden -- sun */ new_st_text[0] = '\0'; if (st_text[0] == '_' && inPrefix) { strcat(new_st_text, "_"); st_text++; } if (inPrefix) strcat(new_st_text, agentName); else strcat(new_st_text, st_text); strcat(new_st_text, "_"); if (inPrefix) strcat(new_st_text, st_text); else strcat(new_st_text, agentName); strcpy(st_text, new_st_text); } st_lval.v = lookUp(st_text); st_parse((st_lval.v)->type); } } void st_lex(int c) { switch (state) { case _S_: if (isalpha(c) || c == '_') { save(c); state = _A_; ScoutAppAgentName = 1; } else if (isdigit(c)) { save(c); state = _D_; } else if (c == ' ' || c == '\t') { state = _S_; } else if (c == '\n') { state = _S_; } else if (c == '\r') { state = _S_; } else if (c == '.') { state = _DOT_; } else if (c == '"') { state = _QUOTE_; } else if (c == '#') { state = _HASH_; } else if (c == '&') { state = _AND_; } else if (c == '|') { state = _OR_; } else if (c == '=') { state = _EQ_; } else if (c == '!') { state = _NOT_; } else if (c == '<') { state = _LT_; } else if (c == '>') { state = _GT_; } else if (c == '/') { state = _SLASH_; } else if (c == '~') { /* for agency -- sun */ state = _A_; ScoutAppAgentName = 0; } else { st_parse(c); state = _S_; } break; case _A_: if (isalnum(c) || c == '_') { save(c); state = _A_; } else { action_A(); clearbuf(); state = _S_; st_lex(c); } break; case _D_: if (isdigit(c)) { save(c); state = _D_; } else if (c == '.') { save(c); state = _DDOT_; } else { st_lval.d = atof(st_text); st_parse(NUMBER); clearbuf(); state = _S_; st_lex(c); } break; case _DDOT_: if (isdigit(c)) { save(c); state = _DDOTD_; } else if (c == '.') { st_lval.d = atof(st_text); st_parse(NUMBER); clearbuf(); state = _DOT_; } else { st_lval.d = atof(st_text); st_parse(NUMBER); clearbuf(); state = _DOT_; st_lex(c); } break; case _DDOTD_: if (isdigit(c)) { save(c); state = _DDOTD_; } else { st_lval.d = atof(st_text); st_parse(NUMBER); clearbuf(); state = _S_; st_lex(c); } break; case _DOT_: if (c == ' ' || c == '\t') { state = _DOT_; } else if (isalpha(c)) { save(c); state = _DOTA_; } else { st_parse('.'); clearbuf(); state = _S_; st_lex(c); } break; case _DOTA_: if (isalpha(c)) { save(c); state = _DOTA_; } else { int pos = search_field(st_text); clearbuf(); st_parse(pos == -1 ? ERROR : fields[pos].token); state = _S_; st_lex(c); } break; case _QUOTE_: if (c == '"') { st_lval.s = strdup(st_text); st_parse(STR); clearbuf(); state = _S_; } else if (c == '\\') { state = _QBSLASH_; } else { save(c); state = _QUOTE_; } break; case _QBSLASH_: switch (c) { case 'n': save('\n'); break; case '\n': /* ignore \newline */ break; default: save(c); break; } state = _QUOTE_; break; case _HASH_: state = c == '\n' ? _S_ : _HASH_; break; case _AND_: if (c == '&') { st_parse(AND); state = _S_; } else { st_parse('&'); state = _S_; st_lex(c); } break; case _OR_: if (c == '|') { st_parse(OR); state = _S_; } else { st_parse('|'); state = _S_; st_lex(c); } break; case _EQ_: if (c == '=') { st_parse(EQ); state = _S_; } else { st_parse('='); state = _S_; st_lex(c); } break; case _NOT_: if (c == '=') { st_parse(NE); state = _S_; } else { st_parse('!'); state = _S_; st_lex(c); } break; case _LT_: if (c == '=') { st_parse(LE); state = _S_; } else { st_parse(LT); state = _S_; st_lex(c); } break; case _GT_: if (c == '=') { st_parse(GE); state = _S_; } else { st_parse(GT); state = _S_; st_lex(c); } break; case _SLASH_: if (c == '/') { st_parse(CONCAT); state = _S_; } else { st_parse('/'); state = _S_; st_lex(c); } break; } } #define FILE_DEV 1 void init_scout(void) { char *name = "/scout.init.e"; char fullname[255]; FILE *initFile; extern char *progname; extern int run(short, void *, char *); char *envcontents; if (st_text == 0) st_text = (char *) emalloc(bufsize * sizeof(int)); strcpy(fullname, libLocation); strcat(fullname, name); if ((initFile = fopen(fullname, "r")) == 0) { fprintf(stderr, "%s: can't open %s\n", progname, fullname); exit(1); } lookUp("screen")->type = DISPVAR; /* screen is of type display */ run(FILE_DEV, initFile, name); /* pre-define these: if you change these, change also the corresponding values in the Eden namespace in scout.init.e [Ash] */ /* These need to be in the constants table if VA is not to mess them up, so removed again. [Ash] */ /* installIntVar("OFF", 0); installIntVar("ON", 1); installIntVar("MOTION", 2); installIntVar("ENTER", 4); installIntVar("LEAVE", 8); */ } tkeden1.32/Scout/symbol.c010060000025250000147000000754250733227744400166200ustar00ashleydcsother00001250000011/* * $Id: symbol.c,v 1.14 2001/08/02 16:26:11 cssbz Exp $ */ static char rcsid[] = "$Id: symbol.c,v 1.14 2001/08/02 16:26:11 cssbz Exp $"; #include #include #include #include #include "../config.h" #include "symbol.h" #include "tree.h" #include "parser.h" #include "../EX/script.h" #include #include "../Eden/emalloc.h" #ifdef HAVE_DMALLOC #include #endif extern Tcl_Interp *interp; extern char *progname; extern void scout_err(char *); extern void appendEden(char *, Script *); extern char *scoutType(int); extern void storeSym(symbol *); extern void printsym(symbol *, FILE *); extern void *getheap(int); #ifdef DISTRIB /* for distributed tkEden --sun */ /* Perhaps we don't need this [Ash] extern void substr(void); */ #endif /* DISTRIB */ Script *st_script; static char edenStr[160]; /* Increased from 80 as the "VB" code below writes more than 80 characters into this array sometimes, depending on the length of Scout symbol names that we have hanging around :(. Really could do with a better solution to this. [Ash]. */ static char ss[2]; char scoutErrorStr[80]; /* function prototypes */ int hash(char *); symbol *new_sym(int, char *); symbol *lookUp(char *); void declare_image_action(char *); int declare(int, tree *); void appendTreeList(tree *); void clearTreeList(void); void translate(tree *, int); void define(tree *); void listsym(char *); int dumpscout(ClientData, Tcl_Interp *, int, char *[]); static int symbolcmp(/* symbol **, symbol ** */); #ifdef DISTRIB void propagateScoutScr(char *, char *); /* for distributed --sun */ static int scoutDefAgencyCheck(tree *, int); static void checkScoutDefOracle(tree *, int); #endif /* DISTRIB */ #ifdef __STDC__ #define out(func, type) \ appendEden(#func, st_script); \ appendEden("(", st_script); \ translate(t->l.t, type); \ appendEden(")", st_script) #define dot(i) \ appendEden("dotint(", st_script); \ translate(t->l.t, WINVAR); \ appendEden(", ", st_script); \ appendEden(#i, st_script); \ appendEden(")", st_script) #else #define out(func, type) \ appendEden("func(", st_script); \ translate(t->l.t, type); \ appendEden(")", st_script) #define dot(i) \ appendEden("dotint(", st_script); \ translate(t->l.t, WINVAR); \ appendEden(", i)", st_script) #endif /* symalloc - allocate space for a new entry of symbol table */ #define symalloc() (symbol *)emalloc(sizeof(symbol)) /* table[] - symbol table */ static symbol *table[26]; /* hash - hashing function which maps from the first two characters of a variable to one of the 26 lists in table[] */ int hash(char *name) { return ( (isupper(name[0]) ? tolower(name[0]) - 'a' : name[0] - 'a') + name[1] ) % 26; } /* new_sym - add a variable, name, to the list table[h] */ symbol * new_sym(int h, char *name) { symbol *v; v = symalloc(); v->next = table[h]; table[h] = v; v->name = (char *) emalloc(sizeof(char) * (strlen(name) + 1)); strcpy(v->name, name); v->type = UNKNOWN; v->def = 0; return v; } /* lookUp - find the location of the variable name, in the symbol table. If it is not there, create one */ symbol * lookUp(char *name) { int h; symbol *v; h = hash(name); for (v = table[h]; v != 0; v = v->next) { /* Not sure if the 'v &&' below is required, but safer to leave it [Ash] */ if (v && !strcmp(v->name, name)) break; } return v ? v : new_sym(h, name); } /* Install a new symbol of type integer into the symbol table with the stated initial value [Ash] */ void installIntVar(char *name, int value) { symbol * sym; sym = lookUp(name); sym->type = INTVAR; sym->def = int_tree((double)value); } /* generating Eden action for handling image */ void declare_image_action(char *name) { /* the image variable name */ char s[256]; /* buffer for generating eden script */ sprintf(s, "proc P_%s : I_%s, %s { ShowImage(&I_%s, &%s); }\n", name, name, name, name, name); appendEden(s, st_script); } /* list is the parse tree denoting a list of variable of type unknown. declare - declare the variables in list to be of type `type' */ int declare(int type, tree * list) { #ifdef DISTRIB extern int handle_check1(char *); #endif /* DISTRIB */ tree *p; #ifdef DISTRIB for (p = list; p->op == ','; p = p->l.t) { if (handle_check1(p->r.t->l.v->name)) { /* declare is allowed --sun */ if (p->r.t->l.v->type == UNKNOWN) { /* declare the type of the variable */ p->r.t->l.v->type = type; if (type == IMGVAR) declare_image_action(p->r.t->l.v->name); } else if (p->r.t->l.v->type != type) { sprintf(scoutErrorStr, "can't redeclare %s %s to %s\n", scoutType(p->r.t->l.v->type), p->r.t->l.v->name, scoutType(type)); return 0; } /*send ScoutDeclaration to others --sun */ sprintf(edenStr, "%%scout\n%s %s;\n%%eden", scoutType(p->r.t->l.v->type), p->r.t->l.v->name); propagateScoutScr(p->r.t->l.v->name, edenStr); } } if (handle_check1(p->l.v->name)) { /* declare is allowed */ if (p->l.v->type == UNKNOWN) { /* declare the type of the variable */ p->l.v->type = type; if (type == IMGVAR) declare_image_action(p->l.v->name); } else if (p->l.v->type != type) { sprintf(scoutErrorStr, "can't redeclare %s %s to %s\n", scoutType(p->l.v->type), p->l.v->name, scoutType(type)); return 0; } /*send ScoutDeclaration to others --sun */ sprintf(edenStr, "%%scout\n%s %s;\n%%eden", scoutType(p->l.v->type), p->l.v->name); propagateScoutScr(p->l.v->name, edenStr); return 1; } #else /* not DISTRIB */ for (p = list; p->op == ','; p = p->l.t) { if (p->r.t->l.v->type == UNKNOWN) { /* declare the type of the variable */ p->r.t->l.v->type = type; if (type == IMGVAR) declare_image_action(p->r.t->l.v->name); } else if (p->r.t->l.v->type != type) { sprintf(scoutErrorStr, "can't redeclare %s %s to %s\n", scoutType(p->r.t->l.v->type), p->r.t->l.v->name, scoutType(type)); return 0; } } if (p->l.v->type == UNKNOWN) { /* declare the type of the variable */ p->l.v->type = type; if (type == IMGVAR) declare_image_action(p->l.v->name); } else if (p->l.v->type != type) { sprintf(scoutErrorStr, "can't redeclare %s %s to %s\n", scoutType(p->l.v->type), p->l.v->name, scoutType(type)); return 0; } return 1; #endif /* DISTRIB */ } static int stage = 1; /* controlling the translation process */ static char *defname; /* name of the variable to be defined */ static tree **TreeList; /* list of pointers to the image expressions */ static int treeListSize = 0; static int TopTreeList = 0; static char tempname[80]; /* name of a temp. image variable */ #ifdef DISTRIB /* name of the variable to be given at first */ /* Perhaps not needed [Ash] static char *givenName; */ #endif /* DISTRIB */ void appendTreeList(tree * t) { if (treeListSize == 0) { treeListSize = 4; TreeList = (tree **) emalloc(sizeof(tree *) * treeListSize); } else if (TopTreeList == treeListSize) { treeListSize += 4; TreeList = (tree **) erealloc(TreeList, sizeof(tree *) * treeListSize); } TreeList[TopTreeList++] = t; } void clearTreeList(void) { TopTreeList = 0; } /* translate - translate the tree t to EDEN notation. the tree is expected to denote an expression of type `type' */ void translate(tree * t, int type) { WinStruct w; char *s; tree *arg; extern int inPrefix; extern char agentName[]; /* For VB style features [Ash] */ char autogen_proc_name[128], procClickName[128]; ss[1] = '\0'; if (!t) { appendEden("@", st_script); return; } switch (t->op) { case '=': defname = t->l.v->name; if (type == IMGVAR) { sprintf(edenStr, "I_%s is ", defname); } else { sprintf(edenStr, "%s is ", defname); } appendEden(edenStr, st_script); translate(t->r.t, type); break; case NUMBER: sprintf(edenStr, (t->l.i == (int)t->l.i) ? "%.1f" : "%f", t->l.i); appendEden(edenStr, st_script); break; case ROW: out(row, INTVAR); break; case COLUMN: out(column, INTVAR); break; case STR: ss[0] = '"'; appendEden(ss, st_script); s = t->l.s; while (*s) { if (*s == '\\') { /* protect \ */ s++; appendEden("\\\\", st_script); } else if (*s == '"') { /* protect " */ s++; appendEden("\\\"", st_script); } else { ss[0] = *s++; appendEden(ss, st_script); } } ss[0] = '"'; appendEden(ss, st_script); break; case UNKNOWN: scout_err("unknown operator"); break; case STRVAR: case INTVAR: case PTVAR: case BOXVAR: case FRAMEVAR: case WINVAR: case DISPVAR: sprintf(edenStr, "%s", t->l.v->name); appendEden(edenStr, st_script); break; case IMGVAR: sprintf(edenStr, "I_%s", t->l.v->name); appendEden(edenStr, st_script); break; case FORMPT: appendEden("[", st_script); translate(t->l.t, INTVAR); appendEden(", ", st_script); translate(t->r.t, INTVAR); appendEden("]", st_script); break; case FORMBOX: appendEden("formbox(", st_script); translate(t->l.t, PTVAR); appendEden(", ", st_script); translate(t->r.t, PTVAR); appendEden(")", st_script); break; case TEXTBOX: appendEden("textbox(", st_script); translate(t->l.t, PTVAR); appendEden(", ", st_script); translate(t->r.t->l.t, INTVAR); appendEden(", ", st_script); translate(t->r.t->r.t, INTVAR); appendEden(")", st_script); break; case FORMFRAME: appendEden("[", st_script); translate(t->l.t, BOXVAR); appendEden("]", st_script); break; case FORMWIN: w = t->l.w; /* Eden list index 1: type */ sprintf(edenStr, "[%d, ", w.type); appendEden(edenStr, st_script); /* Eden list index 2: frame */ if (w.frame) translate(w.frame, FRAMEVAR); else appendEden("[[0,0,100,100]]", st_script); appendEden(", ", st_script); /* Eden list index 3: string */ if (w.string) translate(w.string, STRVAR); else appendEden("\"\"", st_script); appendEden(", ", st_script); /* Eden list index 4: box */ if (w.box) translate(w.box, BOXVAR); else appendEden("[0,0,100,100]", st_script); appendEden(", ", st_script); /* Eden list index 5: pict */ if (w.pict) translate(w.pict, STRVAR); else appendEden("\"pict1\"", st_script); appendEden(", ", st_script); /* Eden list index 6: xmin */ if (w.xmin) translate(w.xmin, INTVAR); else appendEden("DFxmin", st_script); appendEden(", ", st_script); /* Eden list index 7: ymin */ if (w.ymin) translate(w.ymin, INTVAR); else appendEden("DFymin", st_script); appendEden(", ", st_script); /* Eden list index 8: xmax */ if (w.xmax) translate(w.xmax, INTVAR); else appendEden("DFxmax", st_script); appendEden(", ", st_script); /* Eden list index 9: ymax */ if (w.ymax) translate(w.ymax, INTVAR); else appendEden("DFymax", st_script); appendEden(", ", st_script); /* Eden list index 10: bgcolor */ if (w.bgcolor) translate(w.bgcolor, STRVAR); else appendEden("DFbgcolor", st_script); appendEden(", ", st_script); /* Eden list index 11: fgcolor */ if (w.fgcolor) translate(w.fgcolor, STRVAR); else appendEden("DFfgcolor", st_script); appendEden(", ", st_script); /* Eden list index 12: border */ if (w.border) translate(w.border, INTVAR); else appendEden("DFborder", st_script); appendEden(", ", st_script); /* Eden list index 13: align */ if (w.align != -1) { sprintf(edenStr, "%d", w.align); appendEden(edenStr, st_script); } else appendEden("DFalign", st_script); appendEden(", ", st_script); /* Eden list index 14: sensitive */ if (w.sensitive) translate(w.sensitive, INTVAR); else appendEden("DFsensitive", st_script); appendEden(", ", st_script); /* Eden list index 15: bdcolor */ if (w.bdcolor) translate(w.bdcolor, STRVAR); else appendEden("DFbdcolor", st_script); appendEden(", ", st_script); /* Eden list index 16: font */ if (w.font) translate(w.font, STRVAR); else appendEden("DFfont", st_script); appendEden(", ", st_script); /* Eden list index 17: bdtype */ if (w.bdtype) translate(w.bdtype, STRVAR); else appendEden("DFrelief", st_script); /* Eden list index 18: defname */ sprintf(edenStr, ", \"%s\"", defname); appendEden(edenStr, st_script); /*if (w.type == 4) { sprintf(edenStr, ", %s_TEXT_1", defname); appendEden(edenStr, st_script); } */ appendEden("]", st_script); /* for like-VB interface --sun */ if (w.sensitive && (w.type == 4 || w.type == 0 || w.type == 1) ) { *procClickName = 0; if (inPrefix) { strcpy(procClickName, defname); strcat(procClickName, "_click"); } else { strncat(procClickName, defname, strlen(defname)-strlen(agentName)); strcat(procClickName, "click_"); strcat(procClickName, agentName); } if (lookup(procClickName) == 0) { sprintf(edenStr, ";\nproc %s {}", procClickName); appendEden(edenStr, st_script); } /* *autogen_proc_name = 0; strcpy(autogen_proc_name, defname); strcat(autogen_proc_name, "_mouseDown"); if (lookup(autogen_proc_name) == 0) { sprintf(edenStr, ";\nproc %s_mouseDown {}", defname); appendEden(edenStr, st_script); } */ /* proc for MouseDown */ sprintf(edenStr, ";\nproc %s_mouseButtonPress : ", defname); appendEden(edenStr, st_script); if (w.type ==1) sprintf(edenStr, "%s_mouse, %s_mouseClick {\n", defname, defname); else sprintf(edenStr, "%s_mouse_1, %s_mouseClick {\n", defname, defname); appendEden(edenStr, st_script); sprintf(edenStr, " if (%s_mouseClick) {\n", defname); appendEden(edenStr, st_script); sprintf(edenStr, " %s();\n", procClickName); appendEden(edenStr, st_script); sprintf(edenStr, " %s_mouseClick = FALSE;\n", defname); appendEden(edenStr, st_script); /* sprintf(edenStr, " %s_mouseDown(", defname); appendEden(edenStr, st_script); sprintf(edenStr, "%s_mouse_1[4], ", defname); appendEden(edenStr, st_script); sprintf(edenStr, "%s_mouse_1[5]);\n", defname); appendEden(edenStr, st_script); */ /* proc for MouseDown */ appendEden(" }", st_script); appendEden("}", st_script); } if (w.type == 4) { *autogen_proc_name = 0; strcpy(autogen_proc_name, defname); strcat(autogen_proc_name, "_change"); if (lookup(autogen_proc_name) == 0) { sprintf(edenStr, ";\nproc %s_change {}", defname); appendEden(edenStr, st_script); } sprintf(edenStr, ";\nproc %s_textCHANGE : %s_TEXT_1 {\n", defname, defname); appendEden(edenStr, st_script); sprintf(edenStr, " %s_change();\n}", defname); appendEden(edenStr, st_script); sprintf(edenStr, ";\nproc %s_setText {\n", defname); appendEden(edenStr, st_script); sprintf(edenStr, " auto currText;\n\n", defname); appendEden(edenStr, st_script); sprintf(edenStr, " currText = $1;\n", defname); appendEden(edenStr, st_script); sprintf(edenStr, " tcl(\"$%s_boxName delete 1.0 end\");\n", defname); appendEden(edenStr, st_script); sprintf(edenStr, " if ($1!=@) {\n tcl(\"$%s_boxName insert end \\\"\"//$1//\"\\\"\");", defname); appendEden(edenStr, st_script); sprintf(edenStr, "\n %s_TEXT_1 = currText;\n }\n}", defname); appendEden(edenStr, st_script); sprintf(edenStr, ";\nproc %s_getText {\n", defname); appendEden(edenStr, st_script); sprintf(edenStr, " return %s_TEXT_1;\n", defname); appendEden(edenStr, st_script); appendEden("}", st_script); } break; case FORMDISP: appendEden("[", st_script); translate(t->l.t, INTVAR); appendEden("]", st_script); break; case CONCAT: translate(t->l.t, STRVAR); appendEden(" // ", st_script); translate(t->r.t, STRVAR); break; case STRCAT: appendEden("strcat(", st_script); translate(t->l.t, STRVAR); appendEden(", ", st_script); translate(t->r.t, STRVAR); appendEden(")", st_script); break; case STRLEN: appendEden("((", st_script); translate(t->l.t, STRVAR); appendEden(")#)", st_script); break; case SUBSTR: appendEden("substr(", st_script); translate(t->l.t, STRVAR); appendEden(", ", st_script); translate(t->r.t->l.t, INTVAR); appendEden(", ", st_script); translate(t->r.t->r.t, INTVAR); appendEden(")", st_script); break; case TOSTRING: appendEden("str(", st_script); translate(t->l.t, INTVAR); appendEden(")", st_script); break; case BOXSHIFT: appendEden("boxshift(", st_script); translate(t->l.t, BOXVAR); appendEden(", ", st_script); translate(t->r.t->l.t, INTVAR); appendEden(", ", st_script); translate(t->r.t->r.t, INTVAR); appendEden(")", st_script); break; case BOXINTERSECT: appendEden("boxop(", st_script); translate(t->l.t, BOXVAR); appendEden(", ", st_script); translate(t->r.t, BOXVAR); appendEden(", BOXINTERSECT)", st_script); break; case BOXCENTRE: appendEden("boxop(", st_script); translate(t->l.t, BOXVAR); appendEden(", ", st_script); translate(t->r.t, BOXVAR); appendEden(", BOXCENTRE)", st_script); break; case BOXENCLOSING: appendEden("boxop(", st_script); translate(t->l.t, BOXVAR); appendEden(", ", st_script); translate(t->r.t, BOXVAR); appendEden(", BOXENCLOSING)", st_script); break; case BOXREDUCE: appendEden("boxop(", st_script); translate(t->l.t, BOXVAR); appendEden(", ", st_script); translate(t->r.t, BOXVAR); appendEden(", BOXREDUCE)", st_script); break; case DOTNE: out(dotne, BOXVAR); break; case DOTNW: out(dotnw, BOXVAR); break; case DOTSE: out(dotse, BOXVAR); break; case DOTSW: out(dotsw, BOXVAR); break; case DOTN: out(dotn, BOXVAR); break; case DOTE: out(dote, BOXVAR); break; case DOTS: out(dots, BOXVAR); break; case DOTW: out(dotw, BOXVAR); break; case '.': appendEden("dotint(", st_script); translate(t->l.t, PTVAR); appendEden(", ", st_script); translate(t->r.t, INTVAR); appendEden(")", st_script); break; case DOTTYPE: dot(1); break; case DOTFRAME: dot(2); break; case DOTSTR: dot(3); break; case DOTBOX: dot(4); break; case DOTPICT: dot(5); break; case DOTXMIN: dot(6); break; case DOTYMIN: dot(7); break; case DOTXMAX: dot(8); break; case DOTYMAX: dot(9); break; case DOTBG: dot(10); break; case DOTFG: dot(11); break; case DOTBDCOLOR: dot(15); break; case DOTBORDER: dot(12); break; case DOTALIGN: dot(13); break; case DOTSENSITIVE: dot(14); break; case DOTFONT: dot(16); break; case DOTBDTYPE: dot(17); break; case IMGFUNC: if (stage == 1) { /* replace the function with a variable */ appendTreeList(t); sprintf(tempname, "I_%s_temp%d", defname, TopTreeList); appendEden(tempname, st_script); break; } /* stage 2 - actually translate the image function */ stage = 1; /* suppress expanding image sub-expressions */ appendEden(t->l.s, st_script); appendEden("(\"", st_script); appendEden(tempname, st_script); appendEden("\"", st_script); for (arg = t->r.t; arg->op != 0; arg = arg->r.t) { appendEden(", ", st_script); translate(arg->l.t, arg->op); } appendEden(")", st_script); break; case APPEND: appendEden("app(", st_script); translate(t->l.t, type); appendEden(", ", st_script); translate(t->r.t->l.t, INTVAR); appendEden(", ", st_script); translate(t->r.t->r.t, type == DISPVAR ? WINVAR : BOXVAR); appendEden(")", st_script); break; case DELETE: appendEden("del(", st_script); translate(t->l.t, type); appendEden(", ", st_script); translate(t->r.t, INTVAR); appendEden(")", st_script); break; case '&': /* new function for appending a window to a screen --sun */ /* appendEden("list_append(", st_script); */ /* using list_append easily causes the problem of heap overflow. -- sun */ translate(t->l.t, type); /* appendEden(", ", st_script); */ appendEden(" // ", st_script); translate(t->r.t, type); /* appendEden(")", st_script); */ break; case '(': appendEden("(", st_script); translate(t->l.t, INTVAR); appendEden(")", st_script); break; case '>': case ',': translate(t->l.t, type); appendEden(", ", st_script); translate(t->r.t, type); break; case UMINUS: appendEden("-", st_script); translate(t->l.t, INTVAR); break; case '+': if (type == INTVAR) { translate(t->l.t, type); appendEden(" + ", st_script); translate(t->r.t, type); } else { appendEden("pt_add(", st_script); translate(t->l.t, PTVAR); appendEden(", ", st_script); translate(t->r.t, PTVAR); appendEden(")", st_script); } break; case '-': if (type == INTVAR) { translate(t->l.t, type); appendEden(" - ", st_script); translate(t->r.t, type); } else { appendEden("pt_subtract(", st_script); translate(t->l.t, PTVAR); appendEden(", ", st_script); translate(t->r.t, PTVAR); appendEden(")", st_script); } break; case '*': translate(t->l.t, INTVAR); appendEden(" * ", st_script); translate(t->r.t, INTVAR); break; case '/': appendEden("float(", st_script); translate(t->l.t, INTVAR); appendEden(") / ", st_script); translate(t->r.t, INTVAR); break; case '%': translate(t->l.t, INTVAR); appendEden(" % ", st_script); translate(t->r.t, INTVAR); break; case EQ: translate(t->l.t, INTVAR); appendEden(" == ", st_script); translate(t->r.t, INTVAR); break; case NE: translate(t->l.t, INTVAR); appendEden(" != ", st_script); translate(t->r.t, INTVAR); break; case LT: translate(t->l.t, INTVAR); appendEden(" < ", st_script); translate(t->r.t, INTVAR); break; case LE: translate(t->l.t, INTVAR); appendEden(" <= ", st_script); translate(t->r.t, INTVAR); break; case GT: translate(t->l.t, INTVAR); appendEden(" > ", st_script); translate(t->r.t, INTVAR); break; case GE: translate(t->l.t, INTVAR); appendEden(" >= ", st_script); translate(t->r.t, INTVAR); break; case OR: translate(t->l.t, INTVAR); appendEden(" || ", st_script); translate(t->r.t, INTVAR); break; case AND: translate(t->l.t, INTVAR); appendEden(" && ", st_script); translate(t->r.t, INTVAR); break; case IF: appendEden("(int(", st_script); translate(t->l.t, INTVAR); appendEden(") ? ", st_script); translate(t->r.t->l.t, t->r.t->op); appendEden(" : ", st_script); translate(t->r.t->r.t, t->r.t->op); appendEden(")", st_script); break; default: scout_err("unknown operator"); break; } } /* t is assumed to be the parse tree of a definition define - translate the parse tree into EDEN definition */ void define(tree * t) { int start, top, i; extern int useOldTree; /* for the &= operator, we need to check whether a display tree already exists that we need to append to [Ash, with Patrick] */ #ifdef DISTRIB extern int handle_check1(char *); extern void propagateScoutDef(tree *); #endif /* DISTRIB */ if (t->l.v->def && !useOldTree) freetree(t->l.v->def); stage = 1; /* to control the translation process translate image function as a temporary variable */ #ifdef DISTRIB if (!handle_check1(t->l.v->name)) /* not be allowed to change --sun */ return; if (!scoutDefAgencyCheck(t->r.t, t->l.v->type)) /* some variables are not allowed to be observed --sun */ return; #endif /* DISTRIB */ t->l.v->def = t->r.t; translate(t, t->l.v->type); appendEden(";\n", st_script); top = 0; do { start = top + 1; top = TopTreeList; for (i = TopTreeList; i >= start; --i) { sprintf(tempname, "I_%s_temp%d", t->l.v->name, i); stage = 2; /* to control the translation process; truly transate the image functions; stage may reset to 1 if the expr contains image subexpressions */ appendEden(tempname, st_script); appendEden(" is ", st_script); translate(TreeList[i - 1], IMGVAR); appendEden(";\n", st_script); } } while (top != TopTreeList); /* if there are image subexpr */ clearTreeList(); #ifdef DISTRIB propagateScoutDef(t); /* propagate Scout Definition to others --sun */ #endif /* DISTRIB */ free(t); useOldTree = 0; } /* listsym - if s is 0 then list all variables in symbol table else s is a variable name which is going to be listed out */ void listsym(char *s) { int i; symbol *p; if (s == 0) for (i = 0; i < 26; i++) for (p = table[i]; p != 0; p = p->next) printsym(p, stderr); else printsym(lookUp(s), stderr); } int dumpscout(ClientData clientData, Tcl_Interp * interp, int argc, char *argv[]) { extern char *hptr; char *saveHeapPtr; int i, count; symbol *sp; symbol **p, **pptr; count = 0; for (i = 0; i < 26; i++) for (sp = table[i]; sp != 0; sp = sp->next) count++; saveHeapPtr = hptr; p = (symbol **) getheap(count * sizeof(symbol *)); pptr = p; for (i = 0; i < 26; i++) for (sp = table[i]; sp != 0; sp = sp->next) *pptr++ = sp; qsort(p, count, sizeof(symbol *), symbolcmp); Tcl_EvalEC(interp, "cleanup scout"); for (i = 0; i < count; i++) { storeSym(p[i]); } hptr = saveHeapPtr; Tcl_EvalEC(interp, ".scout.t.text mark set insert 1.0"); Tcl_EvalEC(interp, ".scout.t.text see insert"); return TCL_OK; } static int symbolcmp(symbol ** s1, symbol ** s2) { return strcmp((*s1)->name, (*s2)->name); } #ifdef DISTRIB /*--------------------------------------------------------------------------*/ /* for agency --sun */ static int ScoutDefOracle; static void checkScoutDefOracle(tree * t, int type) { extern int oracle_check1(char *); WinStruct w; char *s; tree *arg; if (!t) { return; } switch (t->op) { case '=': checkScoutDefOracle(t->r.t, type); break; case NUMBER: break; case ROW: case COLUMN: checkScoutDefOracle(t->l.t, INTVAR); break; case STR: break; case UNKNOWN: scout_err("unknown operator"); break; case STRVAR: case INTVAR: case PTVAR: case BOXVAR: case FRAMEVAR: case WINVAR: case DISPVAR: case IMGVAR: if (!oracle_check1(t->l.v->name)) ScoutDefOracle = 0; break; case FORMPT: checkScoutDefOracle(t->l.t, INTVAR); checkScoutDefOracle(t->r.t, INTVAR); break; case FORMBOX: checkScoutDefOracle(t->l.t, PTVAR); checkScoutDefOracle(t->r.t, PTVAR); break; case TEXTBOX: checkScoutDefOracle(t->l.t, PTVAR); checkScoutDefOracle(t->r.t->l.t, INTVAR); checkScoutDefOracle(t->r.t->r.t, INTVAR); break; case FORMFRAME: checkScoutDefOracle(t->l.t, BOXVAR); break; case FORMWIN: w = t->l.w; if (w.frame) checkScoutDefOracle(w.frame, FRAMEVAR); if (w.string) checkScoutDefOracle(w.string, STRVAR) ; if (w.box) checkScoutDefOracle(w.box, BOXVAR); if (w.pict) checkScoutDefOracle(w.pict, STRVAR); if (w.xmin) checkScoutDefOracle(w.xmin, INTVAR); if (w.ymin) checkScoutDefOracle(w.ymin, INTVAR); if (w.xmax) checkScoutDefOracle(w.xmax, INTVAR); if (w.ymax) checkScoutDefOracle(w.ymax, INTVAR); if (w.bgcolor) checkScoutDefOracle(w.bgcolor, STRVAR); if (w.fgcolor) checkScoutDefOracle(w.fgcolor, STRVAR); if (w.border) checkScoutDefOracle(w.border, INTVAR); if (w.bdcolor) checkScoutDefOracle(w.bdcolor, STRVAR); if (w.font) checkScoutDefOracle(w.font, STRVAR); if (w.bdtype) checkScoutDefOracle(w.bdtype, STRVAR); break; case FORMDISP: checkScoutDefOracle(t->l.t, INTVAR); break; case CONCAT: case STRCAT: checkScoutDefOracle(t->l.t, STRVAR); checkScoutDefOracle(t->r.t, STRVAR); break; case STRLEN: checkScoutDefOracle(t->l.t, STRVAR); break; case SUBSTR: checkScoutDefOracle(t->l.t, STRVAR); checkScoutDefOracle(t->r.t->l.t, INTVAR); checkScoutDefOracle(t->r.t->r.t, INTVAR); break; case TOSTRING: checkScoutDefOracle(t->l.t, INTVAR); break; case BOXSHIFT: checkScoutDefOracle(t->l.t, BOXVAR); checkScoutDefOracle(t->r.t->l.t, INTVAR); checkScoutDefOracle(t->r.t->r.t, INTVAR); break; case BOXINTERSECT: case BOXCENTRE: case BOXENCLOSING: case BOXREDUCE: checkScoutDefOracle(t->l.t, BOXVAR); checkScoutDefOracle(t->r.t, BOXVAR); break; case DOTNE: case DOTNW: case DOTSE: case DOTSW: case DOTN: case DOTE: case DOTS: case DOTW: checkScoutDefOracle(t->l.t, BOXVAR); break; case '.': checkScoutDefOracle(t->l.t, PTVAR); checkScoutDefOracle(t->r.t, INTVAR); break; case DOTTYPE: case DOTFRAME: case DOTSTR: case DOTBOX: case DOTPICT: case DOTXMIN: case DOTYMIN: case DOTXMAX: case DOTYMAX: case DOTBG: case DOTFG: case DOTBDCOLOR: case DOTBORDER: case DOTALIGN: case DOTSENSITIVE: case DOTFONT: case DOTBDTYPE: checkScoutDefOracle(t->l.t, WINVAR); break; case IMGFUNC: for (arg = t->r.t; arg->op != 0; arg = arg->r.t) { checkScoutDefOracle(arg->l.t, arg->op); } break; case APPEND: checkScoutDefOracle(t->l.t, type); checkScoutDefOracle(t->r.t->l.t, INTVAR); checkScoutDefOracle(t->r.t->r.t, type == DISPVAR ? WINVAR : BOXVAR); break; case DELETE: checkScoutDefOracle(t->l.t, type); checkScoutDefOracle(t->r.t, INTVAR); break; case '&': checkScoutDefOracle(t->l.t, type); checkScoutDefOracle(t->r.t, type); break; case '(': checkScoutDefOracle(t->l.t, INTVAR); break; case '>': case ',': checkScoutDefOracle(t->l.t, type); checkScoutDefOracle(t->r.t, type); break; case UMINUS: checkScoutDefOracle(t->l.t, INTVAR); break; case '+': case '-': if (type == INTVAR) { checkScoutDefOracle(t->l.t, type); checkScoutDefOracle(t->r.t, type); } else { checkScoutDefOracle(t->l.t, PTVAR); checkScoutDefOracle(t->r.t, PTVAR); } break; case '*': case '/': case '%': case EQ: case NE: case LT: case LE: case GT: case GE: case OR: case AND: checkScoutDefOracle(t->l.t, INTVAR); checkScoutDefOracle(t->r.t, INTVAR); break; case IF: checkScoutDefOracle(t->l.t, INTVAR); checkScoutDefOracle(t->r.t->l.t, t->r.t->op); checkScoutDefOracle(t->r.t->r.t, t->r.t->op); break; default: scout_err("unknown operator"); break; } } static int scoutDefAgencyCheck(tree * def, int type) { ScoutDefOracle = 1; checkScoutDefOracle(def, type); return ScoutDefOracle; } void propagateScoutScr(char *name, char *s) { extern void appendEden(char *, Script *); appendEden("propagate(\"", st_script); appendEden(name, st_script); appendEden("\", \"", st_script); appendEden(s, st_script); appendEden("\");\n", st_script); } #endif /* DISTRIB */ t_script); } break; case '-': if (type == INTVAR) { translate(t->l.t, type); appendEden(" - ", st_script); translate(t->r.t, type); } else { appendEden("pt_subtract(", st_script); translate(t->l.t, PTVAtkeden1.32/Scout/symbol.h010060000025250000147000000005010727406551600166040ustar00ashleydcsother00001250000011/* * $Id: symbol.h,v 1.4 1999/11/16 21:20:40 ashley Rel1.10 $ */ struct symbol { char *name; int type; struct tree *def; struct symbol *next; }; typedef struct symbol symbol; extern symbol *lookUp(char *); extern int declare(int, struct tree *); extern void define(struct tree *); extern void listsym(char *); tkeden1.32/Scout/tree.c010060000025250000147000000074530733031740000162270ustar00ashleydcsother00001250000011/* * $Id: tree.c,v 1.8 2001/07/27 17:03:59 cssbz Exp $ */ static char rcsid[] = "$Id: tree.c,v 1.8 2001/07/27 17:03:59 cssbz Exp $"; #include #include #include #include "../config.h" #include "tree.h" #include "symbol.h" #include "parser.h" #include "../Eden/emalloc.h" #ifdef HAVE_DMALLOC #include #endif /* function prototypes */ tree *int_tree(double); tree *str_tree(char *); tree *win_tree(WinStruct); tree *sym_tree(symbol *, int); tree *def_tree(symbol *, tree *); tree *tree2(tree *, int); tree *tree3(tree *, int, tree *); void freetree(tree *); /* treealloc - allocate memory of a new tree node */ #define treealloc() (tree *)emalloc(sizeof(tree)) /* int_tree - build a tree denoting an integer */ tree * int_tree(double i) { tree *t; /* [Ash] According to the Scout documentation, Scout uses only integers, and provides only integer arithmetic. Previously Scout stored integers as a double type and passed them to Eden as floating point numbers. I've changed this, but I'm leaving this assertion here to check my assumption that only integers are dealt with in Scout. */ /* Commented out after discovering that Scout actually has a real datatype, which is treated internally as "integer" (hurrumph) */ /* assert(i == (int)i); */ t = treealloc(); t->op = NUMBER; t->l.i = i; return t; } /* inthonest_tree - build a tree denoting an integer, which is actually an integer, honestly, not a double like 'integer' [Ash] */ tree * inthonest_tree(int i) { tree *t; t = treealloc(); t->op = NUMBER; t->l.i = (double)i; return t; } /* str_tree - build a tree denoting a string */ tree * str_tree(char *s) { tree *t; t = treealloc(); t->op = STR; t->l.s = s; return t; } /* win_tree - build a tree denoting a string */ tree * win_tree(WinStruct w) { tree *t; t = treealloc(); t->op = FORMWIN; t->l.w = w; return t; } /* sym_tree - build a tree denoting a variable */ tree * sym_tree(symbol * sym, int type) { tree *t; t = treealloc(); t->op = type; t->l.v = sym; return t; } /* def_tree - build a parse tree of a definition */ tree * def_tree(symbol * v, tree * def) { tree *t; t = treealloc(); t->op = '='; t->l.v = v; t->r.t = def; return t; } /* tree2 - build a tree with only the left subtree and the opcode fields defined */ tree * tree2(tree * t1, int opcode) { tree *t; t = treealloc(); t->op = opcode; t->l.t = t1; t->r.t = 0; return t; } /* tree3 - build a tree with all 3 fields defined */ tree * tree3(tree * t1, int opcode, tree * t2) { tree *t; t = treealloc(); t->op = opcode; t->l.t = t1; t->r.t = t2; return t; } /* freetree - free the memory occupied by the tree t */ void freetree(tree * t) { if (t == 0) return; switch (t->op) { case NUMBER: case ROW: case COLUMN: case UNKNOWN: case INTVAR: case STRVAR: case PTVAR: case BOXVAR: case FRAMEVAR: case WINVAR: case DISPVAR: free(t); break; case STR: free(t->l.s); free(t); break; case '=': freetree(t->r.t); free(t); break; case FORMWIN: freetree(t->l.w.frame); freetree(t->l.w.string); freetree(t->l.w.box); freetree(t->l.w.pict); freetree(t->l.w.xmin); freetree(t->l.w.ymin); freetree(t->l.w.xmax); freetree(t->l.w.ymax); freetree(t->l.w.font); freetree(t->l.w.bgcolor); freetree(t->l.w.fgcolor); freetree(t->l.w.bdcolor); freetree(t->l.w.bdtype); free(t); break; default: freetree(t->l.t); freetree(t->r.t); free(t); break; } } tkeden1.32/Scout/tree.h010060000025250000147000000045340733031744200162370ustar00ashleydcsother00001250000011/* * $Id: tree.h,v 1.5 2001/07/27 17:04:34 cssbz Exp $ */ /** * * * int_tree(int i) - build a tree which denotes an integer * * * * str_tree(char *s) - build a tree which denotes a string constant * * * * def_tree(symbol *s, tree *def) - build a parse tree of definition * * variable s is defined to be `def' * * * * sym_tree(symbol* sym, int type) - build a tree which denotes a * * variable of type `type' * * * * tree2(tree *l, int opcode) - build a tree with only its left son * * (= `l') and opcode(= `opcode') are defined * * * * tree3(tree *l, int opcode, tree*r) - build a tree with left son * * = `l', opcode = `opcode' and right son = `r' * * * * freetree(tree *t) - free the tree `t' * * * **/ typedef struct { int type; struct tree *frame; struct tree *string; struct tree *box; struct tree *pict; struct tree *xmin; struct tree *ymin; struct tree *xmax; struct tree *ymax; struct tree *font; struct tree *bgcolor; struct tree *fgcolor; struct tree *bdcolor; struct tree *border; struct tree *bdtype; int align; // int sensitive; struct tree *sensitive; } WinStruct; typedef struct { int change; union { int type; struct tree *frame; struct tree *string; struct tree *box; struct tree *pict; struct tree *xmin; struct tree *ymin; struct tree *xmax; struct tree *ymax; struct tree *font; struct tree *bgcolor; struct tree *fgcolor; struct tree *bdcolor; struct tree *border; struct tree *bdtype; int align; // int sensitive; struct tree *sensitive; } f; /* window attributes */ } WinField; struct tree { int op; union { char *s; char c; double i; struct symbol *v; struct tree *t; WinStruct w; } l, r; }; typedef struct tree tree; extern tree *int_tree(); extern tree *inthonest_tree(); extern tree *str_tree(); extern tree *win_tree(); extern tree *def_tree(); extern tree *sym_tree(); extern tree *tree2(); extern tree *tree3(); extern void freetree(); tkeden1.32/Scout/CVS/004070000025250000147000000000000736260534600155655ustar00ashleydcsother00001250000011tkeden1.32/Scout/CVS/Entries010060000025250000147000000005620736260534600171230ustar00ashleydcsother00001250000011/Makefile.in/1.13/Fri Jul 27 16:22:10 2001// /symbol.h/1.4/Wed May 2 20:17:18 2001// /print.c/1.8/Fri Jul 27 16:58:33 2001// /store.c/1.11/Fri Jul 27 17:00:29 2001// /tree.c/1.8/Fri Jul 27 17:03:59 2001// /tree.h/1.5/Fri Jul 27 17:04:34 2001// /parser.y/1.16/Thu Aug 2 16:26:11 2001// /symbol.c/1.14/Thu Aug 2 16:26:11 2001// /lex.c/1.16/Mon Oct 15 16:12:21 2001// D tkeden1.32/Scout/CVS/Repository010060000025250000147000000000150727406552200176600ustar00ashleydcsother00001250000011tkeden/Scout tkeden1.32/Scout/CVS/Root010060000025250000147000000000550733030416000164130ustar00ashleydcsother00001250000011cssbz@cvs.eden.sourceforge.net:/cvsroot/eden tkeden1.32/Sasami/004070000025250000147000000000000737051041400152405ustar00ashleydcsother00001250000011tkeden1.32/Sasami/debug.h010060000025250000147000000011350731570416000165000ustar00ashleydcsother00001250000011// -------------------------------------------------------------------------- // debug.h - This exists only to define various debugging parameters // -------------------------------------------------------------------------- // #define SASAMI_DEBUG below to output debug info via printf() // Don't forget to do a MAKE CLEAN after this to ensure changes take // effect. //#define SASAMI_DEBUG // #define SASAMI_SHOW_LIGHTS to enable (slightly buggy) rendering of light // sources as points #define SASAMI_SHOW_LIGHTS // #define SASAMI_ANIME to enable the experimental renderer //#define SASAMI_ANIME tkeden1.32/Sasami/functions.c010060000025250000147000000335120731367033400174240ustar00ashleydcsother00001250000011// -------------------------------------------------------------------------- // functions.c - Sasami functions called from within EDEN // They are called by stub functions in eden/builtin.c, which // are bound to the appropriate EDEN functions in // eden/builtin.h // -------------------------------------------------------------------------- #include "../config.h" #ifdef WANT_SASAMI #include #include #include "structures.h" #include "debug.h" #include "render.h" // -------------------------------------------------------------------------- // Called whenever a vertex co-ordinate is updated // n contains the vertex number, and x,y & z are the new co-ordinates // -------------------------------------------------------------------------- void sasami_vertex(int n,double x,double y,double z) { vertexinfo *v; v=sa_findvertex(n); if (v==NULL) { // Vertex not found so it must be a new one... #ifdef SASAMI_DEBUG printf("Vertex %d created at %g,%g,%g\n",n,x,y,z); #endif v=sa_addvertex(n,x,y,z); } else { // Existing vertex - just move it #ifdef SASAMI_DEBUG printf("Vertex %d moved to %g,%g,%g\n",n,x,y,z); #endif v->pos.x=x; v->pos.y=y; v->pos.z=z; } sa_r_update(); // Tell the renderer we've changed something } // -------------------------------------------------------------------------- // Called whenever the background colour is updated // -------------------------------------------------------------------------- void sasami_set_bgcolour(double r,double g,double b) { extern colourinfo sa_r_bgcolour; #ifdef SASAMI_DEBUG printf("Background colour set to %g,%g,%g\n",r,g,b); #endif // Update the colour sa_r_bgcolour.r=r; sa_r_bgcolour.g=g; sa_r_bgcolour.b=b; sa_r_bgcolour.a=1; // Alpha is always 1 - it makes no sense to have a transparent background! // Tell the renderer sa_r_update(); } // -------------------------------------------------------------------------- // Called whenever polygon

's geometry vertex is changed to // -------------------------------------------------------------------------- void sasami_poly_geom_vertex(int p,int v,int id) { polyinfo *poly; uidlist *geometry; // First find/create polygon

poly=sa_getpoly(p); // Then find/create entry in its UID list geometry=sa_getuidlist(&(poly->geometry),v); // ...and then set it geometry->uid=id; // Redraw the display sa_r_update(); } // -------------------------------------------------------------------------- // Called whenever polygon

's texture vertex is changed to // -------------------------------------------------------------------------- void sasami_poly_tex_vertex(int p,int v,int id) { polyinfo *poly; uidlist *geometry; // First find/create polygon

poly=sa_getpoly(p); // Then find/create entry in its UID list geometry=sa_getuidlist(&(poly->texcoords),v); // ...and then set it geometry->uid=id; // Redraw the display sa_r_update(); } // -------------------------------------------------------------------------- // Called whenever polygon

's colour is changed to ,,, // -------------------------------------------------------------------------- void sasami_poly_colour(int p,double r,double g,double b,double a) { polyinfo *poly; #ifdef SASAMI_DEBUG printf("Setting polygon %d colour to %g,%g,%g,%g\n",p,r,g,b,a); #endif // Find/create polygon

poly=sa_getpoly(p); // Set the colour poly->colour.r=r; poly->colour.g=g; poly->colour.b=b; poly->colour.a=a; // Redraw the display sa_r_update(); } // -------------------------------------------------------------------------- // Called whenever polygon

's material is changed to // -------------------------------------------------------------------------- void sasami_poly_material(int p,int m) { polyinfo *poly; #ifdef SASAMI_DEBUG printf("Setting polygon %d material to %d\n",p,m); #endif // Find/create polygon

poly=sa_getpoly(p); // Set the material poly->material=m; // Redraw the display sa_r_update(); } // -------------------------------------------------------------------------- // Called whenever object 's polygon

is changed to // -------------------------------------------------------------------------- void sasami_object_poly(int o,int p,int id) { objectinfo *obj; uidlist *poly; // First find/create object obj=sa_getobject(o); // Then find/create entry

in its UID list poly=sa_getuidlist(&(obj->polys),p); // ...and then set it poly->uid=id; // Redraw the display sa_r_update(); } // -------------------------------------------------------------------------- // Called whenever object 's position is changed to ,, // -------------------------------------------------------------------------- void sasami_object_pos(int o,double x,double y,double z) { objectinfo *object; #ifdef SASAMI_DEBUG printf("Setting object %d position to %g,%g,%g\n",o,x,y,z); #endif // Find/create object object=sa_getobject(o); // Set the position object->pos.x=x; object->pos.y=y; object->pos.z=z; // Redraw the display sa_r_update(); } // -------------------------------------------------------------------------- // Called whenever object 's rotation is changed to ,, // -------------------------------------------------------------------------- void sasami_object_rot(int o,double x,double y,double z) { objectinfo *object; #ifdef SASAMI_DEBUG printf("Setting object %d rotation to %g,%g,%g\n",o,x,y,z); #endif // Find/create object object=sa_getobject(o); // Set the position object->rot.x=x; object->rot.y=y; object->rot.z=z; // Redraw the display sa_r_update(); } // -------------------------------------------------------------------------- // Called whenever object 's scale is changed to ,, // -------------------------------------------------------------------------- void sasami_object_scale(int o,double x,double y,double z) { objectinfo *object; #ifdef SASAMI_DEBUG printf("Setting object %d scale to %g,%g,%g\n",o,x,y,z); #endif // Find/create object object=sa_getobject(o); // Set the scale object->scale.x=x; object->scale.y=y; object->scale.z=z; // Redraw the display sa_r_update(); } // -------------------------------------------------------------------------- // Called whenever object 's visible status is changed to // -------------------------------------------------------------------------- void sasami_object_visible(int o,int v) { objectinfo *object; #ifdef SASAMI_DEBUG printf("Setting object %d visible flag to %d\n",o,v); #endif // Find/create object object=sa_getobject(o); // Set the flag object->visible=v; // Redraw the display sa_r_update(); } // -------------------------------------------------------------------------- // Called whenever the viewport size is changed // -------------------------------------------------------------------------- void sasami_viewport(int x,int y) { #ifdef SASAMI_DEBUG printf("Setting viewport size to %dx%d\n",x,y); #endif sa_r_resizeviewport(x,y); } // -------------------------------------------------------------------------- // Called whenever the "show axes" state is changed // -------------------------------------------------------------------------- void sasami_setshowaxes(int n) { #ifdef SASAMI_DEBUG printf("Setting axes display to %d\n",n); #endif sa_r_setshowaxes(n); } // -------------------------------------------------------------------------- // Called whenever material 's ambient is changed to ,,, // -------------------------------------------------------------------------- void sasami_material_ambient(int m,double r,double g,double b,double a) { materialinfo *material; #ifdef SASAMI_DEBUG printf("Setting material %d ambient to %g,%g,%g,%g\n",m,r,g,b,a); #endif // Find/create material material=sa_getmaterial(m); // Set the colour material->ambient.r=r; material->ambient.g=g; material->ambient.b=b; material->ambient.a=a; // Redraw the display sa_r_update(); } // -------------------------------------------------------------------------- // Called whenever material 's diffuse is changed to ,,, // -------------------------------------------------------------------------- void sasami_material_diffuse(int m,double r,double g,double b,double a) { materialinfo *material; #ifdef SASAMI_DEBUG printf("Setting material %d diffuse to %g,%g,%g,%g\n",m,r,g,b,a); #endif // Find/create material material=sa_getmaterial(m); // Set the colour material->diffuse.r=r; material->diffuse.g=g; material->diffuse.b=b; material->diffuse.a=a; // Redraw the display sa_r_update(); } // -------------------------------------------------------------------------- // Called whenever material 's specular is changed to ,,, // -------------------------------------------------------------------------- void sasami_material_specular(int m,double r,double g,double b,double a) { materialinfo *material; #ifdef SASAMI_DEBUG printf("Setting material %d specular to %g,%g,%g,%g\n",m,r,g,b,a); #endif // Find/create material material=sa_getmaterial(m); // Set the colour material->specular.r=r; material->specular.g=g; material->specular.b=b; material->specular.a=a; // Redraw the display sa_r_update(); } // -------------------------------------------------------------------------- // Called whenever material 's texture is changed to // -------------------------------------------------------------------------- void sasami_material_texture(int m,char *t) { materialinfo *material; #ifdef SASAMI_DEBUG printf("Setting material %d texture to \"%s\"\n",m,t); #endif // Find/create material material=sa_getmaterial(m); // Set the texture material->texturefile=realloc(material->texturefile,strlen(t)+1); strcpy(material->texturefile,t); // Set the texture binding to 0 and tell the renderer to load it // (we can't load texture now as OpenGL may not be initialised!) material->texture=0; material->textureneedsloading=1; // Redraw the display sa_r_update(); } // -------------------------------------------------------------------------- // Called whenever light 's position is changed to ,, // -------------------------------------------------------------------------- void sasami_light_pos(int o,double x,double y,double z) { lightinfo *light; #ifdef SASAMI_DEBUG printf("Setting light %d position to %g,%g,%g\n",o,x,y,z); #endif // Find/create light light=sa_getlight(o); // Set the position light->pos.x=x; light->pos.y=y; light->pos.z=z; // Redraw the display sa_r_update(); } // -------------------------------------------------------------------------- // Called whenever light 's ambient is changed to ,,, // -------------------------------------------------------------------------- void sasami_light_ambient(int m,double r,double g,double b,double a) { lightinfo *light; #ifdef SASAMI_DEBUG printf("Setting light %d ambient to %g,%g,%g,%g\n",m,r,g,b,a); #endif // Find/create light light=sa_getlight(m); // Set the colour light->ambient.r=r; light->ambient.g=g; light->ambient.b=b; light->ambient.a=a; // Redraw the display sa_r_update(); } // -------------------------------------------------------------------------- // Called whenever light 's diffuse is changed to ,,, // -------------------------------------------------------------------------- void sasami_light_diffuse(int m,double r,double g,double b,double a) { lightinfo *light; #ifdef SASAMI_DEBUG printf("Setting light %d diffuse to %g,%g,%g,%g\n",m,r,g,b,a); #endif // Find/create light light=sa_getlight(m); // Set the colour light->diffuse.r=r; light->diffuse.g=g; light->diffuse.b=b; light->diffuse.a=a; // Redraw the display sa_r_update(); } // -------------------------------------------------------------------------- // Called whenever light 's specular is changed to ,,, // -------------------------------------------------------------------------- void sasami_light_specular(int m,double r,double g,double b,double a) { lightinfo *light; #ifdef SASAMI_DEBUG printf("Setting light %d specular to %g,%g,%g,%g\n",m,r,g,b,a); #endif // Find/create light light=sa_getlight(m); // Set the colour light->specular.r=r; light->specular.g=g; light->specular.b=b; light->specular.a=a; // Redraw the display sa_r_update(); } // -------------------------------------------------------------------------- // Called whenever light 's enabled status is changed to // -------------------------------------------------------------------------- void sasami_light_enabled(int m,int e) { lightinfo *light; #ifdef SASAMI_DEBUG printf("Setting light %d enabled flag to %d\n",m,e); #endif // Find/create light light=sa_getlight(m); // Set the flag light->enabled=e; // Redraw the display sa_r_update(); } // -------------------------------------------------------------------------- // Called whenever light 's attenuation is changed to // -------------------------------------------------------------------------- void sasami_light_attenuation(int m,double a) { lightinfo *light; #ifdef SASAMI_DEBUG printf("Setting light %d attenuation to %g\n",m,a); #endif // Find/create light light=sa_getlight(m); // Set the attenuation light->attenuation=a; // Redraw the display sa_r_update(); } // -------------------------------------------------------------------------- // Called whenever light 's directional status is changed to // -------------------------------------------------------------------------- void sasami_light_directional(int m,int d) { lightinfo *light; #ifdef SASAMI_DEBUG printf("Setting light %d directional flag to %d\n",m,d); #endif // Find/create light light=sa_getlight(m); // Set the flag light->directional=d; // Redraw the display sa_r_update(); } #endif /* WANT_SASAMI */ ------------------------------------ void sasami_viewport(int x,int y) { #ifdef SASAMI_DEBUG printf("Setting viewport size to %dx%d\n",x,y); #endif sa_r_resizeviewport(x,y); } /tkeden1.32/Sasami/glpng.c010060000025250000147000000427030735015522600165240ustar00ashleydcsother00001250000011/* * PNG loader library for OpenGL v1.45 (10/07/00) * by Ben Wyatt ben@wyatt100.freeserve.co.uk * Using LibPNG 1.0.2 and ZLib 1.1.3 * * This software is provided 'as-is', without any express or implied warranty. * In no event will the author be held liable for any damages arising from the * use of this software. * * Permission is hereby granted to use, copy, modify, and distribute this * source code, or portions hereof, for any purpose, without fee, subject to * the following restrictions: * * 1. The origin of this source code must not be misrepresented. You must not * claim that you wrote the original software. If you use this software in * a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered versions must be plainly marked as such and must not be * misrepresented as being the original source. * 3. This notice must not be removed or altered from any source distribution. */ /* ADDED BY ASH - START */ #include "../config.h" #ifdef WANT_SASAMI #ifndef __WIN32__ # if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) # define __WIN32__ # define _WIN32 # endif #endif /* ADDED BY ASH - END */ #ifdef _WIN32 /* Stupid Windows needs to include windows.h before gl.h */ #undef FAR #include #endif #include "glpng.h" #include #include #include #include /* Used to decide if GL/gl.h supports the paletted extension */ #ifdef GL_COLOR_INDEX1_EXT #define SUPPORTS_PALETTE_EXT #endif static unsigned char DefaultAlphaCallback(unsigned char red, unsigned char green, unsigned char blue) { return 255; } static unsigned char StencilRed = 0, StencilGreen = 0, StencilBlue = 0; static unsigned char (*AlphaCallback)(unsigned char red, unsigned char green, unsigned char blue) = DefaultAlphaCallback; static int StandardOrientation = 0; #ifdef SUPPORTS_PALETTE_EXT #ifdef _WIN32 static PFNGLCOLORTABLEEXTPROC glColorTableEXT = NULL; #endif #endif static int PalettedTextures = -1; static GLint MaxTextureSize = 0; /* screenGamma = displayGamma/viewingGamma * displayGamma = CRT has gamma of ~2.2 * viewingGamma depends on platform. PC is 1.0, Mac is 1.45, SGI defaults * to 1.7, but this can be checked and changed w/ /usr/sbin/gamma command. * If the environment variable VIEWING_GAMMA is set, adjust gamma per this value. */ #ifdef _MAC static double screenGamma = 2.2 / 1.45; #elif SGI static double screenGamma = 2.2 / 1.7; #else /* PC/default */ static double screenGamma = 2.2 / 1.0; #endif static char gammaExplicit = 0; /*if */ static void checkForGammaEnv() { double viewingGamma; char *gammaEnv = getenv("VIEWING_GAMMA"); if(gammaEnv && !gammaExplicit) { sscanf(gammaEnv, "%lf", &viewingGamma); screenGamma = 2.2/viewingGamma; } } /* Returns a safe texture size to use (ie a power of 2), based on the current texture size "i" */ static int SafeSize(int i) { int p; if (i > MaxTextureSize) return MaxTextureSize; for (p = 0; p < 24; p++) if (i <= (1< 1 && height > 1) { if (filter) for (y = 0; y < height; y += 2) { for (x = 0; x < width; x += 2) { for (c = 0; c < components; c++) { *d++ = (GET(0)+GET(components)+GET(line)+GET(line+components)) / 4; data++; } data += components; } data += line; } else for (y = 0; y < height; y += 2) { for (x = 0; x < width; x += 2) { for (c = 0; c < components; c++) { *d++ = GET(0); data++; } data += components; } data += line; } } else if (width > 1 && height == 1) { if (filter) for (y = 0; y < height; y += 1) { for (x = 0; x < width; x += 2) { for (c = 0; c < components; c++) { *d++ = (GET(0)+GET(components)) / 2; data++; } data += components; } } else for (y = 0; y < height; y += 1) { for (x = 0; x < width; x += 2) { for (c = 0; c < components; c++) { *d++ = GET(0); data++; } data += components; } } } else if (width == 1 && height > 1) { if (filter) for (y = 0; y < height; y += 2) { for (x = 0; x < width; x += 1) { for (c = 0; c < components; c++) { *d++ = (GET(0)+GET(line)) / 2; data++; } } data += line; } else for (y = 0; y < height; y += 2) { for (x = 0; x < width; x += 1) { for (c = 0; c < components; c++) { *d++ = GET(0); data++; } } data += line; } } else { return 0; } return 1; } #undef GET /* Replacement for gluBuild2DMipmaps so GLU isn't needed */ static void Build2DMipmaps(GLint components, GLint width, GLint height, GLenum format, const unsigned char *data, int filter) { int level = 0; unsigned char *d = (unsigned char *) malloc((width/2)*(height/2)*components+4); const unsigned char *last = data; glTexImage2D(GL_TEXTURE_2D, level, components, width, height, 0, format, GL_UNSIGNED_BYTE, data); level++; while (HalfSize(components, width, height, last, d, filter)) { if (width > 1) width /= 2; if (height > 1) height /= 2; glTexImage2D(GL_TEXTURE_2D, level, components, width, height, 0, format, GL_UNSIGNED_BYTE, d); level++; last = d; } free(d); } int APIENTRY pngLoadRaw(const char *filename, pngRawInfo *pinfo) { int result; FILE *fp = fopen(filename, "rb"); if (fp == NULL) return 0; result = pngLoadRawF(fp, pinfo); if (fclose(fp) != 0) { if (result) { free(pinfo->Data); free(pinfo->Palette); } return 0; } return result; } int APIENTRY pngLoadRawF(FILE *fp, pngRawInfo *pinfo) { unsigned char header[8]; png_structp png; png_infop info; png_infop endinfo; png_bytep data; png_bytep *row_p; double fileGamma; png_uint_32 width, height; int depth, color; png_uint_32 i; if (pinfo == NULL) return 0; fread(header, 1, 8, fp); if (!png_check_sig(header, 8)) return 0; png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); info = png_create_info_struct(png); endinfo = png_create_info_struct(png); // DH: added following lines if (setjmp(png->jmpbuf)) { png_destroy_read_struct(&png, &info, &endinfo); return 0; } // ~DH png_init_io(png, fp); png_set_sig_bytes(png, 8); png_read_info(png, info); png_get_IHDR(png, info, &width, &height, &depth, &color, NULL, NULL, NULL); pinfo->Width = width; pinfo->Height = height; pinfo->Depth = depth; /*--GAMMA--*/ checkForGammaEnv(); if (png_get_gAMA(png, info, &fileGamma)) png_set_gamma(png, screenGamma, fileGamma); else png_set_gamma(png, screenGamma, 1.0/2.2); png_read_update_info(png, info); data = (png_bytep) malloc(png_get_rowbytes(png, info)*height); row_p = (png_bytep *) malloc(sizeof(png_bytep)*height); for (i = 0; i < height; i++) { if (StandardOrientation) row_p[height - 1 - i] = &data[png_get_rowbytes(png, info)*i]; else row_p[i] = &data[png_get_rowbytes(png, info)*i]; } png_read_image(png, row_p); free(row_p); if (color == PNG_COLOR_TYPE_PALETTE) { int cols; png_get_PLTE(png, info, (png_colorp *) &pinfo->Palette, &cols); } else { pinfo->Palette = NULL; } if (color&PNG_COLOR_MASK_ALPHA) { if (color&PNG_COLOR_MASK_PALETTE || color == PNG_COLOR_TYPE_GRAY_ALPHA) pinfo->Components = 2; else pinfo->Components = 4; pinfo->Alpha = 8; } else { if (color&PNG_COLOR_MASK_PALETTE || color == PNG_COLOR_TYPE_GRAY) pinfo->Components = 1; else pinfo->Components = 3; pinfo->Alpha = 0; } pinfo->Data = data; png_read_end(png, endinfo); png_destroy_read_struct(&png, &info, &endinfo); return 1; } int APIENTRY pngLoad(const char *filename, int mipmap, int trans, pngInfo *pinfo) { int result; FILE *fp = fopen(filename, "rb"); if (fp == NULL) return 0; result = pngLoadF(fp, mipmap, trans, pinfo); if (fclose(fp) != 0) return 0; return result; } int APIENTRY pngLoadF(FILE *fp, int mipmap, int trans, pngInfo *pinfo) { GLint pack, unpack; unsigned char header[8]; png_structp png; png_infop info; png_infop endinfo; png_bytep data, data2; png_bytep *row_p; double fileGamma; png_uint_32 width, height, rw, rh; int depth, color; png_uint_32 i; fread(header, 1, 8, fp); if (!png_check_sig(header, 8)) return 0; png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); info = png_create_info_struct(png); endinfo = png_create_info_struct(png); // DH: added following lines if (setjmp(png->jmpbuf)) { png_destroy_read_struct(&png, &info, &endinfo); return 0; } // ~DH png_init_io(png, fp); png_set_sig_bytes(png, 8); png_read_info(png, info); png_get_IHDR(png, info, &width, &height, &depth, &color, NULL, NULL, NULL); if (pinfo != NULL) { pinfo->Width = width; pinfo->Height = height; pinfo->Depth = depth; } if (MaxTextureSize == 0) glGetIntegerv(GL_MAX_TEXTURE_SIZE, &MaxTextureSize); #ifdef SUPPORTS_PALETTE_EXT #ifdef _WIN32 if (PalettedTextures == -1) PalettedTextures = ExtSupported("GL_EXT_paletted_texture") && (strstr((const char *) glGetString(GL_VERSION), "1.1.0 3Dfx Beta") == NULL); if (PalettedTextures) { if (glColorTableEXT == NULL) { glColorTableEXT = (PFNGLCOLORTABLEEXTPROC) wglGetProcAddress("glColorTableEXT"); if (glColorTableEXT == NULL) PalettedTextures = 0; } } #endif #endif if (PalettedTextures == -1) PalettedTextures = 0; if (color == PNG_COLOR_TYPE_GRAY || color == PNG_COLOR_TYPE_GRAY_ALPHA) png_set_gray_to_rgb(png); if (color&PNG_COLOR_MASK_ALPHA && trans != PNG_ALPHA) { png_set_strip_alpha(png); color &= ~PNG_COLOR_MASK_ALPHA; } if (!(PalettedTextures && mipmap >= 0 && trans == PNG_SOLID)) if (color == PNG_COLOR_TYPE_PALETTE) png_set_expand(png); /*--GAMMA--*/ checkForGammaEnv(); if (png_get_gAMA(png, info, &fileGamma)) png_set_gamma(png, screenGamma, fileGamma); else png_set_gamma(png, screenGamma, 1.0/2.2); png_read_update_info(png, info); data = (png_bytep) malloc(png_get_rowbytes(png, info)*height); row_p = (png_bytep *) malloc(sizeof(png_bytep)*height); for (i = 0; i < height; i++) { if (StandardOrientation) row_p[height - 1 - i] = &data[png_get_rowbytes(png, info)*i]; else row_p[i] = &data[png_get_rowbytes(png, info)*i]; } png_read_image(png, row_p); free(row_p); rw = SafeSize(width), rh = SafeSize(height); if (rw != width || rh != height) { const int channels = png_get_rowbytes(png, info)/width; data2 = (png_bytep) malloc(rw*rh*channels); /* Doesn't work on certain sizes */ /* if (gluScaleImage(glformat, width, height, GL_UNSIGNED_BYTE, data, rw, rh, GL_UNSIGNED_BYTE, data2) != 0) return 0; */ Resize(channels, data, width, height, data2, rw, rh); width = rw, height = rh; free(data); data = data2; } { /* OpenGL stuff */ glGetIntegerv(GL_PACK_ALIGNMENT, &pack); glGetIntegerv(GL_UNPACK_ALIGNMENT, &unpack); glPixelStorei(GL_PACK_ALIGNMENT, 1); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); #ifdef SUPPORTS_PALETTE_EXT if (PalettedTextures && mipmap >= 0 && trans == PNG_SOLID && color == PNG_COLOR_TYPE_PALETTE) { png_colorp pal; int cols; GLint intf; if (pinfo != NULL) pinfo->Alpha = 0; png_get_PLTE(png, info, &pal, &cols); switch (cols) { case 1<<1: intf = GL_COLOR_INDEX1_EXT; break; case 1<<2: intf = GL_COLOR_INDEX2_EXT; break; case 1<<4: intf = GL_COLOR_INDEX4_EXT; break; case 1<<8: intf = GL_COLOR_INDEX8_EXT; break; case 1<<12: intf = GL_COLOR_INDEX12_EXT; break; case 1<<16: intf = GL_COLOR_INDEX16_EXT; break; default: /*printf("Warning: Colour depth %i not recognised\n", cols);*/ return 0; } glColorTableEXT(GL_TEXTURE_2D, GL_RGB8, cols, GL_RGB, GL_UNSIGNED_BYTE, pal); glTexImage2D(GL_TEXTURE_2D, mipmap, intf, width, height, 0, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, data); } else #endif if (trans == PNG_SOLID || trans == PNG_ALPHA || color == PNG_COLOR_TYPE_RGB_ALPHA || color == PNG_COLOR_TYPE_GRAY_ALPHA) { GLenum glformat; GLint glcomponent; switch (color) { case PNG_COLOR_TYPE_GRAY: case PNG_COLOR_TYPE_RGB: case PNG_COLOR_TYPE_PALETTE: glformat = GL_RGB; glcomponent = 3; if (pinfo != NULL) pinfo->Alpha = 0; break; case PNG_COLOR_TYPE_GRAY_ALPHA: case PNG_COLOR_TYPE_RGB_ALPHA: glformat = GL_RGBA; glcomponent = 4; if (pinfo != NULL) pinfo->Alpha = 8; break; default: /*puts("glformat not set");*/ return 0; } if (mipmap == PNG_BUILDMIPMAPS) Build2DMipmaps(glcomponent, width, height, glformat, data, 1); else if (mipmap == PNG_SIMPLEMIPMAPS) Build2DMipmaps(glcomponent, width, height, glformat, data, 0); else glTexImage2D(GL_TEXTURE_2D, mipmap, glcomponent, width, height, 0, glformat, GL_UNSIGNED_BYTE, data); } else { png_bytep p, endp, q; int r, g, b, a; p = data, endp = p+width*height*3; q = data2 = (png_bytep) malloc(sizeof(png_byte)*width*height*4); if (pinfo != NULL) pinfo->Alpha = 8; #define FORSTART \ do { \ r = *p++; /*red */ \ g = *p++; /*green*/ \ b = *p++; /*blue */ \ *q++ = r; \ *q++ = g; \ *q++ = b; #define FOREND \ q++; \ } while (p != endp); #define ALPHA *q switch (trans) { case PNG_CALLBACK: FORSTART ALPHA = AlphaCallback((unsigned char) r, (unsigned char) g, (unsigned char) b); FOREND break; case PNG_STENCIL: FORSTART if (r == StencilRed && g == StencilGreen && b == StencilBlue) ALPHA = 0; else ALPHA = 255; FOREND break; case PNG_BLEND1: FORSTART a = r+g+b; if (a > 255) ALPHA = 255; else ALPHA = a; FOREND break; case PNG_BLEND2: FORSTART a = r+g+b; if (a > 255*2) ALPHA = 255; else ALPHA = a/2; FOREND break; case PNG_BLEND3: FORSTART ALPHA = (r+g+b)/3; FOREND break; case PNG_BLEND4: FORSTART a = r*r+g*g+b*b; if (a > 255) ALPHA = 255; else ALPHA = a; FOREND break; case PNG_BLEND5: FORSTART a = r*r+g*g+b*b; if (a > 255*2) ALPHA = 255; else ALPHA = a/2; FOREND break; case PNG_BLEND6: FORSTART a = r*r+g*g+b*b; if (a > 255*3) ALPHA = 255; else ALPHA = a/3; FOREND break; case PNG_BLEND7: FORSTART a = r*r+g*g+b*b; if (a > 255*255) ALPHA = 255; else ALPHA = (int) sqrt(a); FOREND break; } #undef FORSTART #undef FOREND #undef ALPHA if (mipmap == PNG_BUILDMIPMAPS) Build2DMipmaps(4, width, height, GL_RGBA, data2, 1); else if (mipmap == PNG_SIMPLEMIPMAPS) Build2DMipmaps(4, width, height, GL_RGBA, data2, 0); else glTexImage2D(GL_TEXTURE_2D, mipmap, 4, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data2); free(data2); } glPixelStorei(GL_PACK_ALIGNMENT, pack); glPixelStorei(GL_UNPACK_ALIGNMENT, unpack); } /* OpenGL end */ png_read_end(png, endinfo); png_destroy_read_struct(&png, &info, &endinfo); free(data); return 1; } static unsigned int SetParams(int wrapst, int magfilter, int minfilter) { unsigned int id; glGenTextures(1, &id); glBindTexture(GL_TEXTURE_2D, id); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapst); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapst); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magfilter); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minfilter); return id; } unsigned int APIENTRY pngBind(const char *filename, int mipmap, int trans, pngInfo *info, int wrapst, int minfilter, int magfilter) { unsigned int id = SetParams(wrapst, magfilter, minfilter); if (id != 0 && pngLoad(filename, mipmap, trans, info)) return id; return 0; } unsigned int APIENTRY pngBindF(FILE *file, int mipmap, int trans, pngInfo *info, int wrapst, int minfilter, int magfilter) { unsigned int id = SetParams(wrapst, magfilter, minfilter); if (id != 0 && pngLoadF(file, mipmap, trans, info)) return id; return 0; } void APIENTRY pngSetStencil(unsigned char red, unsigned char green, unsigned char blue) { StencilRed = red, StencilGreen = green, StencilBlue = blue; } void APIENTRY pngSetAlphaCallback(unsigned char (*callback)(unsigned char red, unsigned char green, unsigned char blue)) { if (callback == NULL) AlphaCallback = DefaultAlphaCallback; else AlphaCallback = callback; } void APIENTRY pngSetViewingGamma(double viewingGamma) { if(viewingGamma > 0) { gammaExplicit = 1; screenGamma = 2.2/viewingGamma; } else { gammaExplicit = 0; screenGamma = 2.2; } } void APIENTRY pngSetStandardOrientation(int standardorientation) { StandardOrientation = standardorientation; } /* ADDED BY ASH - START */ #endif /* WANT_SASAMI */ /* ADDED BY ASH - END */ screenGamma, 1.0/2.2); png_read_update_info(png, info); dtkeden1.32/Sasami/glpng.h010060000025250000147000000077610731420114600165270ustar00ashleydcsother00001250000011/* * PNG loader library for OpenGL v1.45 (10/07/00) * by Ben Wyatt ben@wyatt100.freeserve.co.uk * Using LibPNG 1.0.2 and ZLib 1.1.3 * * This software is provided 'as-is', without any express or implied warranty. * In no event will the author be held liable for any damages arising from the * use of this software. * * Permission is hereby granted to use, copy, modify, and distribute this * source code, or portions hereof, for any purpose, without fee, subject to * the following restrictions: * * 1. The origin of this source code must not be misrepresented. You must not * claim that you wrote the original software. If you use this software in * a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered versions must be plainly marked as such and must not be * misrepresented as being the original source. * 3. This notice must not be removed or altered from any source distribution. */ #ifndef _GLPNG_H_ #define _GLPNG_H_ #include #ifdef __cplusplus extern "C" { #endif #ifdef _MSC_VER #ifdef _DEBUG #pragma comment (lib, "glpngd.lib") #else #pragma comment (lib, "glpng.lib") #endif #endif /* XXX This is from Win32's */ #ifndef APIENTRY #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) #define APIENTRY __stdcall #else #define APIENTRY #endif #endif /* Mipmapping parameters */ #define PNG_NOMIPMAPS 0 /* No mipmapping */ #define PNG_BUILDMIPMAPS -1 /* Calls a clone of gluBuild2DMipmaps() */ #define PNG_SIMPLEMIPMAPS -2 /* Generates mipmaps without filtering */ /* Who needs an "S" anyway? */ #define PNG_NOMIPMAP PNG_NOMIPMAPS #define PNG_BUILDMIPMAP PNG_BUILDMIPMAPS #define PNG_SIMPLEMIPMAP PNG_SIMPLEMIPMAPS /* Transparency parameters */ #define PNG_CALLBACK -3 /* Call the callback function to generate alpha */ #define PNG_ALPHA -2 /* Use alpha channel in PNG file, if there is one */ #define PNG_SOLID -1 /* No transparency */ #define PNG_STENCIL 0 /* Sets alpha to 0 for r=g=b=0, 1 otherwise */ #define PNG_BLEND1 1 /* a = r+g+b */ #define PNG_BLEND2 2 /* a = (r+g+b)/2 */ #define PNG_BLEND3 3 /* a = (r+g+b)/3 */ #define PNG_BLEND4 4 /* a = r*r+g*g+b*b */ #define PNG_BLEND5 5 /* a = (r*r+g*g+b*b)/2 */ #define PNG_BLEND6 6 /* a = (r*r+g*g+b*b)/3 */ #define PNG_BLEND7 7 /* a = (r*r+g*g+b*b)/4 */ #define PNG_BLEND8 8 /* a = sqrt(r*r+g*g+b*b) */ typedef struct { unsigned int Width; unsigned int Height; unsigned int Depth; unsigned int Alpha; } pngInfo; typedef struct { unsigned int Width; unsigned int Height; unsigned int Depth; unsigned int Alpha; unsigned int Components; unsigned char *Data; unsigned char *Palette; } pngRawInfo; extern int APIENTRY pngLoadRaw(const char *filename, pngRawInfo *rawinfo); extern int APIENTRY pngLoadRawF(FILE *file, pngRawInfo *rawinfo); extern int APIENTRY pngLoad(const char *filename, int mipmap, int trans, pngInfo *info); extern int APIENTRY pngLoadF(FILE *file, int mipmap, int trans, pngInfo *info); extern unsigned int APIENTRY pngBind(const char *filename, int mipmap, int trans, pngInfo *info, int wrapst, int minfilter, int magfilter); extern unsigned int APIENTRY pngBindF(FILE *file, int mipmap, int trans, pngInfo *info, int wrapst, int minfilter, int magfilter); extern void APIENTRY pngSetStencil(unsigned char red, unsigned char green, unsigned char blue); extern void APIENTRY pngSetAlphaCallback(unsigned char (*callback)(unsigned char red, unsigned char green, unsigned char blue)); extern void APIENTRY pngSetViewingGamma(double viewingGamma); extern void APIENTRY pngSetStandardOrientation(int standardorientation); #ifdef __cplusplus } #endif #endif tkeden1.32/Sasami/Makefile.in010060000025250000147000000002640733031246200173050ustar00ashleydcsother00001250000011# # $Id: Makefile.in,v 1.4 2001/07/27 16:22:10 cssbz Exp $ # SOURCES = parser.c functions.c utils.c structures.c render.c togl.c glpng.c LIB = libsasami.a include ../generic.mk tkeden1.32/Sasami/parser.c010060000025250000147000001654750736257473600167430ustar00ashleydcsother00001250000011// -------------------------------------------------------------------------- // parser.c - Sasami parser - takes Sasami statements and outputs EDEN code // -------------------------------------------------------------------------- #include "../config.h" #ifdef WANT_SASAMI #include "../EX/script.h" #include #include "utils.h" #include "debug.h" #include "structures.h" #include "../Eden/error.h" #ifdef DEBUG extern int Debug; #define DEBUGPRINT(s,i) if (Debug&8) fprintf(stderr, s, i); #define DEBUGPRINT2(s,i,j) if (Debug&8) fprintf(stderr, s, i, j); #else #define DEBUGPRINT(s,i) #define DEBUGPRINT2(s,i,j) #endif /* DEBUG */ // -------------------------------------------------------------------------- // Define some limits // -------------------------------------------------------------------------- #define SA_MAX_INPUTSTRING 256 // The max length of string to parse // -------------------------------------------------------------------------- // This is the script that Sasami will output with EDEN definations in it // -------------------------------------------------------------------------- Script *sa_script; // -------------------------------------------------------------------------- // Useful variables // -------------------------------------------------------------------------- char sa_inputstring[SA_MAX_INPUTSTRING+1]; bool sa_skipline; bool sa_eden_initialised = false; // Have we set up our global Eden definations yet? list *objmateriallist; // -------------------------------------------------------------------------- // Prototypes // -------------------------------------------------------------------------- void sa_parsestring(char *input); // -------------------------------------------------------------------------- // Error handler // -------------------------------------------------------------------------- void sa_error(char *s) { extern Tcl_Interp *interp; Tcl_DString err, message; deleteScript(sa_script); // Blank input string sa_inputstring[0]=0; errorf("Sasami: %s", s); } // -------------------------------------------------------------------------- // This is set up as an exit function during initialisation (above) // so that we can be sure to clean up before Eden exits // -------------------------------------------------------------------------- void sa_exit_trap(void) { DEBUGPRINT("\n--------------------\nSasami closing down!\n--------------------\n", 0); sa_r_closedisplay(); } // -------------------------------------------------------------------------- // This writes EDEN statements to the script for EDEN to parse // -------------------------------------------------------------------------- void sa_output(char *s) { DEBUGPRINT("Out:%s\n", s); appendEden(s,sa_script); } // -------------------------------------------------------------------------- // Called to initialise Sasami // -------------------------------------------------------------------------- void sa_init_sasami() { DEBUGPRINT("\n--------------------\nSasami initialising!\n--------------------\n", 0); // Initialise some parser variables sa_inputstring[0]=0; sa_skipline=false; // Give the renderer a chance to initialise stuff // NOTE : This is *NOT* where the renderer creates the display window, context // and so on. That happens when open_display is called. sa_r_init(); // Register an exit function so that we can be sure that our closedown code will // be called... atexit(sa_exit_trap); } // -------------------------------------------------------------------------- // This gets sent Sasami input one character at a time from eden/lex.c // -------------------------------------------------------------------------- void sa_input(char c) { char temp[2]; if ( (c != '\n') && (c != '\r') ) { if (!sa_skipline) { // Add character to input string if (strlen(sa_inputstring)==SA_MAX_INPUTSTRING) { sa_error("Input string too long!"); sa_skipline=true; } else { sprintf(temp,"%c",c); // For safety strcat(sa_inputstring,temp); } } else { /* We want to skip this line for some reason, so just trash the character */ } } else { // Finished string if (sa_skipline) { // Don't parse this line, just reset flag sa_skipline=false; } else { // Parse string #ifdef SASAMI_DEBUG // printf("\n%s\n",sa_inputstring); #endif sa_parsestring(sa_inputstring); } // Blank input string sa_inputstring[0]=0; } } // -------------------------------------------------------------------------- // This initialised the various "global" Eden definations for Sasami stuff, // like the viewport size and background colour, and monitor functions to // watch them for changes // -------------------------------------------------------------------------- void sa_eden_init(void) { char o[SA_MAX_INPUTSTRING+1]; extern colourinfo sa_r_bgcolour; extern int sa_r_xsize; extern int sa_r_ysize; extern int sa_r_bpp; extern bool sa_r_showaxes; sa_eden_initialised=true; // Background colour variables - // sasami_bgcolour_r,sasami_bgcolour_g,sasami_bgcolour_b sprintf(o,"sasami_bgcolour_r=%d;\n",sa_r_bgcolour.r); sa_output(o); sprintf(o,"sasami_bgcolour_g=%d;\n",sa_r_bgcolour.g); sa_output(o); sprintf(o,"sasami_bgcolour_b=%d;\n",sa_r_bgcolour.b); sa_output(o); sprintf(o,"proc _sasami_bgcolour_mon : sasami_bgcolour_r,sasami_bgcolour_g,sasami_bgcolour_b { sasami_set_bgcolour(sasami_bgcolour_r,sasami_bgcolour_g,sasami_bgcolour_b); };\n"); sa_output(o); // Viewport dimensions and colour depth - // sasami_viewport_xsize,sasami_viewport_ysize,sasami_viewport_bpp sprintf(o,"sasami_viewport_xsize=%d;\n",sa_r_xsize); sa_output(o); sprintf(o,"sasami_viewport_ysize=%d;\n",sa_r_ysize); sa_output(o); sprintf(o, "sasami_viewport_bpp is int(tcl(\"winfo depth .\"));\n"); sa_output(o); sprintf(o,"proc _sasami_viewport_mon : sasami_viewport_xsize,sasami_viewport_ysize { sasami_viewport(sasami_viewport_xsize,sasami_viewport_ysize); };\n"); sa_output(o); // Axes display if (sa_r_showaxes) { sprintf(o,"sasami_show_axes=1;\n"); } else { sprintf(o,"sasami_show_axes=0;\n"); } sa_output(o); sprintf(o,"proc _sasami_showaxes_mon : sasami_show_axes { sasami_setshowaxes(sasami_show_axes); };\n"); sa_output(o); } // -------------------------------------------------------------------------- // This parses a Lightwave format .MTL file and emits Sasami code to create // it - the Sasami statements are passed to sa_parsestring for parsing. // is prefixed onto all the produced Sasami names to keep them unique // (MTL files contain material definations to go with .OBJ files) // -------------------------------------------------------------------------- void sa_load_mtl(char *name,char *file) { char o[SA_MAX_INPUTSTRING+30]; char cmd[SA_MAX_INPUTSTRING+30]; char sarg[3][SA_MAX_INPUTSTRING+30]; char l[SA_MAX_INPUTSTRING+30]; FILE *objfile; int n,i,id; int darg[6]; bool accepted; char currentmaterial[SA_MAX_INPUTSTRING+30]; list *newmaterial; strcpy(currentmaterial,"none"); objfile=fopen(file,"r"); if (objfile==NULL) { sprintf(o,"Unable to open MTL file '%s'!",file); sa_error(o); } else { while (!feof(objfile)) { // Read a line from the file l[0]='\0'; // To avoid lines with no characters acidentally including // the first character of the next line. n=-1; do { n++; fread(&l[n],sizeof(char),1,objfile); } while ((l[n]!=13) && (l[n]!=10) && (!feof(objfile))); if ((l[n]!=13) && (l[n]!=10)) // Overwrite EOL marker if present n++; l[n]='\0'; // Ensure there's a terminator // Convert # signs to \0 - this makes comments a line terminator, // effectively stripping them. for (i=0;l[i]!='\0';i++) { if (l[i]=='#') l[i]='\0'; } // Convert to lowercase for (i=0;l[i]!='\0';i++) { l[i]=tolower(l[i]); } // Get the first word (the command) n=sscanf(l," %s \n",cmd); /* possible problem with \r's here, but I don't know about .MTL format so I'll leave it [Ash] */ if (n==1) { accepted=false; // --------------------------------------------------------------- // "newmtl" command - Add a material // --------------------------------------------------------------- if (strcmp(cmd,"newmtl")==0) { n=sscanf(l," newmtl %s ",sarg[0]); if (n==1) { // Create the material // This does not use SA_PARSESTRING because we need the material // id immediately (for creating polygon->material links with // nodetail set) id=sa_getUID(); // Create a new ID // Create the material sa_addmaterial(id); // First set the material name to contain the ID for future reference sprintf(o,"%s_mat_%s=%d;\n",name,sarg[0],id); sa_output(o); // Store the material ID with its name newmaterial=sa_addlist(&objmateriallist,sa_getUID()); newmaterial->idata=id; newmaterial->data=(void *)malloc(strlen(sarg[0])+2); strcpy((char *)newmaterial->data,sarg[0]); DEBUGPRINT2("Got material name '%s', assigned id %d\n", sarg[0], id); // Set it as current strcpy(currentmaterial,sarg[0]); } else { sa_error("MTL file error - could not get material name!"); } accepted=true; } // --------------------------------------------------------------- // "map_kd" command - Set texture filename // --------------------------------------------------------------- if (strcmp(cmd,"map_kd")==0) { n=sscanf(l," map_kd %s ",sarg[0]); if (n==1) { // Set the texture sprintf(o,"material_texture %s_mat_%s \"%s\"\n",name,currentmaterial,sarg[0]); sa_parsestring(o); } else { sa_error("MTL file error - could not get texture filename!"); } accepted=true; } // --------------------------------------------------------------- // "kd" command - Set the material diffuse colour // --------------------------------------------------------------- if (strcmp(cmd,"kd")==0) { n=sscanf(l," kd %s %s %s ",sarg[0],sarg[1],sarg[2]); if (n==3) { // Set the colour sprintf(o,"material_diffuse %s_mat_%s %s %s %s\n",name,currentmaterial,sarg[0],sarg[1],sarg[2]); sa_parsestring(o); } else { sa_error("MTL file error - could not get diffuse colour!"); } accepted=true; } // --------------------------------------------------------------- // "ns" command - Unknown (ignore) // --------------------------------------------------------------- if (strcmp(cmd,"ns")==0) { accepted=true; } // --------------------------------------------------------------- // "ks" command - Unknown (ignore) // --------------------------------------------------------------- if (strcmp(cmd,"ks")==0) { accepted=true; } // --------------------------------------------------------------- // "illum" command - Unknown (ignore) // --------------------------------------------------------------- if (strcmp(cmd,"illum")==0) { accepted=true; } // --------------------------------------------------------------- // End of Lightwave MTL command list // --------------------------------------------------------------- if (!accepted) { sprintf(o,"MTL file error - unknown command '%s'",l); sa_error(o); } } } fclose(objfile); } } // -------------------------------------------------------------------------- // This converts a string (in [-]dd.dddd format) into a double value. // I'm using this because atof() doesn't seem to be working(!) - it was // returning "55556" for "-5.5556" (ie ignoring the - and . signs) // -------------------------------------------------------------------------- double strtodouble(char *s) { char *c; double result; bool negative,indecimal; int i,d,decimalcount; int exponent; c=s; result=0; negative=false; indecimal=false; decimalcount=0; exponent=0; while (((*c)!='\0') & (exponent==0)) { if (((*c)=='e') | ((*c)=='E')) { exponent=strtodouble(c+1); } if ((*c)=='-') { negative=true; } if ((*c)=='.') indecimal=true; if (((*c)>='0') && ((*c)<='9')) { d=(int) ((*c)-'0'); result=result*10; result=result+d; if (indecimal) decimalcount++; } c++; } if (negative) { result=-result; } for (i=1;i<=decimalcount;i++) result=result / 10; if (exponent>0) for (i=1;i<=exponent;i++) result=result*10; if (exponent<0) for (i=-1;i>=exponent;i--) result=result/10; return(result); } // -------------------------------------------------------------------------- // This parses a Lightwave format .OBJ file and emits Sasami code to create // it - the Sasami statements are passed to sa_parsestring for parsing. // is prefixed onto all the produced Sasami names to keep them unique // If is true then vertices and polygons are *not* created as Eden // declarations, keeping the calculation overhead down (at the cost of not // allowing model geometry to be dynamically altered) // -------------------------------------------------------------------------- void sa_load_obj(char *name,char *file,bool nodetail) { char o[SA_MAX_INPUTSTRING+30]; char cmd[SA_MAX_INPUTSTRING+30]; char l[SA_MAX_INPUTSTRING+30]; char currentobjectname[SA_MAX_INPUTSTRING+30]; char currentmaterial[SA_MAX_INPUTSTRING+30]; int currentobjectid; int currentmaterialid; objectinfo *currentobject; FILE *objfile; int n,i,id,poly_id; int darg[6]; int vertex_number; int texture_vertex_number; int polygon_number; uidlist *cvertex; int vertexuid; double x,y,z; bool accepted; char *arg[SA_MAX_INPUTSTRING]; int numargs; bool inword; polyinfo *currentpoly; uidlist *vertexlist,*texvertexlist; list *temp; vertex_number=0; texture_vertex_number=0; polygon_number=0; strcpy(currentobjectname,"none"); // Make sure we can cope with OBJ files with no // object names currentobject=NULL; strcpy(currentmaterial,""); // Initialise our lists to blank vertexlist=NULL; texvertexlist=NULL; objmateriallist=NULL; objfile=fopen(file,"r"); if (objfile==NULL) { sprintf(o,"Unable to open obj file '%s'!",file); sa_error(o); } else { while (!feof(objfile)) { // Read a line from the file l[0]='\0'; // To avoid lines with no characters acidentally including // the first character of the next line. n=-1; do { n++; fread(&l[n],sizeof(char),1,objfile); } while ((l[n]!=13) && (l[n]!=10) && (!feof(objfile))); if ((l[n]!=13) && (l[n]!=10)) // Overwrite EOL marker if present n++; l[n]='\0'; // Ensure there's a terminator // Convert # signs to \0 - this makes comments a line terminator, // effectively stripping them. for (i=0;l[i]!='\0';i++) { if (l[i]=='#') l[i]='\0'; } // Convert to lowercase for (i=0;l[i]!='\0';i++) { l[i]=tolower(l[i]); } // Split the string into words numargs=0; inword=false; i=0; if (l[0]!='\0') // Check for null string { do { if ((l[i]==' ') || (l[i]==9) || (l[i]==',')) { // Space character (space, tab or comma) if (inword) { inword=false; l[i]='\0'; // Make into word terminator } } else { // Alphanumeric character if (!inword) { inword=true; numargs++; arg[numargs]=&l[i]; } } i++; } while (l[i]!='\0'); } if (numargs>0) { accepted=false; // Get the first word (the command) strcpy(cmd,arg[1]); // --------------------------------------------------------------- // "mtllib" command - Load a material library // --------------------------------------------------------------- if (strcmp(cmd,"mtllib")==0) { if (numargs==2) { sa_load_mtl(name,arg[2]); } else { sa_error("Obj file error - could not get MTL filename!"); } accepted=true; } // --------------------------------------------------------------- // "usemtl" command - Set current material // --------------------------------------------------------------- if (strcmp(cmd,"usemtl")==0) { if (numargs==2) { strcpy(currentmaterial,arg[2]); temp=objmateriallist; currentmaterialid=0; while (temp!=NULL) { if (strcmp((char *)temp->data,arg[2])==0) { currentmaterialid=temp->idata; } temp=temp->next; } if (currentmaterialid==0) { sa_error("Could not find declaration of material!"); } DEBUGPRINT2("Found material name '%s', retrieved id %d\n", arg[2], currentmaterialid); } else { sa_error("Obj file error - could not get USEMTL material name!"); } accepted=true; } // --------------------------------------------------------------- // "g" command - Start geometry of object // --------------------------------------------------------------- if (strcmp(cmd,"g")==0) { if (numargs==2) { // Create an ID for our new object id=sa_getUID(); // Create the object currentobject=sa_addobject(id); // Set the object name to contain the ID sprintf(o,"%s_%s=%d;\n",name,arg[2],id); sa_output(o); currentobjectid=id; strcpy(currentobjectname,arg[2]); } else { sa_error("Obj file error - could not get object name!"); } accepted=true; } // --------------------------------------------------------------- // "v" command - add a vertex // --------------------------------------------------------------- if (strcmp(cmd,"v")==0) { if (numargs==4) { vertex_number++; if (nodetail) { id=sa_getUID(); x=strtodouble(arg[2]); y=strtodouble(arg[3]); z=strtodouble(arg[4]); sa_addvertex(id,x,y,z); sa_adduidlist(&vertexlist,vertex_number)->uid=id; } else { sprintf(o,"vertex %s_v_%d %s %s %s\n",name,vertex_number,arg[2],arg[3],arg[4]); sa_parsestring(o); } } else { sa_error("Obj file error - could not get vertex co-ordinates!"); } accepted=true; } // --------------------------------------------------------------- // "vn" command - add a vertex normal // --------------------------------------------------------------- if (strcmp(cmd,"vn")==0) { accepted=true; } // --------------------------------------------------------------- // "vt" command - add a texture vertex // --------------------------------------------------------------- if (strcmp(cmd,"vt")==0) { if (numargs==4) { texture_vertex_number++; if (nodetail) { id=sa_getUID(); x=strtodouble(arg[2]); y=1-strtodouble(arg[3]); z=strtodouble(arg[4]); sa_addvertex(id,x,y,z); sa_adduidlist(&texvertexlist,texture_vertex_number)->uid=id; } else { sprintf(o,"vertex %s_vt_%d %s (1-%s) %s\n",name,texture_vertex_number,arg[2],arg[3],arg[4]); sa_parsestring(o); } } else { sa_error("Obj file error - could not get texture vertex co-ordinates!"); } accepted=true; } // --------------------------------------------------------------- // "f" command - add a face // Faces are specified as // // --------------------------------------------------------------- if (strcmp(cmd,"f")==0) { if (numargs>1) { // Create the polygon polygon_number++; if (nodetail) { poly_id=sa_getUID(); currentpoly=sa_addpoly(poly_id); } else { sprintf(o,"polygon %s_p_%d\n",name,polygon_number); sa_parsestring(o); } // Create all the vertices for (i=2;i<=numargs;i++) { // Check if there are texture co-ordinates n=sscanf(arg[i]," %d/%d/%*d ",&darg[0],&darg[1]); if (n!=2) { // Try without them... n=sscanf(arg[i]," %d//%*d ",&darg[0]); } if ((n==1) || (n==2)) { if (nodetail) { id=sa_getUID(); // Get a UID for this link // Get the vertex UID cvertex=sa_finduidlist(&vertexlist,darg[0]); if (cvertex==NULL) { sa_error("Unable to locate vertex for face!"); } vertexuid=cvertex->uid; // Create link sa_adduidlist(&(currentpoly->geometry),id)->uid=vertexuid; } else { sprintf(o,"poly_geom_vertex %s_p_%d %s_v_%d\n", name,polygon_number, name,darg[0]); sa_parsestring(o); } if (n==2) { // We've got texture co-ordinates if (nodetail) { id=sa_getUID(); // Get a UID for this link // Get the vertex UID cvertex=sa_finduidlist(&texvertexlist,darg[1]); if (cvertex==NULL) { sa_error("Unable to locate texture vertex for face!"); } vertexuid=cvertex->uid; // Create link sa_adduidlist(&(currentpoly->texcoords),id)->uid=vertexuid; } else { sprintf(o,"poly_tex_vertex %s_p_%d %s_vt_%d\n", name,polygon_number, name,darg[1]); sa_parsestring(o); } } } } // Set the polygon material to the current one (if present) if (strlen(currentmaterial)>0) { if (nodetail) { currentpoly->material=currentmaterialid; } else { sprintf(o,"poly_material %s_p_%d %s_mat_%s\n",name,polygon_number,name,currentmaterial); sa_parsestring(o); } } // Add this polygon to the current object if (nodetail) { if (currentobject==NULL) { sa_error("Obj file error - polygon data with no object!"); } id=sa_getUID(); // Get a UID for this link // Create link sa_adduidlist(&(currentobject->polys),id)->uid=poly_id; } else { sprintf(o,"object_poly %s_%s %s_p_%d\n",name,currentobjectname, name,polygon_number); sa_parsestring(o); } } else { sa_error("Obj file error - could not get polygon data!"); } accepted=true; } // --------------------------------------------------------------- // End of Lightwave OBJ command list // --------------------------------------------------------------- if (!accepted) { sprintf(o,"Obj file error - unknown command '%s'",l); sa_error(o); } } } fclose(objfile); } } // -------------------------------------------------------------------------- // This adds escape characters to a string where needed. // -------------------------------------------------------------------------- void sa_addescapes(char *s) { char *c; char *out; char *o; out=(char *)malloc(strlen(s)+30); // Add a bit to cope with the extra characters o=out; c=s; while (*c!='\0') { if (*c=='\\') { *o='\\'; o++; *o=*c; o++; } else { *o=*c; o++; } c++; } *o='\0'; strcpy(s,out); free(out); } // -------------------------------------------------------------------------- // This takes individual strings and parses them - they may be passed from // the EDEN input system (via sa_input), or from functions in here, such // as the Lightwave object reader (sa_load_obj). // -------------------------------------------------------------------------- void sa_parsestring(char *input) { char s[SA_MAX_INPUTSTRING+30]; char scopy[SA_MAX_INPUTSTRING+30]; char o[SA_MAX_INPUTSTRING+30]; char cmd[SA_MAX_INPUTSTRING+30]; int i,n,id; bool accepted; char *arg[SA_MAX_INPUTSTRING]; char sarg[2][SA_MAX_INPUTSTRING]; int numargs; bool inword; // Check to see if this is the first time the parser has been called, // and if so set up our "global" Eden definations if (!sa_eden_initialised) sa_eden_init(); strcpy(s,input); // Convert # signs to \0 - this makes comments a line terminator, // effectively stripping them. for (i=0;s[i]!='\0';i++) { if (s[i]=='#') s[i]='\0'; } // First check to see if this string starts with a "`" - if so then // it's an EDEN command and should be simply passed on "as is" if (s[0]=='`') { // It's an EDEN command - send all but the first character to EDEN sa_output(&s[1]); // Blank the input string to prevent further processing strcpy(s,""); } // Make a backup copy of the input string in case it's needed (eg for parsing // quoted filenames) strcpy(scopy,s); // Split the string into words numargs=0; inword=false; i=0; if (s[0]!='\0') // Check for null string { do { if ((s[i]==' ') || (s[i]==9) || (s[i]==',')) { // Space character (space, tab or comma) if (inword) { inword=false; s[i]='\0'; // Make into word terminator } } else { // Alphanumeric character if (!inword) { inword=true; numargs++; arg[numargs]=&s[i]; } } i++; } while (s[i]!='\0'); } if (numargs>0) // Check that we actually *got* something! { // Extract the command word (the first word of the string) strcpy(cmd,arg[1]); // Convert command to lowercase for (i=0;cmd[i]!='\0';i++) { cmd[i]=tolower(cmd[i]); } // Now check for the various accepted commands accepted=false; // ------------------------------------------------------------------ // vertex [z] Create a vertex using X, Y and Z // Vertices may or may not be part of a polygon // ------------------------------------------------------------------ if (strcmp(cmd,"vertex")==0) { if ((numargs==4) || (numargs==5)) { id=sa_getUID(); // Create a new object ID // Create the vertex (at 0,0,0, initially, until the settings below get evaluated) sa_addvertex(id,0,0,0); // First set the vertex name to contain the ID for future reference sprintf(o,"%s=%d;\n",arg[2],id); sa_output(o); // Create variables for the parameters given sprintf(o,"_sasami_vertex_%d_x is %s;\n",id,arg[3]); sa_output(o); sprintf(o,"_sasami_vertex_%d_y is %s;\n",id,arg[4]); sa_output(o); if (numargs==5) { // All three were specified sprintf(o,"_sasami_vertex_%d_z is %s;\n",id,arg[5]); } else { // Only X and Y were specified sprintf(o,"_sasami_vertex_%d_z=0;\n",id); } sa_output(o); // Then create a monitor procedure to watch those variables sprintf(o,"proc _sasami_vertex_mon_%d : _sasami_vertex_%d_x,_sasami_vertex_%d_y,_sasami_vertex_%d_z { sasami_vertex(%d,_sasami_vertex_%d_x,_sasami_vertex_%d_y,_sasami_vertex_%d_z); };\n",id,id,id,id,id,id,id,id); sa_output(o); } else { sa_error("Syntax : vertex [z]"); } accepted=true; } // ------------------------------------------------------------------ // material Create a new material // ------------------------------------------------------------------ // Note : Be careful when modifying this code - there is a duplicate // of it up in the OBJ file material library loader that needs // to be changed too. if (strcmp(cmd,"material")==0) { if (numargs==2) { id=sa_getUID(); // Create a new ID // Create the material sa_addmaterial(id); // First set the material name to contain the ID for future reference sprintf(o,"%s=%d;\n",arg[2],id); sa_output(o); } else { sa_error("Syntax : material "); } accepted=true; } // ------------------------------------------------------------------ // material_ambient [a] Sets the ambient colour // of material // ------------------------------------------------------------------ if (strcmp(cmd,"material_ambient")==0) { if ((numargs==5) | (numargs==6)) { // Create a UID for this link id=sa_getUID(); // Create four variables to hold the arguments sprintf(o,"_sasami_material_%d_ambient_r is %s;\n",id,arg[3]); sa_output(o); sprintf(o,"_sasami_material_%d_ambient_g is %s;\n",id,arg[4]); sa_output(o); sprintf(o,"_sasami_material_%d_ambient_b is %s;\n",id,arg[5]); sa_output(o); if (numargs==6) { sprintf(o,"_sasami_material_%d_ambient_a is %s;\n",id,arg[6]); } else { // Alpha not specified - assume 1 sprintf(o,"_sasami_material_%d_ambient_a=1;\n",id); } sa_output(o); // Then create a monitor procedure to watch the variables sprintf(o,"proc _sasami_material_%d_ambient_mon : _sasami_material_%d_ambient_r,_sasami_material_%d_ambient_g,_sasami_material_%d_ambient_b,_sasami_material_%d_ambient_a { sasami_material_ambient(%s,_sasami_material_%d_ambient_r,_sasami_material_%d_ambient_g,_sasami_material_%d_ambient_b,_sasami_material_%d_ambient_a); };\n", id,id,id,id,id,arg[2],id,id,id,id); sa_output(o); } else { sa_error("Syntax : material_ambient [a]"); } accepted=true; } // ------------------------------------------------------------------ // material_diffuse [a] Sets the diffuse colour // of material // ------------------------------------------------------------------ if (strcmp(cmd,"material_diffuse")==0) { if ((numargs==5) | (numargs==6)) { // Create a UID for this link id=sa_getUID(); // Create four variables to hold the arguments sprintf(o,"_sasami_material_%d_diffuse_r is %s;\n",id,arg[3]); sa_output(o); sprintf(o,"_sasami_material_%d_diffuse_g is %s;\n",id,arg[4]); sa_output(o); sprintf(o,"_sasami_material_%d_diffuse_b is %s;\n",id,arg[5]); sa_output(o); if (numargs==6) { sprintf(o,"_sasami_material_%d_diffuse_a is %s;\n",id,arg[6]); } else { sprintf(o,"_sasami_material_%d_diffuse_a=1;\n",id); } sa_output(o); // Then create a monitor procedure to watch the variables sprintf(o,"proc _sasami_material_%d_diffuse_mon : _sasami_material_%d_diffuse_r,_sasami_material_%d_diffuse_g,_sasami_material_%d_diffuse_b,_sasami_material_%d_diffuse_a { sasami_material_diffuse(%s,_sasami_material_%d_diffuse_r,_sasami_material_%d_diffuse_g,_sasami_material_%d_diffuse_b,_sasami_material_%d_diffuse_a); };\n", id,id,id,id,id,arg[2],id,id,id,id); sa_output(o); } else { sa_error("Syntax : material_diffuse [a]"); } accepted=true; } // ------------------------------------------------------------------ // material_specular [a] Sets the ambient colour // of material // ------------------------------------------------------------------ if (strcmp(cmd,"material_specular")==0) { if ((numargs==5) | (numargs==6)) { // Create a UID for this link id=sa_getUID(); // Create four variables to hold the arguments sprintf(o,"_sasami_material_%d_specular_r is %s;\n",id,arg[3]); sa_output(o); sprintf(o,"_sasami_material_%d_specular_g is %s;\n",id,arg[4]); sa_output(o); sprintf(o,"_sasami_material_%d_specular_b is %s;\n",id,arg[5]); sa_output(o); if (numargs==6) { sprintf(o,"_sasami_material_%d_specular_a is %s;\n",id,arg[6]); } else { sprintf(o,"_sasami_material_%d_specular_a=1;\n",id); } sa_output(o); // Then create a monitor procedure to watch the variables sprintf(o,"proc _sasami_material_%d_specular_mon : _sasami_material_%d_specular_r,_sasami_material_%d_specular_g,_sasami_material_%d_specular_b,_sasami_material_%d_specular_a { sasami_material_specular(%s,_sasami_material_%d_specular_r,_sasami_material_%d_specular_g,_sasami_material_%d_specular_b,_sasami_material_%d_specular_a); };\n", id,id,id,id,id,arg[2],id,id,id,id); sa_output(o); } else { sa_error("Syntax : material_specular [a]"); } accepted=true; } // ------------------------------------------------------------------ // material_texture "" Sets the texture file // of material // ------------------------------------------------------------------ // Note : the quotes exist in order to make it possible to specify // filenames containing spaces directly // The parser code here is a bit different from the rest, as it needs // to deal with quoted strings containing spaces if (strcmp(cmd,"material_texture")==0) { // First check to see if it's a quoted string // This uses scopy as spaces in filenames may have caused word splits in // the arg[] list. n=sscanf(scopy,"%*s %s \"%[^\"]",sarg[0],sarg[1]); if (n==2) { // Create a UID for this link id=sa_getUID(); // Make sure all special characters are escaped sa_addescapes(sarg[1]); // Create a variable to hold the argument sprintf(o,"_sasami_material_%d_texture is \"%s\";\n",id,sarg[1]); sa_output(o); // Then create a monitor procedure to watch the variables sprintf(o,"proc _sasami_material_%d_texture_mon : _sasami_material_%d_texture { sasami_material_texture(%s,_sasami_material_%d_texture); };\n", id,id,sarg[0],id); sa_output(o); } else { // OK - Maybe it's a variable reference n=sscanf(scopy,"%*s %s %s",sarg[0],sarg[1]); if (n==2) { // Create a UID for this link id=sa_getUID(); // Create a variable to hold the argument sprintf(o,"_sasami_material_%d_texture is %s;\n",id,sarg[1]); sa_output(o); // Then create a monitor procedure to watch the variables sprintf(o,"proc _sasami_material_%d_texture_mon : _sasami_material_%d_texture { sasami_material_texture(%s,_sasami_material_%d_texture); };\n", id,id,sarg[0],id); sa_output(o); } else { sa_error("Syntax : material_texture (\"\" or )"); } } accepted=true; } // ------------------------------------------------------------------ // load_obj "" Creates an object , // using data from the specified // lightwave OBJ file. // // This version does not create Eden declarations for any of the // vertices or polygons in the object file, to avoid speed problems. // Use load_full_obj to load and create declarations for an entire // object. // ------------------------------------------------------------------ // Note : the quotes exist in order to make it possible to specify // filenames containing spaces directly if (strcmp(cmd,"load_obj")==0) { // First check to see if it's a quoted string // This uses scopy as spaces in filenames may have caused word splits in // the arg[] list. n=sscanf(scopy,"%*s %s \"%[^\"]",sarg[0],sarg[1]); if (n==2) { // Load the object file sa_load_obj(sarg[0],sarg[1],true); } else { sa_error("Syntax : load_obj \"\""); } accepted=true; } // ------------------------------------------------------------------ // load_full_obj "" Creates an object , // using data from the specified // lightwave OBJ file. // // This version creates Eden declarations for all of the // vertices or polygons in the object file, which is *SLOW* for // large objects. // Use load_obj instead of this if you are not going to manipulate // vertices/polys directly. // ------------------------------------------------------------------ // Note : the quotes exist in order to make it possible to specify // filenames containing spaces directly if (strcmp(cmd,"load_full_obj")==0) { // First check to see if it's a quoted string // This uses scopy as spaces in filenames may have caused word splits in // the arg[] list. n=sscanf(scopy,"%*s %s \"%[^\"]",sarg[0],sarg[1]); if (n==2) { // Load the object file sa_load_obj(sarg[0],sarg[1],false); } else { sa_error("Syntax : load_full_obj \"\""); } accepted=true; } // ------------------------------------------------------------------ // polygon Create polygons with names // ------------------------------------------------------------------ if (strcmp(cmd,"polygon")==0) { if (numargs>=2) { for (i=2;i<=numargs;i++) { // Create an ID for our new poly id=sa_getUID(); // Create the polygon sa_addpoly(id); // Set the poly name to contain the ID sprintf(o,"%s=%d;\n",arg[i],id); sa_output(o); } accepted=true; } else { sa_error("Syntax : polygon "); } } // ------------------------------------------------------------------ // poly_geom_vertex ... Add vertices ... to a polygon // 's geometry // ------------------------------------------------------------------ if (strcmp(cmd,"poly_geom_vertex")==0) { if (numargs>=3) { for (i=3;i<=numargs;i++) // Repeat for every vertex { // Create a UID for this link id=sa_getUID(); // First set up a variable to hold this... sprintf(o,"_sasami_poly_geom_vertex_%d is %s;\n",id,arg[i]); sa_output(o); // ...then a monitor to watch it sprintf(o,"proc _sasami_poly_geom_vertex_%d_mon : _sasami_poly_geom_vertex_%d { sasami_poly_geom_vertex(%s,%d,_sasami_poly_geom_vertex_%d); };\n", id,id,arg[2],id,id); sa_output(o); } } else { sa_error("Syntax : poly_geom_vertex "); } accepted=true; } // ------------------------------------------------------------------ // poly_tex_vertex ... Add vertices to a polygon // 's texture coordinates // ------------------------------------------------------------------ if (strcmp(cmd,"poly_tex_vertex")==0) { if (numargs>=3) { for (i=3;i<=numargs;i++) // Repeat for every vertex { // Create a UID for this link id=sa_getUID(); // First set up a variable to hold this... sprintf(o,"_sasami_poly_tex_vertex_%d is %s;\n",id,arg[i]); sa_output(o); // ...then a monitor to watch it sprintf(o,"proc _sasami_poly_tex_vertex_%d_mon : _sasami_poly_tex_vertex_%d { sasami_poly_tex_vertex(%s,%d,_sasami_poly_tex_vertex_%d); };\n", id,id,arg[2],id,id); sa_output(o); } } else { sa_error("Syntax : poly_tex_vertex "); } accepted=true; } // ------------------------------------------------------------------ // poly_colour [a] Sets the colour of poly // // ------------------------------------------------------------------ if (strcmp(cmd,"poly_colour")==0) { if ((numargs==5) || (numargs==6)) { // Create a UID for this link id=sa_getUID(); // Create four variables to hold the arguments sprintf(o,"_sasami_poly_%d_colour_r is %s;\n",id,arg[3]); sa_output(o); sprintf(o,"_sasami_poly_%d_colour_g is %s;\n",id,arg[4]); sa_output(o); sprintf(o,"_sasami_poly_%d_colour_b is %s;\n",id,arg[5]); sa_output(o); if (numargs==6) { sprintf(o,"_sasami_poly_%d_colour_a is %s;\n",id,arg[6]); } else { // Alpha is set to 1 if not specified sprintf(o,"_sasami_poly_%d_colour_a=1;\n",id); } sa_output(o); // Then create a monitor procedure to watch the variables sprintf(o,"proc _sasami_poly_%d_colour_mon : _sasami_poly_%d_colour_r,_sasami_poly_%d_colour_g,_sasami_poly_%d_colour_b,_sasami_poly_%d_colour_a { sasami_poly_colour(%s,_sasami_poly_%d_colour_r,_sasami_poly_%d_colour_g,_sasami_poly_%d_colour_b,_sasami_poly_%d_colour_a); };\n", id,id,id,id,id,arg[2],id,id,id,id); sa_output(o); } else { sa_error("Syntax : poly_colour [a]"); } accepted=true; } // ------------------------------------------------------------------ // poly_material Sets polygon material // to // ------------------------------------------------------------------ if (strcmp(cmd,"poly_material")==0) { if (numargs==3) { // Create a UID for this link id=sa_getUID(); // Create a variable to hold this sprintf(o,"_sasami_poly_%d_material is %s;\n",id,arg[3]); sa_output(o); // Then create a monitor procedure to watch the variables sprintf(o,"proc _sasami_poly_%d_material_mon : _sasami_poly_%d_material { sasami_poly_material(%s,_sasami_poly_%d_material); };\n", id,id,arg[2],id); sa_output(o); } else { sa_error("Syntax : poly_material "); } accepted=true; } // ------------------------------------------------------------------ // object Create objects with names // ------------------------------------------------------------------ // Note : There is a copy of this code in the OBJ file loader above - // if modifing this, then remember to change it up there too! if (strcmp(cmd,"object")==0) { if (numargs>=2) { for (i=2;i<=numargs;i++) { // Create an ID for our new object id=sa_getUID(); // Create the object sa_addobject(id); // Set the object name to contain the ID sprintf(o,"%s=%d;\n",arg[i],id); sa_output(o); } accepted=true; } else { sa_error("Syntax : object "); } } // ------------------------------------------------------------------ // object_poly Add polygons to object // ------------------------------------------------------------------ if (strcmp(cmd,"object_poly")==0) { if (numargs>=3) { for (i=3;i<=numargs;i++) // Repeat for every polygon { // Create a UID for this link id=sa_getUID(); // First set up a variable to hold this... sprintf(o,"_sasami_object_poly_%d is %s;\n",id,arg[i]); sa_output(o); // ...then a monitor to watch it sprintf(o,"proc _sasami_object_poly_%d_mon : _sasami_object_poly_%d { sasami_object_poly(%s,%d,_sasami_object_poly_%d); };\n", id,id,arg[2],id,id); sa_output(o); } } else { sa_error("Syntax : object_poly "); } accepted=true; } // ------------------------------------------------------------------ // object_pos Sets the position of // object // ------------------------------------------------------------------ if (strcmp(cmd,"object_pos")==0) { if (numargs==5) { // Create a UID for this link id=sa_getUID(); // Create three variables to hold the arguments sprintf(o,"_sasami_object_%d_pos_x is %s;\n",id,arg[3]); sa_output(o); sprintf(o,"_sasami_object_%d_pos_y is %s;\n",id,arg[4]); sa_output(o); sprintf(o,"_sasami_object_%d_pos_z is %s;\n",id,arg[5]); sa_output(o); // Then create a monitor procedure to watch the variables sprintf(o,"proc _sasami_object_%d_pos_mon : _sasami_object_%d_pos_x,_sasami_object_%d_pos_y,_sasami_object_%d_pos_z { sasami_object_pos(%s,_sasami_object_%d_pos_x,_sasami_object_%d_pos_y,_sasami_object_%d_pos_z); };\n", id,id,id,id,arg[2],id,id,id); sa_output(o); } else { sa_error("Syntax : object_pos "); } accepted=true; } // ------------------------------------------------------------------ // object_rot Sets the rotation of // object // ------------------------------------------------------------------ if (strcmp(cmd,"object_rot")==0) { if (numargs==5) { // Create a UID for this link id=sa_getUID(); // Create three variables to hold the arguments sprintf(o,"_sasami_object_%d_rot_x is %s;\n",id,arg[3]); sa_output(o); sprintf(o,"_sasami_object_%d_rot_y is %s;\n",id,arg[4]); sa_output(o); sprintf(o,"_sasami_object_%d_rot_z is %s;\n",id,arg[5]); sa_output(o); // Then create a monitor procedure to watch the variables sprintf(o,"proc _sasami_object_%d_rot_mon : _sasami_object_%d_rot_x,_sasami_object_%d_rot_y,_sasami_object_%d_rot_z { sasami_object_rot(%s,_sasami_object_%d_rot_x,_sasami_object_%d_rot_y,_sasami_object_%d_rot_z); };\n", id,id,id,id,arg[2],id,id,id); sa_output(o); } else { sa_error("Syntax : object_rot "); } accepted=true; } // ------------------------------------------------------------------ // object_scale Sets the scale of // object // ------------------------------------------------------------------ if (strcmp(cmd,"object_scale")==0) { if (numargs==5) { // Create a UID for this link id=sa_getUID(); // Create three variables to hold the arguments sprintf(o,"_sasami_object_%d_scale_x is %s;\n",id,arg[3]); sa_output(o); sprintf(o,"_sasami_object_%d_scale_y is %s;\n",id,arg[4]); sa_output(o); sprintf(o,"_sasami_object_%d_scale_z is %s;\n",id,arg[5]); sa_output(o); // Then create a monitor procedure to watch the variables sprintf(o,"proc _sasami_object_%d_scale_mon : _sasami_object_%d_scale_x,_sasami_object_%d_scale_y,_sasami_object_%d_scale_z { sasami_object_scale(%s,_sasami_object_%d_scale_x,_sasami_object_%d_scale_y,_sasami_object_%d_scale_z); };\n", id,id,id,id,arg[2],id,id,id); sa_output(o); } else { sa_error("Syntax : object_scale "); } accepted=true; } // ------------------------------------------------------------------ // object_visible Makes visible (e=1 -> visible // e=0 -> invisible) // ------------------------------------------------------------------ if (strcmp(cmd,"object_visible")==0) { if (numargs==3) { // Create a UID for this link id=sa_getUID(); // Create a variable to hold the argument sprintf(o,"_sasami_object_%d_visible is %s;\n",id,arg[3]); sa_output(o); // Then create a monitor procedure to watch the variables sprintf(o,"proc _sasami_object_%d_visible_mon : _sasami_object_%d_visible { sasami_object_visible(%s,_sasami_object_%d_visible); };\n", id,id,arg[2],id); sa_output(o); } else { sa_error("Syntax : object_visible (e=0 to make invisible, 1 to make visible) "); } accepted=true; } // ------------------------------------------------------------------ // light Create lights with names // ------------------------------------------------------------------ if (strcmp(cmd,"light")==0) { if (numargs>=2) { for (i=2;i<=numargs;i++) { // Create an ID for our new light id=sa_getUID(); // Create the light sa_addlight(id); // Set the light name to contain the ID sprintf(o,"%s=%d;\n",arg[i],id); sa_output(o); } accepted=true; } else { sa_error("Syntax : light "); } } // ------------------------------------------------------------------ // light_pos Sets the position of // light // ------------------------------------------------------------------ if (strcmp(cmd,"light_pos")==0) { if (numargs==5) { // Create a UID for this link id=sa_getUID(); // Create three variables to hold the arguments sprintf(o,"_sasami_light_%d_pos_x is %s;\n",id,arg[3]); sa_output(o); sprintf(o,"_sasami_light_%d_pos_y is %s;\n",id,arg[4]); sa_output(o); sprintf(o,"_sasami_light_%d_pos_z is %s;\n",id,arg[5]); sa_output(o); // Then create a monitor procedure to watch the variables sprintf(o,"proc _sasami_light_%d_pos_mon : _sasami_light_%d_pos_x,_sasami_light_%d_pos_y,_sasami_light_%d_pos_z { sasami_light_pos(%s,_sasami_light_%d_pos_x,_sasami_light_%d_pos_y,_sasami_light_%d_pos_z); };\n", id,id,id,id,arg[2],id,id,id); sa_output(o); } else { sa_error("Syntax : light_pos "); } accepted=true; } // ------------------------------------------------------------------ // light_ambient [a] Sets the ambient colour // of light // ------------------------------------------------------------------ if (strcmp(cmd,"light_ambient")==0) { if ((numargs==5) | (numargs==6)) { // Create a UID for this link id=sa_getUID(); // Create four variables to hold the arguments sprintf(o,"_sasami_light_%d_ambient_r is %s;\n",id,arg[3]); sa_output(o); sprintf(o,"_sasami_light_%d_ambient_g is %s;\n",id,arg[4]); sa_output(o); sprintf(o,"_sasami_light_%d_ambient_b is %s;\n",id,arg[5]); sa_output(o); if (numargs==6) { sprintf(o,"_sasami_light_%d_ambient_a is %s;\n",id,arg[6]); } else { // Alpha not specified - assume 1 sprintf(o,"_sasami_light_%d_ambient_a=1;\n",id); } sa_output(o); // Then create a monitor procedure to watch the variables sprintf(o,"proc _sasami_light_%d_ambient_mon : _sasami_light_%d_ambient_r,_sasami_light_%d_ambient_g,_sasami_light_%d_ambient_b,_sasami_light_%d_ambient_a { sasami_light_ambient(%s,_sasami_light_%d_ambient_r,_sasami_light_%d_ambient_g,_sasami_light_%d_ambient_b,_sasami_light_%d_ambient_a); };\n", id,id,id,id,id,arg[2],id,id,id,id); sa_output(o); } else { sa_error("Syntax : light_ambient [a]"); } accepted=true; } // ------------------------------------------------------------------ // light_diffuse [a] Sets the diffuse colour // of light // ------------------------------------------------------------------ if (strcmp(cmd,"light_diffuse")==0) { if ((numargs==5) | (numargs==6)) { // Create a UID for this link id=sa_getUID(); // Create four variables to hold the arguments sprintf(o,"_sasami_light_%d_diffuse_r is %s;\n",id,arg[3]); sa_output(o); sprintf(o,"_sasami_light_%d_diffuse_g is %s;\n",id,arg[4]); sa_output(o); sprintf(o,"_sasami_light_%d_diffuse_b is %s;\n",id,arg[5]); sa_output(o); if (numargs==6) { sprintf(o,"_sasami_light_%d_diffuse_a is %s;\n",id,arg[6]); } else { sprintf(o,"_sasami_light_%d_diffuse_a=1;\n",id); } sa_output(o); // Then create a monitor procedure to watch the variables sprintf(o,"proc _sasami_light_%d_diffuse_mon : _sasami_light_%d_diffuse_r,_sasami_light_%d_diffuse_g,_sasami_light_%d_diffuse_b,_sasami_light_%d_diffuse_a { sasami_light_diffuse(%s,_sasami_light_%d_diffuse_r,_sasami_light_%d_diffuse_g,_sasami_light_%d_diffuse_b,_sasami_light_%d_diffuse_a); };\n", id,id,id,id,id,arg[2],id,id,id,id); sa_output(o); } else { sa_error("Syntax : light_diffuse [a]"); } accepted=true; } // ------------------------------------------------------------------ // light_specular [a] Sets the ambient colour // of light // ------------------------------------------------------------------ if (strcmp(cmd,"light_specular")==0) { if ((numargs==5) | (numargs==6)) { // Create a UID for this link id=sa_getUID(); // Create four variables to hold the arguments sprintf(o,"_sasami_light_%d_specular_r is %s;\n",id,arg[3]); sa_output(o); sprintf(o,"_sasami_light_%d_specular_g is %s;\n",id,arg[4]); sa_output(o); sprintf(o,"_sasami_light_%d_specular_b is %s;\n",id,arg[5]); sa_output(o); if (numargs==6) { sprintf(o,"_sasami_light_%d_specular_a is %s;\n",id,arg[6]); } else { sprintf(o,"_sasami_light_%d_specular_a=1;\n",id); } sa_output(o); // Then create a monitor procedure to watch the variables sprintf(o,"proc _sasami_light_%d_specular_mon : _sasami_light_%d_specular_r,_sasami_light_%d_specular_g,_sasami_light_%d_specular_b,_sasami_light_%d_specular_a { sasami_light_specular(%s,_sasami_light_%d_specular_r,_sasami_light_%d_specular_g,_sasami_light_%d_specular_b,_sasami_light_%d_specular_a); };\n", id,id,id,id,id,arg[2],id,id,id,id); sa_output(o); } else { sa_error("Syntax : light_specular [a]"); } accepted=true; } // ------------------------------------------------------------------ // light_enabled Enables light (e=1 -> enable // e=0 -> disable) // ------------------------------------------------------------------ if (strcmp(cmd,"light_enabled")==0) { if (numargs==3) { // Create a UID for this link id=sa_getUID(); // Create a variable to hold the argument sprintf(o,"_sasami_light_%d_enabled is %s;\n",id,arg[3]); sa_output(o); // Then create a monitor procedure to watch the variables sprintf(o,"proc _sasami_light_%d_enabled_mon : _sasami_light_%d_enabled { sasami_light_enabled(%s,_sasami_light_%d_enabled); };\n", id,id,arg[2],id); sa_output(o); } else { sa_error("Syntax : light_enabled (e=0 to disable, 1 to enable) "); } accepted=true; } // ------------------------------------------------------------------ // light_directional Sets light as either : // 0 = Positional // 1 = Directional // ------------------------------------------------------------------ if (strcmp(cmd,"light_directional")==0) { if (numargs==3) { // Create a UID for this link id=sa_getUID(); // Create a variable to hold the argument sprintf(o,"_sasami_light_%d_directional is %s;\n",id,arg[3]); sa_output(o); // Then create a monitor procedure to watch the variables sprintf(o,"proc _sasami_light_%d_directional_mon : _sasami_light_%d_directional { sasami_light_directional(%s,_sasami_light_%d_directional); };\n", id,id,arg[2],id); sa_output(o); } else { sa_error("Syntax : light_directional (d=0 for positional, 1 for directional) "); } accepted=true; } // ------------------------------------------------------------------ // light_attenuation Sets light 's attenuation // factor to // ------------------------------------------------------------------ if (strcmp(cmd,"light_attenuation")==0) { if (numargs==3) { // Create a UID for this link id=sa_getUID(); // Create a variable to hold the argument sprintf(o,"_sasami_light_%d_attenuation is %s;\n",id,arg[3]); sa_output(o); // Then create a monitor procedure to watch the variables sprintf(o,"proc _sasami_light_%d_attenuation_mon : _sasami_light_%d_attenuation { sasami_light_attenuation(%s,_sasami_light_%d_attenuation); };\n", id,id,arg[2],id); sa_output(o); } else { sa_error("Syntax : light_attenuation "); } accepted=true; } // ------------------------------------------------------------------ // dump_vertices Primarily a debugging call - this causes the // current list of vertices to be sent to STDOUT // ------------------------------------------------------------------ if (strcmp(cmd,"dump_vertices")==0) { sa_dumpvertices(); accepted=true; } // ------------------------------------------------------------------ // dump_polys Primarily a debugging call - this causes the // current list of polys to be sent to STDOUT // ------------------------------------------------------------------ if (strcmp(cmd,"dump_polys")==0) { sa_dumppolys(); accepted=true; } // ------------------------------------------------------------------ // dump_objects Primarily a debugging call - this causes the // current list of objects to be sent to STDOUT // ------------------------------------------------------------------ if (strcmp(cmd,"dump_objects")==0) { sa_dumpobjects(); accepted=true; } // ------------------------------------------------------------------ // dump_materials Primarily a debugging call - this causes the // current materials list to be sent to STDOUT // ------------------------------------------------------------------ if (strcmp(cmd,"dump_materials")==0) { sa_dumpmaterials(); accepted=true; } // ------------------------------------------------------------------ // dump_lights Primarily a debugging call - this causes the // current light list to be sent to STDOUT // ------------------------------------------------------------------ if (strcmp(cmd,"dump_lights")==0) { sa_dumplights(); accepted=true; } // ------------------------------------------------------------------ // open_display Initialises the Sasami OpenGL display // ------------------------------------------------------------------ if (strcmp(cmd,"open_display")==0) { sa_r_opendisplay(); accepted=true; } // ------------------------------------------------------------------ // close_display Shuts down the Sasami OpenGL display // ------------------------------------------------------------------ if (strcmp(cmd,"close_display")==0) { sa_r_closedisplay(); accepted=true; } // ------------------------------------------------------------------ // bgcolour Sets the viewport background colour // This is just a helper function - the same effect can be achieved // by setting the sasami_bgcolour_ variables // ------------------------------------------------------------------ if (strcmp(cmd,"bgcolour")==0) { if (numargs==4) { // Set the three colour variables sprintf(o,"sasami_bgcolour_r is %s;\n",arg[2]); sa_output(o); sprintf(o,"sasami_bgcolour_g is %s;\n",arg[3]); sa_output(o); sprintf(o,"sasami_bgcolour_b is %s;\n",arg[4]); sa_output(o); } else { sa_error("Syntax : set_bgcolour "); } accepted=true; } // ------------------------------------------------------------------ // viewport Sets the viewport size to x // This is just a helper function - the same effect can be achieved // by setting the sasami_viewport_ variables // ------------------------------------------------------------------ if (strcmp(cmd,"viewport")==0) { if (numargs==3) { // Set the three colour variables sprintf(o,"sasami_viewport_xsize is %s;\n",arg[2]); sa_output(o); sprintf(o,"sasami_viewport_ysize is %s;\n",arg[3]); sa_output(o); } else { sa_error("Syntax : viewport "); } accepted=true; } // Check that the command was processed OK if (!accepted) { // Raise an error sa_error("Unknown command"); } } else { // If we got here, we didn't find a command word, implying that the // input was a null string. It would be silly to flag an error, so // we'll let it pass... } } #endif /* WANT_SASAMI */ else { // Alpha not specified - assume 1 sprintf(o,"_sasami_light_%d_ambient_a=1;\n",id); } sa_output(o); // Then create a monitor procedure to watch the variables tkeden1.32/Sasami/render.c010060000025250000147000000541570736532071000167000ustar00ashleydcsother00001250000011/* * render.c * * Rewritten from Ben Carter's original Windows-only version to one * using Togl which is thus portable across more platforms by Ash May * 2001 */ #include "../config.h" #ifdef WANT_SASAMI #ifndef __WIN32__ # if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) # define __WIN32__ # define _WIN32 # endif #endif /* This bit copied from glpng.c - if we don't do this, we end up with pngLoad referenced here and pngLoad@16 compiled in glpng.o [Ash] */ #ifdef _WIN32 /* Stupid Windows needs to include windows.h before gl.h */ #undef FAR #include #endif #include "glpng.h" #include "togl.h" #include "../Eden/eden.h" #include "render.h" /* this includes windows.h */ #include /* for sqrt etc */ #include #include #include "utils.h" #include "structures.h" /* Globals which can be read/written by Eden */ int sa_r_xsize; /* Display width (Cannot be set with display open) */ int sa_r_ysize; /* Display height (Cannot be set with display open) */ colourinfo sa_r_bgcolour; /* Viewport background colour */ bool sa_r_showaxes; /* Are the axes shown? */ /* Camera information (available to Eden - apparently, but I can't see how [Ash]) */ coord sa_camera_pos; /* Camera position */ coord sa_camera_rot; /* Camera rotation */ /* Default lighting info */ GLfloat sa_def_light_pos1[4] = {0.7,0.7,1.25,0}; GLfloat sa_def_light_pos2[4] = {-0.7,-0.7,-1.25,0}; GLfloat sa_def_light_ambient[4] = {0.8,0.8,0.8,1}; GLfloat sa_def_light_specular[4]= {0.9,0.9,0.9,1}; GLfloat sa_def_light_diffuse[4] = {0.7,0.7,0.7,1}; struct Togl *globTogl; /* keeping a copy to use within sa_r_update - this is a hack [Ash] */ /* Internal globals */ bool sa_r_initialised = false; extern Tcl_Interp *interp; int sa_r_maxlights = 0; /* The maximum number of lights the OpenGL driver allows */ #ifdef DEBUG #define DEBUGPRINT(s,i) if (Debug&8) fprintf(stderr, s, i); #else #define DEBUGPRINT(s,i) #endif int setXrot(struct Togl *togl, int argc, char *argv[]) { Tcl_Interp *interp = Togl_Interp(togl); if (argc != 3) { Tcl_SetResult( interp, "wrong # args: should be \"pathName setXrot pos\"", TCL_STATIC ); return TCL_ERROR; } sa_camera_rot.x = atof( argv[2] ); strcpy( interp->result, argv[2] ); return TCL_OK; } int getXrot(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]) { sprintf(interp->result, "%f", sa_camera_rot.x); return TCL_OK; } int setYrot(struct Togl *togl, int argc, char *argv[]) { Tcl_Interp *interp = Togl_Interp(togl); if (argc != 3) { Tcl_SetResult( interp, "wrong # args: should be \"pathName setYrot pos\"", TCL_STATIC ); return TCL_ERROR; } sa_camera_rot.y = atof( argv[2] ); strcpy( interp->result, argv[2] ); return TCL_OK; } int getYrot(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]) { sprintf(interp->result, "%f", sa_camera_rot.y); return TCL_OK; } int setZpos(struct Togl *togl, int argc, char *argv[]) { Tcl_Interp *interp = Togl_Interp(togl); if (argc != 3) { Tcl_SetResult( interp, "wrong # args: should be \"pathName setZpos pos\"", TCL_STATIC ); return TCL_ERROR; } sa_camera_pos.z = atof( argv[2] ); strcpy( interp->result, argv[2] ); return TCL_OK; } int getZpos(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]) { sprintf(interp->result, "%f", sa_camera_pos.z); return TCL_OK; } /* Initialisation code (called once only at startup, unlike open_display) */ void sa_r_init() { int togl_error; if (togl_error = Togl_Init(interp) != TCL_OK) fprintf(stderr, "Togl_Init error %d\n", togl_error); Togl_CreateCommand("setXrot", setXrot); Togl_CreateCommand("setYrot", setYrot); Togl_CreateCommand("setZpos", setZpos); Tcl_CreateCommand(interp, "sasami_getXrot", getXrot, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL ); Tcl_CreateCommand(interp, "sasami_getYrot", getYrot, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL ); Tcl_CreateCommand(interp, "sasami_getZpos", getZpos, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL ); /* Set up default info */ sa_r_xsize=640; sa_r_ysize=480; sa_r_bgcolour.r=0; sa_r_bgcolour.g=0; sa_r_bgcolour.b=0; sa_r_bgcolour.a=1; sa_r_showaxes=true; } void sa_togl_destroyfunc(struct Togl *togl) { sa_r_closedisplay(); } /* !@!@ A hack: need the togl value in sa_r_update, so store it here. This will need rethinking if Sasami is given more than one window. [Ash] */ void sa_togl_createfunc(struct Togl *togl) { globTogl = togl; } /* Initialise the Sasami OpenGL renderer and get the display window created and open */ int sa_r_opendisplay(void) { #define SA_TCL_COMMAND_MAXLEN 256 char tclCommand[SA_TCL_COMMAND_MAXLEN]; materialinfo *currentmaterial; if (sa_r_initialised) return false; sa_r_initialised=true; Togl_CreateFunc(sa_togl_createfunc); Togl_DisplayFunc(sa_r_render); Togl_DestroyFunc(sa_togl_destroyfunc); /* Call Tcl to create the window */ snprintf(tclCommand, SA_TCL_COMMAND_MAXLEN, "sasamiWindow %d %d", sa_r_xsize, sa_r_ysize); Tcl_EvalEC(interp, tclCommand); /* Find out what colour depth we're running at */ /* This replaced by a sasami_viewport_bpp Eden definition in parser.c */ /* Tcl_EvalEC(interp, "winfo depth .sasami"); sa_r_bpp = atoi(interp->result); */ /* Grab the driver information we need */ glGetIntegerv(GL_MAX_LIGHTS,&sa_r_maxlights); DEBUGPRINT("OpenGL driver :\n", 0); DEBUGPRINT("Vendor : %s\n", glGetString(GL_VENDOR)); DEBUGPRINT("Version : %s\n", glGetString(GL_VERSION)); DEBUGPRINT("Renderer : %s\n", glGetString(GL_RENDERER)); DEBUGPRINT("Extensions : %s\n", glGetString(GL_EXTENSIONS)); DEBUGPRINT("Max lights : %d\n", sa_r_maxlights); /* Set up our basic OpenGL state */ /* Viewport */ glViewport(0, 0, sa_r_xsize, sa_r_ysize); /* Projection matrix */ glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustum(-1, 1, -(sa_r_xsize/sa_r_ysize), (sa_r_xsize/sa_r_ysize), 10.0, 40000.0); /* Near/far clip planes... */ glMatrixMode(GL_MODELVIEW); glLoadIdentity(); /* Rendering state */ glShadeModel(GL_SMOOTH); glCullFace(GL_BACK); glEnable(GL_CULL_FACE); glEnable(GL_DEPTH_TEST); glEnable(GL_NORMALIZE); glDepthFunc(GL_LEQUAL); glDisable(GL_DITHER); glDisable(GL_FOG); glDisable(GL_LOGIC_OP); glDisable(GL_STENCIL_TEST); glDisable(GL_ALPHA_TEST); glEnable(GL_POINT_SMOOTH); /* Texturing settings */ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); /* Pixel mapping */ glPixelTransferi(GL_MAP_COLOR, GL_FALSE); glPixelTransferi(GL_RED_SCALE, 1); glPixelTransferi(GL_RED_BIAS, 0); glPixelTransferi(GL_GREEN_SCALE, 1); glPixelTransferi(GL_GREEN_BIAS, 0); glPixelTransferi(GL_BLUE_SCALE, 1); glPixelTransferi(GL_BLUE_BIAS, 0); glPixelTransferi(GL_ALPHA_SCALE, 1); glPixelTransferi(GL_ALPHA_BIAS, 0); /* Lighting */ glEnable(GL_LIGHTING); /* Set up alpha-blending function */ glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER,0); /* OpenGL setup done */ /* Set up the default camera */ sa_camera_pos.x=0; sa_camera_pos.y=0; sa_camera_pos.z=-30; /* Ben originally had this at -8 [Ash] */ sa_camera_rot.x=0; sa_camera_rot.y=0; sa_camera_rot.z=0; /* Flag all loaded materials as needing re-loading for this new context */ currentmaterial=sa_getfirstmaterial(); while (currentmaterial != NULL) { if (currentmaterial->texturefile!=NULL) currentmaterial->textureneedsloading=1; currentmaterial=currentmaterial->next; } } /* Close down the Sasami renderer */ void sa_r_closedisplay(void) { if (sa_r_initialised) { sa_r_initialised = false; /* Don't think we need to clean up any GL stuff [Ash] */ Tcl_EvalEC(interp, "sasamiWindowClose"); } } /* Resizes the viewport (safely!) */ void sa_r_resizeviewport(int x, int y) { bool wasinitialised; wasinitialised=sa_r_initialised; /* Make sure the viewport is closed before resizing */ if (sa_r_initialised) sa_r_closedisplay(); sa_r_xsize=x; sa_r_ysize=y; /* Reopen the viewport (if it was open before) */ if (wasinitialised) sa_r_opendisplay(); } /* This sets up the camera position onto the modelview matrix */ void sa_r_setupcamera(void) { glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glScalef(10, 10, 10); glTranslatef(sa_camera_pos.x, sa_camera_pos.y, sa_camera_pos.z); glRotatef(sa_camera_rot.x, -1, 0, 0); glRotatef(sa_camera_rot.y, 0, -1, 0); glRotatef(sa_camera_rot.z, 0, 0, -1); } /* This sets up the world lighting */ void sa_r_setuplighting(void) { lightinfo *light; int i; GLfloat lightparams[4]; for (i=0;i enabled lights */ i=0; while ((light != NULL) && (ienabled != 0) { glPushMatrix(); glTranslatef(light->pos.x,light->pos.y,light->pos.z); if (light->directional==1) { lightparams[0]=light->pos.x; lightparams[1]=light->pos.y; lightparams[2]=light->pos.z; lightparams[3]=0; } else { lightparams[0]=0; lightparams[1]=0; lightparams[2]=0; lightparams[3]=1; } glLightfv(GL_LIGHT0+i,GL_POSITION,lightparams); lightparams[0]=light->ambient.r; lightparams[1]=light->ambient.g; lightparams[2]=light->ambient.b; lightparams[3]=light->ambient.a; glLightfv(GL_LIGHT0+i,GL_AMBIENT,lightparams); lightparams[0]=light->diffuse.r; lightparams[1]=light->diffuse.g; lightparams[2]=light->diffuse.b; lightparams[3]=light->diffuse.a; glLightfv(GL_LIGHT0+i,GL_DIFFUSE,lightparams); lightparams[0]=light->specular.r; lightparams[1]=light->specular.g; lightparams[2]=light->specular.b; lightparams[3]=light->specular.a; glLightfv(GL_LIGHT0+i,GL_SPECULAR,lightparams); if (light->attenuation!=0) { glLightf(GL_LIGHT0+i,GL_CONSTANT_ATTENUATION,1); glLightf(GL_LIGHT0+i,GL_LINEAR_ATTENUATION,light->attenuation); } else { glLightf(GL_LIGHT0+i,GL_LINEAR_ATTENUATION,0); glLightf(GL_LIGHT0+i,GL_CONSTANT_ATTENUATION,1); } #ifdef SASAMI_SHOW_LIGHTS glBegin(GL_POINTS); /* Inefficient, but necessary as you can't change light parameters in a glBegin/glEnd block! */ glColor4f(light->diffuse.r,light->diffuse.g,light->diffuse.b, light->diffuse.a); glVertex3f( 0, 0, 0); glEnd(); #endif glEnable(GL_LIGHT0+i); i++; glPopMatrix(); } light=light->next; } #ifdef SASAMI_SHOW_LIGHTS glEnable(GL_CULL_FACE); glEnable(GL_LIGHTING); #endif } } /* Render axes indicators (unit length arrows along each axis) */ void sa_r_render_axes(void) { glDisable(GL_CULL_FACE); glDisable(GL_LIGHTING); glBegin(GL_LINES); // X axis (red) glColor4f(1,0,0,1); glVertex3f(0,0,0); glVertex3f(1,0,0); glVertex3f(1,0,0); glVertex3f(0.8,0,0.1); glVertex3f(1,0,0); glVertex3f(0.8,0,-0.1); // Y axis (green) glColor4f(0,1,0,1); glVertex3f(0,0,0); glVertex3f(0,1,0); glVertex3f(0,1,0); glVertex3f(0.1,0.8,0); glVertex3f(0,1,0); glVertex3f(-0.1,0.8,0); // Z axis (blue) glColor4f(0,0,1,1); glVertex3f(0,0,0); glVertex3f(0,0,1); glVertex3f(0,0,1); glVertex3f(0.1,0,0.8); glVertex3f(0,0,1); glVertex3f(-0.1,0,0.8); glEnd(); } /* Generates a face normal using 3 co-ordinates */ coord sa_get_face_normal(coord a,coord b,coord c) { coord r; double l; a.x=a.x-c.x; a.y=a.y-c.y; a.z=a.z-c.z; b.x=b.x-c.x; b.y=b.y-c.y; b.z=b.z-c.z; r.x=(a.y*b.z)-(a.z*b.y); r.y=(a.z*b.x)-(a.x*b.z); r.z=(a.x*b.y)-(a.y*b.x); /* Normalisation is not strictly necessary (as GL_NORMALIZE is enabled), but avoids potential problems */ l=sqrt((r.x*r.x)+(r.y*r.y)+(r.z*r.z)); r.x=r.x/l; r.y=r.y/l; r.z=r.z/l; return r; } /* Generates a face normal from a vertex UID list. The UID list must have at least 3 vertices to generate a normal, otherwise a normal of (0,0,0) is returned */ coord sa_get_face_normal_from_uid_list(uidlist *first) { int i; coord c[3]; uidlist *currentid; vertexinfo *v; /* Run through the vertex UID list extracting the coordinates of the first three vertices */ currentid=first; i=0; while ((currentid!=NULL) && (i!=3)) { v=sa_findvertex(currentid->uid); c[i]=v->pos; currentid=currentid->next; i++; } if (i==3) { /* We got 3 vertices - calculate normal */ return sa_get_face_normal(c[0],c[1],c[2]); } else { /* We didn't find enough vertices - return (0,0,0); */ c[0].x=0; c[0].y=0; c[0].z=0; return c[0]; } } /* Renders all of the polygons for a given polygon UID list */ void sa_r_render_object_polys(uidlist *polylist) { polyinfo *currentpoly; uidlist *currentpolyid; uidlist *currentvertexid; uidlist *currenttexcoordid; vertexinfo *v; vertexinfo *tv; coord normal; GLfloat mat_amb[4] = {0.01,0.01,0.01,1.00}; GLfloat mat_diff[4] = {0.65,0.05,0.20,0.60}; GLfloat mat_spec[4] = {0.50,0.50,0.50,1.00}; GLfloat mat_shine = 20; materialinfo *polymat; currentpolyid=polylist; glEnable(GL_LIGHTING); while (currentpolyid!=NULL) { currentpoly = sa_findpoly(currentpolyid->uid); /* Get the polygon material */ polymat = sa_findmaterial(currentpoly->material); /* Check to see if there is a valid texture attached */ if (polymat!=NULL) { /* Load texture if necessary. This is done here to ensure that OpenGL is initialised when textures are loaded! */ if (polymat->textureneedsloading > 0) { polymat->texture = sa_getandbindnewtexture(); sa_loadtexture(polymat->texturefile); polymat->textureneedsloading = 0; } if (polymat->texture!=0) { glBindTexture(GL_TEXTURE_2D,polymat->texture); glEnable(GL_TEXTURE_2D); } else { glDisable(GL_TEXTURE_2D); } } else { glDisable(GL_TEXTURE_2D); } /* Per-polygon lighting calculations */ glEnable(GL_CULL_FACE); glDepthMask(1); /* Allow Z-Buffer writes */ /* Get the face normal */ normal=sa_get_face_normal_from_uid_list(currentpoly->geometry); if #ifdef SASAMI_ANIME (((normal.x==0) && (normal.y==0) && (normal.z==0)) | (true)) #else (((normal.x==0) && (normal.y==0) && (normal.z==0))) #endif { /* We couldn't calculate a normal, so don't light this polygon, and just use the basic colour */ glDisable(GL_LIGHTING); glColor4f( currentpoly->colour.r, currentpoly->colour.g, currentpoly->colour.b, currentpoly->colour.a); if (currentpoly->colour.a<1) { glDisable(GL_CULL_FACE); /* Transparent stuff is two-sided */ glDepthMask(0); /* Transparent stuff doesn't affect Z buffer */ } } else { if (polymat==NULL) { /* This poly has no material - set up default lighting parameters from the colour given */ /* Set up material parameters for this surface */ mat_amb[0]=0.1; mat_amb[1]=0.1; mat_amb[2]=0.1; mat_amb[3]=1; mat_diff[0]=currentpoly->colour.r; mat_diff[1]=currentpoly->colour.g; mat_diff[2]=currentpoly->colour.b; mat_diff[3]=currentpoly->colour.a; mat_spec[0]=0.7; mat_spec[1]=0.7; mat_spec[2]=0.7; mat_spec[3]=1; if (currentpoly->colour.a<1) { glDisable(GL_CULL_FACE); /* Transparent stuff is two-sided */ glDepthMask(0); /* Transparent stuff doesn't affect Z buffer */ } } else { /* This poly has a material - use it! */ mat_amb[0]=polymat->ambient.r; mat_amb[1]=polymat->ambient.g; mat_amb[2]=polymat->ambient.b; mat_amb[3]=polymat->ambient.a; mat_diff[0]=polymat->diffuse.r; mat_diff[1]=polymat->diffuse.g; mat_diff[2]=polymat->diffuse.b; mat_diff[3]=polymat->diffuse.a; mat_spec[0]=polymat->specular.r; mat_spec[1]=polymat->specular.g; mat_spec[2]=polymat->specular.b; mat_spec[3]=polymat->specular.a; if ((polymat->ambient.a<1) || (polymat->diffuse.a<1) || (polymat->specular.a<1)) { glDisable(GL_CULL_FACE); /* Transparent stuff is two-sided */ glDepthMask(0); /* Transparent stuff doesn't affect Z buffer */ } } /* Pass the material data to OpenGL */ glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT,mat_amb); glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,mat_diff); glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,mat_spec); glMaterialf(GL_FRONT_AND_BACK,GL_SHININESS,mat_shine); glEnable(GL_LIGHTING); } /* Run through each vertex of the polygon's vertex UID list and feed it to OpenGL */ currentvertexid=currentpoly->geometry; currenttexcoordid=currentpoly->texcoords; glBegin(GL_POLYGON); while (currentvertexid!=NULL) { v=sa_findvertex(currentvertexid->uid); /* It seems that v==NULL when eager() is used in a tight loop. Ignoring the vertex like this stops tkeden crashing when dereferencing v, but the resulting 3D geometry is corrupted :( [Ash] */ if (v != NULL) { glNormal3f(normal.x,normal.y,normal.z); if (currenttexcoordid!=NULL) { /* We've got a texture co-ordinate to use */ tv=sa_findvertex(currenttexcoordid->uid); glTexCoord2f(tv->pos.x,tv->pos.y); currenttexcoordid=currenttexcoordid->next; } else { /* Default to generating texture co-ordinates from X,Y */ #ifndef SASAMI_ANIME glTexCoord2f(v->pos.x,v->pos.y); #else /* SASAMI_ANIME "enables the experimental renderer" apparently [Ash] */ glTexCoord2f(0.5+(normal.x/2),0.5+(normal.y/2)); #endif } glVertex3f( v->pos.x, v->pos.y, v->pos.z); } currentvertexid=currentvertexid->next; } glEnd(); currentpolyid=currentpolyid->next; } glDepthMask(1); glDisable(GL_TEXTURE_2D); } /* Renders all the objects in the current scene */ void sa_r_render_objects(void) { objectinfo *current; current=sa_getfirstobject(); while (current!=NULL) { if (current->visible!=0) { /* Set up this object's position, rotation and scale on the modelview matrix */ glPushMatrix(); glTranslatef( current->pos.x, current->pos.y, current->pos.z); /* Rotation precidence is X->Y->Z, as set here... */ glRotatef(current->rot.x,1,0,0); glRotatef(current->rot.y,0,1,0); /* 0,cos(rad(current->rot.x)), sin(rad(current->rot.x)) */ glRotatef(current->rot.z,0,0,1); glScalef( current->scale.x, current->scale.y, current->scale.z); /* Render all of the polys for this object */ sa_r_render_object_polys(current->polys); /* Restore the previous modelview matrix */ glPopMatrix(); } current=current->next; } } /* Render vertices (this just renderers a dot at each vertex to make them easier to see - it is unrelated to the main polygon renderer) Note : since no object transforms are performed here, the vertices are shown in object-space */ void sa_r_render_vertices(void) { vertexinfo *current; current=sa_getfirstvertex(); glDisable(GL_CULL_FACE); glDisable(GL_LIGHTING); glColor4f(1,0,0,1); glPointSize(5); glBegin(GL_POINTS); while (current!=NULL) { glVertex3f( current->pos.x, current->pos.y, current->pos.z); current=current->next; } glEnd(); } /* The actual renderer function */ void sa_r_render(struct Togl *togl) { globTogl = togl; /* hack [Ash] */ if (!sa_r_initialised) return; DEBUGPRINT("sa_r_render\n", 0); glClearColor(sa_r_bgcolour.r, sa_r_bgcolour.g, sa_r_bgcolour.b, sa_r_bgcolour.a); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); sa_r_setupcamera(); sa_r_setuplighting(); if (sa_r_showaxes) sa_r_render_axes(); sa_r_render_objects(); /* sa_r_render_vertices(); */ Togl_SwapBuffers(togl); } /* Called whenever something has been changed by Eden (from functions.c, mainly) to get the renderer to rerender the scene */ void sa_r_update(void) { if (globTogl) { /* Ben called sa_r_render(globTogl) here, but the performance was pretty poor. This call ensures that many updates made by Eden in one RunSet get combined into one redraw. [Ash] */ Togl_PostRedisplay(globTogl); } } /* Set the axes display state */ void sa_r_setshowaxes(int s) { if (s==1) { sa_r_showaxes=true; } else { sa_r_showaxes=false; } sa_r_update(); } /* Creates a new texture object, binds it and sets up default parameters */ GLint sa_getandbindnewtexture() { GLint a; glGenTextures(1, &a); if (a==0) { errorf("Sasami: Unable to generate texture binding!\n"); } glBindTexture(GL_TEXTURE_2D,a); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); return a; } /* Loads a texture from the specified file */ void sa_loadtexture(char *f) { char o[256]; pngInfo info; DEBUGPRINT("Loading texture file '%s'\n", f); /* pngSetStandardOrientation(1); */ if (pngLoad(f, PNG_NOMIPMAP, PNG_ALPHA, &info) != 1) { errorf("Sasami: unable to load texture file `%s`", f); } else { #ifdef DEBUG if (Debug&8) { fprintf(stderr, "Successfully loaded %s: size=%i,%i depth=%i alpha=%i\n", f, info.Width, info.Height, info.Depth, info.Alpha); } #endif } } #endif /* WANT_SASAMI */ ,0,0); glVertex3f(0,0,1); glVertex3f(0,0,1); glVertex3f(0.1,0,0.8); glVertex3f(0,0,1); glVertex3f(-0.1,0,0.8); glEnd(); } /* Generates a face normal using 3 co-ordinates */ coord sa_get_face_normal(coord a,coord b,coord c) { coord r; double l; a.x=a.x-c.x; a.y=a.y-c.y; a.z=a.z-c.z; b.x=b.x-c.x; b.y=b.y-c.y; b.z=b.z-c.z; r.x=(a.y*b.z)-(a.z*b.y); r.y=(a.z*b.x)-(a.x*b.z)tkeden1.32/Sasami/render.h010060000025250000147000000020330731420030600166570ustar00ashleydcsother00001250000011// -------------------------------------------------------------------------- // render.h - This contains the Sasami OpenGL renderer headers // -------------------------------------------------------------------------- #ifndef __sa_render__ #define __sa_render__ #include "GL/gl.h" #include "GL/glu.h" #include "structures.h" #include "togl.h" // -------------------------------------------------------------------------- // Time (in milliseconds) between forced redraws - determines framerate // -------------------------------------------------------------------------- #define SA_R_REDRAW_TIME 20 // -------------------------------------------------------------------------- // Functions // -------------------------------------------------------------------------- int sa_r_opendisplay(void); void sa_r_closedisplay(void); void sa_r_init(); void sa_r_render(struct Togl *); void sa_r_update(void); void sa_r_resizeviewport(int x,int y); void sa_r_setshowaxes(int s); GLint sa_getandbindnewtexture(); void sa_loadtexture(char *f); #endif tkeden1.32/Sasami/renderinit.c010060000025250000147000000003760727406552400175660ustar00ashleydcsother00001250000011// -------------------------------------------------------------------------- // renderinit.c - This contains the Sasami Windows-related OpenGL init and // shutdown code // -------------------------------------------------------------------------- tkeden1.32/Sasami/structures.c010060000025250000147000000513450731367040400176410ustar00ashleydcsother00001250000011// -------------------------------------------------------------------------- // structures.c - This contains various global Sasami structure functions // -------------------------------------------------------------------------- #include "../config.h" #ifdef WANT_SASAMI #include #include #include "structures.h" #include "debug.h" // -------------------------------------------------------------------------- // Global stuff // -------------------------------------------------------------------------- vertexinfo *firstvertex = NULL; polyinfo *firstpoly = NULL; objectinfo *firstobject = NULL; materialinfo *firstmaterial = NULL; lightinfo *firstlight = NULL; // -------------------------------------------------------------------------- // Vertex-related functions // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Add a new vertex to the vertex list, returning a pointer to the new vertex // -------------------------------------------------------------------------- vertexinfo *sa_addvertex(int n,double x,double y,double z) { vertexinfo *newvertex; vertexinfo *currentvertex; newvertex=malloc(sizeof(vertexinfo)); newvertex->n=n; newvertex->pos.x=x; newvertex->pos.y=y; newvertex->pos.z=z; newvertex->next=NULL; if (firstvertex == NULL) { newvertex->prev=NULL; firstvertex=newvertex; } else { currentvertex=firstvertex; while ((currentvertex->next)!=NULL) currentvertex=currentvertex->next; newvertex->prev=currentvertex; currentvertex->next=newvertex; } return newvertex; } // -------------------------------------------------------------------------- // Finds vertex number in the vertex list // -------------------------------------------------------------------------- vertexinfo *sa_findvertex(int n) { vertexinfo *currentvertex; if (firstvertex==NULL) { // No vertices in list return NULL; } currentvertex=firstvertex; while (((currentvertex->n)!=n) && ((currentvertex->next)!=NULL)) currentvertex=currentvertex->next; if ((currentvertex->n)==n) { // Vertex found return currentvertex; } else { // No vertex found return NULL; } } // -------------------------------------------------------------------------- // Finds vertex number in the vertex list, or creates it if it doesn't // exist // -------------------------------------------------------------------------- vertexinfo *sa_getvertex(int n) { vertexinfo *r; r=sa_findvertex(n); if (r==NULL) { // Create it r=sa_addvertex(n,0,0,0); } return r; } // -------------------------------------------------------------------------- // Dumps the contents of the vertex list to STDOUT (for debugging) // -------------------------------------------------------------------------- void sa_dumpvertices(void) { vertexinfo *currentvertex; if (firstvertex!=NULL) { currentvertex=firstvertex; printf("--- Vertex list ---\n"); while (currentvertex!=NULL) { printf("Vertex %d : (%g,%g,%g)\n",currentvertex->n,currentvertex->pos.x, currentvertex->pos.y,currentvertex->pos.z); currentvertex=currentvertex->next; } printf("-------------------\n"); } else { printf("No vertices to list.\n"); } } // -------------------------------------------------------------------------- // Returns a pointer to the first vertex // -------------------------------------------------------------------------- vertexinfo *sa_getfirstvertex(void) { return firstvertex; } // -------------------------------------------------------------------------- // UID list-related functions // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Add a new UID to , returning a pointer to this UID // -------------------------------------------------------------------------- uidlist *sa_adduidlist(uidlist **first,int n) { uidlist *newuidlist; uidlist *currentuidlist; newuidlist=malloc(sizeof(uidlist)); newuidlist->n=n; newuidlist->uid=0; // No UID in list initially newuidlist->next=NULL; if ((*first) == NULL) { newuidlist->prev=NULL; (*first)=newuidlist; } else { currentuidlist=(*first); while ((currentuidlist->next)!=NULL) currentuidlist=currentuidlist->next; newuidlist->prev=currentuidlist; currentuidlist->next=newuidlist; } return newuidlist; } // -------------------------------------------------------------------------- // Finds UID list entry number // -------------------------------------------------------------------------- uidlist *sa_finduidlist(uidlist **first,int n) { uidlist *currentuidlist; if ((*first)==NULL) { // No UIDs in list return NULL; } currentuidlist=(*first); while (((currentuidlist->n)!=n) && ((currentuidlist->next)!=NULL)) currentuidlist=currentuidlist->next; if ((currentuidlist->n)==n) { // UID found return currentuidlist; } else { // No UID found return NULL; } } // -------------------------------------------------------------------------- // Finds UID number in the UID list, or creates it if it doesn't exist // -------------------------------------------------------------------------- uidlist *sa_getuidlist(uidlist **first,int n) { uidlist *r; r=sa_finduidlist(first,n); if (r==NULL) { // Create it r=sa_adduidlist(first,n); } return r; } // -------------------------------------------------------------------------- // Polygon-related functions // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Add a new polygon to the polygon list, returning a pointer to the new poly // -------------------------------------------------------------------------- polyinfo *sa_addpoly(int n) { polyinfo *newpoly; polyinfo *currentpoly; newpoly=malloc(sizeof(polyinfo)); newpoly->n=n; newpoly->colour.r=1; // Default polygon colour (white) newpoly->colour.g=1; newpoly->colour.b=1; newpoly->colour.a=1; newpoly->material=0; // No material newpoly->geometry=NULL; // No geometry in polygon initially newpoly->texcoords=NULL; newpoly->next=NULL; if (firstpoly == NULL) { newpoly->prev=NULL; firstpoly=newpoly; } else { currentpoly=firstpoly; while ((currentpoly->next)!=NULL) currentpoly=currentpoly->next; newpoly->prev=currentpoly; currentpoly->next=newpoly; } return newpoly; } // -------------------------------------------------------------------------- // Finds polygon number in the polygon list // -------------------------------------------------------------------------- polyinfo *sa_findpoly(int n) { polyinfo *currentpoly; if (firstpoly==NULL) { // No polys in list return NULL; } currentpoly=firstpoly; while (((currentpoly->n)!=n) && ((currentpoly->next)!=NULL)) currentpoly=currentpoly->next; if ((currentpoly->n)==n) { // Polygon found return currentpoly; } else { // No polygon found return NULL; } } // -------------------------------------------------------------------------- // Finds polygon number in the polygon list, or creates it if it doesn't // exist // -------------------------------------------------------------------------- polyinfo *sa_getpoly(int n) { polyinfo *r; r=sa_findpoly(n); if (r==NULL) { // Create it r=sa_addpoly(n); } return r; } // -------------------------------------------------------------------------- // Dumps the contents of the polygon list to STDOUT (for debugging) // -------------------------------------------------------------------------- void sa_dumppolys(void) { polyinfo *currentpoly; uidlist *currentuid; if (firstpoly!=NULL) { currentpoly=firstpoly; printf("--- Poly list ---\n"); while (currentpoly!=NULL) { printf("Poly %d :\n",currentpoly->n); printf(" Geometry :\n"); currentuid=currentpoly->geometry; while (currentuid!=NULL) { printf(" Vertex %d (link UID %d)\n",currentuid->uid,currentuid->n); currentuid=currentuid->next; } printf(" Texture co-ordinates :\n"); currentuid=currentpoly->texcoords; while (currentuid!=NULL) { printf(" Vertex %d (link UID %d)\n",currentuid->uid,currentuid->n); currentuid=currentuid->next; } currentpoly=currentpoly->next; } printf("-----------------\n"); } else { printf("No polys to list.\n"); } } // -------------------------------------------------------------------------- // Returns a pointer to the first polygon // -------------------------------------------------------------------------- polyinfo *sa_getfirstpoly(void) { return firstpoly; } // -------------------------------------------------------------------------- // Object-related functions // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Add a new object to the object list, returning a pointer to the new object // -------------------------------------------------------------------------- objectinfo *sa_addobject(int n) { objectinfo *newobj; objectinfo *currentobj; newobj=malloc(sizeof(objectinfo)); newobj->n=n; newobj->polys=NULL; newobj->pos.x=0; newobj->pos.y=0; newobj->pos.z=0; newobj->rot.x=0; newobj->rot.y=0; newobj->rot.z=0; newobj->scale.x=1; newobj->scale.y=1; newobj->scale.z=1; newobj->visible=1; newobj->next=NULL; if (firstobject == NULL) { newobj->prev=NULL; firstobject=newobj; } else { currentobj=firstobject; while ((currentobj->next)!=NULL) currentobj=currentobj->next; newobj->prev=currentobj; currentobj->next=newobj; } return newobj; } // -------------------------------------------------------------------------- // Finds object number in the object list // -------------------------------------------------------------------------- objectinfo *sa_findobject(int n) { objectinfo *currentobj; if (firstobject==NULL) { // No objects in list return NULL; } currentobj=firstobject; while (((currentobj->n)!=n) && ((currentobj->next)!=NULL)) currentobj=currentobj->next; if ((currentobj->n)==n) { // Object found return currentobj; } else { // No object found return NULL; } } // -------------------------------------------------------------------------- // Finds object number in the object list, or creates it if it doesn't // exist // -------------------------------------------------------------------------- objectinfo *sa_getobject(int n) { objectinfo *r; r=sa_findobject(n); if (r==NULL) { // Create it r=sa_addobject(n); } return r; } // -------------------------------------------------------------------------- // Dumps the contents of the object list to STDOUT (for debugging) // -------------------------------------------------------------------------- void sa_dumpobjects(void) { objectinfo *currentobject; uidlist *currentuid; if (firstobject!=NULL) { currentobject=firstobject; printf("--- Object list ---\n"); while (currentobject!=NULL) { printf("Object %d :\n",currentobject->n); printf(" Polys :\n"); currentuid=currentobject->polys; while (currentuid!=NULL) { printf(" Poly %d (link UID %d)\n",currentuid->uid,currentuid->n); currentuid=currentuid->next; } currentobject=currentobject->next; } printf("-------------------\n"); } else { printf("No objects to list.\n"); } } // -------------------------------------------------------------------------- // Returns a pointer to the first object // -------------------------------------------------------------------------- objectinfo *sa_getfirstobject(void) { return firstobject; } // -------------------------------------------------------------------------- // Material-related functions // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Add a new material to the material list, returning a pointer to the new // material. // -------------------------------------------------------------------------- materialinfo *sa_addmaterial(int n) { materialinfo *newmaterial; materialinfo *currentmaterial; newmaterial=malloc(sizeof(materialinfo)); newmaterial->n=n; newmaterial->ambient.r=0.1; newmaterial->ambient.g=0.1; newmaterial->ambient.b=0.1; newmaterial->ambient.a=1; newmaterial->diffuse.r=0.7; newmaterial->diffuse.g=0.7; newmaterial->diffuse.b=0.7; newmaterial->diffuse.a=1; newmaterial->specular.r=1; newmaterial->specular.g=1; newmaterial->specular.b=1; newmaterial->specular.a=1; newmaterial->texturefile=NULL; newmaterial->texture=0; newmaterial->textureneedsloading=0; newmaterial->next=NULL; if (firstmaterial == NULL) { newmaterial->prev=NULL; firstmaterial=newmaterial; } else { currentmaterial=firstmaterial; while ((currentmaterial->next)!=NULL) currentmaterial=currentmaterial->next; newmaterial->prev=currentmaterial; currentmaterial->next=newmaterial; } return newmaterial; } // -------------------------------------------------------------------------- // Finds material number in the list // -------------------------------------------------------------------------- materialinfo *sa_findmaterial(int n) { materialinfo *currentmaterial; if (firstmaterial==NULL) { // No materials in list return NULL; } currentmaterial=firstmaterial; while (((currentmaterial->n)!=n) && ((currentmaterial->next)!=NULL)) currentmaterial=currentmaterial->next; if ((currentmaterial->n)==n) { // Material found return currentmaterial; } else { // Nothing found return NULL; } } // -------------------------------------------------------------------------- // Finds material number in the list, or creates it if it doesn't // exist // -------------------------------------------------------------------------- materialinfo *sa_getmaterial(int n) { materialinfo *r; r=sa_findmaterial(n); if (r==NULL) { // Create it r=sa_addmaterial(n); } return r; } // -------------------------------------------------------------------------- // Dumps the contents of the material list to STDOUT (for debugging) // -------------------------------------------------------------------------- void sa_dumpmaterials(void) { materialinfo *currentmaterial; if (firstmaterial!=NULL) { currentmaterial=firstmaterial; printf("--- Material list ---\n"); while (currentmaterial!=NULL) { printf("Material %d :\n",currentmaterial->n); printf("Ambient : %g,%g,%g\n",currentmaterial->ambient.r,currentmaterial->ambient.g,currentmaterial->ambient.b); printf("Diffuse : %g,%g,%g\n",currentmaterial->diffuse.r,currentmaterial->diffuse.g,currentmaterial->diffuse.b); printf("Specular : %g,%g,%g\n",currentmaterial->specular.r,currentmaterial->specular.g,currentmaterial->specular.b); if (currentmaterial->texturefile==NULL) { printf("No texture\n"); } else { printf("Texture file : \"%s\" \n",currentmaterial->texturefile); } currentmaterial=currentmaterial->next; } printf("---------------------\n"); } else { printf("No materials to list.\n"); } } // -------------------------------------------------------------------------- // Returns a pointer to the first material // -------------------------------------------------------------------------- materialinfo *sa_getfirstmaterial(void) { return firstmaterial; } // -------------------------------------------------------------------------- // Light-related functions // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Add a new light to the light list, returning a pointer to the new // light. // -------------------------------------------------------------------------- lightinfo *sa_addlight(int n) { lightinfo *newlight; lightinfo *currentlight; newlight=malloc(sizeof(lightinfo)); newlight->n=n; newlight->ambient.r=0.1; newlight->ambient.g=0.1; newlight->ambient.b=0.1; newlight->ambient.a=1; newlight->diffuse.r=0.7; newlight->diffuse.g=0.7; newlight->diffuse.b=0.7; newlight->diffuse.a=1; newlight->specular.r=1; newlight->specular.g=1; newlight->specular.b=1; newlight->specular.a=1; newlight->pos.x=0; newlight->pos.y=0; newlight->pos.z=0; newlight->attenuation=0; newlight->enabled=1; newlight->directional=0; newlight->next=NULL; if (firstlight == NULL) { newlight->prev=NULL; firstlight=newlight; } else { currentlight=firstlight; while ((currentlight->next)!=NULL) currentlight=currentlight->next; newlight->prev=currentlight; currentlight->next=newlight; } return newlight; } // -------------------------------------------------------------------------- // Finds light number in the list // -------------------------------------------------------------------------- lightinfo *sa_findlight(int n) { lightinfo *currentlight; if (firstlight==NULL) { // No lights in list return NULL; } currentlight=firstlight; while (((currentlight->n)!=n) && ((currentlight->next)!=NULL)) currentlight=currentlight->next; if ((currentlight->n)==n) { // light found return currentlight; } else { // Nothing found return NULL; } } // -------------------------------------------------------------------------- // Finds light number in the list, or creates it if it doesn't // exist // -------------------------------------------------------------------------- lightinfo *sa_getlight(int n) { lightinfo *r; r=sa_findlight(n); if (r==NULL) { // Create it r=sa_addlight(n); } return r; } // -------------------------------------------------------------------------- // Dumps the contents of the light list to STDOUT (for debugging) // -------------------------------------------------------------------------- void sa_dumplights(void) { lightinfo *currentlight; if (firstlight!=NULL) { currentlight=firstlight; printf("--- light list ---\n"); while (currentlight!=NULL) { printf("light %d :\n",currentlight->n); if (currentlight->enabled==1) printf("Enabled\n"); else printf("Disabled\n"); if (currentlight->directional==1) printf("Directional\n"); else printf("Positional\n"); printf("Position : %g,%g,%g\n",currentlight->pos.x,currentlight->pos.y,currentlight->pos.z); printf("Ambient : %g,%g,%g\n",currentlight->ambient.r,currentlight->ambient.g,currentlight->ambient.b); printf("Diffuse : %g,%g,%g\n",currentlight->diffuse.r,currentlight->diffuse.g,currentlight->diffuse.b); printf("Specular : %g,%g,%g\n",currentlight->specular.r,currentlight->specular.g,currentlight->specular.b); printf("Attenuation : %g\n",currentlight->attenuation); currentlight=currentlight->next; } printf("---------------------\n"); } else { printf("No lights to list.\n"); } } // -------------------------------------------------------------------------- // Returns a pointer to the first light // -------------------------------------------------------------------------- lightinfo *sa_getfirstlight(void) { return firstlight; } // -------------------------------------------------------------------------- // General list-related functions // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Add a new entry to , returning a pointer to it // -------------------------------------------------------------------------- list *sa_addlist(list **first,int n) { list *newlist; list *currentlist; newlist=malloc(sizeof(list)); newlist->n=n; newlist->idata=0; // No data to start with newlist->data=NULL; newlist->next=NULL; if ((*first) == NULL) { newlist->prev=NULL; (*first)=newlist; } else { currentlist=(*first); while ((currentlist->next)!=NULL) currentlist=currentlist->next; newlist->prev=currentlist; currentlist->next=newlist; } return newlist; } // -------------------------------------------------------------------------- // Finds list entry number // -------------------------------------------------------------------------- list *sa_findlist(list **first,int n) { list *currentlist; if ((*first)==NULL) { // No UIDs in list return NULL; } currentlist=(*first); while (((currentlist->n)!=n) && ((currentlist->next)!=NULL)) currentlist=currentlist->next; if ((currentlist->n)==n) { // UID found return currentlist; } else { // No UID found return NULL; } } // -------------------------------------------------------------------------- // Finds UID number in the UID list, or creates it if it doesn't exist // -------------------------------------------------------------------------- list *sa_getlist(list **first,int n) { list *r; r=sa_findlist(first,n); if (r==NULL) { // Create it r=sa_addlist(first,n); } return r; } #endif /* WANT_SASAMI */ ------------------------------ void sa_dumpobjects(void) { objectinfo *currentobject; uidlist *currentuid; if (firstobject!=NULL) { currentobject=firstobject; printf("--- Object list ---\n"); while (currentobject!=NULL) { printf("Object %d :\n",currentobject->n); tkeden1.32/Sasami/structures.h010060000025250000147000000123260731570416600176470ustar00ashleydcsother00001250000011// -------------------------------------------------------------------------- // structures.h - This contains definations for the Sasami structures and // functions to operate on them // -------------------------------------------------------------------------- #ifndef __sa_structures__ #define __sa_structures__ #include "debug.h" #include "render.h" // -------------------------------------------------------------------------- // Coordinate X,Y,Z triple // -------------------------------------------------------------------------- typedef struct coordptr { double x,y,z; } coord; // -------------------------------------------------------------------------- // RGBA colour // -------------------------------------------------------------------------- typedef struct colourinfoptr { double r,g,b,a; } colourinfo; // -------------------------------------------------------------------------- // Vertex // -------------------------------------------------------------------------- typedef struct materialinfoptr { int n; colourinfo ambient; colourinfo diffuse; colourinfo specular; char *texturefile; GLint texture; int textureneedsloading; struct materialinfoptr *next; struct materialinfoptr *prev; } materialinfo; // -------------------------------------------------------------------------- // UID List // -------------------------------------------------------------------------- typedef struct _uidlist { int n; // UID of this UID (if that makes sense) // i.e. a unique reference number for this // entry in this UID list (may be either // a "true" GUID or just a convienient // number) int uid; // Actual list entry data struct _uidlist *next; struct _uidlist *prev; } uidlist; // -------------------------------------------------------------------------- // Vertex // -------------------------------------------------------------------------- typedef struct vertexinfoptr { int n; coord pos; struct vertexinfoptr *next; struct vertexinfoptr *prev; } vertexinfo; // -------------------------------------------------------------------------- // Polygon // -------------------------------------------------------------------------- typedef struct polyinfoptr { int n; uidlist *geometry; // List of vertices uidlist *texcoords; colourinfo colour; int material; struct polyinfoptr *next; struct polyinfoptr *prev; } polyinfo; // -------------------------------------------------------------------------- // Object // -------------------------------------------------------------------------- typedef struct objectinfoptr { int n; coord pos; coord rot; coord scale; int visible; uidlist *polys; // List of polygons struct objectinfoptr *next; struct objectinfoptr *prev; } objectinfo; // -------------------------------------------------------------------------- // Light // -------------------------------------------------------------------------- typedef struct lightinfoptr { int n; coord pos; colourinfo ambient; colourinfo diffuse; colourinfo specular; int enabled; double attenuation; int directional; struct lightinfoptr *next; struct lightinfoptr *prev; } lightinfo; // -------------------------------------------------------------------------- // General-purpose list // -------------------------------------------------------------------------- typedef struct _list { int n; // UID of this UID (if that makes sense) // i.e. a unique reference number for this // entry in this UID list (may be either // a "true" GUID or just a convienient // number) int idata; // Integer value data void *data; // General-purpose data pointer struct _list *next; struct _list *prev; } list; // -------------------------------------------------------------------------- // Functions // -------------------------------------------------------------------------- // Vertex-related vertexinfo *sa_addvertex(int n,double x,double y,double z); vertexinfo *sa_findvertex(int n); vertexinfo *sa_getvertex(int n); void sa_dumpvertices(void); vertexinfo *sa_getfirstvertex(void); // UID list related uidlist *sa_adduidlist(uidlist **first,int n); uidlist *sa_finduidlist(uidlist **first,int n); uidlist *sa_getuidlist(uidlist **first,int n); // Polygon-related polyinfo *sa_addpoly(int n); polyinfo *sa_findpoly(int n); polyinfo *sa_getpoly(int n); void sa_dumppolys(void); polyinfo *sa_getfirstpoly(void); // Object-related objectinfo *sa_addobject(int n); objectinfo *sa_findobject(int n); objectinfo *sa_getobject(int n); void sa_dumpobjects(void); objectinfo *sa_getfirstobject(void); // Material-related materialinfo *sa_addmaterial(int n); materialinfo *sa_findmaterial(int n); materialinfo *sa_getmaterial(int n); void sa_dumpmaterials(void); materialinfo *sa_getfirstmaterial(void); // Light-related lightinfo *sa_addlight(int n); lightinfo *sa_findlight(int n); lightinfo *sa_getlight(int n); void sa_dumplights(void); lightinfo *sa_getfirstlight(void); // List-related list *sa_addlist(list **first,int n); list *sa_findlist(list **first,int n); list *sa_getlist(list **first,int n); #endif tkeden1.32/Sasami/togl.c010060000025250000147000003151200735020372400163530ustar00ashleydcsother00001250000011/* $Id: togl.c,v 1.1 2001/08/01 18:23:22 cssbz Exp $ */ /* * Togl - a Tk OpenGL widget * Version 1.6 * Copyright (C) 1996-2000 Brian Paul and Ben Bederson * See the LICENSE file for copyright details. */ /* ADDED BY ASH - START */ #include "../config.h" #ifdef WANT_SASAMI #ifndef __WIN32__ # if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) # define __WIN32__ # define WIN32 # endif #endif /* ADDED BY ASH - END */ /* * Currently we support X11, Win32 and Macintosh only */ #if !defined(WIN32) && !defined(macintosh) #define X11 #endif /*** Windows headers ***/ #if defined(WIN32) && !defined(X11) && !defined(macintosh) #define WIN32_LEAN_AND_MEAN #include #undef WIN32_LEAN_AND_MEAN #include /* ADDED BY ASH - START */ #include #include /* ADDED BY ASH - END */ /*** X Window System headers ***/ #elif defined(X11) && !defined(WIN32) && !defined(macintosh) #include #include #include /* for XA_RGB_DEFAULT_MAP atom */ #if defined(__vms) #include /* for XmuLookupStandardColormap */ #else #ifndef __CYGWIN__ #include /* for XmuLookupStandardColormap */ #endif #endif #ifndef __CYGWIN__ #include #endif /*** Mac headers ***/ #elif defined(macintosh) && !defined(WIN32) && !defined(X11) #include #include #include #include #else /* make sure only one platform defined */ #error Unsupported platform, or confused platform defines... #endif /*** Standard C headers ***/ #include #include #include #include #include #include #ifdef WIN32 # include #endif #if TK_MAJOR_VERSION<8 # error Sorry Togl requires Tcl/Tk ver 8.0 or higher. #endif #if defined(macintosh) # if TK_MAJOR_VERSION<8 || TK_MINOR_VERSION<3 # error Sorry Mac version requires Tcl/Tk ver 8.3.0 or higher. # endif #endif /* Mac */ /* workaround for bug #123153 in tcl ver8.4a2 (tcl.h) */ #if defined(Tcl_InitHashTable) && defined(USE_TCL_STUBS) #undef Tcl_InitHashTable #define Tcl_InitHashTable (tclStubsPtr->tcl_InitHashTable) #endif #if TK_MAJOR_VERSION>=8 && TK_MINOR_VERSION>=4 && TK_RELEASE_LEVEL >= TCL_ALPHA_RELEASE && TK_RELEASE_SERIAL >= 2 # define HAVE_TK_SETCLASSPROCS /* pointer to Tk_SetClassProcs function in the stub table */ static void (*SetClassProcsPtr) _ANSI_ARGS_((Tk_Window, Tk_ClassProcs*,ClientData)); #endif /* * Copy of TkClassProcs declarations form tkInt.h * (this is needed for Tcl ver =< 8.4a2) */ typedef int (TkBindEvalProc) _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp, XEvent *eventPtr, Tk_Window tkwin, KeySym keySym)); typedef void (TkBindFreeProc) _ANSI_ARGS_((ClientData clientData)); typedef Window (TkClassCreateProc) _ANSI_ARGS_((Tk_Window tkwin, Window parent, ClientData instanceData)); typedef void (TkClassGeometryProc) _ANSI_ARGS_((ClientData instanceData)); typedef void (TkClassModalProc) _ANSI_ARGS_((Tk_Window tkwin, XEvent *eventPtr)); typedef struct TkClassProcs { TkClassCreateProc *createProc; TkClassGeometryProc *geometryProc; TkClassModalProc *modalProc; } TkClassProcs; #include "togl.h" /* Defaults */ #define DEFAULT_WIDTH "400" #define DEFAULT_HEIGHT "400" #define DEFAULT_IDENT "" #define DEFAULT_FONTNAME "fixed" #define DEFAULT_TIME "1" #ifdef WIN32 /* Maximum size of a logical palette corresponding to a colormap * in color index mode. */ #define MAX_CI_COLORMAP_SIZE 4096 /* * copy of TkWinColormap from tkWinInt.h */ typedef struct { HPALETTE palette; /* Palette handle used when drawing. */ UINT size; /* Number of entries in the palette. */ int stale; /* 1 if palette needs to be realized, * otherwise 0. If the palette is stale, * then an idle handler is scheduled to * realize the palette. */ Tcl_HashTable refCounts; /* Hash table of palette entry reference counts * indexed by pixel value. */ } TkWinColormap; static LRESULT (CALLBACK *tkWinChildProc)(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) = NULL; #define TK_WIN_CHILD_CLASS_NAME "TkChild" #endif /* WIN32 */ #define MAX(a,b) (((a)>(b))?(a):(b)) #define TCL_ERR(interp, string) \ do { \ Tcl_ResetResult(interp); \ Tcl_AppendResult(interp, string, NULL); \ return TCL_ERROR; \ } while (0) #define ALL_EVENTS_MASK \ (KeyPressMask | \ KeyReleaseMask | \ ButtonPressMask | \ ButtonReleaseMask | \ EnterWindowMask | \ LeaveWindowMask | \ PointerMotionMask | \ ExposureMask | \ VisibilityChangeMask | \ FocusChangeMask | \ PropertyChangeMask | \ ColormapChangeMask) struct Togl { struct Togl *Next; /* next in linked list */ #if defined(WIN32) HDC tglGLHdc; /* Device context of device that OpenGL calls will be drawn on */ HGLRC tglGLHglrc; /* OpenGL rendering context to be made current */ int CiColormapSize; /* (Maximum) size of colormap in color index mode */ #elif defined(X11) GLXContext GlCtx; /* Normal planes GLX context */ #elif defined(macintosh) AGLContext aglCtx; #endif /* WIN32 */ Display *display; /* X's token for the window's display. */ Tk_Window TkWin; /* Tk window structure */ Tcl_Interp *Interp; /* Tcl interpreter */ Tcl_Command widgetCmd; /* Token for togl's widget command */ #ifndef NO_TK_CURSOR Tk_Cursor Cursor; /* The widget's cursor */ #endif int Width, Height; /* Dimensions of window */ int TimerInterval; /* Time interval for timer in milliseconds */ #if (TCL_MAJOR_VERSION * 100 + TCL_MINOR_VERSION) >= 705 Tcl_TimerToken timerHandler; /* Token for togl's timer handler */ #else Tk_TimerToken timerHandler; /* Token for togl's timer handler */ #endif int RgbaFlag; /* configuration flags (ala GLX parameters) */ int RgbaRed; int RgbaGreen; int RgbaBlue; int DoubleFlag; int DepthFlag; int DepthSize; int AccumFlag; int AccumRed; int AccumGreen; int AccumBlue; int AccumAlpha; int AlphaFlag; int AlphaSize; int StencilFlag; int StencilSize; int PrivateCmapFlag; int OverlayFlag; int StereoFlag; int AuxNumber; int Indirect; char *ShareList; /* name (ident) of Togl to share dlists with */ char *ShareContext; /* name (ident) to share OpenGL context with */ char *Ident; /* User's identification string */ ClientData Client_Data; /* Pointer to user data */ GLboolean UpdatePending; /* Should normal planes be redrawn? */ Togl_Callback *CreateProc; /* Callback when widget is created */ Togl_Callback *DisplayProc; /* Callback when widget is rendered */ Togl_Callback *ReshapeProc; /* Callback when window size changes */ Togl_Callback *DestroyProc; /* Callback when widget is destroyed */ Togl_Callback *TimerProc; /* Callback when widget is idle */ /* Overlay stuff */ #if defined(X11) GLXContext OverlayCtx; /* Overlay planes OpenGL context */ #elif defined(WIN32) HGLRC tglGLOverlayHglrc; #endif /* X11 */ Window OverlayWindow; /* The overlay window, or 0 */ Togl_Callback *OverlayDisplayProc; /* Overlay redraw proc */ GLboolean OverlayUpdatePending; /* Should overlay be redrawn? */ Colormap OverlayCmap; /* colormap for overlay is created */ int OverlayTransparentPixel; /* transparent pixel */ int OverlayIsMapped; /* for DumpToEpsFile: Added by Miguel A. de Riera Pasenau 10.01.1997 */ XVisualInfo *VisInfo; /* Visual info of the current */ /* context needed for DumpToEpsFile */ GLfloat *EpsRedMap; /* Index2RGB Maps for Color index modes */ GLfloat *EpsGreenMap; GLfloat *EpsBlueMap; GLint EpsMapSize; /* = Number of indices in our Togl */ }; /* NTNTNT need to change to handle Windows Data Types */ /* * Prototypes for functions local to this file */ static int Togl_Cmd(ClientData clientData, Tcl_Interp *interp, int argc, char **argv); static void Togl_EventProc(ClientData clientData, XEvent *eventPtr); static Window Togl_CreateWindow(Tk_Window, Window, ClientData); #ifdef MESA_COLOR_HACK static int get_free_color_cells( Display *display, int screen, Colormap colormap); static void free_default_color_cells( Display *display, Colormap colormap); #endif static void ToglCmdDeletedProc( ClientData ); #if defined(__sgi) && defined(STEREO) /* SGI-only stereo */ static void stereoMakeCurrent( Display *dpy, Window win, GLXContext ctx ); static void stereoInit( struct Togl *togl,int stereoEnabled ); #endif #ifdef macintosh static void SetMacBufRect(struct Togl *togl); #endif /* * Setup Togl widget configuration options: */ static Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_PIXELS, "-height", "height", "Height", DEFAULT_HEIGHT, Tk_Offset(struct Togl, Height), 0, NULL}, {TK_CONFIG_PIXELS, "-width", "width", "Width", DEFAULT_WIDTH, Tk_Offset(struct Togl, Width), 0, NULL}, {TK_CONFIG_BOOLEAN, "-rgba", "rgba", "Rgba", "true", Tk_Offset(struct Togl, RgbaFlag), 0, NULL}, {TK_CONFIG_INT, "-redsize", "redsize", "RedSize", "1", Tk_Offset(struct Togl, RgbaRed), 0, NULL}, {TK_CONFIG_INT, "-greensize", "greensize", "GreenSize", "1", Tk_Offset(struct Togl, RgbaGreen), 0, NULL}, {TK_CONFIG_INT, "-bluesize", "bluesize", "BlueSize", "1", Tk_Offset(struct Togl, RgbaBlue), 0, NULL}, {TK_CONFIG_BOOLEAN, "-double", "double", "Double", "false", Tk_Offset(struct Togl, DoubleFlag), 0, NULL}, {TK_CONFIG_BOOLEAN, "-depth", "depth", "Depth", "false", Tk_Offset(struct Togl, DepthFlag), 0, NULL}, {TK_CONFIG_INT, "-depthsize", "depthsize", "DepthSize", "1", Tk_Offset(struct Togl, DepthSize), 0, NULL}, {TK_CONFIG_BOOLEAN, "-accum", "accum", "Accum", "false", Tk_Offset(struct Togl, AccumFlag), 0, NULL}, {TK_CONFIG_INT, "-accumredsize", "accumredsize", "AccumRedSize", "1", Tk_Offset(struct Togl, AccumRed), 0, NULL}, {TK_CONFIG_INT, "-accumgreensize", "accumgreensize", "AccumGreenSize", "1", Tk_Offset(struct Togl, AccumGreen), 0, NULL}, {TK_CONFIG_INT, "-accumbluesize", "accumbluesize", "AccumBlueSize", "1", Tk_Offset(struct Togl, AccumBlue), 0, NULL}, {TK_CONFIG_INT, "-accumalphasize", "accumalphasize", "AccumAlphaSize", "1", Tk_Offset(struct Togl, AccumAlpha), 0, NULL}, {TK_CONFIG_BOOLEAN, "-alpha", "alpha", "Alpha", "false", Tk_Offset(struct Togl, AlphaFlag), 0, NULL}, {TK_CONFIG_INT, "-alphasize", "alphasize", "AlphaSize", "1", Tk_Offset(struct Togl, AlphaSize), 0, NULL}, {TK_CONFIG_BOOLEAN, "-stencil", "stencil", "Stencil", "false", Tk_Offset(struct Togl, StencilFlag), 0, NULL}, {TK_CONFIG_INT, "-stencilsize", "stencilsize", "StencilSize", "1", Tk_Offset(struct Togl, StencilSize), 0, NULL}, {TK_CONFIG_INT, "-auxbuffers", "auxbuffers", "AuxBuffers", "0", Tk_Offset(struct Togl, AuxNumber), 0, NULL}, {TK_CONFIG_BOOLEAN, "-privatecmap", "privateCmap", "PrivateCmap", "false", Tk_Offset(struct Togl, PrivateCmapFlag), 0, NULL}, {TK_CONFIG_BOOLEAN, "-overlay", "overlay", "Overlay", "false", Tk_Offset(struct Togl, OverlayFlag), 0, NULL}, {TK_CONFIG_BOOLEAN, "-stereo", "stereo", "Stereo", "false", Tk_Offset(struct Togl, StereoFlag), 0, NULL}, #ifndef NO_TK_CURSOR { TK_CONFIG_ACTIVE_CURSOR, "-cursor", "cursor", "Cursor", "", Tk_Offset(struct Togl, Cursor), TK_CONFIG_NULL_OK }, #endif {TK_CONFIG_INT, "-time", "time", "Time", DEFAULT_TIME, Tk_Offset(struct Togl, TimerInterval), 0, NULL}, {TK_CONFIG_STRING, "-sharelist", "sharelist", "ShareList", NULL, Tk_Offset(struct Togl, ShareList), 0, NULL}, {TK_CONFIG_STRING, "-sharecontext", "sharecontext", "ShareContext", NULL, Tk_Offset(struct Togl, ShareContext), 0, NULL}, {TK_CONFIG_STRING, "-ident", "ident", "Ident", DEFAULT_IDENT, Tk_Offset(struct Togl, Ident), 0, NULL}, {TK_CONFIG_BOOLEAN, "-indirect", "indirect", "Indirect", "false", Tk_Offset(struct Togl, Indirect), 0, NULL}, {TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL, (char *) NULL, 0, 0, NULL} }; /* * Default callback pointers. When a new Togl widget is created it * will be assigned these initial callbacks. */ static Togl_Callback *DefaultCreateProc = NULL; static Togl_Callback *DefaultDisplayProc = NULL; static Togl_Callback *DefaultReshapeProc = NULL; static Togl_Callback *DefaultDestroyProc = NULL; static Togl_Callback *DefaultOverlayDisplayProc = NULL; static Togl_Callback *DefaultTimerProc = NULL; static ClientData DefaultClientData = NULL; static Tcl_HashTable CommandTable; /* * Head of linked list of all Togl widgets */ static struct Togl *ToglHead = NULL; /* * Add given togl widget to linked list. */ static void AddToList(struct Togl *t) { t->Next = ToglHead; ToglHead = t; } /* * Remove given togl widget from linked list. */ static void RemoveFromList(struct Togl *t) { struct Togl *prev = NULL; struct Togl *pos = ToglHead; while (pos) { if (pos == t) { if (prev) { prev->Next = pos->Next; } else { ToglHead = pos->Next; } return; } prev = pos; pos = pos->Next; } } /* * Return pointer to togl widget given a user identifier string. */ static struct Togl *FindTogl(const char *ident) { struct Togl *t = ToglHead; while (t) { if (strcmp(t->Ident, ident) == 0) return t; t = t->Next; } return NULL; } #if defined(X11) /* * Return an X colormap to use for OpenGL RGB-mode rendering. * Input: dpy - the X display * scrnum - the X screen number * visinfo - the XVisualInfo as returned by glXChooseVisual() * Return: an X Colormap or 0 if there's a _serious_ error. */ static Colormap get_rgb_colormap( Display *dpy, int scrnum, const XVisualInfo *visinfo, Tk_Window tkwin) { Atom hp_cr_maps; Status status; int numCmaps; int i; XStandardColormap *standardCmaps; Window root = XRootWindow(dpy,scrnum); int using_mesa; /* * First check if visinfo's visual matches the default/root visual. */ if (visinfo->visual==Tk_Visual(tkwin)) { /* use the default/root colormap */ Colormap cmap; cmap = Tk_Colormap(tkwin); #ifdef MESA_COLOR_HACK (void) get_free_color_cells( dpy, scrnum, cmap); #endif return cmap; } /* * Check if we're using Mesa. */ if (strstr(glXQueryServerString( dpy, scrnum, GLX_VERSION ), "Mesa")) { using_mesa = 1; } else { using_mesa = 0; } /* * Next, if we're using Mesa and displaying on an HP with the "Color * Recovery" feature and the visual is 8-bit TrueColor, search for a * special colormap initialized for dithering. Mesa will know how to * dither using this colormap. */ if (using_mesa) { hp_cr_maps = XInternAtom( dpy, "_HP_RGB_SMOOTH_MAP_LIST", True ); if (hp_cr_maps #ifdef __cplusplus && visinfo->visual->c_class==TrueColor #else && visinfo->visual->class==TrueColor #endif && visinfo->depth==8) { status = XGetRGBColormaps( dpy, root, &standardCmaps, &numCmaps, hp_cr_maps ); if (status) { for (i=0; ivisual->visualid) { Colormap cmap = standardCmaps[i].colormap; XFree( standardCmaps ); return cmap; } } XFree(standardCmaps); } } } /* * Next, try to find a standard X colormap. */ #if !HP && !SUN #ifndef SOLARIS_BUG status = XmuLookupStandardColormap( dpy, visinfo->screen, visinfo->visualid, visinfo->depth, XA_RGB_DEFAULT_MAP, /* replace */ False, /* retain */ True); if (status == 1) { status = XGetRGBColormaps( dpy, root, &standardCmaps, &numCmaps, XA_RGB_DEFAULT_MAP); if (status == 1) { for (i = 0; i < numCmaps; i++) { if (standardCmaps[i].visualid == visinfo->visualid) { Colormap cmap = standardCmaps[i].colormap; XFree(standardCmaps); return cmap; } } XFree(standardCmaps); } } #endif #endif /* * If we get here, give up and just allocate a new colormap. */ return XCreateColormap( dpy, root, visinfo->visual, AllocNone ); } #elif defined(WIN32) /* Code to create RGB palette is taken from the GENGL sample program of Win32 SDK */ static unsigned char threeto8[8] = { 0, 0111>>1, 0222>>1, 0333>>1, 0444>>1, 0555>>1, 0666>>1, 0377 }; static unsigned char twoto8[4] = { 0, 0x55, 0xaa, 0xff }; static unsigned char oneto8[2] = { 0, 255 }; static int defaultOverride[13] = { 0, 3, 24, 27, 64, 67, 88, 173, 181, 236, 247, 164, 91 }; static PALETTEENTRY defaultPalEntry[20] = { { 0, 0, 0, 0 }, { 0x80,0, 0, 0 }, { 0, 0x80,0, 0 }, { 0x80,0x80,0, 0 }, { 0, 0, 0x80, 0 }, { 0x80,0, 0x80, 0 }, { 0, 0x80,0x80, 0 }, { 0xC0,0xC0,0xC0, 0 }, { 192, 220, 192, 0 }, { 166, 202, 240, 0 }, { 255, 251, 240, 0 }, { 160, 160, 164, 0 }, { 0x80,0x80,0x80, 0 }, { 0xFF,0, 0, 0 }, { 0, 0xFF,0, 0 }, { 0xFF,0xFF,0, 0 }, { 0, 0, 0xFF, 0 }, { 0xFF,0, 0xFF, 0 }, { 0, 0xFF,0xFF, 0 }, { 0xFF,0xFF,0xFF, 0 } }; static unsigned char ComponentFromIndex(int i, UINT nbits, UINT shift) { unsigned char val; val = (unsigned char) (i >> shift); switch (nbits) { case 1: val &= 0x1; return oneto8[val]; case 2: val &= 0x3; return twoto8[val]; case 3: val &= 0x7; return threeto8[val]; default: return 0; } } static Colormap Win32CreateRgbColormap(PIXELFORMATDESCRIPTOR pfd) { TkWinColormap *cmap = (TkWinColormap *) ckalloc(sizeof(TkWinColormap)); LOGPALETTE *pPal; int n, i; n = 1 << pfd.cColorBits; pPal = (PLOGPALETTE)LocalAlloc(LMEM_FIXED, sizeof(LOGPALETTE) + n * sizeof(PALETTEENTRY)); pPal->palVersion = 0x300; pPal->palNumEntries = n; for (i=0; ipalPalEntry[i].peRed = ComponentFromIndex(i, pfd.cRedBits, pfd.cRedShift); pPal->palPalEntry[i].peGreen = ComponentFromIndex(i, pfd.cGreenBits, pfd.cGreenShift); pPal->palPalEntry[i].peBlue = ComponentFromIndex(i, pfd.cBlueBits, pfd.cBlueShift); pPal->palPalEntry[i].peFlags = 0; } /* fix up the palette to include the default GDI palette */ if ((pfd.cColorBits == 8) && (pfd.cRedBits == 3) && (pfd.cRedShift == 0) && (pfd.cGreenBits == 3) && (pfd.cGreenShift == 3) && (pfd.cBlueBits == 2) && (pfd.cBlueShift == 6) ) { for (i = 1 ; i <= 12 ; i++) pPal->palPalEntry[defaultOverride[i]] = defaultPalEntry[i]; } cmap->palette = CreatePalette(pPal); LocalFree(pPal); cmap->size = n; cmap->stale = 0; /* Since this is a private colormap of a fix size, we do not need a valid hash table, but a dummy one */ Tcl_InitHashTable(&cmap->refCounts, TCL_ONE_WORD_KEYS); return (Colormap)cmap; } static Colormap Win32CreateCiColormap(struct Togl *togl) { /* Create a colormap with size of togl->CiColormapSize and set all entries to black */ LOGPALETTE logPalette; TkWinColormap *cmap = (TkWinColormap *) ckalloc(sizeof(TkWinColormap)); logPalette.palVersion = 0x300; logPalette.palNumEntries = 1; logPalette.palPalEntry[0].peRed = 0; logPalette.palPalEntry[0].peGreen = 0; logPalette.palPalEntry[0].peBlue = 0; logPalette.palPalEntry[0].peFlags = 0; cmap->palette = CreatePalette(&logPalette); cmap->size = togl->CiColormapSize; ResizePalette(cmap->palette, cmap->size); /* sets new entries to black */ cmap->stale = 0; /* Since this is a private colormap of a fix size, we do not need a valid hash table, but a dummy one */ Tcl_InitHashTable(&cmap->refCounts, TCL_ONE_WORD_KEYS); return (Colormap)cmap; } #endif /*X11*/ /* * Togl_Init * * Called upon system startup to create Togl command. */ int Togl_Init(Tcl_Interp *interp) { int major,minor,patchLevel,releaseType; #ifdef USE_TCL_STUBS if (Tcl_InitStubs(interp, "8.1", 0) == NULL) {return TCL_ERROR;} #endif #ifdef USE_TK_STUBS if (Tk_InitStubs(interp, "8.1", 0) == NULL) {return TCL_ERROR;} #endif /* Skip all this on Tcl/Tk 8.0 or older. Seems to work */ #if TCL_MAJOR_VERSION * 100 + TCL_MINOR_VERSION > 800 Tcl_GetVersion(&major,&minor,&patchLevel,&releaseType); #ifdef HAVE_TK_SETCLASSPROCS if (major>=8 && minor >= 4 && releaseType >= 0 && patchLevel >= 2) { SetClassProcsPtr = tkStubsPtr->tk_SetClassProcs; } else { SetClassProcsPtr = NULL; } #else if (major>=8 && minor >= 4 && releaseType >= 0 && patchLevel >= 2) { TCL_ERR(interp,"Sorry, this instance of Togl was not compiled to work with Tcl/Tk 8.4 or higher."); } #endif #endif if (Tcl_PkgProvide(interp, "Togl", TOGL_VERSION) != TCL_OK) { return TCL_ERROR; } Tcl_CreateCommand(interp, "togl", Togl_Cmd, (ClientData) Tk_MainWindow(interp), NULL); Tcl_InitHashTable(&CommandTable, TCL_STRING_KEYS); return TCL_OK; } /* * Register a C function to be called when an Togl widget is realized. */ void Togl_CreateFunc( Togl_Callback *proc ) { DefaultCreateProc = proc; } /* * Register a C function to be called when an Togl widget must be redrawn. */ void Togl_DisplayFunc( Togl_Callback *proc ) { DefaultDisplayProc = proc; } /* * Register a C function to be called when an Togl widget is resized. */ void Togl_ReshapeFunc( Togl_Callback *proc ) { DefaultReshapeProc = proc; } /* * Register a C function to be called when an Togl widget is destroyed. */ void Togl_DestroyFunc( Togl_Callback *proc ) { DefaultDestroyProc = proc; } /* * Register a C function to be called from TimerEventHandler. */ void Togl_TimerFunc( Togl_Callback *proc ) { DefaultTimerProc = proc; } /* * Reset default callback pointers to NULL. */ void Togl_ResetDefaultCallbacks( void ) { DefaultCreateProc = NULL; DefaultDisplayProc = NULL; DefaultReshapeProc = NULL; DefaultDestroyProc = NULL; DefaultOverlayDisplayProc = NULL; DefaultTimerProc = NULL; DefaultClientData = NULL; } /* * Chnage the create callback for a specific Togl widget. */ void Togl_SetCreateFunc( struct Togl *togl, Togl_Callback *proc ) { togl->CreateProc = proc; } /* * Change the display/redraw callback for a specific Togl widget. */ void Togl_SetDisplayFunc( struct Togl *togl, Togl_Callback *proc ) { togl->DisplayProc = proc; } /* * Change the reshape callback for a specific Togl widget. */ void Togl_SetReshapeFunc( struct Togl *togl, Togl_Callback *proc ) { togl->ReshapeProc = proc; } /* * Change the destroy callback for a specific Togl widget. */ void Togl_SetDestroyFunc( struct Togl *togl, Togl_Callback *proc ) { togl->DestroyProc = proc; } /* * Togl_Timer * * Gets called from Tk_CreateTimerHandler. */ static void Togl_Timer( ClientData clientData ) { struct Togl *togl = (struct Togl *) clientData; if (togl->TimerProc) { togl->TimerProc(togl); /* Re-register this callback since Tcl/Tk timers are "one-shot". * That is, after the timer callback is called it not normally * called again. That's not the behavior we want for Togl. */ #if (TK_MAJOR_VERSION * 100 + TK_MINOR_VERSION) >= 401 togl->timerHandler = Tcl_CreateTimerHandler( togl->TimerInterval, Togl_Timer, (ClientData)togl ); #else togl->timerHandler = Tk_CreateTimerHandler( togl->TimeInterval, Togl_Timer, (ClientData)togl ); #endif } } /* * Change the timer callback for a specific Togl widget. * Pass NULL to disable the callback. */ void Togl_SetTimerFunc( struct Togl *togl, Togl_Callback *proc ) { togl->TimerProc = proc; if (proc) { #if (TK_MAJOR_VERSION * 100 + TK_MINOR_VERSION) >= 401 togl->timerHandler = Tcl_CreateTimerHandler( togl->TimerInterval, Togl_Timer, (ClientData)togl ); #else togl->timerHandler = Tk_CreateTimerHandler( togl->TimeInterval, Togl_Timer, (ClientData)togl ); #endif } } /* * Togl_CreateCommand * * Declares a new C sub-command of Togl callable from Tcl. * Every time the sub-command is called from Tcl, the * C routine will be called with all the arguments from Tcl. */ void Togl_CreateCommand( char *cmd_name, Togl_CmdProc *cmd_proc) { int new_item; Tcl_HashEntry *entry; entry = Tcl_CreateHashEntry(&CommandTable, cmd_name, &new_item); Tcl_SetHashValue(entry, cmd_proc); } /* * Togl_MakeCurrent * * Bind the OpenGL rendering context to the specified * Togl widget. */ void Togl_MakeCurrent( const struct Togl *togl ) { #if defined(WIN32) int res = wglMakeCurrent(togl->tglGLHdc, togl->tglGLHglrc); assert(res == TRUE); #elif defined(X11) glXMakeCurrent( Tk_Display(togl->TkWin), Tk_WindowId(togl->TkWin), togl->GlCtx ); #if defined(__sgi) && defined(STEREO) stereoMakeCurrent( Tk_Display(togl->TkWin), Tk_WindowId(togl->TkWin), togl->GlCtx ); #endif /*__sgi STEREO */ #elif defined(macintosh) aglSetCurrentContext(togl->aglCtx); #endif /* WIN32 */ } #ifdef macintosh /* tell OpenGL which part of the Mac window to render to */ static void SetMacBufRect(struct Togl *togl) { GLint wrect[4]; /* set wrect[0,1] to lower left corner of widget */ wrect[2] = ((TkWindow *) (togl->TkWin))->changes.width; wrect[3] = ((TkWindow *) (togl->TkWin))->changes.height; wrect[0] = ((TkWindow *) (togl->TkWin))->privatePtr->xOff; wrect[1] = ((TkWindow *) (togl->TkWin))->privatePtr->toplevel->portPtr->portRect.bottom - wrect[3] - ((TkWindow *) (togl->TkWin))->privatePtr->yOff; aglSetInteger(togl->aglCtx, AGL_BUFFER_RECT, wrect); aglEnable(togl->aglCtx, AGL_BUFFER_RECT); aglUpdateContext(togl->aglCtx); } #endif /* * Called when the widget's contents must be redrawn. Basically, we * just call the user's render callback function. * * Note that the parameter type is ClientData so this function can be * passed to Tk_DoWhenIdle(). */ static void Togl_Render( ClientData clientData ) { struct Togl *togl = (struct Togl *)clientData; if (togl->DisplayProc) { #ifdef macintosh /* Mac is complicated here because OpenGL needs to know what part of the parent window to render into, and it seems that region need to be invalidated before drawing, so that QuickDraw will allow OpenGL to transfer pixels into that part of the window. I'm not even totally sure how or why this works as it does, since this aspect of Mac OpenGL seems to be totally undocumented. This was put together by trial and error! (thiessen) */ MacRegion r; RgnPtr rp = &r; GrafPtr curPort, parentWin; parentWin = (GrafPtr) (((MacDrawable *) (Tk_WindowId(togl->TkWin)))->toplevel->portPtr); if (!parentWin) return; #endif Togl_MakeCurrent(togl); #ifdef macintosh /* Set QuickDraw port and clipping region */ GetPort(&curPort); SetPort(parentWin); r.rgnBBox.left = ((TkWindow *) (togl->TkWin))->privatePtr->xOff; r.rgnBBox.right = r.rgnBBox.left + ((TkWindow *) (togl->TkWin))->changes.width - 1; r.rgnBBox.top = ((TkWindow *) (togl->TkWin))->privatePtr->yOff; r.rgnBBox.bottom = r.rgnBBox.top + ((TkWindow *) (togl->TkWin))->changes.height - 1; r.rgnSize = sizeof(Region); InvalRgn(&rp); SetClip(&rp); /* this may seem an odd place to put this, with possibly redundant calls to aglSetInteger(AGL_BUFFER_RECT...), but for some reason performance is actually a lot better if this is called before every render... */ SetMacBufRect(togl); #endif togl->DisplayProc(togl); #ifdef macintosh SetPort(curPort); /* restore previous port */ #endif } togl->UpdatePending = GL_FALSE; } static void RenderOverlay( ClientData clientData ) { struct Togl *togl = (struct Togl *)clientData; if (togl->OverlayFlag && togl->OverlayDisplayProc) { #if defined(WIN32) int res = wglMakeCurrent(togl->tglGLHdc, togl->tglGLHglrc); assert(res == TRUE); #elif defined(X11) glXMakeCurrent( Tk_Display(togl->TkWin), togl->OverlayWindow, togl->OverlayCtx ); #if defined(__sgi) && defined(STEREO) stereoMakeCurrent( Tk_Display(togl->TkWin), togl->OverlayWindow, togl->OverlayCtx ); #endif /*__sgi STEREO */ #endif /* WIN32 */ togl->OverlayDisplayProc(togl); } togl->OverlayUpdatePending = GL_FALSE; } /* * It's possible to change with this function or in a script some * options like RGBA - ColorIndex ; Z-buffer and so on */ int Togl_Configure(Tcl_Interp *interp, struct Togl *togl, int argc, char *argv[], int flags) { int oldRgbaFlag = togl->RgbaFlag; int oldRgbaRed = togl->RgbaRed; int oldRgbaGreen = togl->RgbaGreen; int oldRgbaBlue = togl->RgbaBlue; int oldDoubleFlag = togl->DoubleFlag; int oldDepthFlag = togl->DepthFlag; int oldDepthSize = togl->DepthSize; int oldAccumFlag = togl->AccumFlag; int oldAccumRed = togl->AccumRed; int oldAccumGreen = togl->AccumGreen; int oldAccumBlue = togl->AccumBlue; int oldAccumAlpha = togl->AccumAlpha; int oldAlphaFlag = togl->AlphaFlag; int oldAlphaSize = togl->AlphaSize; int oldStencilFlag = togl->StencilFlag; int oldStencilSize = togl->StencilSize; int oldAuxNumber = togl->AuxNumber; if (Tk_ConfigureWidget(interp, togl->TkWin, configSpecs, argc, argv, (char *)togl, flags) == TCL_ERROR) { return(TCL_ERROR); } #ifndef USE_OVERLAY if (togl->OverlayFlag) { TCL_ERR(interp,"Sorry, overlay was disabled"); } #endif Tk_GeometryRequest(togl->TkWin, togl->Width, togl->Height); /* this added per Lou Arata */ Tk_ResizeWindow(togl->TkWin, togl->Width, togl->Height); if (togl->ReshapeProc && #if defined(WIN32) togl->tglGLHglrc #elif defined(X11) togl->GlCtx #elif defined(macintosh) togl->aglCtx #endif ) { Togl_MakeCurrent(togl); togl->ReshapeProc(togl); } if (togl->RgbaFlag != oldRgbaFlag || togl->RgbaRed != oldRgbaRed || togl->RgbaGreen != oldRgbaGreen || togl->RgbaBlue != oldRgbaBlue || togl->DoubleFlag != oldDoubleFlag || togl->DepthFlag != oldDepthFlag || togl->DepthSize != oldDepthSize || togl->AccumFlag != oldAccumFlag || togl->AccumRed != oldAccumRed || togl->AccumGreen != oldAccumGreen || togl->AccumBlue != oldAccumBlue || togl->AccumAlpha != oldAccumAlpha || togl->AlphaFlag != oldAlphaFlag || togl->AlphaSize != oldAlphaSize || togl->StencilFlag != oldStencilFlag || togl->StencilSize != oldStencilSize || togl->AuxNumber != oldAuxNumber) { #ifdef MESA_COLOR_HACK free_default_color_cells( Tk_Display(togl->TkWin), Tk_Colormap(togl->TkWin) ); #endif } #if defined(__sgi) && defined(STEREO) stereoInit(togl,togl->StereoFlag); #endif return TCL_OK; } int Togl_Widget(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]) { struct Togl *togl = (struct Togl *)clientData; int result = TCL_OK; Tcl_HashEntry *entry; Tcl_HashSearch search; Togl_CmdProc *cmd_proc; if (argc < 2) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " ?options?\"", NULL); return TCL_ERROR; } Tk_Preserve((ClientData)togl); if (!strncmp(argv[1], "configure", MAX(1, strlen(argv[1])))) { if (argc == 2) { /* Return list of all configuration parameters */ result = Tk_ConfigureInfo(interp, togl->TkWin, configSpecs, (char *)togl, (char *)NULL, 0); } else if (argc == 3) { if (strcmp(argv[2],"-extensions")==0) { /* Return a list of OpenGL extensions available */ char *extensions; extensions = (char *) glGetString(GL_EXTENSIONS); Tcl_SetResult( interp, extensions, TCL_STATIC ); result = TCL_OK; } else { /* Return a specific configuration parameter */ result = Tk_ConfigureInfo(interp, togl->TkWin, configSpecs, (char *)togl, argv[2], 0); } } else { /* Execute a configuration change */ result = Togl_Configure(interp, togl, argc-2, argv+2, TK_CONFIG_ARGV_ONLY); } } else if (!strncmp(argv[1], "render", MAX(1, strlen(argv[1])))) { /* force the widget to be redrawn */ Togl_Render((ClientData) togl); } else if (!strncmp(argv[1], "swapbuffers", MAX(1, strlen(argv[1])))) { /* force the widget to be redrawn */ Togl_SwapBuffers(togl); } else if (!strncmp(argv[1], "makecurrent", MAX(1, strlen(argv[1])))) { /* force the widget to be redrawn */ Togl_MakeCurrent(togl); } else { /* Probably a user-defined function */ entry = Tcl_FindHashEntry(&CommandTable, argv[1]); if (entry != NULL) { cmd_proc = (Togl_CmdProc *)Tcl_GetHashValue(entry); result = cmd_proc(togl, argc, argv); } else { Tcl_AppendResult(interp, "Togl: Unknown option: ", argv[1], "\n", "Try: configure or render\n", "or one of the user-defined commands:\n", NULL); entry = Tcl_FirstHashEntry(&CommandTable, &search); while (entry) { Tcl_AppendResult(interp, " ", Tcl_GetHashKey(&CommandTable, entry), "\n", NULL); entry = Tcl_NextHashEntry(&search); } result = TCL_ERROR; } } Tk_Release((ClientData)togl); return result; } /* * Togl_Cmd * * Called when Togl is executed - creation of a Togl widget. * * Creates a new window * * Creates an 'Togl' data structure * * Creates an event handler for this window * * Creates a command that handles this object * * Configures this Togl for the given arguments */ static int Togl_Cmd(ClientData clientData, Tcl_Interp *interp, int argc, char **argv) { char *name; Tk_Window main = (Tk_Window)clientData; Tk_Window tkwin; struct Togl *togl; if (argc <= 1) { TCL_ERR(interp, "wrong # args: should be \"pathName read filename\""); } /* Create the window. */ name = argv[1]; tkwin = Tk_CreateWindowFromPath(interp, main, name, (char *) NULL); if (tkwin == NULL) { return TCL_ERROR; } Tk_SetClass(tkwin, "Togl"); /* Create Togl data structure */ togl = (struct Togl *)malloc(sizeof(struct Togl)); if (!togl) { return TCL_ERROR; } togl->Next = NULL; #if defined(WIN32) togl->tglGLHdc = NULL; togl->tglGLHglrc = NULL; #elif defined(X11) togl->GlCtx = NULL; togl->OverlayCtx = NULL; #elif defined(macintosh) togl->aglCtx = NULL; #endif /* WIN32 */ togl->display = Tk_Display( tkwin ); togl->TkWin = tkwin; togl->Interp = interp; #ifndef NO_TK_CURSOR togl->Cursor = None; #endif togl->Width = 0; togl->Height = 0; togl->TimerInterval = 0; togl->RgbaFlag = 1; togl->RgbaRed = 1; togl->RgbaGreen = 1; togl->RgbaBlue = 1; togl->DoubleFlag = 0; togl->DepthFlag = 0; togl->DepthSize = 1; togl->AccumFlag = 0; togl->AccumRed = 1; togl->AccumGreen = 1; togl->AccumBlue = 1; togl->AccumAlpha = 1; togl->AlphaFlag = 0; togl->AlphaSize = 1; togl->StencilFlag = 0; togl->StencilSize = 1; togl->OverlayFlag = 0; togl->StereoFlag = 0; togl->AuxNumber = 0; togl->Indirect = GL_FALSE; togl->UpdatePending = GL_FALSE; togl->OverlayUpdatePending = GL_FALSE; togl->CreateProc = DefaultCreateProc; togl->DisplayProc = DefaultDisplayProc; togl->ReshapeProc = DefaultReshapeProc; togl->DestroyProc = DefaultDestroyProc; togl->TimerProc = DefaultTimerProc; togl->OverlayDisplayProc = DefaultOverlayDisplayProc; togl->ShareList = NULL; togl->ShareContext = NULL; togl->Ident = NULL; togl->Client_Data = DefaultClientData; /* for EPS Output */ togl->EpsRedMap = togl->EpsGreenMap = togl->EpsBlueMap = NULL; togl->EpsMapSize = 0; /* Create command event handler */ togl->widgetCmd = Tcl_CreateCommand(interp, Tk_PathName(tkwin), Togl_Widget, (ClientData)togl, (Tcl_CmdDeleteProc*) ToglCmdDeletedProc); /* Setup the Tk_ClassProcs callbacks to point at our own window creation function We need to check at runtime if we should use the new Tk_SetClassProcs() API or if we need to modify the window structure directly */ #ifdef HAVE_TK_SETCLASSPROCS if (SetClassProcsPtr != NULL) { /* use public API (Tk 8.4+) */ Tk_ClassProcs *procsPtr; procsPtr = (Tk_ClassProcs*) Tcl_Alloc(sizeof(Tk_ClassProcs)); procsPtr->size = sizeof(Tk_ClassProcs); procsPtr->createProc = Togl_CreateWindow; procsPtr->worldChangedProc = NULL; procsPtr->modalProc = NULL; /* Tk_SetClassProcs(togl->TkWin,procsPtr,(ClientData)togl); */ (SetClassProcsPtr)(togl->TkWin,procsPtr,(ClientData)togl); } else #endif { /* use private API */ /* We need to set these fields in the Tk_FakeWin structure: dummy17 = classProcsPtr dummy18 = instanceData */ TkClassProcs *procsPtr; Tk_FakeWin *winPtr = (Tk_FakeWin*)(togl->TkWin); procsPtr = (TkClassProcs*)Tcl_Alloc(sizeof(TkClassProcs)); procsPtr->createProc = Togl_CreateWindow; procsPtr->geometryProc = NULL; procsPtr->modalProc = NULL; winPtr->dummy17 = (char*)procsPtr; winPtr->dummy18 = (ClientData)togl; } Tk_CreateEventHandler(tkwin, ExposureMask | StructureNotifyMask, Togl_EventProc, (ClientData)togl); /* Configure Togl widget */ if (Togl_Configure(interp, togl, argc-2, argv+2, 0) == TCL_ERROR) { Tk_DestroyWindow(tkwin); goto error; } /* * If OpenGL window wasn't already created by Togl_Configure() we * create it now. We can tell by checking if the GLX context has * been initialized. */ if (! #if defined(WIN32) togl->tglGLHdc #elif defined(X11) togl->GlCtx #elif defined(macintosh) togl->aglCtx #endif ) { Tk_MakeWindowExist(togl->TkWin); Togl_MakeCurrent(togl); } /* If defined, call create callback */ if (togl->CreateProc) { togl->CreateProc(togl); } /* If defined, call reshape proc */ if (togl->ReshapeProc) { togl->ReshapeProc(togl); } /* If defined, setup timer */ if (togl->TimerProc){ Tk_CreateTimerHandler( togl->TimerInterval, Togl_Timer, (ClientData)togl ); } Tcl_AppendResult(interp, Tk_PathName(tkwin), NULL); /* Add to linked list */ AddToList(togl); return TCL_OK; error: Tcl_DeleteCommand(interp, "togl"); /*free(togl); Don't free it, if we do a crash occurs later...*/ return TCL_ERROR; } #ifdef USE_OVERLAY /* * Do all the setup for overlay planes * Return: TCL_OK or TCL_ERROR */ static int SetupOverlay( struct Togl *togl ) { #if defined(X11) #ifdef GLX_TRANSPARENT_TYPE_EXT static int ovAttributeList[] = { GLX_BUFFER_SIZE, 2, GLX_LEVEL, 1, GLX_TRANSPARENT_TYPE_EXT, GLX_TRANSPARENT_INDEX_EXT, None }; #else static int ovAttributeList[] = { GLX_BUFFER_SIZE, 2, GLX_LEVEL, 1, None }; #endif Display *dpy; XVisualInfo *visinfo; TkWindow *winPtr = (TkWindow *) togl->TkWin; XSetWindowAttributes swa; Tcl_HashEntry *hPtr; int new_flag; dpy = Tk_Display(togl->TkWin); visinfo = glXChooseVisual( dpy, Tk_ScreenNumber(winPtr), ovAttributeList ); if (!visinfo){ Tcl_AppendResult(togl->Interp,Tk_PathName(winPtr), ": No suitable overlay index visual available", (char *) NULL); togl->OverlayCtx = 0; togl->OverlayWindow = 0; togl->OverlayCmap = 0; return TCL_ERROR; } #ifdef GLX_TRANSPARENT_INDEX_EXT { int fail = glXGetConfig(dpy, visinfo,GLX_TRANSPARENT_INDEX_VALUE_EXT, &togl->OverlayTransparentPixel); if (fail) togl->OverlayTransparentPixel=0; /* maybe, maybe ... */ } #else togl->OverlayTransparentPixel=0; /* maybe, maybe ... */ #endif /* togl->OverlayCtx = glXCreateContext( dpy, visinfo, None, GL_TRUE ); */ /* NEW in Togl 1.5 beta 3 */ /* share display lists with normal layer context */ togl->OverlayCtx = glXCreateContext( dpy, visinfo, togl->GlCtx, !togl->Indirect ); swa.colormap = XCreateColormap( dpy, XRootWindow(dpy, visinfo->screen), visinfo->visual, AllocNone ); togl->OverlayCmap = swa.colormap; swa.border_pixel = 0; swa.event_mask = ALL_EVENTS_MASK; togl->OverlayWindow = XCreateWindow( dpy, Tk_WindowId(togl->TkWin), 0, 0, togl->Width, togl->Height, 0, visinfo->depth, InputOutput, visinfo->visual, CWBorderPixel|CWColormap|CWEventMask, &swa ); hPtr = Tcl_CreateHashEntry( &winPtr->dispPtr->winTable, (char *) togl->OverlayWindow, &new_flag ); Tcl_SetHashValue( hPtr, winPtr ); /* XMapWindow( dpy, togl->OverlayWindow );*/ togl->OverlayIsMapped = 0; /* Make sure window manager installs our colormap */ XSetWMColormapWindows( dpy, togl->OverlayWindow, &togl->OverlayWindow, 1 ); return TCL_OK; #elif defined(WIN32) || defined(macintosh) /* not yet implemented on these */ return TCL_ERROR; #endif /* X11 */ } #endif /* USE_OVERLAY */ #ifdef WIN32 #define TOGL_CLASS_NAME "Togl Class" static ToglClassInitialized = 0; static LRESULT CALLBACK Win32WinProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { LONG result; struct Togl *togl = (struct Togl*) GetWindowLong(hwnd, 0); WNDCLASS childClass; switch( message ){ case WM_WINDOWPOSCHANGED: /* Should be processed by DefWindowProc, otherwise a double buffered context is not properly resized when the corresponding window is resized.*/ break; case WM_DESTROY: if (togl->tglGLHglrc) { wglDeleteContext(togl->tglGLHglrc); } if (togl->tglGLHdc) { ReleaseDC(hwnd, togl->tglGLHdc); } free(togl); break; default: #if USE_STATIC_LIB return TkWinChildProc(hwnd, message, wParam, lParam); #else /* * OK, since TkWinChildProc is not explicitly exported in the * dynamic libraries, we have to retrieve it from the class info * registered with windows. * */ if (tkWinChildProc == NULL) { GetClassInfo(Tk_GetHINSTANCE(),TK_WIN_CHILD_CLASS_NAME, &childClass); tkWinChildProc = childClass.lpfnWndProc; } return tkWinChildProc(hwnd, message, wParam, lParam); #endif } result = DefWindowProc(hwnd, message, wParam, lParam); Tcl_ServiceAll(); return result; } #endif /* WIN32 */ /* * Togl_CreateWindow * * Window creation function, invoked as a callback from Tk_MakeWindowExist. * Creates an OpenGL window for the Togl widget. */ static Window Togl_CreateWindow(Tk_Window tkwin, Window parent, ClientData instanceData) { struct Togl *togl = (struct Togl*) instanceData; XVisualInfo *visinfo = NULL; Display *dpy; Tk_Window *winPtr = (Tk_Window *) togl->TkWin; Colormap cmap; int scrnum; int directCtx = GL_TRUE; Window window; #if defined(X11) int attrib_list[1000]; int attrib_count; int dummy; XSetWindowAttributes swa; #define MAX_ATTEMPTS 12 static int ci_depths[MAX_ATTEMPTS] = { 8, 4, 2, 1, 12, 16, 8, 4, 2, 1, 12, 16 }; static int dbl_flags[MAX_ATTEMPTS] = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1 }; #elif defined(WIN32) HWND hwnd, parentWin; int pixelformat; HANDLE hInstance; WNDCLASS ToglClass; PIXELFORMATDESCRIPTOR pfd; XVisualInfo VisInf; #elif defined(macintosh) GLint attribs[20]; int na; AGLPixelFormat fmt; XVisualInfo VisInf; #endif /* X11 */ dpy = Tk_Display(togl->TkWin); #if defined(X11) /* Make sure OpenGL's GLX extension supported */ if (!glXQueryExtension(dpy, &dummy, &dummy)) { TCL_ERR(togl->Interp, "Togl: X server has no OpenGL GLX extension"); } if (togl->ShareContext && FindTogl(togl->ShareContext)) { /* share OpenGL context with existing Togl widget */ struct Togl *shareWith = FindTogl(togl->ShareContext); assert(shareWith); assert(shareWith->GlCtx); togl->GlCtx = shareWith->GlCtx; togl->VisInfo = shareWith->VisInfo; visinfo = togl->VisInfo; printf("SHARE CTX\n"); } else { int attempt; /* It may take a few tries to get a visual */ for (attempt=0; attemptRgbaFlag) { /* RGB[A] mode */ attrib_list[attrib_count++] = GLX_RGBA; attrib_list[attrib_count++] = GLX_RED_SIZE; attrib_list[attrib_count++] = togl->RgbaRed; attrib_list[attrib_count++] = GLX_GREEN_SIZE; attrib_list[attrib_count++] = togl->RgbaGreen; attrib_list[attrib_count++] = GLX_BLUE_SIZE; attrib_list[attrib_count++] = togl->RgbaBlue; if (togl->AlphaFlag) { attrib_list[attrib_count++] = GLX_ALPHA_SIZE; attrib_list[attrib_count++] = togl->AlphaSize; } /* for EPS Output */ if ( togl->EpsRedMap) free( ( char *)togl->EpsRedMap); if ( togl->EpsGreenMap) free( ( char *)togl->EpsGreenMap); if ( togl->EpsBlueMap) free( ( char *)togl->EpsBlueMap); togl->EpsRedMap = togl->EpsGreenMap = togl->EpsBlueMap = NULL; togl->EpsMapSize = 0; } else { /* Color index mode */ int depth; attrib_list[attrib_count++] = GLX_BUFFER_SIZE; depth = ci_depths[attempt]; attrib_list[attrib_count++] = depth; } if (togl->DepthFlag) { attrib_list[attrib_count++] = GLX_DEPTH_SIZE; attrib_list[attrib_count++] = togl->DepthSize; } if (togl->DoubleFlag || dbl_flags[attempt]) { attrib_list[attrib_count++] = GLX_DOUBLEBUFFER; } if (togl->StencilFlag) { attrib_list[attrib_count++] = GLX_STENCIL_SIZE; attrib_list[attrib_count++] = togl->StencilSize; } if (togl->AccumFlag) { attrib_list[attrib_count++] = GLX_ACCUM_RED_SIZE; attrib_list[attrib_count++] = togl->AccumRed; attrib_list[attrib_count++] = GLX_ACCUM_GREEN_SIZE; attrib_list[attrib_count++] = togl->AccumGreen; attrib_list[attrib_count++] = GLX_ACCUM_BLUE_SIZE; attrib_list[attrib_count++] = togl->AccumBlue; if (togl->AlphaFlag) { attrib_list[attrib_count++] = GLX_ACCUM_ALPHA_SIZE; attrib_list[attrib_count++] = togl->AccumAlpha; } } if (togl->AuxNumber != 0) { attrib_list[attrib_count++] = GLX_AUX_BUFFERS; attrib_list[attrib_count++] = togl->AuxNumber; } if (togl->Indirect) { directCtx = GL_FALSE; } /* stereo hack */ /* if (togl->StereoFlag) { attrib_list[attrib_count++] = GLX_STEREO; } */ attrib_list[attrib_count++] = None; visinfo = glXChooseVisual(dpy, Tk_ScreenNumber(togl->TkWin), attrib_list); if (visinfo) { /* found a GLX visual! */ break; } } togl->VisInfo = visinfo; if (visinfo==NULL) { TCL_ERR(togl->Interp, "Togl: couldn't get visual"); } /* * Create a new OpenGL rendering context. */ if (togl->ShareList) { /* share display lists with existing togl widget */ struct Togl *shareWith = FindTogl(togl->ShareList); GLXContext shareCtx; if (shareWith) shareCtx = shareWith->GlCtx; else shareCtx = None; togl->GlCtx = glXCreateContext(dpy, visinfo, shareCtx, directCtx); } else { /* don't share display lists */ togl->GlCtx = glXCreateContext(dpy, visinfo, None, directCtx); } if (togl->GlCtx == NULL) { TCL_ERR(togl->Interp, "could not create rendering context"); } } #endif /* X11 */ #ifdef WIN32 parentWin = Tk_GetHWND(parent); hInstance = Tk_GetHINSTANCE(); if (ToglClassInitialized == 0) { ToglClassInitialized = 1; ToglClass.style = CS_HREDRAW | CS_VREDRAW; ToglClass.cbClsExtra = 0; ToglClass.cbWndExtra = 4; /* to save struct Togl* */ ToglClass.hInstance = hInstance; ToglClass.hbrBackground = NULL; ToglClass.lpszMenuName = NULL; ToglClass.lpszClassName = TOGL_CLASS_NAME; ToglClass.lpfnWndProc = Win32WinProc; ToglClass.hIcon = NULL; ToglClass.hCursor = NULL; if (!RegisterClass(&ToglClass)){ TCL_ERR(togl->Interp, "unable register Togl window class"); } } hwnd = CreateWindow(TOGL_CLASS_NAME, NULL, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0, 0, togl->Width, togl->Height, parentWin, NULL, hInstance, NULL); SetWindowLong(hwnd, 0, (LONG) togl); SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); togl->tglGLHdc = GetDC(hwnd); pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); pfd.nVersion = 1; pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL; if (togl->DoubleFlag) { pfd.dwFlags |= PFD_DOUBLEBUFFER; } /* The stereo flag is not supported in the current generic OpenGL * implementation, but may be supported by specific hardware devices. */ if (togl->StereoFlag) { pfd.dwFlags |= PFD_STEREO; } pfd.cColorBits = togl->RgbaRed + togl->RgbaGreen + togl->RgbaBlue; pfd.iPixelType = togl->RgbaFlag ? PFD_TYPE_RGBA : PFD_TYPE_COLORINDEX; /* Alpha bitplanes are not supported in the current generic OpenGL * implementation, but may be supported by specific hardware devices. */ pfd.cAlphaBits = togl->AlphaFlag ? togl->AlphaSize : 0; pfd.cAccumBits = togl->AccumFlag ? (togl->AccumRed + togl->AccumGreen + togl->AccumBlue +togl->AccumAlpha) : 0; pfd.cDepthBits = togl->DepthFlag ? togl->DepthSize : 0; pfd.cStencilBits = togl->StencilFlag ? togl->StencilSize : 0; /* Auxiliary buffers are not supported in the current generic OpenGL * implementation, but may be supported by specific hardware devices. */ pfd.cAuxBuffers = togl->AuxNumber; pfd.iLayerType = PFD_MAIN_PLANE; if ( (pixelformat = ChoosePixelFormat(togl->tglGLHdc, &pfd)) == 0 ) { TCL_ERR(togl->Interp, "Togl: couldn't choose pixel format"); } if (SetPixelFormat(togl->tglGLHdc, pixelformat, &pfd) == FALSE) { TCL_ERR(togl->Interp, "Togl: couldn't choose pixel format"); } /* Get the actual pixel format */ DescribePixelFormat(togl->tglGLHdc, pixelformat, sizeof(pfd), &pfd); if (togl->ShareContext && FindTogl(togl->ShareContext)) { /* share OpenGL context with existing Togl widget */ struct Togl *shareWith = FindTogl(togl->ShareContext); assert(shareWith); assert(shareWith->tglGLHglrc); togl->tglGLHglrc = shareWith->tglGLHglrc; togl->VisInfo = shareWith->VisInfo; visinfo = togl->VisInfo; } else { /* * Create a new OpenGL rendering context. And check to share lists. */ togl->tglGLHglrc = wglCreateContext(togl->tglGLHdc); if (togl->ShareList) { /* share display lists with existing togl widget */ struct Togl *shareWith = FindTogl(togl->ShareList); if (shareWith) wglShareLists(shareWith->tglGLHglrc, togl->tglGLHglrc); } if (!togl->tglGLHglrc) { TCL_ERR(togl->Interp, "could not create rendering context"); } /* Just for portability, define the simplest visinfo */ visinfo = &VisInf; visinfo->visual = DefaultVisual(dpy, DefaultScreen(dpy)); visinfo->depth = visinfo->visual->bits_per_rgb; } #endif /*WIN32 */ /* * find a colormap */ scrnum = Tk_ScreenNumber(togl->TkWin); if (togl->RgbaFlag) { /* Colormap for RGB mode */ #if defined(X11) cmap = get_rgb_colormap( dpy, scrnum, visinfo, togl->TkWin ); #elif defined(WIN32) if (pfd.dwFlags & PFD_NEED_PALETTE) { cmap = Win32CreateRgbColormap(pfd); } else { cmap = DefaultColormap(dpy,scrnum); } /* for EPS Output */ if ( togl->EpsRedMap) free( ( char *)togl->EpsRedMap); if ( togl->EpsGreenMap) free( ( char *)togl->EpsGreenMap); if ( togl->EpsBlueMap) free( ( char *)togl->EpsBlueMap); togl->EpsRedMap = togl->EpsGreenMap = togl->EpsBlueMap = NULL; togl->EpsMapSize = 0; #elif defined(macintosh) cmap = DefaultColormap(dpy, scrnum); /* for EPS Output */ if (togl->EpsRedMap) free((char *) togl->EpsRedMap); if (togl->EpsGreenMap) free((char *) togl->EpsGreenMap); if (togl->EpsBlueMap) free((char *) togl->EpsBlueMap); togl->EpsRedMap = togl->EpsGreenMap = togl->EpsBlueMap = NULL; togl->EpsMapSize = 0; #endif /* X11 */ } else { /* Colormap for CI mode */ #ifdef WIN32 togl->CiColormapSize = 1 << pfd.cColorBits; togl->CiColormapSize = togl->CiColormapSize < MAX_CI_COLORMAP_SIZE ? togl->CiColormapSize : MAX_CI_COLORMAP_SIZE; #endif /* WIN32 */ if (togl->PrivateCmapFlag) { /* need read/write colormap so user can store own color entries */ #if defined(X11) cmap = XCreateColormap(dpy, XRootWindow(dpy, visinfo->screen), visinfo->visual, AllocAll); #elif defined(WIN32) cmap = Win32CreateCiColormap(togl); #elif defined(macintosh) /* need to figure out how to do this correctly on Mac... */ cmap = DefaultColormap(dpy, scrnum); #endif /* X11 */ } else { if (visinfo->visual==DefaultVisual(dpy, scrnum)) { /* share default/root colormap */ cmap = Tk_Colormap(togl->TkWin); } else { /* make a new read-only colormap */ cmap = XCreateColormap(dpy, XRootWindow(dpy, visinfo->screen), visinfo->visual, AllocNone); } } } /* Make sure Tk knows to switch to the new colormap when the cursor * is over this window when running in color index mode. */ Tk_SetWindowVisual(togl->TkWin, visinfo->visual, visinfo->depth, cmap); #ifdef WIN32 /* Install the colormap */ SelectPalette(togl->tglGLHdc, ((TkWinColormap *)cmap)->palette, TRUE); RealizePalette(togl->tglGLHdc); #endif /* WIN32 */ #if defined(X11) swa.colormap = cmap; swa.border_pixel = 0; swa.event_mask = ALL_EVENTS_MASK; window = XCreateWindow(dpy, parent, 0, 0, togl->Width, togl->Height, 0, visinfo->depth, InputOutput, visinfo->visual, CWBorderPixel | CWColormap | CWEventMask, &swa); /* Make sure window manager installs our colormap */ XSetWMColormapWindows( dpy,window, &window, 1 ); #elif defined(WIN32) window = Tk_AttachHWND((Tk_Window)winPtr, hwnd); #elif defined(macintosh) window = TkpMakeWindow(winPtr, parent); #endif /* X11 */ #ifdef USE_OVERLAY if (togl->OverlayFlag) { if (SetupOverlay( togl )==TCL_ERROR) { fprintf(stderr,"Warning: couldn't setup overlay.\n"); togl->OverlayFlag = 0; } } #endif /* USE_OVERLAY */ /* Request the X window to be displayed */ XMapWindow(dpy, window); #ifdef macintosh if (togl->ShareContext && FindTogl(togl->ShareContext)) { /* share OpenGL context with existing Togl widget */ struct Togl *shareWith = FindTogl(togl->ShareContext); assert(shareWith); assert(shareWith->aglCtx); togl->aglCtx = shareWith->aglCtx; togl->VisInfo = shareWith->VisInfo; visinfo = togl->VisInfo; } else { AGLContext shareCtx = NULL; /* Need to do this after mapping window, so MacDrawable structure is more completely filled in */ na = 0; attribs[na++] = AGL_MINIMUM_POLICY; attribs[na++] = AGL_ROBUST; if (togl->RgbaFlag) { /* RGB[A] mode */ attribs[na++] = AGL_RGBA; attribs[na++] = AGL_RED_SIZE; attribs[na++] = togl->RgbaRed; attribs[na++] = AGL_GREEN_SIZE; attribs[na++] = togl->RgbaGreen; attribs[na++] = AGL_BLUE_SIZE; attribs[na++] = togl->RgbaBlue; if (togl->AlphaFlag) { attribs[na++] = AGL_ALPHA_SIZE; attribs[na++] = togl->AlphaSize; } } else { /* Color index mode */ attribs[na++] = AGL_BUFFER_SIZE; attribs[na++] = 8; } if (togl->DepthFlag) { attribs[na++] = AGL_DEPTH_SIZE; attribs[na++] = togl->DepthSize; } if (togl->DoubleFlag) { attribs[na++] = AGL_DOUBLEBUFFER; } if (togl->StencilFlag) { attribs[na++] = AGL_STENCIL_SIZE; attribs[na++] = togl->StencilSize; } if (togl->AccumFlag) { attribs[na++] = AGL_ACCUM_RED_SIZE; attribs[na++] = togl->AccumRed; attribs[na++] = AGL_ACCUM_GREEN_SIZE; attribs[na++] = togl->AccumGreen; attribs[na++] = AGL_ACCUM_BLUE_SIZE; attribs[na++] = togl->AccumBlue; if (togl->AlphaFlag) { attribs[na++] = AGL_ACCUM_ALPHA_SIZE; attribs[na++] = togl->AccumAlpha; } } if (togl->AuxNumber != 0) { attribs[na++] = AGL_AUX_BUFFERS; attribs[na++] = togl->AuxNumber; } attribs[na++] = AGL_NONE; if ((fmt = aglChoosePixelFormat(NULL, 0, attribs)) == NULL) { TCL_ERR(togl->Interp, "Togl: couldn't choose pixel format"); } /* * Check whether to share lists. */ if (togl->ShareList) { /* share display lists with existing togl widget */ struct Togl *shareWith = FindTogl(togl->ShareList); if (shareWith) shareCtx = shareWith->aglCtx; } if ((togl->aglCtx = aglCreateContext(fmt, shareCtx)) == NULL) { aglDestroyPixelFormat(fmt); TCL_ERR(togl->Interp, "Togl: couldn't create context"); } aglDestroyPixelFormat(fmt); if (!aglSetDrawable(togl->aglCtx, ((MacDrawable *) (window))->toplevel->portPtr)) { aglDestroyContext(togl->aglCtx); TCL_ERR(togl->Interp, "Togl: couldn't set drawable"); } /* Just for portability, define the simplest visinfo */ visinfo = &VisInf; visinfo->visual = DefaultVisual(dpy, DefaultScreen(dpy)); visinfo->depth = visinfo->visual->bits_per_rgb; } #endif /* macintosh */ #if defined(X11) /* Check for a single/double buffering snafu */ { int dbl_flag; if (glXGetConfig( dpy, visinfo, GLX_DOUBLEBUFFER, &dbl_flag )) { if (togl->DoubleFlag==0 && dbl_flag) { /* We requested single buffering but had to accept a */ /* double buffered visual. Set the GL draw buffer to */ /* be the front buffer to simulate single buffering. */ glDrawBuffer( GL_FRONT ); } } } #endif /* X11 */ /* for EPS Output */ if ( !togl->RgbaFlag) { int index_size; #if defined(X11) || defined(macintosh) GLint index_bits; glGetIntegerv( GL_INDEX_BITS, &index_bits ); index_size = 1 << index_bits; #elif defined(WIN32) index_size = togl->CiColormapSize; #endif /* X11 */ if ( togl->EpsMapSize != index_size) { if ( togl->EpsRedMap) free( ( char *)togl->EpsRedMap); if ( togl->EpsGreenMap) free( ( char *)togl->EpsGreenMap); if ( togl->EpsBlueMap) free( ( char *)togl->EpsBlueMap); togl->EpsMapSize = index_size; togl->EpsRedMap = ( GLfloat *)calloc( index_size, sizeof( GLfloat)); togl->EpsGreenMap = ( GLfloat *)calloc( index_size, sizeof( GLfloat)); togl->EpsBlueMap = ( GLfloat *)calloc( index_size, sizeof( GLfloat)); } } return window; } /* * ToglCmdDeletedProc * * This procedure is invoked when a widget command is deleted. If * the widget isn't already in the process of being destroyed, * this command destroys it. * * Results: * None. * * Side effects: * The widget is destroyed. * *---------------------------------------------------------------------- */ static void ToglCmdDeletedProc( ClientData clientData ) { struct Togl *togl = (struct Togl *)clientData; Tk_Window tkwin = togl->TkWin; /* * This procedure could be invoked either because the window was * destroyed and the command was then deleted (in which case tkwin * is NULL) or because the command was deleted, and then this procedure * destroys the widget. */ /* NEW in togl 1.5 beta 3 */ if (togl && tkwin) { Tk_DeleteEventHandler(tkwin, ExposureMask | StructureNotifyMask, Togl_EventProc, (ClientData)togl); } /* NEW in togl 1.5 beta 3 */ #if defined(X11) if (togl->GlCtx) { /* XXX this might be bad if two or more Togl widgets share a context */ glXDestroyContext( togl->display, togl->GlCtx ); togl->GlCtx = NULL; } #ifdef USE_OVERLAY if (togl->OverlayCtx) { Tcl_HashEntry *entryPtr; TkWindow *winPtr = (TkWindow *) togl->TkWin; if (winPtr) { entryPtr = Tcl_FindHashEntry(&winPtr->dispPtr->winTable, (char *) togl->OverlayWindow ); Tcl_DeleteHashEntry(entryPtr); } glXDestroyContext( togl->display, togl->OverlayCtx ); togl->OverlayCtx = NULL; } #endif /* USE_OVERLAY */ #endif if (tkwin != NULL) { togl->TkWin = NULL; Tk_DestroyWindow(tkwin); } } /* * Togl_Destroy * * Gets called when an Togl widget is destroyed. */ #if (TK_MAJOR_VERSION * 100 + TK_MINOR_VERSION) >= 401 static void Togl_Destroy( char *clientData ) #else static void Togl_Destroy( ClientData clientData ) #endif { struct Togl *togl = (struct Togl *)clientData; Tk_FreeOptions(configSpecs, (char *)togl, togl->display, 0); #ifndef NO_TK_CURSOR if (togl->Cursor != None) { Tk_FreeCursor(togl->display, togl->Cursor); } #endif if (togl->DestroyProc) { togl->DestroyProc(togl); } /* remove from linked list */ RemoveFromList(togl); #if defined(X11) free(togl); #elif defined(macintosh) free ((char *) togl); #endif } /* * This gets called to handle Togl window configuration events */ static void Togl_EventProc(ClientData clientData, XEvent *eventPtr) { struct Togl *togl = (struct Togl *)clientData; switch (eventPtr->type) { case Expose: if (eventPtr->xexpose.count == 0) { if (!togl->UpdatePending && eventPtr->xexpose.window==Tk_WindowId(togl->TkWin)) { Togl_PostRedisplay(togl); } #if defined(X11) if (!togl->OverlayUpdatePending && togl->OverlayFlag && togl->OverlayIsMapped && eventPtr->xexpose.window==togl->OverlayWindow){ Togl_PostOverlayRedisplay(togl); } #endif /*X11*/ } break; case ConfigureNotify: if (togl->Width != Tk_Width(togl->TkWin) || togl->Height != Tk_Height(togl->TkWin)) { togl->Width = Tk_Width(togl->TkWin); togl->Height = Tk_Height(togl->TkWin); XResizeWindow(Tk_Display(togl->TkWin), Tk_WindowId(togl->TkWin), togl->Width, togl->Height); #if defined(X11) if (togl->OverlayFlag) { XResizeWindow( Tk_Display(togl->TkWin), togl->OverlayWindow, togl->Width, togl->Height ); XRaiseWindow( Tk_Display(togl->TkWin), togl->OverlayWindow ); } #endif /*X11*/ Togl_MakeCurrent(togl); if (togl->ReshapeProc) { togl->ReshapeProc(togl); } else { glViewport(0, 0, togl->Width, togl->Height); #if defined(X11) if (togl->OverlayFlag) { Togl_UseLayer( togl,TOGL_OVERLAY ); glViewport( 0, 0, togl->Width, togl->Height ); Togl_UseLayer( togl, TOGL_NORMAL ); } #endif /*X11*/ } #ifndef WIN32 /* causes double redisplay on Win32 platform */ Togl_PostRedisplay(togl); #endif /* WIN32 */ } break; case MapNotify: break; case DestroyNotify: if (togl->TkWin != NULL) { togl->TkWin = NULL; #if (TCL_MAJOR_VERSION * 100 + TCL_MINOR_VERSION) >= 800 /* This function new in Tcl/Tk 8.0 */ Tcl_DeleteCommandFromToken( togl->Interp, togl->widgetCmd ); #endif } if (togl->TimerProc != NULL) { #if (TK_MAJOR_VERSION * 100 + TK_MINOR_VERSION) >= 401 Tcl_DeleteTimerHandler(togl->timerHandler); #else Tk_DeleteTimerHandler(togl->timerHandler); #endif } if (togl->UpdatePending) { #if (TCL_MAJOR_VERSION * 100 + TCL_MINOR_VERSION) >= 705 Tcl_CancelIdleCall(Togl_Render, (ClientData) togl); #else Tk_CancelIdleCall(Togl_Render, (ClientData) togl); #endif } #if (TK_MAJOR_VERSION * 100 + TK_MINOR_VERSION) >= 401 Tcl_EventuallyFree( (ClientData) togl, Togl_Destroy ); #else Tk_EventuallyFree((ClientData)togl, Togl_Destroy); #endif break; default: /*nothing*/ ; } } void Togl_PostRedisplay( struct Togl *togl ) { if (!togl->UpdatePending) { togl->UpdatePending = GL_TRUE; Tk_DoWhenIdle( Togl_Render, (ClientData) togl ); } } void Togl_SwapBuffers( const struct Togl *togl ) { if (togl->DoubleFlag) { #if defined(WIN32) int res = SwapBuffers(togl->tglGLHdc); assert(res == TRUE); #elif defined(X11) glXSwapBuffers( Tk_Display(togl->TkWin), Tk_WindowId(togl->TkWin) ); #elif defined(macintosh) aglSwapBuffers(togl->aglCtx); #endif /* WIN32 */ } else { glFlush(); } } char *Togl_Ident( const struct Togl *togl ) { return togl->Ident; } int Togl_Width( const struct Togl *togl ) { return togl->Width; } int Togl_Height( const struct Togl *togl ) { return togl->Height; } Tcl_Interp *Togl_Interp( const struct Togl *togl ) { return togl->Interp; } Tk_Window Togl_TkWin( const struct Togl *togl ) { return togl->TkWin; } #if defined(X11) /* * A replacement for XAllocColor. This function should never * fail to allocate a color. When XAllocColor fails, we return * the nearest matching color. If we have to allocate many colors * this function isn't too efficient; the XQueryColors() could be * done just once. * Written by Michael Pichler, Brian Paul, Mark Kilgard * Input: dpy - X display * cmap - X colormap * cmapSize - size of colormap * In/Out: color - the XColor struct * Output: exact - 1=exact color match, 0=closest match */ static void noFaultXAllocColor( Display *dpy, Colormap cmap, int cmapSize, XColor *color, int *exact ) { XColor *ctable, subColor; int i, bestmatch; double mindist; /* 3*2^16^2 exceeds long int precision. */ /* First try just using XAllocColor. */ if (XAllocColor(dpy, cmap, color)) { *exact = 1; return; } /* Retrieve color table entries. */ /* XXX alloca candidate. */ ctable = (XColor *) malloc(cmapSize * sizeof(XColor)); for (i = 0; i < cmapSize; i++) { ctable[i].pixel = i; } XQueryColors(dpy, cmap, ctable, cmapSize); /* Find best match. */ bestmatch = -1; mindist = 0.0; for (i = 0; i < cmapSize; i++) { double dr = (double) color->red - (double) ctable[i].red; double dg = (double) color->green - (double) ctable[i].green; double db = (double) color->blue - (double) ctable[i].blue; double dist = dr * dr + dg * dg + db * db; if (bestmatch < 0 || dist < mindist) { bestmatch = i; mindist = dist; } } /* Return result. */ subColor.red = ctable[bestmatch].red; subColor.green = ctable[bestmatch].green; subColor.blue = ctable[bestmatch].blue; free(ctable); /* Try to allocate the closest match color. This should only * fail if the cell is read/write. Otherwise, we're incrementing * the cell's reference count. */ if (!XAllocColor(dpy, cmap, &subColor)) { /* do this to work around a problem reported by Frank Ortega */ subColor.pixel = (unsigned long) bestmatch; subColor.red = ctable[bestmatch].red; subColor.green = ctable[bestmatch].green; subColor.blue = ctable[bestmatch].blue; subColor.flags = DoRed | DoGreen | DoBlue; } *color = subColor; } #elif defined(WIN32) static UINT Win32AllocColor( const struct Togl *togl, float red, float green, float blue ) { /* Modified version of XAllocColor emulation of Tk. * - returns index, instead of color itself * - allocates logical palette entry even for non-palette devices */ TkWinColormap *cmap = (TkWinColormap *) Tk_Colormap(togl->TkWin); UINT index; COLORREF newColor, closeColor; PALETTEENTRY entry, closeEntry; int new, refCount; Tcl_HashEntry *entryPtr; entry.peRed = (unsigned char)(red*255 + .5); entry.peGreen = (unsigned char)(green*255 + .5); entry.peBlue = (unsigned char)(blue*255 + .5); entry.peFlags = 0; /* * Find the nearest existing palette entry. */ newColor = RGB(entry.peRed, entry.peGreen, entry.peBlue); index = GetNearestPaletteIndex(cmap->palette, newColor); GetPaletteEntries(cmap->palette, index, 1, &closeEntry); closeColor = RGB(closeEntry.peRed, closeEntry.peGreen, closeEntry.peBlue); /* * If this is not a duplicate and colormap is not full, allocate a new entry. */ if (newColor != closeColor) { if (cmap->size == (unsigned int)togl->CiColormapSize) { entry = closeEntry; } else { cmap->size++; ResizePalette(cmap->palette, cmap->size); index = cmap->size -1; SetPaletteEntries(cmap->palette, index, 1, &entry); SelectPalette(togl->tglGLHdc, cmap->palette, TRUE); RealizePalette(togl->tglGLHdc); } } newColor = PALETTERGB(entry.peRed, entry.peGreen, entry.peBlue); entryPtr = Tcl_CreateHashEntry(&cmap->refCounts, (char *) newColor, &new); if (new) { refCount = 1; } else { refCount = ((int) Tcl_GetHashValue(entryPtr)) + 1; } Tcl_SetHashValue(entryPtr, (ClientData)refCount); /* for EPS output */ togl->EpsRedMap[index] = (GLfloat)(entry.peRed / 255.0); togl->EpsGreenMap[index] = (GLfloat)(entry.peGreen / 255.0); togl->EpsBlueMap[index] = (GLfloat)(entry.peBlue / 255.0); return index; } static void Win32FreeColor( const struct Togl *togl, unsigned long index ) { TkWinColormap *cmap = (TkWinColormap *) Tk_Colormap(togl->TkWin); COLORREF cref; UINT count, refCount; PALETTEENTRY entry, *entries; Tcl_HashEntry *entryPtr; if (index >= cmap->size ) { panic("Tried to free a color that isn't allocated."); } GetPaletteEntries(cmap->palette, index, 1, &entry); cref = PALETTERGB(entry.peRed, entry.peGreen, entry.peBlue); entryPtr = Tcl_FindHashEntry(&cmap->refCounts, (char *) cref); if (!entryPtr) { panic("Tried to free a color that isn't allocated."); } refCount = (int) Tcl_GetHashValue(entryPtr) - 1; if (refCount == 0) { count = cmap->size - index; entries = (PALETTEENTRY *) ckalloc(sizeof(PALETTEENTRY)* count); GetPaletteEntries(cmap->palette, index+1, count, entries); SetPaletteEntries(cmap->palette, index, count, entries); SelectPalette(togl->tglGLHdc, cmap->palette, TRUE); RealizePalette(togl->tglGLHdc); ckfree((char *) entries); cmap->size--; Tcl_DeleteHashEntry(entryPtr); } else { Tcl_SetHashValue(entryPtr, (ClientData)refCount); } } static void Win32SetColor( const struct Togl *togl, unsigned long index, float red, float green, float blue ) { TkWinColormap *cmap = (TkWinColormap *) Tk_Colormap(togl->TkWin); PALETTEENTRY entry; entry.peRed = (unsigned char)(red*255 + .5); entry.peGreen = (unsigned char)(green*255 + .5); entry.peBlue = (unsigned char)(blue*255 + .5); entry.peFlags = 0; SetPaletteEntries(cmap->palette, index, 1, &entry); SelectPalette(togl->tglGLHdc, cmap->palette, TRUE); RealizePalette(togl->tglGLHdc); /* for EPS output */ togl->EpsRedMap[index] = (GLfloat)(entry.peRed / 255.0); togl->EpsGreenMap[index] = (GLfloat)(entry.peGreen / 255.0); togl->EpsBlueMap[index] = (GLfloat)(entry.peBlue / 255.0); } #endif /* X11 */ unsigned long Togl_AllocColor( const struct Togl *togl, float red, float green, float blue ) { if (togl->RgbaFlag) { fprintf(stderr,"Error: Togl_AllocColor illegal in RGBA mode.\n"); return 0; } /* TODO: maybe not... */ if (togl->PrivateCmapFlag) { fprintf(stderr,"Error: Togl_FreeColor illegal with private colormap\n"); return 0; } #if defined(X11) { XColor xcol; int exact; xcol.red = (short) (red * 65535.0); xcol.green = (short) (green * 65535.0); xcol.blue = (short) (blue * 65535.0); noFaultXAllocColor( Tk_Display(togl->TkWin), Tk_Colormap(togl->TkWin), Tk_Visual(togl->TkWin)->map_entries, &xcol, &exact ); /* for EPS output */ togl->EpsRedMap[ xcol.pixel] = (float) xcol.red / 65535.0; togl->EpsGreenMap[ xcol.pixel] = (float) xcol.green / 65535.0; togl->EpsBlueMap[ xcol.pixel] = (float) xcol.blue / 65535.0; return xcol.pixel; } #elif defined(WIN32) return Win32AllocColor( togl, red, green, blue ); #elif defined(macintosh) /* still need to implement this on Mac... */ return 0; #endif /* X11 */ } void Togl_FreeColor( const struct Togl *togl, unsigned long pixel ) { if (togl->RgbaFlag) { fprintf(stderr,"Error: Togl_AllocColor illegal in RGBA mode.\n"); return; } /* TODO: maybe not... */ if (togl->PrivateCmapFlag) { fprintf(stderr,"Error: Togl_FreeColor illegal with private colormap\n"); return; } #if defined(X11) XFreeColors( Tk_Display(togl->TkWin), Tk_Colormap(togl->TkWin), &pixel, 1, 0 ); #elif defined(WIN32) Win32FreeColor(togl, pixel); #endif /* X11 */ } void Togl_SetColor( const struct Togl *togl, unsigned long index, float red, float green, float blue ) { if (togl->RgbaFlag) { fprintf(stderr,"Error: Togl_AllocColor illegal in RGBA mode.\n"); return; } if (!togl->PrivateCmapFlag) { fprintf(stderr,"Error: Togl_SetColor requires a private colormap\n"); return; } #if defined(X11) { XColor xcol; xcol.pixel = index; xcol.red = (short) (red * 65535.0); xcol.green = (short) (green * 65535.0); xcol.blue = (short) (blue * 65535.0); xcol.flags = DoRed | DoGreen | DoBlue; XStoreColor( Tk_Display(togl->TkWin), Tk_Colormap(togl->TkWin), &xcol ); /* for EPS output */ togl->EpsRedMap[ xcol.pixel] = (float) xcol.red / 65535.0; togl->EpsGreenMap[ xcol.pixel] = (float) xcol.green / 65535.0; togl->EpsBlueMap[ xcol.pixel] = (float) xcol.blue / 65535.0; } #elif defined(WIN32) Win32SetColor( togl, index, red, green, blue ); #endif /* X11 */ } #ifdef USE_FONTS #if defined(WIN32) #include "tkFont.h" /* * The following structure represents Windows' implementation of a font. */ typedef struct WinFont { TkFont font; /* Stuff used by generic font package. Must * be first in structure. */ HFONT hFont; /* Windows information about font. */ HWND hwnd; /* Toplevel window of application that owns * this font, used for getting HDC. */ int widths[256]; /* Widths of first 256 chars in this font. */ } WinFont; #endif /* WIN32 */ #define MAX_FONTS 1000 static GLuint ListBase[MAX_FONTS]; static GLuint ListCount[MAX_FONTS]; /* * Load the named bitmap font as a sequence of bitmaps in a display list. * fontname may be one of the predefined fonts like TOGL_BITMAP_8_BY_13 * or an X font name, or a Windows font name, etc. */ GLuint Togl_LoadBitmapFont( const struct Togl *togl, const char *fontname ) { static int FirstTime = 1; #if defined(X11) XFontStruct *fontinfo; #elif defined(WIN32) WinFont *winfont; HFONT oldFont; TEXTMETRIC tm; #endif /* X11 */ int first, last, count; GLuint fontbase; const char *name; /* Initialize the ListBase and ListCount arrays */ if (FirstTime) { int i; for (i=0;iTkWin), name ); if (!fontinfo) { return 0; } first = fontinfo->min_char_or_byte2; last = fontinfo->max_char_or_byte2; #elif defined(WIN32) winfont = (WinFont*) Tk_GetFont(togl->Interp, togl->TkWin, name); if (!winfont) { return 0; } oldFont = SelectObject(togl->tglGLHdc, winfont->hFont); GetTextMetrics(togl->tglGLHdc, &tm); first = tm.tmFirstChar; last = tm.tmLastChar; #elif defined(macintosh) first = 10; /* don't know how to determine font range on Mac... */ last = 127; #endif /* X11 */ count = last-first+1; fontbase = glGenLists( (GLuint) (last+1) ); if (fontbase==0) { #ifdef WIN32 SelectObject(togl->tglGLHdc, oldFont); Tk_FreeFont((Tk_Font) winfont); #endif /* WIN32 */ return 0; } #if defined(WIN32) wglUseFontBitmaps(togl->tglGLHdc, first, count, (int) fontbase+first ); SelectObject(togl->tglGLHdc, oldFont); Tk_FreeFont((Tk_Font) winfont); #elif defined(X11) glXUseXFont( fontinfo->fid, first, count, (int) fontbase+first ); #elif defined(macintosh) aglUseFont(togl->aglCtx, 1, 0, 14, /* for now, only app font, regular 14-point */ 10, 118, fontbase+first); #endif /* Record the list base and number of display lists * for Togl_UnloadBitmapFont(). */ { int i; for (i=0;iOverlayWindow) { if (layer==TOGL_OVERLAY) { #if defined(WIN32) int res = wglMakeCurrent(togl->tglGLHdc, togl->tglGLOverlayHglrc); assert(res == TRUE); #elif defined(X11) glXMakeCurrent( Tk_Display(togl->TkWin), togl->OverlayWindow, togl->OverlayCtx ); #if defined(__sgi) && defined(STEREO) stereoMakeCurrent( Tk_Display(togl->TkWin), togl->OverlayWindow, togl->OverlayCtx ); #endif /* __sgi STEREO */ #endif /*WIN32 */ } else if (layer==TOGL_NORMAL) { #if defined(WIN32) int res = wglMakeCurrent(togl->tglGLHdc, togl->tglGLHglrc); assert(res == TRUE); #elif defined(X11) glXMakeCurrent( Tk_Display(togl->TkWin), Tk_WindowId(togl->TkWin), togl->GlCtx ); #if defined(__sgi) && defined(STEREO) stereoMakeCurrent( Tk_Display(togl->TkWin), Tk_WindowId(togl->TkWin), togl->GlCtx ); #endif /* __sgi STEREO */ #endif /* WIN32 */ } else { /* error */ } } } #if defined(X11) /* not yet implemented on Windows*/ void Togl_ShowOverlay( struct Togl *togl ) { if (togl->OverlayWindow) { XMapWindow( Tk_Display(togl->TkWin), togl->OverlayWindow ); XInstallColormap(Tk_Display(togl->TkWin),togl->OverlayCmap); togl->OverlayIsMapped = 1; } } #endif /* X11 */ void Togl_HideOverlay( struct Togl *togl ) { if (togl->OverlayWindow && togl->OverlayIsMapped) { XUnmapWindow( Tk_Display(togl->TkWin), togl->OverlayWindow ); togl->OverlayIsMapped=0; } } void Togl_PostOverlayRedisplay( struct Togl *togl ) { if (!togl->OverlayUpdatePending && togl->OverlayWindow && togl->OverlayDisplayProc) { Tk_DoWhenIdle( RenderOverlay, (ClientData) togl ); togl->OverlayUpdatePending = 1; } } void Togl_OverlayDisplayFunc( Togl_Callback *proc ) { DefaultOverlayDisplayProc = proc; } int Togl_ExistsOverlay( const struct Togl *togl ) { return togl->OverlayFlag; } int Togl_GetOverlayTransparentValue( const struct Togl *togl ) { return togl->OverlayTransparentPixel; } int Togl_IsMappedOverlay( const struct Togl *togl ) { return togl->OverlayFlag && togl->OverlayIsMapped; } #if defined(X11) /* not yet implemented on Windows*/ unsigned long Togl_AllocColorOverlay( const struct Togl *togl, float red, float green, float blue ) { if (togl->OverlayFlag && togl->OverlayCmap) { XColor xcol; xcol.red = (short) (red* 65535.0); xcol.green = (short) (green* 65535.0); xcol.blue = (short) (blue* 65535.0); if (!XAllocColor(Tk_Display(togl->TkWin),togl->OverlayCmap,&xcol)) return (unsigned long) -1; return xcol.pixel; } else { return (unsigned long) -1; } } void Togl_FreeColorOverlay( const struct Togl *togl, unsigned long pixel ) { if (togl->OverlayFlag && togl->OverlayCmap) { XFreeColors( Tk_Display(togl->TkWin), togl->OverlayCmap, &pixel, 1, 0 ); } } #endif /* X11 */ /* * User client data */ void Togl_ClientData( ClientData clientData ) { DefaultClientData = clientData; } ClientData Togl_GetClientData( const struct Togl *togl ) { return togl->Client_Data; } void Togl_SetClientData( struct Togl *togl, ClientData clientData ) { togl->Client_Data = clientData; } /* * X11-only functions * Contributed by Miguel A. De Riera Pasenau (miguel@DALILA.UPC.ES) */ Display* Togl_Display( const struct Togl *togl) { return Tk_Display(togl->TkWin); } Screen* Togl_Screen( const struct Togl *togl) { return Tk_Screen(togl->TkWin); } int Togl_ScreenNumber( const struct Togl *togl) { return Tk_ScreenNumber(togl->TkWin); } Colormap Togl_Colormap( const struct Togl *togl) { return Tk_Colormap(togl->TkWin); } #ifdef MESA_COLOR_HACK /* * Let's know how many free colors do we have */ #if 0 static unsigned char rojo[] = { 4, 39, 74, 110, 145, 181, 216, 251}, verde[] = { 4, 39, 74, 110, 145, 181, 216, 251}, azul[] = { 4, 39, 74, 110, 145, 181, 216, 251}; unsigned char rojo[] = { 4, 36, 72, 109, 145, 182, 218, 251}, verde[] = { 4, 36, 72, 109, 145, 182, 218, 251}, azul[] = { 4, 36, 72, 109, 145, 182, 218, 251}; azul[] = { 0, 85, 170, 255}; #endif #define RLEVELS 5 #define GLEVELS 9 #define BLEVELS 5 /* to free dithered_rgb_colormap pixels allocated by Mesa */ static unsigned long *ToglMesaUsedPixelCells = NULL; static int ToglMesaUsedFreeCells = 0; static int get_free_color_cells( Display *display, int screen, Colormap colormap) { if ( !ToglMesaUsedPixelCells) { XColor xcol; int i; int colorsfailed, ncolors = XDisplayCells( display, screen); long r, g, b; ToglMesaUsedPixelCells = ( unsigned long *)calloc( ncolors, sizeof( unsigned long)); /* Allocate X colors and initialize color_table[], red_table[], etc */ /* de Mesa 2.1: xmesa1.c setup_dithered_(...) */ i = colorsfailed = 0; for (r = 0; r < RLEVELS; r++) for (g = 0; g < GLEVELS; g++) for (b = 0; b < BLEVELS; b++) { int exact; xcol.red = ( r*65535)/(RLEVELS-1); xcol.green = ( g*65535)/(GLEVELS-1); xcol.blue = ( b*65535)/(BLEVELS-1); noFaultXAllocColor( display, colormap, ncolors, &xcol, &exact ); ToglMesaUsedPixelCells[ i++] = xcol.pixel; if (!exact) { colorsfailed++; } } ToglMesaUsedFreeCells = i; XFreeColors( display, colormap, ToglMesaUsedPixelCells, ToglMesaUsedFreeCells, 0x00000000); } return ToglMesaUsedFreeCells; } static void free_default_color_cells( Display *display, Colormap colormap) { if ( ToglMesaUsedPixelCells) { XFreeColors( display, colormap, ToglMesaUsedPixelCells, ToglMesaUsedFreeCells, 0x00000000); free( ( char *)ToglMesaUsedPixelCells); ToglMesaUsedPixelCells = NULL; ToglMesaUsedFreeCells = 0; } } #endif /* * Generate EPS file. * Contributed by Miguel A. De Riera Pasenau (miguel@DALILA.UPC.ES) */ /* Function that creates a EPS File from a created pixmap on the current * context. * Based on the code from Copyright (c) Mark J. Kilgard, 1996. * Parameters: name_file, b&w / Color flag, redraw function. * The redraw function is needed in order to draw things into the new * created pixmap. */ /* Copyright (c) Mark J. Kilgard, 1996. */ static GLvoid *grabPixels(int inColor, unsigned int width, unsigned int height) { GLvoid *buffer; GLint swapbytes, lsbfirst, rowlength; GLint skiprows, skippixels, alignment; GLenum format; unsigned int size; if (inColor) { format = GL_RGB; size = width * height * 3; } else { format = GL_LUMINANCE; size = width * height * 1; } buffer = (GLvoid *) malloc(size); if (buffer == NULL) return NULL; /* Save current modes. */ glGetIntegerv(GL_PACK_SWAP_BYTES, &swapbytes); glGetIntegerv(GL_PACK_LSB_FIRST, &lsbfirst); glGetIntegerv(GL_PACK_ROW_LENGTH, &rowlength); glGetIntegerv(GL_PACK_SKIP_ROWS, &skiprows); glGetIntegerv(GL_PACK_SKIP_PIXELS, &skippixels); glGetIntegerv(GL_PACK_ALIGNMENT, &alignment); /* Little endian machines (DEC Alpha for example) could benefit from setting GL_PACK_LSB_FIRST to GL_TRUE instead of GL_FALSE, but this would require changing the generated bitmaps too. */ glPixelStorei(GL_PACK_SWAP_BYTES, GL_FALSE); glPixelStorei(GL_PACK_LSB_FIRST, GL_FALSE); glPixelStorei(GL_PACK_ROW_LENGTH, 0); glPixelStorei(GL_PACK_SKIP_ROWS, 0); glPixelStorei(GL_PACK_SKIP_PIXELS, 0); glPixelStorei(GL_PACK_ALIGNMENT, 1); /* Actually read the pixels. */ glReadPixels(0, 0, width, height, format, GL_UNSIGNED_BYTE, (GLvoid *) buffer); /* Restore saved modes. */ glPixelStorei(GL_PACK_SWAP_BYTES, swapbytes); glPixelStorei(GL_PACK_LSB_FIRST, lsbfirst); glPixelStorei(GL_PACK_ROW_LENGTH, rowlength); glPixelStorei(GL_PACK_SKIP_ROWS, skiprows); glPixelStorei(GL_PACK_SKIP_PIXELS, skippixels); glPixelStorei(GL_PACK_ALIGNMENT, alignment); return buffer; } static int generateEPS(const char *filename, int inColor, unsigned int width, unsigned int height) { FILE *fp; GLvoid *pixels; unsigned char *curpix; unsigned int components, i; int pos; unsigned char bitpixel; pixels = grabPixels(inColor, width, height); if (pixels == NULL) return 1; if (inColor) components = 3; /* Red, green, blue. */ else components = 1; /* Luminance. */ fp = fopen(filename, "w"); if (fp == NULL) { return 2; } fprintf(fp, "%%!PS-Adobe-2.0 EPSF-1.2\n"); fprintf(fp, "%%%%Creator: OpenGL pixmap render output\n"); fprintf(fp, "%%%%BoundingBox: 0 0 %d %d\n", width, height); fprintf(fp, "%%%%EndComments\n"); i = ((( width * height) + 7) / 8 ) / 40; /* # of lines, 40 bytes per line */ fprintf(fp, "%%%%BeginPreview: %d %d %d %d\n%%", width, height, 1, i); pos = 0; curpix = ( unsigned char *)pixels; for ( i = 0; i < width * height * components; ) { bitpixel = 0; if ( inColor) { double pix = 0.0; pix = 0.30 * ( double)curpix[ i++] + 0.59 * ( double)curpix[ i++] + 0.11 * ( double)curpix[ i++]; if ( pix > 127.0) bitpixel |= 0x80; pix = 0.30 * ( double)curpix[ i++] + 0.59 * ( double)curpix[ i++] + 0.11 * ( double)curpix[ i++]; if ( pix > 127.0) bitpixel |= 0x40; pix = 0.30 * ( double)curpix[ i++] + 0.59 * ( double)curpix[ i++] + 0.11 * ( double)curpix[ i++]; if ( pix > 127.0) bitpixel |= 0x20; pix = 0.30 * ( double)curpix[ i++] + 0.59 * ( double)curpix[ i++] + 0.11 * ( double)curpix[ i++]; if ( pix > 127.0) bitpixel |= 0x10; pix = 0.30 * ( double)curpix[ i++] + 0.59 * ( double)curpix[ i++] + 0.11 * ( double)curpix[ i++]; if ( pix > 127.0) bitpixel |= 0x08; pix = 0.30 * ( double)curpix[ i++] + 0.59 * ( double)curpix[ i++] + 0.11 * ( double)curpix[ i++]; if ( pix > 127.0) bitpixel |= 0x04; pix = 0.30 * ( double)curpix[ i++] + 0.59 * ( double)curpix[ i++] + 0.11 * ( double)curpix[ i++]; if ( pix > 127.0) bitpixel |= 0x02; pix = 0.30 * ( double)curpix[ i++] + 0.59 * ( double)curpix[ i++] + 0.11 * ( double)curpix[ i++]; if ( pix > 127.0) bitpixel |= 0x01; } else { if ( curpix[ i++] > 0x7f) bitpixel |= 0x80; if ( curpix[ i++] > 0x7f) bitpixel |= 0x40; if ( curpix[ i++] > 0x7f) bitpixel |= 0x20; if ( curpix[ i++] > 0x7f) bitpixel |= 0x10; if ( curpix[ i++] > 0x7f) bitpixel |= 0x08; if ( curpix[ i++] > 0x7f) bitpixel |= 0x04; if ( curpix[ i++] > 0x7f) bitpixel |= 0x02; if ( curpix[ i++] > 0x7f) bitpixel |= 0x01; } fprintf(fp, "%02hx", bitpixel); if (++pos >= 40) { fprintf(fp, "\n%%"); pos = 0; } } if (pos) fprintf(fp, "\n%%%%EndPreview\n"); else fprintf(fp, "%%EndPreview\n"); fprintf(fp, "gsave\n"); fprintf(fp, "/bwproc {\n"); fprintf(fp, " rgbproc\n"); fprintf(fp, " dup length 3 idiv string 0 3 0\n"); fprintf(fp, " 5 -1 roll {\n"); fprintf(fp, " add 2 1 roll 1 sub dup 0 eq\n"); fprintf(fp, " { pop 3 idiv 3 -1 roll dup 4 -1 roll dup\n"); fprintf(fp, " 3 1 roll 5 -1 roll put 1 add 3 0 }\n"); fprintf(fp, " { 2 1 roll } ifelse\n"); fprintf(fp, " } forall\n"); fprintf(fp, " pop pop pop\n"); fprintf(fp, "} def\n"); fprintf(fp, "systemdict /colorimage known not {\n"); fprintf(fp, " /colorimage {\n"); fprintf(fp, " pop\n"); fprintf(fp, " pop\n"); fprintf(fp, " /rgbproc exch def\n"); fprintf(fp, " { bwproc } image\n"); fprintf(fp, " } def\n"); fprintf(fp, "} if\n"); fprintf(fp, "/picstr %d string def\n", width * components); fprintf(fp, "%d %d scale\n", width, height); fprintf(fp, "%d %d %d\n", width, height, 8); fprintf(fp, "[%d 0 0 %d 0 0]\n", width, height); fprintf(fp, "{currentfile picstr readhexstring pop}\n"); fprintf(fp, "false %d\n", components); fprintf(fp, "colorimage\n"); curpix = (unsigned char *) pixels; pos = 0; for (i = width * height * components; i > 0; i--) { fprintf(fp, "%02hx", *curpix++); if (++pos >= 40) { fprintf(fp, "\n"); pos = 0; } } if (pos) fprintf(fp, "\n"); fprintf(fp, "grestore\n"); free(pixels); fclose(fp); return 0; } /* int Togl_DumpToEpsFile( const struct Togl *togl, const char *filename, int inColor, void (*user_redraw)(void)) */ /* changed by GG */ int Togl_DumpToEpsFile( const struct Togl *togl, const char *filename, int inColor, void (*user_redraw)( const struct Togl *)) { int using_mesa = 0; #if 0 Pixmap eps_pixmap; GLXPixmap eps_glxpixmap; XVisualInfo *vi = togl->VisInfo; Window win = Tk_WindowId( togl->TkWin); #endif Display *dpy = Tk_Display( togl->TkWin); int retval; int scrnum = Tk_ScreenNumber(togl->TkWin); unsigned int width = togl->Width, height = togl->Height; #if defined(X11) if (strstr(glXQueryServerString( dpy, scrnum, GLX_VERSION ), "Mesa")) using_mesa = 1; else #endif /* X11 */ using_mesa = 0; /* I don't use Pixmap do drawn into, because the code should link * with Mesa libraries and OpenGL libraries, and the which library * we use at run time should not matter, but the name of the calls * differs one from another: * MesaGl: glXCreateGLXPixmapMESA( dpy, vi, eps_pixmap, Tk_Colormap(togl->TkWin)) * OpenGl: glXCreateGLXPixmap( dpy, vi, eps_pixmap); * * instead of this I read direct from back buffer of the screeen. */ #if 0 eps_pixmap = XCreatePixmap( dpy, win, width, height, vi->depth); if ( using_mesa) eps_glxpixmap = glXCreateGLXPixmapMESA( dpy, vi, eps_pixmap, Tk_Colormap(togl->TkWin)); else eps_glxpixmap = glXCreateGLXPixmap( dpy, vi, eps_pixmap); glXMakeCurrent( dpy, eps_glxpixmap, togl->GlCtx); user_redraw(); #endif if ( !togl->RgbaFlag) { #if defined(WIN32) /* Due to the lack of a unique inverse mapping from the frame buffer to the logical palette we need a translation map from the complete logical palette. */ { int n, i; TkWinColormap *cmap = (TkWinColormap *)Tk_Colormap(togl->TkWin); LPPALETTEENTRY entry = malloc(togl->EpsMapSize * sizeof(PALETTEENTRY)); n = GetPaletteEntries(cmap->palette, 0, togl->EpsMapSize, entry); for (i=0; iEpsRedMap[i] = (GLfloat)(entry[i].peRed / 255.0); togl->EpsGreenMap[i] = (GLfloat)(entry[i].peGreen / 255.0); togl->EpsBlueMap[i] = (GLfloat)(entry[i].peBlue / 255.0); } free(entry); } #endif /* WIN32 */ glPixelMapfv( GL_PIXEL_MAP_I_TO_R, togl->EpsMapSize, togl->EpsRedMap); glPixelMapfv( GL_PIXEL_MAP_I_TO_G, togl->EpsMapSize, togl->EpsGreenMap); glPixelMapfv( GL_PIXEL_MAP_I_TO_B, togl->EpsMapSize, togl->EpsBlueMap); } /* user_redraw(); */ user_redraw(togl); /* changed by GG */ /* glReadBuffer( GL_FRONT); */ /* by default it read GL_BACK in double buffer mode*/ glFlush(); retval = generateEPS( filename, inColor, width, height); #if 0 glXMakeCurrent( dpy, win, togl->GlCtx ); glXDestroyGLXPixmap( dpy, eps_glxpixmap); XFreePixmap( dpy, eps_pixmap); #endif return retval; } /* * Full screen stereo for SGI graphics * Contributed by Ben Evans (Ben.Evans@anusf.anu.edu.au) * This code was based on SGI's /usr/share/src/OpenGL/teach/stereo */ #if defined(__sgi) && defined(STEREO) static struct stereoStateRec { Bool useSGIStereo; Display *currentDisplay; Window currentWindow; GLXContext currentContext; GLenum currentDrawBuffer; int currentStereoBuffer; Bool enabled; char *stereoCommand; char *restoreCommand; } stereo; /* call instead of glDrawBuffer */ void Togl_StereoDrawBuffer(GLenum mode) { if (stereo.useSGIStereo) { stereo.currentDrawBuffer = mode; switch (mode) { case GL_FRONT: case GL_BACK: case GL_FRONT_AND_BACK: /* ** Simultaneous drawing to both left and right buffers isn't ** really possible if we don't have a stereo capable visual. ** For now just fall through and use the left buffer. */ case GL_LEFT: case GL_FRONT_LEFT: case GL_BACK_LEFT: stereo.currentStereoBuffer = STEREO_BUFFER_LEFT; break; case GL_RIGHT: case GL_FRONT_RIGHT: stereo.currentStereoBuffer = STEREO_BUFFER_RIGHT; mode = GL_FRONT; break; case GL_BACK_RIGHT: stereo.currentStereoBuffer = STEREO_BUFFER_RIGHT; mode = GL_BACK; break; default: break; } if (stereo.currentDisplay && stereo.currentWindow) { glXWaitGL(); /* sync with GL command stream before calling X */ XSGISetStereoBuffer(stereo.currentDisplay, stereo.currentWindow, stereo.currentStereoBuffer); glXWaitX(); /* sync with X command stream before calling GL */ } } glDrawBuffer(mode); } /* call instead of glClear */ void Togl_StereoClear(GLbitfield mask) { GLenum drawBuffer; if (stereo.useSGIStereo) { drawBuffer = stereo.currentDrawBuffer; switch (drawBuffer) { case GL_FRONT: stereoDrawBuffer(GL_FRONT_RIGHT); glClear(mask); stereoDrawBuffer(drawBuffer); break; case GL_BACK: stereoDrawBuffer(GL_BACK_RIGHT); glClear(mask); stereoDrawBuffer(drawBuffer); break; case GL_FRONT_AND_BACK: stereoDrawBuffer(GL_RIGHT); glClear(mask); stereoDrawBuffer(drawBuffer); break; case GL_LEFT: case GL_FRONT_LEFT: case GL_BACK_LEFT: case GL_RIGHT: case GL_FRONT_RIGHT: case GL_BACK_RIGHT: default: break; } } glClear(mask); } static void stereoMakeCurrent(Display *dpy, Window win, GLXContext ctx) { if (stereo.useSGIStereo) { if (dpy && (dpy != stereo.currentDisplay)) { int event, error; /* Make sure new Display supports SGIStereo */ if (XSGIStereoQueryExtension(dpy, &event, &error) == False) { dpy = NULL; } } if (dpy && win && (win != stereo.currentWindow)) { /* Make sure new Window supports SGIStereo */ if (XSGIQueryStereoMode(dpy, win) == X_STEREO_UNSUPPORTED) { win = None; } } if (ctx && (ctx != stereo.currentContext)) { GLint drawBuffer; glGetIntegerv(GL_DRAW_BUFFER, &drawBuffer); stereoDrawBuffer((GLenum) drawBuffer); } stereo.currentDisplay = dpy; stereo.currentWindow = win; stereo.currentContext = ctx; } } /* call before using stereo */ static void stereoInit(struct Togl *togl,int stereoEnabled) { stereo.useSGIStereo = stereoEnabled; stereo.currentDisplay = NULL; stereo.currentWindow = None; stereo.currentContext = NULL; stereo.currentDrawBuffer = GL_NONE; stereo.currentStereoBuffer = STEREO_BUFFER_NONE; stereo.enabled = False; } void Togl_StereoFrustum(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat near, GLfloat far, GLfloat eyeDist, GLfloat eyeOffset) { GLfloat eyeShift = (eyeDist - near) * (eyeOffset / eyeDist); glFrustum(left+eyeShift, right+eyeShift, bottom, top, near, far); glTranslatef(-eyeShift, 0.0, 0.0); } #endif /* __sgi STEREO */ #ifdef macintosh /* needed to make shared library on Mac with CodeWarrior; should be overridden by user app */ /* int main(int argc, char *argv[]) { return -1; } */ /* the following code is borrowed from tkMacAppInit.c */ /* *---------------------------------------------------------------------- * * MacintoshInit -- * * This procedure calls Mac specific initilization calls. Most of * these calls must be made as soon as possible in the startup * process. * * Results: * Returns TCL_OK if everything went fine. If it didn't the * application should probably fail. * * Side effects: * Inits the application. * *---------------------------------------------------------------------- */ int Togl_MacInit(void) { int i; long result, mask = 0x0700; /* mask = system 7.x */ #if GENERATING68K && !GENERATINGCFM SetApplLimit(GetApplLimit() - (TK_MAC_68K_STACK_GROWTH)); #endif MaxApplZone(); for (i = 0; i < 4; i++) { (void) MoreMasters(); } /* * Tk needs us to set the qd pointer it uses. This is needed * so Tk doesn't have to assume the availablity of the qd global * variable. Which in turn allows Tk to be used in code resources. */ tcl_macQdPtr = &qd; /* * If appearance is present, then register Tk as an Appearance client * This means that the mapping from non-Appearance to Appearance cdefs * will be done for Tk regardless of the setting in the Appearance * control panel. */ if (TkMacHaveAppearance()) { RegisterAppearanceClient(); } InitGraf(&tcl_macQdPtr->thePort); InitFonts(); InitWindows(); InitMenus(); InitDialogs((long) NULL); InitCursor(); /* * Make sure we are running on system 7 or higher */ if ((NGetTrapAddress(_Gestalt, ToolTrap) == NGetTrapAddress(_Unimplemented, ToolTrap)) || (((Gestalt(gestaltSystemVersion, &result) != noErr) || (result < mask)))) { panic("Tcl/Tk requires System 7 or higher."); } /* * Make sure we have color quick draw * (this means we can't run on 68000 macs) */ if (((Gestalt(gestaltQuickdrawVersion, &result) != noErr) || (result < gestalt32BitQD13))) { panic("Tk requires Color QuickDraw."); } FlushEvents(everyEvent, 0); SetEventMask(everyEvent); Tcl_MacSetEventProc(TkMacConvertEvent); return TCL_OK; } int Togl_MacSetupMainInterp(Tcl_Interp * interp) { TkMacInitAppleEvents(interp); TkMacInitMenus(interp); return TCL_OK; } #endif /* macintosh */ /* ADDED BY ASH - START */ #endif /* WANT_SASAMI */ /* ADDED BY ASH - END */ %d\n", width, height, 8); fprintf(fp, "[%d 0 0 %d 0 0]\n", width, height); fprintf(fp, "{currentfile picstr readhexstring pop}\n"); fprintf(fp, "false %d\n", components); fprintf(fp, "colorimage\n"); curpix = (unsigned char *) pixels; pos = 0; for (i = width * height * components; i > 0; i--) { fprintf(fp, "%02hx", *curpix++); if (++pos >= 40) { fprintf(fp, "\n"); pos = 0; } } iftkeden1.32/Sasami/togl.h010060000025250000147000000201600733204443200163540ustar00ashleydcsother00001250000011/* $Id: togl.h,v 1.1 2001/08/01 18:23:22 cssbz Exp $ */ /* * Togl - a Tk OpenGL widget * Version 1.6 * Copyright (C) 1996-1998 Brian Paul and Ben Bederson * See the LICENSE file for copyright details. */ /* * $Log: togl.h,v $ * Revision 1.1 2001/08/01 18:23:22 cssbz * Initial version * * Revision 1.20 2001/01/29 18:11:53 brianp * Jonas Beskow's changes to use Tcl/Tk stub interface * * Revision 1.19 2000/05/12 00:28:12 thiessen * first Macintosh port * * Revision 1.18 1998/10/14 01:26:51 brianp * added Togl_SetTimerFunc(), bumped version to 1.6 * * Revision 1.17 1997/11/15 04:14:37 brianp * changed version to 1.5 * * Revision 1.16 1997/11/15 02:58:48 brianp * added Togl_TkWin() per Glenn Lewis * * Revision 1.15 1997/10/01 02:49:45 brianp * added SGI stereo functions from Ben Evans * * Revision 1.14 1997/08/26 02:05:19 brianp * added Togl_ResetDefaultCallbacks() and Togl_ClientData() (Greg Couch) * * Revision 1.13 1997/08/26 01:35:41 brianp * added Togl_Set*Func() functions from Matthias Ott * * Revision 1.12 1997/08/22 02:48:25 brianp * added WIN32 header stuff. changed Togl version to 1.4. * * Revision 1.11 1997/04/11 01:37:22 brianp * added Togl_TimerFunc() and related code from Elmar Gerwalin * * Revision 1.10 1997/02/16 10:03:33 brianp * removed GL/glx.h include, added X11/Xlib.h include * * Revision 1.9 1997/02/16 01:25:34 brianp * added new overlay and EPS functions from Miguel A. De Riera Pasenau * * Revision 1.8 1996/12/13 21:24:41 brianp * added Togl_DestroyFunc() contributed by scotter@iname.com * * Revision 1.7 1996/11/14 00:49:54 brianp * added Togl_Get/SetClientData() functions * * Revision 1.6 1996/11/05 02:40:12 brianp * added Togl_Configure() and Togl_UnloadBitmapFont() * * Revision 1.5 1996/10/25 03:44:06 brianp * updated version to 1.2 * * Revision 1.4 1996/10/24 01:20:17 brianp * added overlay constants and functions * * Revision 1.3 1996/10/24 00:13:34 brianp * added const qualifier to many function parameters * * Revision 1.2 1996/10/23 23:28:06 brianp * updated version to 1.1 * added TOGL_BITMAP_* constants * added Togl_LoadBitmapFont() * * Revision 1.1 1996/10/23 23:15:27 brianp * Initial revision * */ #ifndef TOGL_H #define TOGL_H #if defined(WIN32) # define WIN32_LEAN_AND_MEAN # include # undef WIN32_LEAN_AND_MEAN # if defined(_MSC_VER) # define EXPORT(a,b) __declspec(dllexport) a b # define DllEntryPoint DllMain # else # if defined(__BORLANDC__) # define EXPORT(a,b) a _export b # else # define EXPORT(a,b) a b # endif # endif #else # define EXPORT(a,b) a b #endif /* WIN32 */ #ifdef macintosh # ifndef MAC_TCL # define MAC_TCL # endif #endif #include #include #include #ifdef TOGL_X11 #include #endif #ifdef __sgi #include #include #endif #ifndef NULL #define NULL 0 #endif #ifdef __cplusplus extern "C" { #endif #define TOGL_VERSION "1.6" #define TOGL_MAJOR_VERSION 1 #define TOGL_MINOR_VERSION 6 /* * "Standard" fonts which can be specified to Togl_LoadBitmapFont() */ #define TOGL_BITMAP_8_BY_13 ((char *) 1) #define TOGL_BITMAP_9_BY_15 ((char *) 2) #define TOGL_BITMAP_TIMES_ROMAN_10 ((char *) 3) #define TOGL_BITMAP_TIMES_ROMAN_24 ((char *) 4) #define TOGL_BITMAP_HELVETICA_10 ((char *) 5) #define TOGL_BITMAP_HELVETICA_12 ((char *) 6) #define TOGL_BITMAP_HELVETICA_18 ((char *) 7) /* * Normal and overlay plane constants */ #define TOGL_NORMAL 1 #define TOGL_OVERLAY 2 struct Togl; typedef void (Togl_Callback) (struct Togl *togl); typedef int (Togl_CmdProc) (struct Togl *togl, int argc, char *argv[]); EXPORT(int,Togl_Init)(Tcl_Interp *interp); /* * Default/initial callback setup functions */ extern void Togl_CreateFunc( Togl_Callback *proc ); extern void Togl_DisplayFunc( Togl_Callback *proc ); extern void Togl_ReshapeFunc( Togl_Callback *proc ); extern void Togl_DestroyFunc( Togl_Callback *proc ); extern void Togl_TimerFunc( Togl_Callback *proc ); extern void Togl_ResetDefaultCallbacks( void ); /* * Change callbacks for existing widget */ extern void Togl_SetCreateFunc( struct Togl *togl, Togl_Callback *proc ); extern void Togl_SetDisplayFunc( struct Togl *togl, Togl_Callback *proc ); extern void Togl_SetReshapeFunc( struct Togl *togl, Togl_Callback *proc ); extern void Togl_SetDestroyFunc( struct Togl *togl, Togl_Callback *proc ); extern void Togl_SetTimerFunc( struct Togl *togl, Togl_Callback *proc ); /* * Miscellaneous */ extern int Togl_Configure( Tcl_Interp *interp, struct Togl *togl, int argc, char *argv[], int flags ); extern void Togl_MakeCurrent( const struct Togl *togl ); extern void Togl_CreateCommand( char *cmd_name, Togl_CmdProc *cmd_proc ); extern void Togl_PostRedisplay( struct Togl *togl ); extern void Togl_SwapBuffers( const struct Togl *togl ); /* * Query functions */ extern char *Togl_Ident( const struct Togl *togl ); extern int Togl_Width( const struct Togl *togl ); extern int Togl_Height( const struct Togl *togl ); extern Tcl_Interp *Togl_Interp( const struct Togl *togl ); extern Tk_Window Togl_TkWin( const struct Togl *togl ); /* * Color Index mode */ extern unsigned long Togl_AllocColor( const struct Togl *togl, float red, float green, float blue ); extern void Togl_FreeColor( const struct Togl *togl, unsigned long index ); extern void Togl_SetColor( const struct Togl *togl, unsigned long index, float red, float green, float blue ); /* * Bitmap fonts */ extern GLuint Togl_LoadBitmapFont( const struct Togl *togl, const char *fontname ); extern void Togl_UnloadBitmapFont( const struct Togl *togl, GLuint fontbase ); /* * Overlay functions */ extern void Togl_UseLayer( struct Togl *togl, int layer ); extern void Togl_ShowOverlay( struct Togl *togl ); extern void Togl_HideOverlay( struct Togl *togl ); extern void Togl_PostOverlayRedisplay( struct Togl *togl ); extern void Togl_OverlayDisplayFunc( Togl_Callback *proc ); extern int Togl_ExistsOverlay( const struct Togl *togl ); extern int Togl_GetOverlayTransparentValue( const struct Togl *togl ); extern int Togl_IsMappedOverlay( const struct Togl *togl ); extern unsigned long Togl_AllocColorOverlay( const struct Togl *togl, float red, float green, float blue ); extern void Togl_FreeColorOverlay( const struct Togl *togl, unsigned long index ); /* * User client data */ extern void Togl_ClientData( ClientData clientData ); extern ClientData Togl_GetClientData( const struct Togl *togl ); extern void Togl_SetClientData( struct Togl *togl, ClientData clientData ); /* * X11-only commands. * Contributed by Miguel A. De Riera Pasenau (miguel@DALILA.UPC.ES) */ #ifdef TOGL_X11 extern Display *Togl_Display( const struct Togl *togl ); extern Screen *Togl_Screen( const struct Togl *togl ); extern int Togl_ScreenNumber( const struct Togl *togl ); extern Colormap Togl_Colormap( const struct Togl *togl ); #endif /* * SGI stereo-only commands. * Contributed by Ben Evans (Ben.Evans@anusf.anu.edu.au) */ #ifdef __sgi extern void Togl_StereoDrawBuffer( GLenum mode ); extern void Togl_StereoFrustum( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat near, GLfloat far, GLfloat eyeDist, GLfloat eyeOffset ); extern void Togl_StereoClear( GLbitfield mask ); #endif /* * Generate EPS file. * Contributed by Miguel A. De Riera Pasenau (miguel@DALILA.UPC.ES) */ extern int Togl_DumpToEpsFile( const struct Togl *togl, const char *filename, int inColor, void (*user_redraw)(const struct Togl *) ); /* Mac-specific setup functions */ #ifdef macintosh int Togl_MacInit(void); int Togl_MacSetupMainInterp(Tcl_Interp *interp); #endif #ifdef __cplusplus } #endif #endif tkeden1.32/Sasami/utils.c010060000025250000147000000034720731367041600165570ustar00ashleydcsother00001250000011// -------------------------------------------------------------------------- // utils.c - This contains various Sasami utility functions // -------------------------------------------------------------------------- #include "../config.h" #ifdef WANT_SASAMI #include "debug.h" // -------------------------------------------------------------------------- // This is the UID counter - by incrementing it every time a UID is // allocated, we can be sure that all UIDs are unique. // -------------------------------------------------------------------------- static int sa_uidcounter = 1; // -------------------------------------------------------------------------- // This returns a Sasami UID (unique ID) number which can then be used to // reference an object. // -------------------------------------------------------------------------- int sa_getUID(void) { return sa_uidcounter++; } /* // -------------------------------------------------------------------------- // This copies the first word of a string into the buffer given // -------------------------------------------------------------------------- void sa_firstWord(char *dest,char *src); { int i = 0; while (src[i]!='\0') and (src[i]!=' ') and (src[i]!='\9') { dest[i]=src[i]; i++; } dest[i]='\0'; // Add terminator } // -------------------------------------------------------------------------- // This copies the last (ie not first) word of a string into the buffer given // -------------------------------------------------------------------------- void sa_lastWords(char *dest,char *src); { int i = 0; bool found = false; while (src[i]!='\0') and (src[i]!=' ') and (src[i]!='\9') { if (found) { dest[i]=src[i]; } if (src[i]==' ') or (src[i]=='\9') { found=true; } i++; } dest[i]='\0'; // Add terminator } */ #endif /* WANT_SASAMI */ tkeden1.32/Sasami/utils.h010060000025250000147000000012270727406552200165620ustar00ashleydcsother00001250000011// -------------------------------------------------------------------------- // utils.h - This contains headers for various Sasami utility functions // -------------------------------------------------------------------------- #include "debug.h" // -------------------------------------------------------------------------- // Fake booleans // -------------------------------------------------------------------------- #define bool int #define true 1 #define false 0 // -------------------------------------------------------------------------- // Functions // -------------------------------------------------------------------------- int sa_getUID(void); tkeden1.32/Sasami/CVS/004070000025250000147000000000000736260527200157035ustar00ashleydcsother00001250000011tkeden1.32/Sasami/CVS/Entries010060000025250000147000000011620736260527200172360ustar00ashleydcsother00001250000011/Makefile.in/1.4/Fri Jul 27 16:22:10 2001// /renderinit.c/1.1/Wed May 2 20:17:24 2001// /utils.h/1.1/Wed May 2 20:17:22 2001// /debug.h/1.2/Mon Jun 25 18:52:32 2001// /functions.c/1.4/Tue Jun 19 15:33:48 2001// /render.c/1.4/Wed Jun 20 20:17:10 2001// /render.h/1.2/Wed Jun 20 20:00:06 2001// /structures.c/1.4/Tue Jun 19 15:34:28 2001// /structures.h/1.2/Mon Jun 25 18:52:38 2001// /utils.c/1.4/Tue Jun 19 15:34:38 2001// /glpng.h/1.1/Wed Jun 20 20:07:02 2001// /togl.h/1.1/Wed Aug 1 18:23:22 2001// /togl.c/1.1/Thu Sep 13 19:24:03 2001// /glpng.c/1.2/Thu Sep 13 16:11:02 2001// /parser.c/1.6/Mon Oct 15 14:59:42 2001// D tkeden1.32/Sasami/CVS/Repository010060000025250000147000000000160727406552600200050ustar00ashleydcsother00001250000011tkeden/Sasami tkeden1.32/Sasami/CVS/Root010060000025250000147000000000550733030414200165330ustar00ashleydcsother00001250000011cssbz@cvs.eden.sourceforge.net:/cvsroot/eden tkeden1.32/Misc/004070000025250000147000000000000737051041400147165ustar00ashleydcsother00001250000011tkeden1.32/Misc/curses.c010060000025250000147000000062550733031500200163650ustar00ashleydcsother00001250000011/* * $Id: curses.c,v 1.7 2001/07/27 16:42:42 cssbz Exp $ */ static char rcsid[] = "$Id: curses.c,v 1.7 2001/07/27 16:42:42 cssbz Exp $"; /** * MACROS FUNCTIONS OF "CURSES" ARE REWRITTEN * * INTO TRUE FUNCTIONS * **/ #include "../config.h" #if (defined(HAVE_CURSES) || defined(HAVE_NCURSES)) && defined(TTYEDEN) #include "../Eden/eden.h" #include int _eden_initscr() { symbol *sp; initscr(); sp = lookup("stdscr"); sp->d.u.i = (Int) stdscr; change(sp, TRUE); sp = lookup("curscr"); sp->d.u.i = (Int) curscr; change(sp, TRUE); } int _eden_waddch(WINDOW *win, chtype ch) { waddch(win, ch); } int _eden_waddstr(WINDOW *win, char *str) { waddstr(win, str); } int _eden_box(WINDOW *win, chtype verch, chtype horch) { box(win, verch, horch); } int _eden_clearok(WINDOW *win, bool bf) { clearok(win, bf); } int _eden_wclear(WINDOW *win) { wclear(win); } int _eden_wclrtobot(WINDOW *win) { wclrtobot(win); } int _eden_wclrtoeol(WINDOW *win) { wclrtoeol(win); } int _eden_wdelch(WINDOW *win) { wdelch(win); } int _eden_wdeleteln(WINDOW *win) { wdeleteln(win); } int _eden_werase(WINDOW *win) { werase(win); } int _eden_winsch(WINDOW *win, chtype ch) { winsch(win, ch); } int _eden_winsertln(WINDOW *win) { winsertln(win); } int _eden_wmove(WINDOW *win, int y, int x) { wmove(win, y, x); } int _eden_overlay(WINDOW *srcwin, WINDOW *dstwin) { overlay(srcwin, dstwin); } int _eden_overwrite(WINDOW *srcwin, WINDOW *dstwin) { overwrite(srcwin, dstwin); } int _eden_wrefresh(WINDOW *win) { wrefresh(win); } int _eden_wstandout(WINDOW *win) { wstandout(win); } int _eden_wstandend(WINDOW *win) { wstandend(win); } int _eden_echo(void) { echo(); } int _eden_noecho(void) { noecho(); } int _eden_wgetch(WINDOW *win) { wgetch(win); } int _eden_wgetstr(WINDOW *win, char *str) { wgetstr(win, str); } int _eden_raw(void) { raw(); } int _eden_noraw(void) { noraw(); } WINDOW *_eden_newwin(int nlines, int ncols, int begin_y, int begin_x) { newwin(nlines, ncols, begin_y, begin_x); } int _eden_delwin(WINDOW *win) { delwin(win); } int _eden_endwin(void) { endwin(); } chtype _eden_winch(WINDOW *win) { winch(win); } int _eden_leaveok(WINDOW *win, bool bf) { leaveok(win, bf); } int _eden_mvcur(int oldrow, int oldcol, int newrow, int newcol) { mvcur(oldrow, oldcol, newrow, newcol); } int _eden_nl(void) { nl(); } int _eden_nonl(void) { nonl(); } int _eden_scrollok(WINDOW *win, bool bf) { scrollok(win, bf); } int _eden_scroll(WINDOW *win) { scroll(win); } int _eden_cbreak(void) { cbreak(); } int _eden_nocbreak(void) { nocbreak(); } /* crmode was replaced by cbreak in Solaris 2 - keep it here for compatibility. I'm attempting to do what the old curses version of this did here, but I still don't think I've got it right. */ int _eden_crmode(void) { cbreak(); raw(); } int _eden_nocrmode(void) { nocbreak(); noraw(); } /* Don't know how to cope with multiple arguments here int _eden_wprintw(WINDOW *win, char *fmt, arg ... ); int _eden_wscanw(WINDOW *win, char *fmt, arg ...); */ /* getx and gety seem to no longer exist */ #endif /* ifdef HAVE_CURSES or HAVE_NCURSES */ tkeden1.32/Misc/curses.h010060000025250000147000000064010733031506600163750ustar00ashleydcsother00001250000011/* * $Id: curses.h,v 1.10 2001/07/27 16:43:33 cssbz Exp $ */ #if (defined(HAVE_CURSES) || defined(HAVE_NCURSES)) && defined(TTYEDEN) #if INCLUDE == 'H' #include /* All this is designed to cope with the fact that some of the curses routines might be macros. We need to make them all functions. */ extern int _eden_initscr(); extern int _eden_waddch(); extern int _eden_winsch(); extern int _eden_initscr(); extern int _eden_waddch(); extern int _eden_waddstr(); extern int _eden_box(); extern int _eden_clearok(); extern int _eden_wclear(); extern int _eden_wclrtobot(); extern int _eden_wclrtoeol(); extern int _eden_wdelch(); extern int _eden_wdeleteln(); extern int _eden_werase(); extern int _eden_winsch(); extern int _eden_winsertln(); extern int _eden_wmove(); extern int _eden_overlay(); extern int _eden_overwrite(); extern int _eden_wrefresh(); extern int _eden_wstandout(); extern int _eden_wstandend(); extern int _eden_echo(); extern int _eden_noecho(); extern int _eden_wgetch(); extern int _eden_wgetstr(); extern int _eden_raw(); extern int _eden_noraw(); extern int _eden_newwin(); extern int _eden_delwin(); extern int _eden_endwin(); extern int _eden_winch(); extern int _eden_leaveok(); extern int _eden_mvcur(); extern int _eden_nl(); extern int _eden_nonl(); extern int _eden_scrollok(); extern int _eden_scroll(); extern int _eden_cbreak(); extern int _eden_nocbreak(); extern int _eden_crmode(); extern int _eden_nocrmode(); #endif /* if INCLUDE == 'H' */ #if INCLUDE == 'T' { "initscr", _eden_initscr, }, { "waddch", _eden_waddch, }, { "waddstr", _eden_waddstr, }, { "box", _eden_box, }, { "clearok", _eden_clearok, }, { "wclear", _eden_wclear, }, { "wclrtobot", _eden_wclrtobot, }, { "wclrtoeol", _eden_wclrtoeol, }, { "wdelch", _eden_wdelch, }, { "wdeleteln", _eden_wdeleteln, }, { "werase", _eden_werase, }, { "winsch", _eden_winsch, }, { "winsertln", _eden_winsertln, }, { "wmove", _eden_wmove, }, { "overlay", _eden_overlay, }, { "overwrite", _eden_overwrite, }, { "wrefresh", _eden_wrefresh, }, { "wstandout", _eden_wstandout, }, { "wstandend", _eden_wstandend, }, { "echo", _eden_echo, }, { "noecho", _eden_noecho, }, { "wgetch", _eden_wgetch, }, { "wgetstr", _eden_wgetstr, }, { "raw", _eden_raw, }, { "noraw", _eden_noraw, }, { "newwin", _eden_newwin, }, { "delwin", _eden_delwin, }, { "endwin", _eden_endwin, }, { "winch", _eden_winch, }, { "leaveok", _eden_leaveok, }, { "mvcur", _eden_mvcur, }, { "nl", _eden_nl, }, { "nonl", _eden_nonl, }, { "scrollok", _eden_scrollok, }, { "scroll", _eden_scroll, }, { "cbreak", _eden_cbreak, }, { "nocbreak", _eden_nocbreak, }, /* crmode was replaced by cbreak in Solaris 2 - keep it here for compatibility */ { "crmode", _eden_crmode, }, { "nocrmode", _eden_nocrmode, }, #endif /* if INCLUDE == 'T' */ #endif /* ifdef HAVE_CURSES or HAVE_NCURSES */ tkeden1.32/Misc/custom.c010060000025250000147000000022150733031514000163660ustar00ashleydcsother00001250000011/* * $Id: custom.c,v 1.8 2001/07/27 16:44:15 cssbz Exp $ */ static char rcsid[] = "$Id: custom.c,v 1.8 2001/07/27 16:44:15 cssbz Exp $"; / * SYSTEM INITIALIZATION * / #include #include "../config.h" #include "../Eden/eden.h" #include "../Eden/yacc.h" #include "custom.h" #define INCLUDE 'H' #include "../Eden/builtin.h" #include "customlib.h" #undef INCLUDE struct ILIBTBL ilibtbl[] = { #define INCLUDE 'T' #include "customlib.h" #undef INCLUDE {0, 0} }; struct RLIBTBL rlibtbl[] = { #define INCLUDE 'R' #include "customlib.h" #undef INCLUDE {0, 0} }; void install_custom_variables(void) { /* PRE-DEFINED VARIABLES */ #define INSTALL_VAR(name, value) \ (install(name, VAR, INTEGER, value))->changed = FALSE #if (defined(HAVE_CURSES) || defined(HAVE_NCURSES)) && defined(TTYEDEN) INSTALL_VAR("stdscr", (int) stdscr); INSTALL_VAR("curscr", (int) curscr); #endif /** these are standard input/output file pointers **/ /** don't change them **/ INSTALL_VAR("stdin", (int) stdin); INSTALL_VAR("stdout", (int) stdout); INSTALL_VAR("stderr", (int) stderr); } tkeden1.32/Misc/custom.h010060000025250000147000000005670727406553000164170ustar00ashleydcsother00001250000011/* * $Id: custom.h,v 1.5 1999/11/16 21:20:40 ashley Rel1.10 $ */ struct ILIBTBL { /* C LIB FUNCTIONS */ char *name; int (*func) (); }; struct RLIBTBL { /* FLOATING POINT C LIB FUNCTIONS */ char *name; double (*func) (); }; extern struct ILIBTBL ilibtbl[]; extern struct RLIBTBL rlibtbl[]; void install_custom_variables(void); tkeden1.32/Misc/customlib.h010060000025250000147000000145250733031530000170670ustar00ashleydcsother00001250000011/* * $Id: customlib.h,v 1.12 2001/07/27 16:45:51 cssbz Exp $ */ #ifndef __WIN32__ # if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) # define __WIN32__ # endif #endif /* ------------------------ library.h --------------------------- */ /\ **** ** ** ** The following macros are intended to reduce the ** ** complexity of binding EDEN functions with C functions. ** ** Programmers are adviced to use these macros in their ** ** header files. The macros are: ** ** ** ** Function(Ename,Cname) -- bind Eden name to Cname func. ** ** SameFunc(Name) -- Eden's name is the same as C's name. ** ** SpecialF(Ename,Type,Cname) ** ** -- if the type of C func isn't int, ** ** Type specifies the type. ** ** ** **** \/ /* This file gets included from custom.c three times, with INCLUDE defined to something else each time. In order: INCLUDE == 'H' (Header?) - included as global text, to make initial declarations INCLUDE == 'T' (Table?) - included into ilibtcl (an array of ILIBTBL structs) INCLUDE == 'R' (Real?) - included into rlibtcl (an array of RLIBTBL structs) [Ash] */ #if INCLUDE == 'H' #define SpecialF(Ename,Type,Cname)extern Type Cname(); #define Function(Ename,Cname)extern Cname(); #define SameFunc(Name)extern Name(); #define RealFunc(Ename,Cname)extern double Cname(); #define SameReal(Name)extern double Name(); #endif #if INCLUDE == 'T' #ifdef __STDC__ /* Note the # is a preprocessor quoting operator: standard compilers now don't expand macro strings inside "" [Ash] */ #define SpecialF(Ename,Type,Cname){#Ename,(int(*)())Cname}, #define Function(Ename,Cname){#Ename,Cname}, #define SameFunc(Name){#Name,Name}, #else /* not __STDC__... */ #define SpecialF(Ename,Type,Cname){"Ename",(int(*)())Cname}, #define Function(Ename,Cname){"Ename",Cname}, #define SameFunc(Name){"Name",Name}, #endif #endif #if INCLUDE == 'T' /* We should ignore real-valued functions */ #define RealFunc(Ename,Cname) #define SameReal(Name) #endif #if INCLUDE == 'R' #define SpecialF(Ename,Type,Cname) #define Function(Ename,Cname) #define SameFunc(Name) #ifdef __STDC__ #define RealFunc(Ename,Cname){#Ename,Cname}, #define SameReal(Name){#Name,Name}, #else /* not __STDC__... */ #define RealFunc(Ename,Cname){"Ename",Cname}, #define SameReal(Name){"Name",Name}, #endif #endif /\ **** ** ** ** The following include files containes EDEN/C binding ** ** header files. ** ** If programmers do not use the macros, the format of the ** ** header files should be: ** ** #if INCLUDE == 'H' ** ** extern C_name(); C function declaration ** ** ... etc. ** ** #endif ** ** #if INCLUDE == 'T' ** ** {"Eden_name",C_name,0}, binding declaration ** ** the 0 means int function ** ** 1 means double ** ** ... etc. ** ** #endif ** ... Ash's note: looks like the third parameter in the binding declaration here (specifying type) was never implemented. ** ** **** \/ #if (defined(HAVE_CURSES) || defined(HAVE_NCURSES)) && defined(TTYEDEN) #include "curses.h" #endif #include #include #ifdef HAVE_DMALLOC #include #endif /* <<<<------ Any more header files should be inserted here */ /\ **** ** ** ** The following declarations bind some standard ** ** C functions to EDEN names. ** ** ** ** Note: no commas or semicolons are needed ** ** after the macros. ** ** ** **** \/ SameFunc(system) SameFunc(fprintf) /* The declaration of sprintf might need to be the one commented out * below in some circumstances, but I don't know which ones yet. The * old code used to look for a declaration of SYSV, but I'm not sure * about this. Tell me if you need to make this change, and we'll put * a test into the configure script for it. [Ash, June 1999] */ /* SpecialF(sprintf, char *, sprintf) */ SameFunc(sprintf) SpecialF(popen,FILE *,popen) SameFunc(pclose) SpecialF(fopen,FILE *,fopen) SameFunc(fclose) SameFunc(fseek) SpecialF(setbuf,void,setbuf) SpecialF(trace,void,user_trace) /* produce trace message */ SpecialF(eager,void,eager) /* eagerly eval all def's and action's */ /* the followings are math functions */ /* random is declared in stdlib.h and has various return types on various systems. As it is declared by stdlib.h already, declaring it again with the correct type simply adds complexity - let's try this. [Ash] */ #if INCLUDE == 'T' {"rand", (int(*)())random}, {"srand", (int(*)())srandom}, #endif SameReal(sqrt) SameReal(sin) SameReal(cos) SameReal(tan) SameReal(asin) SameReal(acos) SameReal(atan) SameReal(atan2) SameReal(exp) SameReal(log) SameReal(log10) SameReal(pow) SameReal(sinh) SameReal(cosh) SameReal(tanh) /* end of macros */ #undef SpecialF #undef Function #undef SameFunc #undef RealFunc #undef SameReal DE == 'T' /* We should ignore real-valued functions */ #define RealFunc(Ename,Cname) #define SameReal(Name) #endif #if INCLUDE == 'R' #define SpecialF(Ename,Type,Cname) #tkeden1.32/Misc/Makefile.in010060000025250000147000000002020733031246200167530ustar00ashleydcsother00001250000011# # $Id: Makefile.in,v 1.10 2001/07/27 16:22:10 cssbz Exp $ # SOURCES = custom.c curses.c LIB = libmisc.a include ../generic.mk tkeden1.32/Misc/CVS/004070000025250000147000000000000735463305200153575ustar00ashleydcsother00001250000011tkeden1.32/Misc/CVS/Entries010060000025250000147000000004010733031530200166720ustar00ashleydcsother00001250000011/Makefile.in/1.10/Fri Jul 27 16:22:10 2001// /custom.h/1.5/Wed May 2 20:17:28 2001// /curses.c/1.7/Fri Jul 27 16:42:42 2001// /curses.h/1.10/Fri Jul 27 16:43:33 2001// /custom.c/1.8/Fri Jul 27 16:44:15 2001// /customlib.h/1.12/Fri Jul 27 16:45:51 2001// D tkeden1.32/Misc/CVS/Repository010060000025250000147000000000140727406553000174540ustar00ashleydcsother00001250000011tkeden/Misc tkeden1.32/Misc/CVS/Root010060000025250000147000000000550733030412400162110ustar00ashleydcsother00001250000011cssbz@cvs.eden.sourceforge.net:/cvsroot/eden tkeden1.32/lib-tkeden/004070000025250000147000000000000737051021100160345ustar00ashleydcsother00001250000011tkeden1.32/lib-tkeden/arca.lib010060000025250000147000000563440733204145200174510ustar00ashleydcsother00001250000011/*** * - EDEN library routines - * * - edenlib.e - * ****/ /* $Id: arca.lib,v 1.2 2001/08/01 17:58:02 cssbz Exp $ */ /* used the operator `varname` which turns a string into a variable */ setbuf(stdout, 0); NullStr =""; ON = 1; OFF = 0; CART ='C'; LINE ='L'; LABEL ='T'; ABST ='A'; EXPL ='E'; INT ='I'; VERT ='V'; COL ='C'; DIAG ='D'; DEBUG ='N'; ARROW_BEGIN = 0.51; ARROW_END = 0.6; ARROW_FACTOR = 0.05; _ARROW = ON; _LABEL = ON; _line_colour=["red","blue","green","brown","thistle","yellow","lightblue"]; proc debugmsg { if (DEBUG=='Y') writeln($1); } proc _writeln { auto count; for (count = 1; count <= $#; count++) writeln($[count]); } func if_assign { return $1 ? $2 : $3; } proc check_mode { if ($1 == 0) writeln("ERROR LHS IS ABSTRACT OR UNDEFINED"); } func one_int { return [INT,EXPL,0,$1]; } UNDEF = one_int(@); UNDEF_VERT = [VERT, EXPL, 2, [[UNDEF], [UNDEF]]]; UNDEF_COL = [COL, EXPL, @, [[UNDEF]]]; func op_and { return $1 && $2; } func op_or { return $1 || $2; } func check_int{ auto modval, val,value, int; int = ($# == 2) ? $1 : $1[4][$3]; val = int[4]; if (val==@) return [$2[1],$2[2],$2[3],value]; modval = $2[3]; value = (modval==0 || modval==1 ) ? val : val % modval; if (value == 0) value = modval; if (modval==@) return[INT,ABST,int[3],value]; if ($2!=@) if (int[3]!=$2[3] && int[3]) { writeln("ERROR INTS OF INCOMPATIBLE MODULUS"); exit(0); } else return ($2[2]==EXPL) ? [$2[1],$2[2],$2[3],value] : [$2[1],$2[2],int[3],value]; else return[INT,@,@,int[4]]; } func int_mult { /* if ($1==2 || $2==@) return [INT,@,@,@]; */ if ($1[3]!=$2[3] && $1[3] && $2[3]) writeln("ERROR INTEGERS OF INCOMPATIBLE DIM"); else return [$1[1],$1[2],$1[3],$1[4] * $2[4]]; } func int_div { /* if ($1==2 || $2==@) return [INT,@,@,@]; */ if ($1[3]!=$2[3] && $1[3] && $2[3]) writeln("ERROR INTEGERS OF INCOMPATIBLE DIM"); else return [$1[1],$1[2],$1[3],int($1[4] / $2[4])]; } func int_add { /* if ($1==2 || $2==@) return [INT,@,@,@]; */ if ($1[3]!=$2[3] && $1[3] && $2[3]) writeln("ERROR INTEGERS OF INCOMPATIBLE DIM"); else return [$1[1],$1[2],$1[3],$1[4] + $2[4]]; } func int_sub { /* if ($1==2 || $2==@) return UNDEF; */ if ($1[3]!=$2[3] && $1[3] || $2[3]) { writeln("ERROR INTEGERS OF INCOMPATIBLE DIM"); return UNDEF; } else return ($1[3]>$2[3]) ? [$1[1],$1[2],$1[3],$1[4] - $2[4]] : [$1[1],$1[2],$2[3],$1[4] - $2[4]]; } func int_mod { if ($2[3]==0) return [$1[1],$1[2],$1[3],$1[4] % $2[4]]; else { writeln("ERROR ILLEGAL DIM IN MOD INT"); return UNDEF; }; } func int_rup { auto result, sign; if ($1[4] == @ || $2[4] == @) return UNDEF; sign = ($2[4] < 0) ? -1 : 1; result = $1[4] % $2[4]; return one_int((result == 0) ? $1[4] : (result > 0) ? $1[4] - result + sign * $2[4] : $1[4] + result - sign * $2[4]); } func int_smash { auto new_mod, int1, int2, result; int1 = $1[4]; int2 = $2[4]; if (int1 == @ || int2 == @ || $1[3] == @ || $2[3] == @) return UNDEF; new_mod = $1[3] * $2[3]; result = int1+$1[3]; while (result%$1[3] != int1 || result%$2[3] != int2) result = result+$1[3]; return [INT,$1[2],new_mod,result]; } func int_inv { auto u,v,q,r,f,g,h,m,n; n = $1[3]; m = $1[4]; if (n == @ || m == @) return UNDEF; u=m; v=n; r=n; f=1; g=0; h=0; while (r) { q=u/v; h=f-g*q; r=u-v*q; f=g; u=v; g=h; v=r; }; if (u==1) return [INT,EXPL,$1[3],f]; writeln("NO INVERSE - INT INV"); return UNDEF; } func int_prime {return [INT, EXPL, 0,$1[4]];}/*normalises after mod calc*/ func int_size {return [INT,EXPL,0,$1[3]];} func i_eq { return ($1[4]==$2[4]); } func int_lt { if ($1[3] == $2[3]) { return ($1[4] == @ || $2[4] == @) ? 0 : ($1[4] < $2[4]); } else { writeln("ERROR INTS OF INCOMPATIBLE DIM"); return 0; }; } func int_grt { if ($1[3] == $2[3]) { return ($1[4] == @ || $2[4] == @) ? 0 : ($1[4] > $2[4]); } else { writeln("ERROR INTS OF INCOMPATIBLE DIM"); return 0; } } func int_ltoe { if ($1[3] == $2[3]) { return ($1[4] == @ || $2[4] == @) ? 0 : ($1[4] <= $2[4]); } else { writeln("ERROR INTS OF INCOMPATIBLE DIM"); return 0; } } func int_gtoe { if ($1[3] == $2[3]) { return ($1[4] == @ || $2[4] == @) ? 0 : ($1[4] >= $2[4]); } else { writeln("ERROR INTS OF INCOMPATIBLE DIM"); return 0; } } func int_ne { if ($1[3] == $2[3]) { return ($1[4] == @ || $2[4] == @) ? 0 : ($1[4] != $2[4]); } else { writeln("ERROR INTS OF INCOMPATIBLE DIM"); return 0; } } func i_actval {return @;} /*replaces symbolic expressions with values */ func find_min { auto min, count; min = @; for(count=1; count<=$1#; count++) if ($1[count]!=@ && $2[count]) min = (min==@ || $1[count]<$1[min]) ? count : min; return min; } func col_dist{ para start, end; auto count, ncols, at, dists, useable; useable = []; dists = []; ncols = $# ; for(count = 1; count<=$3[3]; count++) { useable = useable//[1]; dists = dists//[@]; } if (start == 0 || end == 0) return UNDEF; if (start > $3[3] || end > $3[3]) { writeln( "START OR END POINT OUT OF RANGE OF PERM"); return UNDEF; } dists[start] = 0; for (at = find_min(dists,useable); at!=end && at!=@; at = find_min(dists,useable)) { for (count=3; count<=ncols; count++){ if ($[count][4][at][4]!=@ && $[count][4][at][4] && (dists[$[count][4][at][4]]==@ || dists[$[count][4][at][4]]>dists[at]+1)) dists[$[count][4][at][4]]=dists[at]+1; }; useable[at]=0; } return(one_int(dists[end])); } func col_mult { auto count, permsize, result; permsize = $1[4]#; result = []; if (($1[4]# != $2[4]#)) { writeln("ERROR INCOMPATIBLE PERMS"); return UNDEF_COL; } for (count = 1; count <= permsize; count= count+1) result = ($2[4][count][4]!=@ && $2[4][count][4] && $1[4][$2[4][count][4]][4]) ? result // [$1[4][$2[4][count][4]]] : result // [UNDEF]; return [COL,EXPL,permsize,result]; } func vert_col { return [COL, $1[2], $1[3], $1[4]]; } func join_cols { auto count, size, result; if ($1[3] == 0 || $2[3] == 0) return UNDEF_COL; if ($1[3] > $2[3]) { size = $1[3]; result = $1[4]; for (count = 1; count <= $2[3]; count++) if (result[count][4] == @) result[count] = $2[4][count]; } else { size = $2[3]; result = $2[4]; for (count = 1; count <= $1[3]; count++) if ($1[4][count][4] != @ && $1[4][count][4]) result[count] = $1[4][count]; }; return [COL, EXPL, size, result]; } func col_size { auto length, count, largest; length = $1#; largest = length; for (count = 1; count <= length; count++) if ($1[count][4] != @ && $1[count][4] > largest) largest = $1[count][4]; return largest; } func list_undef { para length; auto count, result; result = []; for (count = 1; count < length; count ++) append result, UNDEF; return result; } func check_col { auto ERROR, count, undef; ERROR = 0; if ($2[3] != 0){ undef = list_undef($2[3]); if ($1[4]# != $2[3]) { writeln("ERROR COLS OF INCOMPATIBLE SIZE"); ERROR = 1; } else for (count = 1; count <= $1[4]#; count++) { if ($1[4][count][4] != @ && $1[4][count][4] > $2[3]){ writeln("INT OUT OF RANGE IN COL"); ERROR = 1; }; }; } else undef = list_undef($1[4]#); return (ERROR==1) ? [COL,$2[2],$2[3], undef] : [COL,$2[2],$1[3],$1[4]]; } func c_make { auto size, count, result ; result = []; size = col_size($1); for (count = 1; count <= size; count++) append result, UNDEF; for (count = 1; count <= $1# - 1; count++) { if ($1[count][4] != @ && $1[count][4]) result[$1[count][4]] = $1[count+1]; if ($1[count+1][4] == @ && $1[count][4] == 0) result[$1[count][4]]= UNDEF; }; if ($1[$1#][4] != @ && $1[$1#][4]) result[$1[$1#][4]] = $1[1]; return [COL,EXPL,size,result]; } func col_exp { auto count, result, size; size = $2[4]; result = $1; if ($2[4] != @){ if ($2[4] < 0) size = - $2[4]; for (count = 1; count <= size-1; count++) result = col_mult(result ,$1); }; if ($2[4]==0){ result = []; for (count= 1; count<= $1[4]#; count++) append result, one_int(count); result = [COL,EXPL,$1[3]]//[result]; }; return ($2[4] != @) ? (($2[4] > -1) ? result : col_inv(result)) : UNDEF_COL; } func cactval {return @;} func col_inv { /*inverse of a perm*/ auto result, count; result = []; if ($1[3] != $1[4]# || $1[3]==@ || $1[4]==@) return UNDEF_COL; for (count = 1; count<= $1[3]; count++) append result, UNDEF; for (count = 1; count<= $1[3]; count++) if (($1[4][count][4]==@)||($1[4][count][4]==0)); /* writeln("WARNING-PERM NOT COMPLETELY DEFINED - INV");*/ else result[$1[4][count][4]] = one_int(count); return [$1[1], $1[2], $1[3], result]; } func cat_cols { auto count, size, result; size = $1[3] + $2[3]; result = $1[4] // $2[4]; for (count = $1[3]+1; count <= size; count++) if (result[count][4] != @) result[count][4] += $1[3]; return [COL, EXPL, size, result]; } func colisize {return [INT,EXPL,0,$1[3]];} /*degree of the perm*/ proc c_bin_fns { /*works for binary functions*/ auto ERROR, count, undef; ERROR = 0; if ($1[3] != 0){ undef = list_undef($1[3]); if ($2[4]# != $1[3]){ writeln("ERROR COLS OF INCOMPATIBLE SIZE"); ERROR = 1; }; for (count = 1; ERROR == 0 && count <= $1[3]; count++){ if ($2[4][count][4] != @ && $2[4][count][4] > $1[3]){ writeln("INT OUT OF RANGE IN COL"); ERROR = 1; }; }; }; } proc v_make { return [VERT,EXPL,$1#,$1]; } func check_vert { auto vert; vert = ($#==2) ? $1 : $1[$3]; if (vert[3] != $2[3] && $2[3]!=0){ writeln("ERROR VERTS OF INCOMPATIBLE DIM"); return UNDEF_VERT; } else return [vert[1], $2[2], vert[3], vert[4]]; } proc v_bin_fns { /*works for binary functions*/ if ($1[3]!=$2[3] && $1[2]!=ABST) writeln("ERROR VERTS OF INCOMPATIBLE DIM"); } func vert_add { auto result, count; if ($1[4]==@ || $2[4]==@) return UNDEF_VERT; if($1[3]!=$2[3]) writeln("ERROR VERTS INCOMPATIBLE DIM (RHS)"); result =[]; for (count = 1; count <= $1[3]; count++) append result, int_add($1[4][count],$2[4][count]); return [$1[1],$1[2],$1[3],result]; } func vert_sub { auto result, count; if ($1[4]==@ || $2[4]==@) return UNDEF_VERT; if($1[3]!=$2[3]) writeln("ERROR VERTS INCOMPATIBLE DIM (RHS)"); result =[]; for (count = 1; count <= $1[3]; count++) append result, int_sub($1[4][count],$2[4][count]); return [$1[1],$1[2],$1[3],result]; } proc vert_mult { auto result, count; if ($1[4]==@ || $2[4]==@) return UNDEF_VERT; result =[]; for (count = 1; count <= $2[3]; count++) append result, int_mult($1,$2[4][count]); return [$2[1],$2[2],$2[3],result]; } func vert_rot { para vert, other; auto xc, yc, xr, yr, angle, plane1, plane2; angle = other[4][1][4] * PI / 180; plane1 = other[4][2][4]; plane2 = other[4][3][4]; xc = vert[4][plane1][4]; yc = vert[4][plane2][4]; if ((angle * plane1 * plane2 * xc * yc) == @) return UNDEF_VERT; xr = int(xc * cos(angle) - yc * sin(angle)); yr = int(xc * sin(angle) + yc * cos(angle)); vert[4][plane1] = one_int(xr); vert[4][plane2] = one_int(yr); return vert; } func v_ref {return @;} /*reflection*/ func vert_smash { /*cat vertices dim N ,M -> N+M*/ return [$1[1],$2[2],$1[3]+$2[3], $1[4]//$2[4]]; } func v_actval {return @;} func vert_size {return [INT,EXPL,0,$1[3]];} func vneq { auto count, result; result = 0; if ($1[3] != $2[3]) writeln("ERROR VERTS Of INCOMPATIBLE DIM (IF)"); else for (count = 1; count <= $1[3]; count++) if ($1[4][count] == $2[4][count]) result++; return result!=$1[3]; } func veq { auto count, result; if ($1[3] != $2[3]) writeln("ERROR VERTS Of INCOMPATIBLE DIM (IF)"); else for (count = 1; count <= $1[3]; count++) if ($1[4][count] == $2[4][count]) result++; return result==$1[3]; } proc d_bin_fns{ if ($1[3]!=$2[3] && $1[3]!=0) writeln("ERROR DIAGS OF INCOMPATIBLE SIZE"); } func check_diag { if ($2[3]==0 || $1[3]==$2[3]) return $1[4][2]; } func diag_join { return [DIAG, EXPL, $2[3]+$1[3], [EXPL, $1[4][2]//$2[4][2]]]; } func sub_diag { auto subsize, result, count; subsize = $# - 1; result = []; for (count = 1; count <= subsize; count++) { if ($[count+1][4] != @) append result, $1[4][2][$[count+1][4]]; else append result, UNDEF_VERT; } return [DIAG, EXPL, $#-1, [EXPL, result]]; } func diag_mult { auto result, count; result = []; for (count = 1;count <= $2[3]; count++) append result, vert_mult($1,$2[4][2][count]); return [DIAG, EXPL, $2[3], [EXPL, result]]; } func diag_rot { auto result, count; result = []; for (count = 1;count <= $1[3]; count++) append result, vert_rot($1[4][2][count], $2); return [DIAG, EXPL, $1[3], [EXPL, result]]; } func v_trans { auto count, verts, result; result = []; verts = $2[4][2]#; for (count=1; count <= verts; count++) append result, vert_add( $1, $2[4][2][count]); return [$2[1],$2[2],$2[3], [$2[4][1], result], $2[5]]; } func diag_smash { auto count, result; result = []; for (count = 1; count <= $1[3]; count++) result = result//v_trans($1[4][2][count],$2)[4][2]; return [$2[1],$2[2],$2[3]*$1[3], [$1[4][1], result]]; } func diag_size {return [INT,EXPL,0,$1[2][2]];} /*number of verts*/ func nd_2d { para vert; auto count, count2, dim; dim = vert#; for (count = dim; count>=3; count--) for (count2 = dim-1; count2 >= 1; count2--) if (vert[count2][4] > 0) { vert[count2][4] = vert[count2][4] - 0.1*vert[count][4]; if (vert[count2][4] < 0) vert[count2][4] = 0; } else if (vert[count2][4] < 0 ) { vert[count2][4] = vert[count2][4] + 0.1*vert[count][4]; if (vert[count2][4] > 0)vert[count2][4] = 0; }; return [vert[1],vert[2]]; } func inColList { para list, item; auto i; if (list == []) return 0; for (i = 1; i <= list#; i++) if (list[i] == item) return i; return 0; } /*** Functions for manipulating assocative memory ***/ func searchKey { para map, key; auto start, mid, end; start = 1; end = (*map)#; mid = (start + end) / 2; while ( start <= mid && mid <= end ) { if ((*map)[mid][1] > key) end = mid - 1; else if ((*map)[mid][1] < key) start = mid + 1; else /* match */ return [ mid, (*map)[mid][2] ]; mid = (start + end) / 2; } return [mid < start ? start : mid, @]; } func putKey { para map, key, data; auto ans; ans = searchKey(map, key); if (ans[2] == @) { insert *map, ans[1], [key, data]; return ans[1]; } else /* already there */ return 0; /* fail */ } func deleteKey { para map, key; auto ans; ans = searchKey(map, key); if (ans[2] == @) { return 0; /* fail */ } else { /* found */ delete *map, ans[1]; return ans[1]; } } func replaceKey { para map, key, data; auto ans; ans = searchKey(map, key); if (ans[1] > (*map)# || (*map)[ans[1]][1] != key) /* not there */ insert *map, ans[1], [key, data]; else /* found */ (*map)[ans[1]][2] = data; return ans[1]; } proc dispNoLabels { auto diag, dname, oldDiagCols, cols, window, j, vertex; auto collist, pos; diag = *($[$#-1]); dname = nameof($[$#-1]); oldDiagCols = "old_"//dname//"_cols"; if (`oldDiagCols` == @) `oldDiagCols` = []; collist = []; cols = $#-2; window = $[$#]; for (j = cols; j >= 2; j -= 2) { append collist, $[j-1]; if (pos = inColList(`oldDiagCols`, $[j-1])) { delete `oldDiagCols`, pos; } delete_shape(&`$[j-1]//"__"`); draw_col($[j-1],$[j][4],diag[4][2],window); } while (`oldDiagCols` != []) { delete_shape(&``oldDiagCols`[1]//"__"`); shift `oldDiagCols`; } vertex = "L_"//dname; delete_shape(&`vertex`); `oldDiagCols` = collist; } proc dispWithLabels { auto diag, dname, oldDiagCols, cols, window, i, j, vertex; auto collist, pos; auto var, viewport_name; diag = *($[$#-1]); dname = nameof($[$#-1]); oldDiagCols = "old_"//dname//"_cols"; if (`oldDiagCols` == @) `oldDiagCols` = []; collist = []; cols = $#-2; window = $[$#]; for (j = cols; j >= 2; j -= 2) { append collist, $[j-1]; if (pos = inColList(`oldDiagCols`, $[j-1])) { delete `oldDiagCols`, pos; } delete_shape(&`$[j-1]//"__"`); draw_col($[j-1],$[j][4],diag[4][2],window); } while (`oldDiagCols` != []) { delete_shape(&``oldDiagCols`[1]//"__"`); shift `oldDiagCols`; } vertex = "L_"//dname; delete_shape(&`vertex`); `oldDiagCols` = collist; for(i = 1; i<=diag[4][2]#; i++){ x1 = nd_2d(diag[4][2][i][4])[1][4]; y1 = nd_2d(diag[4][2][i][4])[2][4]; _p1 = cart(x1,y1); _L_attr = "color=gray1"; `vertex` = label(str(i),_p1); PLOT_label(`window`, &`vertex`, &_L_attr); } } proc draw_col { para c_nm,cols,verts,window; auto k1,x1,y1,x2,y2,li,vert; auto colour, style, _L_attr; auto var, viewport_name; colour = c_nm[c_nm#]-'a'+1; colour = colour ? colour : _line_colour#; style = (displayDepth > 1) ? "solid,color="//_line_colour[colour] : (colour == 1) ? "solid,color=gray1" : "dashed,dash="//str(colour*20+2); _L_attr = "linestyle="//style ; for (k1=1;k1<=cols#;k1++){ vert = nd_2d(verts[k1][4]); x1=vert[1][4]; y1=vert[2][4]; _p1 = cart(x1,y1); if ((cols[k1][4] != @ && cols[k1][4])&& (k1!=cols[cols[k1][4]][4] || k1\ on host <$eshost>.\n\ Please login with your agent name" entry .login.usrName -relief sunken -textvariable usrName pack .login.mess .login.usrName -side top -padx 1m -pady 2m button .login.ok -text "OK" -command { if {[string trim $usrName] != ""} { sendUsrName; destroy .login } else { bell } } # button .login.cancel -text "Cancel" -command { notLogin; destroy .login } button .login.clear -text "Clear" -command { set usrName ""; focus .login.usrName } pack .login.ok .login.clear -side left -expand 1 bind .login.usrName { sendUsrName; destroy .login } focus .login.usrName grab .login } proc setupSocket {} { global usrName getUsrName global esvrSock eshost esport variantversion puts "$variantversion: connecting to dtkeden server channel <[expr $esport-9000]> on host <$eshost>..." # this is a synchronous connection: # The command does not return until the server responds to the # connection request set errCode [catch {set esvrSock [socket $eshost $esport]} string] # puts $errCode # Setup monitoring on the socket so that when there is data to be # read the proc "read_sock" is called if {$errCode == 0 } { # puts "You are connected to tkServer in 'gem'...\n" fileevent $esvrSock readable [list read_sock $esvrSock] # configure channel modes # ensure the socket is line buffered so we can get a line of text # at a time (Cos thats what the server expects)... # Depending on your needs you may also want this unbuffered so # you don't block in reading a chunk larger than has been fed # into the socket # i.e fconfigure $esvrSock -blocking off fconfigure $esvrSock -buffering line -translation {crlf crlf} # set up our keyboard read event handler: # Vector stdin data to the socket #fileevent stdin readable [list read_stdin $esvrSock] # message indicating connection accepted and we're ready to go # wait for and handle either socket or stdin events... #vwait eventLoop if {$usrName == "" } { loginUsrName } else { sendUsrName } vwait getUsrName } else { puts "Fail to connect dtkeden server channel <[expr $esport-9000]> on host <$eshost>." puts "Using dtkeden as a stand-alone environment" .radios.send config -state disabled bell } } # read scripts from tkeden input window and send them to server set sendServerDebug 0 proc sendServer { text } { global EOF ECS synchronize serverReply sendServerDebug # don't change synchronize which comes from ../Eden/main.client.c if ($sendServerDebug) { puts "sendServerDebug: sendServer1" } if {$synchronize > 0} { while {$serverReply < 0} { vwait serverReply } } if ($sendServerDebug) { puts "sendServerDebug: sendServer2" } if {$synchronize > 0} { set text "$text\n$ECS" } else { set text "$text\n$EOF" } if ($sendServerDebug) { puts "sendServerDebug: sendServer3" } sendServer1 $text } proc sendServer1 {text} { global esvrSock usrName EOF currentNotation global synchronize serverReply sendServerDebug if ($sendServerDebug) { puts "sendServerDebug: sendServer4" } set isCancel -1 set text "$text$usrName" if {$esvrSock == "" } { set isCancel [connectServer] } if {$isCancel == "0"} return if {$esvrSock != ""} { # set errCode [catch {.menu.accept invoke} string] ; # may need to handle error control??? # puts "text $text" set errCode -1 while {$errCode !=0} { getCurrentNotation # cannot change currentNotation below. It comes from EX/Exinit() set errCode [catch {puts $esvrSock "$currentNotation\n$text"} string] if {$errCode != 0} { set isCancel [connectServer] if {$isCancel == "0"} break } } if {$synchronize > 0} { incr serverReply -1 while {$serverReply < 0} { vwait serverReply } } } } proc connectServer {} { global esvrSock variantversion set selectButton -1 while { $selectButton != 0 } { set selectButton [tk_dialog .message "$variantversion: Connection Failed" \ "Cannot connect to server" warning 0 Cancel Retry ] if {$selectButton == "1"} { set esvrSock "" setupSocket if {$esvrSock != ""} break } } return $selectButton } set EOF "@#$%EOF%$#@" set EOU "@#$%EOU%$#@" set EOS "@#$%EOS%$#@" set ECS "@#$%ECS%$#@" set serverReply 0 set receiveScripts "" set usrName "" set getUsrName 0 #set eshost "gem" #set esport 7000 #puts "eshost $eshost esport $esport" set esvrSock "" setupSocket tkeden1.32/lib-tkeden/credits.txt010060000025250000147000000054560732605642200202550ustar00ashleydcsother00001250000011Eden: the Evaluator of DEfinitive Notations Copyright (c) 1995-2001 The University of ÌÇÐÄTV. All rights reserved. Authors: Edward Yun Wai Yung (Eden) Simon Yun Pui Yung (tkeden) Pi-Hwa (Patrick) Sun (dtkeden) Richard Cartwright (initial work on PC port, bug fixes etc) Amanda Wright (initial work on PC port) Ben Carter (Sasami on PC, finishing PC port) Ashley Ward (rationalisation, new auto-configure system, Sasami on UNIX, bug fixes, CVS, interface improvements, teeth gnashing) Certain variants of Eden use some of these libraries: Tcl/Tk http://tcl.activestate.com cygwin http://www.cygwin.com readline http://cnswww.cns.cwru.edu/~chet/readline/rltop.html Togl http://togl.sourceforge.net/ GLpng http://www.wyatt100.freeserve.co.uk/download.htm libpng http://www.libpng.org/pub/png libz http://www.zlib.org/ ncurses http://www.clark.net/pub/dickey/ncurses/ncurses.html Tk Img package http://members1.chello.nl/~j.nijtmans/img.html This software is provided "as is", and no warranty, express or implied, is given. Neither the author nor the University of ÌÇÐÄTV takes any responsibility whatsoever for any use or misuse of this software, or any damage created by its use or misuse. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Permission to use, copy, modify, and distribute this software and documentation for non-commercial purposes and without fee is hereby granted, provided that the University of ÌÇÐÄTV copyright notices and this permission notice appear in all copies. Neither the author nor The University of ÌÇÐÄTV makes any representations about the suitability of this software and documentation for any purpose. It is provided ``as is'' without express or implied warranty. Commercial use of this software requires specific permission from the University of ÌÇÐÄTV; contact the Empirical Modelling project through the web pages at http://www.dcs.warwick.ac.uk/modelling/ or by snail mail at The Empirical Modelling Project, Department of Computer Science, University of ÌÇÐÄTV, Coventry, CV4 7AL, UK for further information. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA tkeden1.32/lib-tkeden/donald.txt010060000025250000147000000065170732331410600200510ustar00ashleydcsother00001250000011------ DoNaLD (Definitive Notation for Line Drawing) QUICK REFERENCE ------ Warning: this documentation isn't quite finished yet... -- SYNTAX ----------------------------------------------------------------- No semi-colons: line feeds are terminators Line continuation: use \ at the end of a line to continue to the next # UNIX shell style one-line comments Variables must be declared before use (except when using the ! operator) Redeclaration of type is not possible Name space: append ! to an identifier to reference an Eden variable: eg eq!(a, b) Escaping to Eden: ? is a one-line escape to Eden (remember to terminate with a semi-colon) -- DATA TYPES ------------------------------------------------------------- int: 34 real: 10.0 char: "abc" boolean: true, false point: {50, 100} point: {modulo @ angle} ie distance and angle (radians) from the origin line: [{10, 10}, {80, 90}] arc: [point1, point2, r] circle: circle(centre, radius), circle({500, 500}, 400) ellipse: ellipse(centre, major, minor) rectangle: rectangle(point1, point2) label: label(string, point) image: I!ImageFile("gif", "hill.gif") openshape: openshape cross within cross { line l1, l2 l1 = [{10, -10}, {-10, 10}] l2 = [{10, 10}, {-10, -10}] } shape: shape S S = trans(cross, 100, 200) graph: (see other documentation) -- FUNCTIONS -------------------------------------------------------------- Arithmetic: + - * div mod sqrt log exp trunc float rand Trigonometric: sin cos tan asin acos atan Relational: && || ! < <= == > >= Geometric: point midpoint(line) point intersect(line, line) line perpend(point, line) real dist(point, point) bool intersects(line, line) bool separates(line, point, point) bool includes(circle, point) bool incident(line, point) bool incident(circle, point) bool pt_betwn_pts(point, point, point) bool colinear(point, point, point) bool distlarger(point, point, value) bool distlarger(line, point, value) bool distsmaller(point, point, value) bool distsmaller(line, point, value) Shape transformations: trans(shape, x, y) scale(shape, ratio) rot(shape, point, angle) String functions: // (string concatenation) itos(int) rtos(real, fprintf-format-string) Image functions: I!functionName denotes a function returning an image -- REFERENCES ------------------------------------------------------------- .1, .2: first and second points of a line or first and second coordinates of a point .x, .y: projection of a point onto the x- and y- axes -- ATTRIBUTES ------------------------------------------------------------- To give an attribute to the DoNaLD variable Obj/line1, use the Eden escape: ?A_Obj_line1 = "attribute1=value1,attribute2=value2..."; color outlinecolor linewidth linestyle: dotted, dashed or solid arrow: first, last, both or none locus: true, false fill: solid or hollow font: a string: "{family size style}"... family = times, courier or helvetica, size = in points (1/72th inch) style = normal, bold, roman, italic, underline, overstrike (multiple styles are possible: "{times 12 {bold italic}}") -- VIEWPORTS -------------------------------------------------------------- viewport VIEW1 The default viewport is DoNaLD. -- MORE INFORMATION ---------------------------------------------------------- See http://www.dcs.warwick.ac.uk/modelling/ for more detail. tkeden1.32/lib-tkeden/donald.init.e010060000025250000147000000774540733254410600204350ustar00ashleydcsother00001250000011/* * $Id: donald.init.e,v 1.6 2001/08/03 15:50:29 cssbz Exp $ */ /* --- SPECIFICATION FOR OPERATORS AND INITIALIZE GRAPHICS --- */ setbuf(stdout, 0); OFF = 0; ON = 1; FALSE = 0; TRUE = 1; NullStr = ""; NullList = []; PI = 3.141593; /* TYPE = 1; X = 2; Y = 3; P1 = 2; P2 = 3; P3 = 4; CENTRE = 2; RADIUS = 3; TEXT = 2; */ INF = '!'; /* [ INF ] */ /* INT = 'I'; /* [ INT, I ] */ */ REAL = 'R'; /* [ REAL, ??? ] */ CHAR = 'W'; /* [ CHAR, ??? ] */ BOOLEAN = 'B'; /* [ BOOLEAN, B ] */ CART = 'C'; /* [ CART, X, Y ] */ POLAR = 'P'; /* [ POLAR, R, A ] */ LINE = 'L'; /* [ LINE, P1, P2 ] */ ARC = 'U'; /* [ ARC, P1, P2, R ] */ CIRCLE = 'E'; /* [ CIRCLE, P, R] */ RECTANGLE = 'G'; /* [ RECTANGLE, P1, P2] */ ELLIPSE = 'Q'; /* [ ELLIPSE, P, P, P ] */ LABEL = 'T'; /* [ LABEL, W, P ] */ SHAPE = 'S'; /* [ SHAPE, ??? ] */ OPENSHAPE = 'O'; /* [ OPENSHAPE, ... ] */ IMAGE = 'I'; /* [ IMAGE, W, P ] */ /* MONITOR = 'M'; /* [ MONITOR, B, ...] */ IMPOSE = 'I'; /* [ IMPOSE, I ] */ */ if (tcl("set tk_version") < "8.3") { dashedopt = ""; dottedopt = ""; } else { dashedopt = " -dash {_}"; dottedopt = " -dash {.}"; } /* check for ill-defined value argument: list return: @ if the list is @ 1 if all terms are well-defined 0 if partly undefined */ func idv { para d; auto i; if (d == @) return 1; if (type(d) != "list") return 0; for (i = d#; i > 0; --i) { if (idv(d[i])) return 1; } return 0; } /* real to string conversion using sprintf(), see sprintf(3) for format spec */ func rtos { para r, format; auto s; s = substr("", 1, 255); /* create a 255-char long string */ sprintf(s, "%"//format, r); if (s# > 255) { error("rtos: goofed up with memory allocation"); } return s; } func DD_random { if (type($1) == "int") { return rand() % $1; } else { return rand() * $1 / 2147483647; } } /* POINT */ func cart { return [CART, $1, $2]; /* [ CART, X, Y ] */ } /* POINT */ func polar { return [POLAR, $1, $2]; /* [ POLAR, R, A ] */ } /* LINE */ func line { return [LINE, $1, $2]; /* [ LINE, P1, P2 ] */ } /* ARC */ func arc { return [ARC, $1, $2, $3]; /* [ LINE, P1, P2, ANGLE ] */ } /* CIRCLE */ func circle { return [CIRCLE, $1, $2]; /* [ CIRCLE, P, R] */ } /* RECTANGLE */ func rectangle { return [RECTANGLE, $1, $2]; /* [ RECTANGLE, P1, P2] */ } /* ELLIPSE */ func ellipse { return [ELLIPSE, $1, $2, $3]; /* [ ELLIPSE, P, P, P] */ } /* LABEL */ func image /* CHAR $1; POINT $2; */ { return [IMAGE, $1, $2]; /* [ IMAGE, T, P] */ } /* LABEL */ func label /* CHAR $1; POINT $2; */ { return [LABEL, $1, $2]; /* [ LABEL, T, P] */ } /* /* MONITOR */ func monitor { return [MONITOR, $2, $1, $3]; /* [ MONITOR, mesg1, bool, mesg2 ] */ } */ /* SHAPE */ func open2shape { para openShape; auto shape, entity, i; if (openShape == @) return @; shape = [SHAPE]; for (i = 2; i <= openShape#; i++) { entity = *(openShape[i]); if (type(entity) == "list") if (entity[1] == 'O') shape = shape // [open2shape(entity)]; else shape = shape // [entity]; } return shape; } /* POINT */ func intersect { para line1, line2; auto a1, a2, b1, b2, c1, c2, s, t; if (idv(line1) || idv(line2)) return @; a1 = line1[3][3] - line1[2][3]; /* implicit eqn */ b1 = line1[2][2] - line1[3][2]; /* of line line1 */ c1 = line1[2][3] * line1[3][2] - line1[3][3] * line1[2][2]; a2 = line2[3][3] - line2[2][3]; /* implicit eqn */ b2 = line2[2][2] - line2[3][2]; /* of line line2 */ c2 = line2[2][3] * line2[3][2] - line2[3][3] * line2[2][2]; if (a1 * b2 == a2 * b1) writeln("intersect(): Can't happen on parallel lines"); else { /* find intersection of lines */ s = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1); t = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1); return [CART, s, t]; } } /* LINE */ func parallel { para line, point, alpha, beta; auto a1, a2, b1, b2, m; if (idv(line) || idv(point) || alpha == @ || beta == @) return @; alpha = float(alpha); /* make sure it is real number */ beta = float(beta); /* vert and horiz lines have no gradient */ /* parallel lines have the same gradient */ m = (line[2][2] == line[3][2] || line[2][3] == line[3][3]) ? 0.0 : float(line[3][3] - line[2][3] / line[3][2] - line[2][2]); if (line[2][2] == line[3][2]) { /* line is vertical */ b1 = point[3] - alpha; b2 = point[3] + beta; if (m == 0) a1 = a2 = float(point[2]); else { a1 = (b1 - point[3]) / m + point[2]; a2 = (b2 - point[3]) / m + point[2]; } } else { /* line is horizontal or other */ a1 = point[2] - alpha; b1 = (a1 - point[2]) * m + point[3]; a2 = point[2] + beta; b2 = (a2 - point[2]) * m + point[3]; } return [LINE, [CART, a1, b1], [CART, a2, b2]]; } /* LINE */ func perpend { para point, line; auto a1, a2, b1, b2, c1, c2, x, y; if (idv(point) || idv(line)) return @; /* implicit eqn of point $1 */ a1 = float(line[2][2] - line[3][2]); b1 = float(line[2][3] - line[3][3]); c1 = -a1 * point[2] - b1 * point[3]; /* implicit eqn of line $2 */ a2 = float(line[3][3] - line[2][3]); b2 = float(line[2][2] - line[3][2]); c2 = float(line[2][3] * line[3][2] - line[3][3] * line[2][2]); /* find perpendicular */ x = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1); y = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1); return [LINE, point, [CART, x, y]]; } /* REAL */ func dist /* POINT(LINE) $1; POINT(LINE) $2 */ { para arg1, arg2; auto a, b, c; if (idv(arg1) || idv(arg2)) return @; switch (arg1[1]) { case 'C': case 'P': if (arg1[1] == POLAR) arg1 = polar_to_cart(arg1); if (arg2[1] == POLAR) arg2 = polar_to_cart(arg2); a = (arg1[2] - arg2[2]) * (arg1[2] - arg2[2]); b = (arg1[3] - arg2[3]) * (arg1[3] - arg2[3]); return sqrt(float(a + b)); case 'L': if (arg1[2][1] == POLAR) arg1[2] = polar_to_cart(arg1[2]); if (arg1[3][1] == POLAR) arg1[3] = polar_to_cart(arg1[3]); if (arg2[2][1] == POLAR) arg2[2] = polar_to_cart(arg2[2]); if (arg2[3][1] == POLAR) arg2[3] = polar_to_cart(arg2[3]); a = arg1[3][3] - arg1[2][3]; b = arg1[3][2] - arg1[2][2]; c = arg1[2][3] * arg2[2][2] - arg1[3][3] * arg1[2][2]; return sqrt(float(a * arg2[2] + b * arg2[3] + c)) * (a * arg2[2] + b * arg2[3] + c) / (a * a + b * b); } } /* POINT */ func midpoint { para line; auto s, t; if (idv(line)) return @; if (line[2][1] == POLAR) line[2] = polar_to_cart(line[2]); if (line[3][1] == POLAR) line[3] = polar_to_cart(line[3]); s = (line[2][2] + line[3][2]) / 2.0; t = (line[2][3] + line[3][3]) / 2.0; return [CART, s, t]; } /* ENTITY */ func trans { para entity, x, y; auto point, i; if (idv(entity) || x == @ || y == @) return @; point = [CART, x, y]; switch (entity[1]) { case 'C': case 'P': return vector_add(entity, point); case 'R': writeln("trans(): Can't happen on ", entity[1]); break; case 'L': return [LINE, vector_add(entity[2], point), vector_add(entity[3], point)]; case 'U': return [ARC, vector_add(entity[2], point), vector_add(entity[3], point), entity[4]]; case 'E': return [CIRCLE, vector_add(entity[2], point), entity[3]]; case 'G': return [RECTANGLE, vector_add(entity[2], point), vector_add(entity[3], point)]; case 'Q' : return[ELLIPSE, vector_add(entity[2],point), vector_add(entity[3],point), vector_add(entity[4],point)]; case 'L': /* 3D line ? */ return [LINE, vector_add(entity[2], point), vector_add(entity[3], point), vector_add(entity[4], point)]; case 'O': entity = open2shape(entity); case 'S': for (i = 2; i <= entity#; i++) entity[i] = trans(entity[i], x, y); return entity; case 'T': return [LABEL, entity[2], vector_add(entity[3], point)]; case 'I': return [IMAGE, entity[2], vector_add(entity[3], point)]; } } /* ENTITY */ func rot { para entity, point, angle; auto i, s, t, dx, dy, center; auto s1, t1, s2, t2; if (idv(entity) || idv(point) || angle == @) return @; angle = float(angle); switch (entity[1]) { case 'C': case 'P': if (entity[1] == POLAR) entity = polar_to_cart(entity); if (point[1] == POLAR) point = polar_to_cart(point); dx = entity[2] - point[2]; dy = entity[3] - point[3]; s = dx * cos(angle) - dy * sin(angle) + point[2]; t = dx * sin(angle) + dy * cos(angle) + point[3]; return [CART, s, t]; case 'R': writeln("rot(): Can't happen on ", entity[1]); return entity; case 'L': return [LINE, rot(entity[2], point, angle), rot(entity[3], point, angle)]; case 'U': return [ARC, rot(entity[2], point, angle), rot(entity[3], point, angle), entity[4]]; case 'E': return [CIRCLE, rot(entity[2], point, angle), entity[3]]; case 'G': return [RECTANGLE, rot(entity[2], point, angle), rot(entity[3], point, angle)]; case 'Q': return [ELLIPSE, rot(entity[2], point, angle), rot(entity[3], point, angle), rot(entity[4], point, angle)]; case 'O': entity = open2shape(entity); case 'S': for (i = 2; i <= entity#; i++) entity[i] = rot(entity[i], point, angle); return entity; case 'T': return [LABEL, entity[2], rot(entity[3], point, angle)]; case 'I': return [IMAGE, entity[2], rot(entity[3], point, angle)]; } } /* ENTITY */ func scale { para entity, factor; auto i, dx, dy, s1, s2, t1, t2, r, center; if (idv(entity) || factor == @) return @; switch (entity[1]) { case 'P': entity = polar_to_cart(entity); case 'C': return [CART, entity[2] * factor, entity[3] * factor]; case 'L' : return [LINE, scale(entity[2], factor), scale(entity[3], factor)]; case 'E' : r = entity[3] * factor; /* scale radius */ center = scale(entity[2], factor); return [CIRCLE, center, r]; case 'G' : return [RECTANGLE, scale(entity[2], factor), scale(entity[3], factor)]; case 'Q' : return [ELLIPSE, scale(entity[2], factor), scale(entity[3], factor), scale(entity[4], factor)]; case 'O': entity = open2shape(entity); case 'S': for (i = 2; i <= entity# ; i++) entity[i] = scale(entity[i], factor); return entity; case 'T': return [LABEL, entity[2], scale(entity[3], factor)]; case 'I': return [IMAGE, entity[2], scale(entity[3], factor)]; } } /* LINE */ func line_reverse { if ($1 == @) return @; return [LINE, $1[3], $1[2]]; } /* POINT */ func dotx { para point; if (point == @) return @; point = polar_to_cart(point); return [CART, point[2], 0.0]; } /* POINT */ func doty { para point; if (point == @) return @; point = polar_to_cart(point); return [CART, 0.0, point[3]]; } func dot1 { if ($1 == @) return @; return $1[2]; } func dot2 { if ($1 == @) return @; return $1[3]; } func dotrad { if ($1 == @) return @; return cart_to_polar($1)[2]; } func dotarg { if ($1 == @) return @; return cart_to_polar($1)[3]; } func vector_add { para point1, point2; if (idv(point1) || idv(point2)) return @; if (point1[1] == POLAR) point1 = polar_to_cart(point1); if (point2[1] == POLAR) point2 = polar_to_cart(point2); return [CART, point1[2] + point2[2], point1[3] + point2[3]]; } func vector_sub { para point1, point2; if (idv(point1) || idv(point2)) return @; if (point1[1] == POLAR) point1 = polar_to_cart(point1); if (point2[1] == POLAR) point2 = polar_to_cart(point2); return [CART, point1[2] - point2[2], point1[3] - point2[3]]; } func scalar_mult { para point, value; if (idv(point) || idv(value)) return @; if (point[1] == POLAR) return [POLAR, float(point[3]) * value, point[2]]; else return [CART, float(point[2]) * value, float(point[3] * value)]; } func scalar_div { para point, value; if (idv(point) || idv(value)) return @; if (point[1] == POLAR) return [POLAR, float(point[3]) / value, point[2]]; else return [CART, float(point[2]) / value, float(point[3] / value)]; } func scalar_mod { para point, value; if (idv(point) || idv(value)) return @; if (point[1] == POLAR) return [POLAR, int(point[3]) % int(value), point[2]]; else return [CART, int(point[2]) % int(value), int(point[3]) % int(value)]; } /* ----- BOOLEAN CONDITIONS ----- */ /* BOOLEAN */ func pt_betwn_pts { para point1, point2, point3; if (idv(point1) || idv(point2) || idv(point3)) return @; if (point1[1] == POLAR) point1 = polar_to_cart(point1); if (point2[1] == POLAR) point2 = polar_to_cart(point2); return ( (point1[2] <= point2[2] && point2[2] <= point3[2]) || (point1[2] >= point2[2] && point2[2] >= point3[2]) ) && ( (point1[3] <= point2[3] && point2[3] <= point3[3]) || (point1[3] >= point2[3] && point2[3] >= point3[3]) ) ; } /* BOOLEAN */ func colinear { para point1, point2, point3; auto dab, dbc, dac; if (idv(point1) || idv(point2) || idv(point3)) return @; dab = dist(point1, point2); dbc = dist(point2, point3); dac = dist(point1, point3); return dab == dbc + dac || dac == dab + dbc || dbc == dab + dac; } /* BOOLEAN */ func intersects { para line1, line2; auto a1, a2, b1, b2, c1, c2, s, t; if (idv(line1) || idv(line2)) return @; a1 = float(line1[3][3] - line1[2][3]); /* implicit eqn */ b1 = float(line1[2][2] - line1[3][2]); /* of line1 */ c1 = float(line1[2][3] * line1[3][2] - line1[3][3] * line1[2][2]); a2 = float(line2[3][3] - line2[2][3]); /* implicit eqn */ b2 = float(line2[2][2] - line2[3][2]); /* of line2 */ c2 = float(line2[2][3] * line2[3][2] - line2[3][3] * line2[2][2]); if (a1 * b2 == a2 * b1) { writeln("intersect(): Can't happen on parallel lines"); return FALSE; } else { /* find point of intersection */ s = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1); /* x co-ord */ t = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1); /* y co-ord */ if (pt_betwn_pts(line1[2], [CART, s, t], line1[3]) && pt_betwn_pts(line2[2], [CART, s, t], line2[3])) return TRUE; /* intersection of */ else return FALSE; /* actual line only */ } } /* BOOLEAN */ func separates { para line, point1, point2; auto a1, a2, a3, b1, b2, b3, c1, c2, c3, s2, s3; if (idv(line) || idv(point1) || idv(point2)) return @; a1 = float(line[3][3] - line[2][3]); /* implicit eqn */ b1 = float(line[2][2] - line[3][2]); /* line $1 */ c1 = float(line[2][3] * line[3][2] - line[3][3] * line[2][2]); /* perpendicular line from point2 to line */ a2 = float(line[2][2] - line[3][2]); b2 = float(line[2][3] - line[3][3]); c2 = -a2 * point1[2] - b2 * point1[3]; a3 = a2; /* perpendicular line */ b3 = b2; /* from point2 to line */ c3 = -a3 * point2[2] - b3 * point2[3]; s2 = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1); s3 = (b1 * c3 - b3 * c1) / (a1 * b3 - a3 * b1); if (point1[2] > s2 && point2[2] > s3) return FALSE; /* Points on +side of line */ if (point1[2] < s2 && point2[2] < s3) return FALSE; /* Points on -side of line */ else return TRUE; /* Line separates points */ } /* BOOLEAN */ func includes { para Circle, point; auto s, t; if (idv(Circle) || idv(point)) return @; s = (Circle[2][2] - point[2]) * (Circle[2][2] - point[2]); t = (Circle[2][3] - point[3]) * (Circle[2][3] - point[3]); return (sqrt(float (s + t)) <= Circle[3]); } /* BOOLEAN */ func incident { para entity, point; auto s, t; if (idv(entity) || idv(point)) return @; switch (entity[1]) { case 'L': /* LINE */ return (colinear(entity[2], point, entity[3])); /* substitute x- and y- coordinate into circle */ case 'E': /* CIRCLE */ s = (entity[2][2] - point[2]) * (entity[2][2] - point[2]); t = (entity[2][3] - point[3]) * (entity[2][3] - point[3]); return (sqrt(float(s + t)) == entity[3]); } } /* BOOLEAN */ func distlarger { para entity, point, value; auto a, b, c, d; if (idv(entity) || idv(point) || idv(value)) return @; switch (entity[1]) { case 'C': case 'P': if (entity[1] == POLAR) entity = polar_to_cart(entity); if (point[1] == POLAR) point = polar_to_cart(point); a = (entity[2] - point[2]) * (entity[2] - point[2]); b = (entity[3] - point[3]) * (entity[3] - point[3]); d = sqrt(float(a + b)); return d > value; case 'L': if (entity[2][1] == POLAR) entity[2] = polar_to_cart(entity[2]); if (entity[3][1] == POLAR) entity[3] = polar_to_cart(entity[3]); if (point[1] == POLAR) point = polar_to_cart(point); a = entity[3][3] - entity[2][3]; b = entity[3][2] - entity[2][2]; c = entity[2][3] * entity[2][2] - entity[3][3] * entity[2][2]; d = sqrt(float(a * point[2] + b * point[3] + c)) * (a * point[2] + b * point[3] + c) / (a * a + b * b); return d > value; } } /* BOOLEAN */ func distsmaller { para entity, point, value; auto a, b, c, d; if (idv(entity) || idv(point) || idv(value)) return @; switch (entity[1]) { case 'C': case 'P': if (entity[1] == POLAR) entity = polar_to_cart(entity); if (point[1] == POLAR) point = polar_to_cart(point); a = (entity[2] - point[2]) * (entity[2] - point[2]); b = (entity[3] - point[3]) * (entity[3] - point[3]); d = sqrt(float(a + b)); return d < value; case 'L': if (entity[2][1] == POLAR) entity[2] = polar_to_cart(entity[2]); if (entity[3][1] == POLAR) entity[3] = polar_to_cart(entity[3]); if (point[1] == POLAR) point = polar_to_cart(point); a = entity[3][2] - entity[2][2]; b = entity[3][3] - entity[2][3]; c = entity[2][3] * entity[2][2] - entity[3][3] * entity[2][2]; d = sqrt(float(a * point[2] + b * point[3] + c)) * (a * point[2] + b * point[3] + c) / (a * a + b * b); return d < value; } } func cart_to_polar { para cart; if (idv(cart)) return @; if (cart[1] == POLAR) return cart; if (cart[1] != CART) error("argument is not in cart coordinate"); cart[2] = float(cart[2]); cart[3] = float(cart[3]); if (cart[2] == 0.0 && cart[3] == 0.0) return [POLAR, 0.0, 0.0]; return [POLAR, sqrt(cart[2]*cart[2]+cart[3]*cart[3]), atan2(cart[3], cart[2])]; } func polar_to_cart { para polar; if (idv(polar)) return @; if (polar[1] == CART) return polar; if (polar[1] != POLAR) error("argument is not in polar coordinate"); return [CART, polar[2] * cos(float(polar[3])), polar[2] * sin(float(polar[3]))]; } func toComma { para s; auto i; for (i = 1; i <= s# && s[i] != ','; i++); return (i > 0) ? substr(s, 1, i-1) : ""; } func lookAttr { para s, attr; auto head; if (s# <= attr# + 1) return ""; head = toComma(s); if (substr(s, 1, attr#+1) == (attr//"=")) return substr(head, attr#+2, head#); else if (s# > head# + 1 + attr# + 1) return lookAttr(substr(s, head# + 2, s#), attr); else return ""; } /* ----- GRAPHICS DRAWING ROUTINE ----- */ _tkeden_showxoutput = 0; proc xoutput { auto i, s; if ($# == 0) return; s = str($1); for (i = 2; i <= $#; i++) s = strcat(s, " ", str($[i])); /* do '_tkeden_showxoutput = 1;' to debug Donald graphics [Ash] */ if (_tkeden_showxoutput) writeln("xoutput: tcl(\"", s, "\");"); tcl(s); } proc xdelete { para viewport_name, segid; auto command; command = "."//viewport_name[1]//"."//viewport_name[2]; xoutput("if [winfo exists", command, "] {",command, "delete", "t"//str(int(segid)), "}"); } proc xpoint { para viewport_name, segid, x, y, attr, xOrigin, yOrigin, xScale, yScale; auto command, color, var; var = viewport_name[2]; command = "."//viewport_name[1]//"."//var; color = lookAttr(*attr, "color"); color = (color == "") ? "-fill $"//var//"_fg" : "-fill "//color; x = x * xScale + xOrigin; y = y * yScale + yOrigin; xoutput(command, "create line", x, y, x, y, color, "-tags {all t"//str(int(segid))//"}"); } proc xline { para viewport_name, segid, x1, y1, x2, y2, attr, xOrigin, yOrigin, xScale, yScale; auto command, val, opt, var; var = viewport_name[2]; command = "."//viewport_name[1]//"."//var; val = lookAttr(*attr, "color"); opt = "-fill " // ((val == "") ? "$"//var//"_fg" : val); val = lookAttr(*attr, "arrow"); opt = opt // " -arrow " // ((val == "") ? "none" : val); val = lookAttr(*attr, "linewidth"); if (val != "") opt = opt // " -width " // val; val = lookAttr(*attr, "linestyle"); if (val == "dashed") opt = opt // dashedopt; else if (val == "dotted") opt = opt // dottedopt; x1 = x1 * xScale + xOrigin; y1 = y1 * yScale + yOrigin; x2 = x2 * xScale + xOrigin; y2 = y2 * yScale + yOrigin; xoutput(command, "create line", x1, y1, x2, y2, opt, "-tags {all t"//str(int(segid))//"}"); } proc xrectangle { para viewport_name, segid, x1, y1, x2, y2, attr, xOrigin, yOrigin, xScale, yScale; auto command, col, val, var, opt, outcol; var = viewport_name[2]; command = "."//viewport_name[1]//"."//var; opt = ""; outcol = lookAttr(*attr, "outlinecolor"); opt = "-outline " // ((outcol == "") ? "$"//var//"_fg" : outcol); col = lookAttr(*attr, "color"); val = lookAttr(*attr, "fill"); opt = opt // " -fill " // ((val == "solid") ? ((col == "") ? "$"//var//"_fg" : col) : "{}"); val = lookAttr(*attr, "linewidth"); opt = opt // " -width " // ((val == "") ? "1.0" : val); val = lookAttr(*attr, "linestyle"); if (val == "dashed") opt = opt // dashedopt; else if (val == "dotted") opt = opt // dottedopt; x1 = x1 * xScale + xOrigin; y1 = y1 * yScale + yOrigin; x2 = x2 * xScale + xOrigin; y2 = y2 * yScale + yOrigin; xoutput(command, "create rect", x1, y1, x2, y2, opt, "-tags {all t"//str(int(segid))//"}"); } proc xarc { para viewport_name, segid, x1, y1, x2, y2, a, attr, xOrigin, yOrigin, xScale, yScale; auto p1, p2, cx, cy, r, rad, b, c, start, col, outcol; auto command, val, opt, var; var = viewport_name[2]; command = "."//viewport_name[1]//"."//var; if ((a >= 0 ? a : -a) < 1.0) { /* small angle, treat as straight line */ x1 = x1 * xScale + xOrigin; y1 = y1 * yScale + yOrigin; x2 = x2 * xScale + xOrigin; y2 = y2 * yScale + yOrigin; xline(viewport_name, segid, x1, y1, x2, y2, xOrigin, yOrigin, xScale, yScale); return; } col = lookAttr(*attr, "color"); opt = "-fill " // ((col == "") ? "$"//var//"_fg" : col); outcol = lookAttr(*attr, "outlinecolor"); opt = opt // " -outline " // ((outcol == "") ? "$"//var//"_fg" : outcol); val = lookAttr(*attr, "linewidth"); if (val != "") opt = opt // " -width " // val; val = lookAttr(*attr, "linestyle"); if (val == "dashed") opt = opt // dashedopt; else if (val == "dotted") opt = opt // dottedopt; val = lookAttr(*attr, "fill"); opt = opt // " -style " // ((val == "") ? "arc" : "pieslice"); /* treat it properly as a genuine arc */ a = float(a); if (a > 360 || a < -360) error("arc angle must be in between -360 and 360"); x1 = float(x1); y1 = float(y1); x2 = float(x2); y2 = float(y2); p1 = [CART, x1, y1]; p2 = [CART, x2, y2]; rad = a * PI / 180; rad = rad >= 0 ? rad : 2 * PI + rad; b = (PI - rad) / 2; c = cart_to_polar(vector_sub(p2, p1))[3]; r = sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)) / 2 / sin(rad / 2); r = r >= 0 ? r : -r; cx = x1 + r * cos(c - b); cy = y1 + r * sin(c - b); start = 90 + (c - rad / 2) * 180 / PI; start = start - int(start / 360) * 360; start = start >= 0 ? start : start + 360; x1 = (cx - r) * xScale + xOrigin; y1 = (cy - r) * yScale + yOrigin; x2 = (cx + r) * xScale + xOrigin; y2 = (cy + r) * yScale + yOrigin; xoutput(command, "create arc", x1, y1, x2, y2, "-start", start, "-extent", a, opt, "-tags {all t"//str(int(segid))//"}"); } proc xcircle { para viewport_name, segid, x, y, r, attr, xOrigin, yOrigin, xScale, yScale; auto command, col, val, var, opt, outcol; var = viewport_name[2]; command = "."//viewport_name[1]//"."//var; opt = ""; outcol = lookAttr(*attr, "outlinecolor"); opt = "-outline " // ((outcol == "") ? "$"//var//"_fg" : outcol); col = lookAttr(*attr, "color"); val = lookAttr(*attr, "fill"); opt = opt // " -fill " // ((val == "solid") ? ((col == "") ? "$"//var//"_fg" : col) : "{}"); val = lookAttr(*attr, "linewidth"); opt = opt // " -width " // ((val == "") ? "1.0" : val); val = lookAttr(*attr, "linestyle"); if (val == "dashed") opt = opt // dashedopt; else if (val == "dotted") opt = opt // dottedopt; x = x * xScale + xOrigin; y = y * yScale + yOrigin; xoutput(command, "create oval", x-r*xScale, y-r*yScale, x+r*xScale, y+r*yScale, opt, "-tags {all t"//str(int(segid))//"}"); } proc xellipse { para viewport_name, segid, x0, y0, x1, y1, x2, y2, attr, xOrigin, yOrigin, xScale, yScale; auto command, val, opt, var, dx1, dy1, dx2, dy2, outcol; var = viewport_name[2]; command = "."//viewport_name[1]//"."//var; val = lookAttr(*attr, "color"); opt = (val == "") ? "-fill $"//var//"_fg" : "-fill "//val; val = lookAttr(*attr, "linewidth"); opt = opt // " -width " // ((val == "") ? "1.0" : val); val = lookAttr(*attr, "linestyle"); if (val == "dashed") opt = opt // dashedopt; else if (val == "dotted") opt = opt // dottedopt; x0 = x0 * xScale + xOrigin; y0 = y0 * yScale + yOrigin; x1 = x1 * xScale + xOrigin; y1 = y1 * yScale + yOrigin; x2 = x2 * xScale + xOrigin; y2 = y2 * yScale + yOrigin; val = lookAttr(*attr, "fill"); dx1 = 4.0 * (x1 - x0) / 3; dy1 = 4.0 * (y1 - y0) / 3; dx2 = 4.0 * (x2 - x0) / 3; dy2 = 4.0 * (y2 - y0) / 3; if (val == "") { xoutput(command, "create line", x0-dx2, y0-dy2, x0+dx1, y0+dy1, x0+dx2, y0+dy2, x0-dx1, y0-dy1, x0-dx2, y0-dy2, opt, "-smooth true -splinesteps 5 -tags {all t" //str(int(segid))//"}"); } else { outcol = lookAttr(*attr, "outlinecolor"); opt = opt // " -outline " // ((outcol == "") ? "$"//var//"_fg" : outcol); xoutput(command, "create polygon", x0-dx2, y0-dy2, x0+dx1, y0+dy1, x0+dx2, y0+dy2, x0-dx1, y0-dy1, x0-dx2, y0-dy2, opt, "-smooth true -splinesteps 5 -tags {all t" //str(int(segid))//"}"); } } proc xtext { para viewport_name, segid, x, y, text, attr, xOrigin, yOrigin, xScale, yScale; auto command, var, val, opt; var = viewport_name[2]; command = "."//viewport_name[1]//"."//var; opt = "-fill "; val = lookAttr(*attr, "color"); opt = opt // (val == "" ? "$"//var//"_fg" : val); val = lookAttr(*attr, "font"); opt = opt // " -font " // (val == "" ? "$"//var//"_font" : val); x = x * xScale + xOrigin; y = y * yScale + yOrigin; xoutput(command, "create text", x, y, "-text {"//text//"}", opt, "-tags {all t"//str(int(segid))//"}"); } proc ximage { para viewport_name, segid, x, y, image, attr, xOrigin, yOrigin, xScale, yScale; auto command, var, val, opt; var = viewport_name[2]; command = "."//viewport_name[1]//"."//var; x = x * xScale + xOrigin; y = y * yScale + yOrigin; xoutput(command, "create image", x, y, "-image", image, "-tags {all t"//str(int(segid))//"}"); } /**** * INITIALIZE ROOT CONTEXT * ****/ /*-----------------------------------------------------------------------------+ | plot_point, plot_line, plot_rectangle, plot_circle, plot_ellipse, plot_shape | +-----------------------------------------------------------------------------*/ plot_point is plot_shape; plot_line is plot_shape; plot_arc is plot_shape; plot_circle is plot_shape; plot_ellipse is plot_shape; plot_rectangle is plot_shape; plot_label is plot_shape; plot_shape is PlotShape; proc draw_shape { para viewport_name, SegName, entity, attr, xOrigin, yOrigin, xScale, yScale; auto x1, y1, x2, y2, i, p1, p2; if (viewport_name == @ || SegName == @ || idv(entity)) return; switch (entity[1]) { case 'C': xpoint(viewport_name, SegName, entity[2], entity[3], attr, xOrigin, yOrigin, xScale, yScale); break; case 'P': p1 = polar_to_cart(entity); xpoint(viewport_name, SegName, p1[2], p1[3], attr, xOrigin, yOrigin, xScale, yScale); break; case 'L': if (entity[2][1] == POLAR) { entity[2] = polar_to_cart(entity[2]); } if (entity[3][1] == POLAR) { entity[3] = polar_to_cart(entity[3]); } xline(viewport_name, SegName, entity[2][2], entity[2][3], entity[3][2], entity[3][3], attr, xOrigin, yOrigin, xScale, yScale); break; case 'G': xrectangle(viewport_name, SegName, entity[2][2], entity[2][3], entity[3][2], entity[3][3], attr, xOrigin, yOrigin, xScale, yScale); break; case 'U': if (entity[2][1] == POLAR) { entity[2] = polar_to_cart(entity[2]); } if (entity[3][1] == POLAR) { entity[3] = polar_to_cart(entity[3]); } xarc(viewport_name, SegName, entity[2][2], entity[2][3], entity[3][2], entity[3][3], entity[4], attr, xOrigin, yOrigin, xScale, yScale); break; case 'E': if (entity[2][1] == POLAR) { entity[2] = polar_to_cart(entity[2]); } xcircle(viewport_name, SegName, entity[2][2], entity[2][3], entity[3], attr, xOrigin, yOrigin, xScale, yScale); break; case 'Q': if (entity[2][1] == POLAR) { entity[2] = polar_to_cart(entity[2]); } if (entity[3][1] == POLAR) { entity[3] = polar_to_cart(entity[3]); } if (entity[4][1] == POLAR) { entity[4] = polar_to_cart(entity[4]); } xellipse(viewport_name, SegName, entity[2][2], entity[2][3], entity[3][2], entity[3][3], entity[4][2], entity[4][3], attr, xOrigin, yOrigin, xScale, yScale); break; case 'T': if (entity[3][1] == POLAR) entity[3] = polar_to_cart(entity[3]); xtext(viewport_name, SegName, entity[3][2], entity[3][3], str(entity[2]), attr, xOrigin, yOrigin, xScale, yScale); break; case 'I': if (entity[3][1] == POLAR) entity[3] = polar_to_cart(entity[3]); ximage(viewport_name, SegName, entity[3][2], entity[3][3], str(entity[2]), attr, xOrigin, yOrigin, xScale, yScale); break; case 'S': for (i = 2; i <= entity#; i++) draw_shape(viewport_name, SegName, entity[i], attr, xOrigin, yOrigin, xScale, yScale); break; default: writeln("ERROR: draw_shape(" , entity, ");"); break; } } proc dd_delete { para id, viewport, attr; plot_shape([], id, attr); *id = @; } proc InitDoNaLDViewport { OpenDisplay("donaldscreen", 500, 500); tcl("wm title .donaldscreen DoNaLD"); execute("%scout window DoNaLDdefaultWin = { type: DONALD pict: \"DoNaLD\" box: [{0,0}, {500, 500}] border: 1 };\n%eden"); tcl("canvas .donaldscreen.default"); DoNaLD is scout_show_2D_window(DoNaLDdefaultWin, ".donaldscreen.default", "default") ? [["donaldscreen", "default"]] : [["donaldscreen", "default"]]; } include(getenv("TKEDEN_LIB") // "/macro.e"); proc SetGraph { para ename, dname; execute(macro(" proc P?1 : ?1_viewport, ?1__fi_, ?1__xi_, ?1_nSegment, ?1_?3, ?1_?4 { auto i, j, s, xi, xi_1, fi, fi_1; xi = \"(\"//?1__xi_//\")\"; xi_1 = macro(xi, \"??2\"); fi = \"(\"//macro(?1__fi_, \"??1\", xi)//\")\"; fi_1 = macro(fi, \"??2\"); execute(\"%donald\\nviewport \"//?1_viewport//\"\\nwithin ?2 {\\n\"); if (o?1_nNode != @) for (j = o?1_nNode[2]; j > 0; j--) for (i = o?1_nNode[1]; i > 0; i--) execute(macro(\"%donald\\ndelete ?3??2_??1\", str(i-1),str(j))); if (o?1_nSegment != @) for (j = o?1_nSegment[2]; j > 0; j--) for (i = o?1_nSegment[1]; i > 0; i--) execute(macro(\"%donald\\ndelete ?4??2_??1\", str(i), str(j))); "//" if (?1_?3 != []) { for (j = 0; j < ?1_?3# / 2; j++) { s = \"\"; for (i = ?1_nSegment; i >= 0; i--) { s = s // macro(\" ?3??2_??1\", str(i), str(j+1)); if (i > 0) s = s // ','; } if (?1_nSegment > 0) execute(\"%donald\\n\"//?1_?3[2*j+1]//s); if (?1_?3[2*j+2] != \"\") for (i = ?1_nSegment; i >= 0; i--) execute(macro(macro(\"%donald\\n?3????3_??1 = \"//?1_?3[2*j+2], \"??1\", xi, fi, \"??2\", xi_1, fi_1), str(i), str(i-1), str(j+1))); } o?1_nNode = [?1_nSegment + 1, ?1_?3# / 2]; } else o?1_nNode = [0,0]; "//" if (?1_?4 != []) { for (j = 0; j < ?1_?4# / 2; j++) { s = \"\"; for (i = ?1_nSegment; i > 0; i--) { s = s // macro(\" ?4??2_??1\", str(i), str(j+1)); if (i > 1) s = s // ','; } if (?1_nSegment >= 0) execute(\"%donald\\n\"//?1_?4[2*j+1]//s); if (?1_?4[2*j+2] != \"\") for (i = ?1_nSegment; i > 0; i--) execute(macro(macro(\"%donald\\n?4????3_??1 = \"//?1_?4[2*j+2], \"??1\", xi, fi, \"??2\", xi_1, fi_1), str(i), str(i-1), str(j+1))); } o?1_nSegment = [?1_nSegment, ?1_?4# / 2]; } else o?1_nSegment = [0,0]; execute(\"%donald\\n}\"); } ", ename, dname, "node", "segment")); } proc quit {} lookAttr(*attr, "linestyle"); if (val == "dashed") opt = opt // dashedopt; else if (val == "dotted") opt = opt // dottedopt; val = lookAttr(*attr, "fill"); opt = opt // " -style " // ((val == "") ? "artkeden1.32/lib-tkeden/eden.txt010060000025250000147000000241340737031715200175240ustar00ashleydcsother00001250000011---------- EDEN (Evaluator of DEfinitive Notations) QUICK REFERENCE ---------- Parts of syntax which are !@Ooptional are shown like this!@P -- C-LIKE SYNTAX ------------------------------------------------------------- Statements are followed by the semi-colon; /* Multi-line C-style comments /* ...although note they may nest in Eden */ */ ## one-line comments start with two hash characters Assignment: v = 1; Definition: a is f(b, c); Function: func square { return $1*$1; } Procedure: proc inc_a { a++; } Action: proc print : q { writeln("q is ", q); } Name space: can access Scout variables directly. to access Donald variables, prepend an underscore _ Variable declaration is not required or possible. Redeclaration of type is automatic -- DATA TYPES ---------------------------------------------------------------- Undefined: @ Integer: 123, 018 (octal), 0xAB (hex) Character: 'A', '\n', '\009' Floating point: 1.23e-15 String: s = "this is a string" s[1] is the first character of the string s Pointer: ip = &int_variable * dereferences a pointer: *ip == int_variable List: L = [ 100, 'a', "string", [1,2,3] ] L[1] is the first item of L L[4][2] is the second item in the fourth item of L L# is the length of list L L // M is the concatenation of L and M See also append, insert, delete and shift -- OPERATORS --------------------------------------------------------------- Arithmetic (strict): + - (difference and unary) * / % (remainder) Relational: < > <= >= Equality: == != Logical (lazy): && || ! Logical (eager): and or not Bitwise (eager): bitand bitor Conditional: cond ? iftrue : iffalseor@ Assignment: = += -= Prefix assignment: ++lvalue --lvalue Postfix assignment: lvalue++ lvalue-- Strict: Returns @ if an operand is @ Lazy: Leaves the second operand unevaluated if it is unnecessary Eager: Always evaluates both operands Indirection: a=1; r="a"; v=`r`; Now v == 1 (note: there are problems with use of indirection on the RHS of a definition) Type casting is implemented through functions: see int(), char() etc below -- PROCEDURAL STATEMENTS ----------------------------------------------------- Compound statements: { statement; !@Ostatements...!@P } insert list, position, value; (note: - no brackets - these are not functions append list, value; - they operate only only lists, not delete list, position; strings) shift !@Olist!@P; (shift with no argument deletes the first item from $) if (expression) statement !@Oelse statement!@P while (expression) statement do statement while (expression); for (!@Oinitialisation!@P; !@Opre-iteration-test!@P; !@Opost-statement!@P) statement switch (expression) { case constant: statement; !@Odefault statement;!@P } break; causes termination of the smallest enclosing while, do, for, switch continue; causes continuation of smallest enclosing while, do, for return !@Oexpression!@P; Null statement: ; Dependency link: identifier ~> [ !@Oidentifier_list!@P ]; Query: ?lvalue; -- USER-DEFINED FUNCTIONS, PROCEDURES, ACTIONS... ---------------------------- func identifier { !@Opara id_list;!@P !@Oauto id_list;!@P !@Ostatements...!@P } proc identifier !@O: id_list!@P { !@Opara id_list;!@P !@Oauto id_list;!@P !@Ostatements...!@P } procmacro identifier { !@Opara id_list;!@P !@Oauto id_list;!@P !@Ostatements...!@P } $ is the argument list of a function $3 is the third argument $[n] is the n-th argument Function call: four = square(2); -- PRE-DEFINED VARIABLES ----------------------------------------------------- stdin: standard input stdout: standard output stderr: standard error autocalc: whether Eden automatically recalculates formula definitions _tkeden_showxoutput: whether to show info sent to Tcl for debugging purposes eden_error_index_range: whether to generate an error or @ when referencing outside an array eden_notice_undef_reference: whether to give notices about references to undefined values -- PRE-DEFINED FUNCTIONS AND PROCEDURES -------------------------------------- write(args...): print arguments on stdout writeln(args...): print arguments on stdout, appending a newline (\n) type(data): returns the type of data as a string int(data): returns data after cast to integer type char(data): returns data after cast to character type str(data): returns data after cast to character type float(data): returns data after cast to floating point type substr(string, from, to): returns a substring of string strcat(strings...): returns the string concatenation of its arguments nameof(pointer): returns the name of the symbol to which the pointer points sublist(list, from, to): returns a sublist of list listcat(lists...): returns the list concatenation of its arguments array(size, data): returns a list constructed from data items, of length size time(): returns the current time in seconds since Jan 1, 1970 ftime(): returns the current time in [second, milli] form gettime(): returns the current time in [second, minute, hour, day of month, month of year, year, day of week] form apply(function, list): calls function with list as argument execute(string): executes string as Eden statements todo(string): will execute string as Eden statements after current evaluation terminates include(string!@O, string...!@P): executes the contents of the named file(s) as Eden statements cd(string): changes the current working directory cwd(): returns the current working directory dirname(string): returns the containing directory of a given filepath basename(string): returns the filename (leafname) of a given filepath exit(status): terminates the program, returning status as exit status forget(string): attempts to remove the named variable from the symbol table. Returns 0 for OK, 1 for not found, 2 for failure forget(pointer): attempts to remove the pointed-to variable from the symbol table. Returns 0 for OK, 2 for failure (1 is not possible). eager(): evaluate all out of date formula variables and actions now, update the screen, whatever the state of autocalc touch(pointers...): put the targets of the pointed to variables on the evaluation queue formula_list(): returns list of pointers to queued formula variables action_list(): returns list of pointers to queued actions symboltable(): returns the current symbol table as a list of lists symbols(string): returns a list of symbols from the symbol table which are of the specified type symboldetail(string): returns a list of information about the named symbol symboldetail(pointer): returns a list of information about the named symbol symboltext(string): returns the original text used when defining a symbol symboltext(pointer): returns the original text used when defining a symbol getenv(env): returns the string contents of the environment variable env putenv(env): set environment variable: env should have the form "name=value" error(message): generate an Eden error error_no(): returns the last system (not Eden) error number backgnd(path, cmd, arg1, arg2...): executes a process in the background pipe(path, cmd, arg1, arg2...): pipes stdout to the process given by path get_msgq(key flag): gets a message queue remove_msgq(msgqid): removes a message from the message queue msgqid send_msg(msgid, [msg_type, msg_text], flag): send a message on a message queue receive_msg(msgqid, msg_type, flag): receive a message from a message queue notation(name, agentname): install a new definitive notation installeddi(): install the eddi notation -- C-LIBRARY FUNCTIONS AND PROCEDURES ---------------------------------------- (see their man pages for more detail) fclose(fileid): closes a file stream fgetc(fileid): gets and returns a character from a file stream fgets(&s, n, fileid): gets a string from a file stream (warning: s must first be initialised to a string of appropriate length) fopen(filename, mode): opens a file, returning the fileid fprintf(fileid, format, args...): prints a formatted string to a file stream fputc(char, fileid): prints a character to a file stream fscanf(fileid, format, &out1, &out2...): formatted read from the input stream gets(): returns a string read from stdin pclose(fileid): close a pipe popen(command, mode): open a pipe, returning fileid putw(w, fileid): puts a machine word to a file stream setbuf(fileid, buf): set the buffer size of a file sprintf(&s, format, args...): formatted print to a string (warning: s must first be initialised to a string of appropriate length) sscanf(&s, format, &out1, &out2...): formatted read from string s system(string): execute command in a sub-shell ungetc(c, fileid): pushes the character back onto the input stream fileid srand(seed): seed the random number generator rand(): return a random number sin(float): returns the sine of its (radians) argument cos(float): returns the cosine of its (radians) argument tan(float): returns the tangent of its (radians) argument asin(float): returns the principle arcsine of its (radians) argument acos(float): returns the principle arccosine of its (radians) argument atan(float): returns the principle arctangent of its (radians) argument atan2(y, x): returns the principle value of the arctangent of y/x (floats) sqrt(float): returns the square root of its argument pow(x, y): returns the value of x raised to the power y (floats) log(float): returns the natural logarithm of its argument (which must be +ve) log10(float): returns the logarithm to base 10 of its argument exp(float): returns the exponential (pow(e,x)) of its argument debug(status): sets the interpreter debugging mode pack(data...): stores data in a newly allocated memory space on the heap ... there may be more built-in functions and procedures depending upon the Eden variant you are using. -- WRITING A CLOCK ----------------------------------------------------------- proc clocking : clock { /* a clocking process */ todo("clock++;"); /* increment clock after current evaluation finishes */ } proc device1 : clock { /* action synchronised by the clock */ ... /* action body */ } proc device2 : clock { ... /* action body */ } -- MORE INFORMATION ---------------------------------------------------------- See the full manual available at http://www.dcs.warwick.ac.uk/modelling/ for more detail. tkeden1.32/lib-tkeden/edenio.tcl010060000025250000147000001351110737027634300200230ustar00ashleydcsother00001250000011# $Id: edenio.tcl,v 1.19 2001/10/15 16:22:59 cssbz Exp $ # # [Ben] Only use focusfollowsmouse on Unix, as on Win32 this is non-standard # behaviour and will confuse users if {$_tkeden_win32_version == "0.0"} { tk_focusFollowsMouse } if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { set variantversion "dtkeden $_tkeden_version (server)" } else { set variantversion "dtkeden $_tkeden_version (client)" } } else { # tkeden set variantversion "tkeden $_tkeden_version" } wm title . "$variantversion: Input" set radiosBg grey60 set radiosButtonBg grey50 frame .radios -background $radiosBg -borderwidth 0 button .radios.accept -text "Accept" -underline 0 \ -background $radiosButtonBg -command {accept} pack .radios.accept -side left if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { button .radios.send -text "Send" -underline 0 \ -background $radiosButtonBg -command {selectClients} } else { button .radios.send -text "Send" -underline 0 \ -background $radiosButtonBg -command { set text [.text get 1.0 end] set text [string trim $text] if {$text != ""} { set errCode [catch {.menu.accept invoke} string] sendServer $text } } } pack .radios.send -side left } set notation "%eden" radiobutton .radios.eden -variable notation \ -highlightbackground $radiosBg -background $radiosBg \ -value "%eden" -text "%eden" \ -command { appendHist "%eden\n"; evaluate "%eden\n" } radiobutton .radios.donald -variable notation \ -highlightbackground $radiosBg -background $radiosBg \ -value "%donald" -text "%donald" \ -command { appendHist "%donald\n"; evaluate "%donald\n" } radiobutton .radios.scout -variable notation \ -highlightbackground $radiosBg -background $radiosBg \ -value "%scout" -text "%scout" \ -command { appendHist "%scout\n"; evaluate "%scout\n" } pack .radios.eden .radios.donald .radios.scout -side left if {$_tkeden_sasamiAvail == "1"} { radiobutton .radios.sasami -variable notation \ -highlightbackground $radiosBg -background $radiosBg \ -value "%sasami" -text "%sasami" \ -command { appendHist "%sasami\n"; evaluate "%sasami\n" } pack .radios.sasami -side left } if {$_tkeden_variant == "dtkeden"} { radiobutton .radios.lsd -variable notation \ -highlightbackground $radiosBg -background $radiosBg \ -value "%lsd" -text "%lsd" \ -command { appendHist "%lsd\n"; evaluate "%lsd\n" } pack .radios.lsd -side left } button .radios.interrupt -text "Interrupt" \ -background $radiosButtonBg -command {interrupt} pack .radios.interrupt -side right menu .menu . config -menu .menu frame .labelframe -borderwidth 0 # The prompt shows the current notation [Ash] label .prompt -anchor w -text "Enter EDEN statements:" # The labelframe also contains the current virtual agent [Ash] label .agentName -anchor e -text "" pack .prompt -side left -fill x -in .labelframe pack .agentName -side right -fill x -in .labelframe # ideally we should use this font whereever Eden code is displayed font create edencode -family courier -size 10 text .text -width 80 -height 15 -yscrollcommand ".scroll set" \ -background white -foreground black -insertbackground blue \ -insertofftime 80 -insertontime 1000 -insertwidth 2p \ -font edencode # set tabs to width of two characters (have to set it in pixels) [Ash] .text configure -tabs [font measure [.text cget -font] 00] scrollbar .scroll -command ".text yview" pack .radios -side top -fill x pack .labelframe -side top -fill x pack .scroll -side right -fill y pack .text -side right -fill both -expand 1 set m [menu .menu.file -tearoff 0] .menu add cascade -label "File" -underline 0 -menu .menu.file $m add command -label "Open..." -command {include Open} -underline 0 $m add command -label "Execute..." -command {include Execute} -underline 0 $m add separator set saveAsReusable 1 $m add checkbutton -label "Save as reusable definitions" \ -variable saveAsReusable -offvalue 0 -onvalue 1 $m add command -label "Save all definitions..." \ -command {save all} -underline 5 $m add command -label "Save Scout definitions..." \ -command {save scout} -underline 5 $m add command -label "Save DoNaLD definitions..." \ -command {save donald} -underline 5 $m add command -label "Save Eden definitions..." \ -command {save eden} -underline 5 if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { $m add command -label "Save LSD description..." \ -command {save lsd} -underline 5 } } $m add command -label "Save history..." \ -command {save hist} -underline 5 $m add separator $m add command -label "Quit" -command { close $histfile; quit; } -underline 0 set m [menu .menu.edit] .menu add cascade -label "Edit" -underline 0 -menu .menu.edit # (I found the keysym names using xmodmap -pk as I don't know the # virtual event names for select all and select none). $m add command -label "Select all" -underline 7 \ -accelerator "Control-/" \ -command {event generate .text } $m add command -label "Select none" \ -accelerator "Control-\\" \ -command {event generate .text } $m add command -label "Copy" -underline 0 \ -command {event generate .text <>} $m add command -label "Cut" -underline 2 \ -command {event generate .text <>} $m add command -label "Paste" -underline 0 \ -command {event generate .text <>} $m add command -label "Previous" \ -accelerator "Control-Alt-Up or Meta-Up" \ -command {previous} -underline 1 $m add command \ -label "Next" \ -accelerator "Control-Alt-Down or Meta-Down" \ -command {next} -underline 0 $m add command -label "Clear" \ -accelerator "Control-Alt-0 or Meta-0" \ -command {clearInputWindow} -underline 1 set m [menu .menu.show] .menu add cascade -label "View" -underline 0 -menu .menu.show $m add checkbutton -label "View history..." \ -variable showhist -command {show hist $showhist} -underline 5 $m add checkbutton -label "View errors..." \ -variable showerr -command {show err $showerr} -underline 6 $m add checkbutton -label "View Scout definitions..." \ -variable showscout -command {show scout $showscout} -underline 5 $m add checkbutton -label "View DoNaLD definitions..." \ -variable showdonald -command {show donald $showdonald} -underline 5 $m add checkbutton -label "View Eden definitions..." \ -variable showeden -command {show eden $showeden} -underline 5 if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { $m add checkbutton -label "View LSD descriptions..." \ -variable showlsd -command {show lsd $showlsd} -underline 5 $m add checkbutton -label "View client connections..." \ -variable showclient -command {show client $showclient} \ -underline 5 set m2 [menu .menu.type] .menu add cascade -label "Type" -menu .menu.type -underline 0 set proType 0 $m2 add radiobutton -label "Normal mode" \ -variable proType -value 0 $m2 add radiobutton -label "Interference mode" \ -variable proType -value 1 $m2 add radiobutton -label "Broadcast mode" \ -variable proType -value 2 \ -command { appendHist ">>\n"; evaluate ">>\n" } $m2 add radiobutton -label "Private mode" \ -variable proType -value 3 } } set m [menu .menu.help -tearoff 0] .menu add cascade -label "Help" -underline 0 -menu .menu.help $m add command -label "About $_tkeden_variant..." -command about \ -underline 0 $m add command -label "Credits..." -command credits \ -underline 0 $m add command -label "Key shortcuts..." -command keys \ -underline 0 $m add command -label "Eden quick reference..." \ -command edenQuickRef -underline 0 $m add command -label "Scout quick reference..." \ -command scoutQuickRef -underline 0 $m add command -label "Donald quick reference..." \ -command donaldQuickRef -underline 0 $m add command -label "Sasami quick reference..." \ -command sasamiQuickRef -underline 4 $m add command -label "ChangeLog..." -command changeLog \ -underline 1 bind .text { accept } bind .text { accept } bind .text { previous } bind .text { previous } bind .text { previous } bind .text { previous } bind .text { next } bind .text { next } bind .text { next } bind .text { next } bind .text { clearInputWindow } bind .text { clearInputWindow } bind .text { controlU } bind .text { controlU } proc bringToTop {} { set wins "[winfo children .] ."; foreach w $wins { set tlw [winfo toplevel $w]; if {[wm state $tlw] == "iconic"} { wm deiconify $tlw; } if {$w != ".menu"} { raise $w } } } # bring all our windows to the top if this combination of keys is pressed bind all { bringToTop } bindtags .text {all .text Text} update # History window toplevel .hist wm title .hist "$variantversion: Command History" frame .hist.menu -relief raised -borderwidth 2 pack .hist.menu -side top -fill x button .hist.menu.save -text "Save" -underline 0 -command {save hist} \ -relief flat -highlightthickness 0 bind .hist { .hist.menu.save invoke } bind .hist { .hist.menu.save invoke } button .hist.menu.find -text "Find" -underline 0 -command {find hist} \ -relief flat -highlightthickness 0 bind .hist { .hist.menu.find invoke } bind .hist { .hist.menu.find invoke } button .hist.menu.close -text "Close" -underline 0 \ -command {global showhist; set showhist 0; show hist 0} \ -relief flat -highlightthickness 0 bind .hist { .hist.menu.close invoke } bind .hist { .hist.menu.close invoke } pack .hist.menu.save .hist.menu.find .hist.menu.close -side left frame .hist.t pack .hist.t -fill both -expand 1 text .hist.t.text -state disabled -width 80 -height 10 \ -yscrollcommand ".hist.t.scroll set" -font edencode scrollbar .hist.t.scroll -command ".hist.t.text yview" pack .hist.t.scroll -side right -fill y pack .hist.t.text -side right -fill both -expand 1 wm withdraw .hist wm protocol .hist WM_DELETE_WINDOW ".hist.menu.close invoke;" update # Error window toplevel .err wm title .err "$variantversion: Errors" frame .err.menu -relief raised -borderwidth 2 pack .err.menu -side top -fill x button .err.menu.save -text "Save" -underline 0 -command {save err} \ -relief flat -highlightthickness 0 bind .err { .err.menu.save invoke } bind .err { .err.menu.save invoke } button .err.menu.find -text "Find" -underline 0 -command {find err} \ -relief flat -highlightthickness 0 bind .err { .err.menu.find invoke } bind .err { .err.menu.find invoke } button .err.menu.close -text "Close" -underline 0 \ -command {global showerr; set showerr 0; show err 0} \ -relief flat -highlightthickness 0 bind .err { .err.menu.close invoke } bind .err { .err.menu.close invoke } pack .err.menu.save .err.menu.find .err.menu.close -side left frame .err.t pack .err.t -fill both -expand 1 text .err.t.text -state disabled -width 80 -height 10 \ -yscrollcommand ".err.t.scroll set" -font edencode scrollbar .err.t.scroll -command ".err.t.text yview" pack .err.t.scroll -side right -fill y pack .err.t.text -side right -fill both -expand 1 wm withdraw .err wm protocol .err WM_DELETE_WINDOW ".err.menu.close invoke;" update if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { toplevel .client wm title .client "$variantversion: Client Connections" frame .client.menu -relief raised -borderwidth 2 pack .client.menu -side top -fill x button .client.menu.close -text "Close" -underline 0 \ -relief flat -highlightthickness 0 \ -command {global showclient; set showclient 0; show client 0;} bind .client { .client.menu.close invoke } bind .client { .client.menu.close invoke } pack .client.menu.close -side left frame .client.t pack .client.t -fill both -expand 1 text .client.t.text -state disabled -width 80 -height 10 \ -yscrollcommand ".client.t.scroll set" scrollbar .client.t.scroll -command ".client.t.text yview" pack .client.t.scroll -side right -fill y pack .client.t.text -side right -fill both -expand 1 wm withdraw .client wm protocol .client WM_DELETE_WINDOW ".client.menu.close invoke;" update } } toplevel .scout wm title .scout "$variantversion: Scout Definitions" frame .scout.menu -relief raised -borderwidth 2 pack .scout.menu -side top -fill x button .scout.menu.save -text "Save" -underline 0 -command {save scout} \ -relief flat -highlightthickness 0 bind .scout { .scout.menu.save invoke } bind .scout { .scout.menu.save invoke } button .scout.menu.find -text "Find" -underline 0 -command {find scout} \ -relief flat -highlightthickness 0 bind .scout { .scout.menu.find invoke } bind .scout { .scout.menu.find invoke } button .scout.menu.rebuild -text "Rebuild" -underline 0 \ -command {dumpscout} \ -relief flat -highlightthickness 0 bind .scout { .scout.menu.rebuild invoke } bind .scout { .scout.menu.rebuild invoke } button .scout.menu.close -text "Close" -underline 0 \ -command {global showscout; set showscout 0; show scout 0} \ -relief flat -highlightthickness 0 bind .scout { .scout.menu.close invoke } bind .scout { .scout.menu.close invoke } pack .scout.menu.save .scout.menu.find .scout.menu.rebuild .scout.menu.close \ -side left frame .scout.t pack .scout.t -fill both -expand 1 text .scout.t.text -state disabled -width 80 -height 20 \ -yscrollcommand ".scout.t.scroll set" -font edencode scrollbar .scout.t.scroll -command ".scout.t.text yview" pack .scout.t.scroll -side right -fill y pack .scout.t.text -side right -fill both -expand 1 wm withdraw .scout wm protocol .scout WM_DELETE_WINDOW ".scout.menu.close invoke;" update toplevel .donald wm title .donald "$variantversion: DoNaLD Definitions" frame .donald.menu -relief raised -borderwidth 2 pack .donald.menu -side top -fill x button .donald.menu.save -text "Save" -underline 0 -command {save donald} \ -relief flat -highlightthickness 0 bind .donald { .donald.menu.save invoke } bind .donald { .donald.menu.save invoke } button .donald.menu.find -text "Find" -underline 0 -command {find donald} \ -relief flat -highlightthickness 0 bind .donald { .donald.menu.find invoke } bind .donald { .donald.menu.find invoke } button .donald.menu.rebuild -text "Rebuild" -underline 0 \ -command {dumpdonald} \ -relief flat -highlightthickness 0 bind .donald { .donald.menu.rebuild invoke } bind .donald { .donald.menu.rebuild invoke } button .donald.menu.close -text "Close" -underline 0 \ -command {global showdonald; set showdonald 0; show donald 0} \ -relief flat -highlightthickness 0 bind .donald { .donald.menu.close invoke } bind .donald { .donald.menu.close invoke } pack .donald.menu.save .donald.menu.find .donald.menu.rebuild \ .donald.menu.close -side left frame .donald.t pack .donald.t -fill both -expand 1 text .donald.t.text -state disabled -width 80 -height 20 \ -yscrollcommand ".donald.t.scroll set" -font edencode .donald.t.text tag config viewport -background #efd4b4 .donald.t.text tag config master -background #efd4b4 scrollbar .donald.t.scroll -command ".donald.t.text yview" pack .donald.t.scroll -side right -fill y pack .donald.t.text -side right -fill both -expand 1 wm withdraw .donald wm protocol .donald WM_DELETE_WINDOW ".donald.menu.close invoke;" update if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { toplevel .lsd wm title .lsd "$variantversion: LSD Descriptions" frame .lsd.menu -relief raised -borderwidth 2 pack .lsd.menu -side top -fill x button .lsd.menu.save -text "Save" -underline 0 -command {save lsd} \ -relief flat -highlightthickness 0 bind .lsd { .lsd.menu.save invoke } bind .lsd { .lsd.menu.save invoke } button .lsd.menu.find -text "Find" -underline 0 -command {find lsd} \ -relief flat -highlightthickness 0 bind .lsd { .lsd.menu.find invoke } bind .lsd { .lsd.menu.find invoke } button .lsd.menu.rebuild -text "Rebuild" -underline 0 \ -command {dumpLSD} \ -relief flat -highlightthickness 0 bind .lsd { .lsd.menu.rebuild invoke } bind .lsd { .lsd.menu.rebuild invoke } button .lsd.menu.close -text "Close" -underline 0 \ -command {global showlsd; set showlsd 0; show lsd 0} \ -relief flat -highlightthickness 0 bind .lsd { .lsd.menu.close invoke } bind .lsd { .lsd.menu.close invoke } pack .lsd.menu.save .lsd.menu.find .lsd.menu.rebuild .lsd.menu.close \ -side left frame .lsd.t pack .lsd.t -fill both -expand 1 text .lsd.t.text -state disabled -width 80 -height 20 \ -yscrollcommand ".lsd.t.scroll set" scrollbar .lsd.t.scroll -command ".lsd.t.text yview" pack .lsd.t.scroll -side right -fill y pack .lsd.t.text -side right -fill both -expand 1 wm withdraw .lsd wm protocol .lsd WM_DELETE_WINDOW ".lsd.menu.close invoke;" update } } toplevel .eden wm title .eden "$variantversion: Eden Definitions" menu .eden.menu .eden config -menu .eden.menu set m [menu .eden.menu.edit] .eden.menu add cascade -label "Edit" -underline 0 -menu .eden.menu.edit $m add command -label "Copy" -underline 0 \ -command {event generate .eden.t.text <>} $m add command -label "Cut" -underline 2 \ -command {event generate .eden.t.text <>} $m add command -label "Paste" -underline 0 \ -command {event generate .eden.t.text <>} .eden.menu add command -label "Save" -underline 0 -command {save eden} .eden.menu add command -label "Find" -underline 0 -command {find eden} .eden.menu add command -label "Rebuild" -underline 0 -command {viewOption} .eden.menu add command -label "Update" -underline 0 -command {edenUpdate} .eden.menu add command -label "Close" -underline 0 \ -command {global showeden; set showeden 0; show eden 0} frame .eden.t pack .eden.t -fill both -expand 1 text .eden.t.text -state disabled -width 80 -height 20 \ -yscrollcommand ".eden.t.scroll set" -font edencode .eden.t.text tag config masteragent -background #efd4b4 .eden.t.text tag config scout -foreground red .eden.t.text tag config donald -foreground blue scrollbar .eden.t.scroll -command ".eden.t.text yview" pack .eden.t.scroll -side right -fill y pack .eden.t.text -side right -fill both -expand 1 wm withdraw .eden wm protocol .eden WM_DELETE_WINDOW ".eden.menu.close invoke;" update if {$_tkeden_win32_version == "0.0"} { # we're on UNIX set histfilename $env(HOME)/.tkeden-history } else { # cygwin seems to require filenames in DOS (C:\blah) format set histfilename \ [cygwin_conv_to_full_win32_path "$env(HOME)/.tkeden-history"] } # Keep a few backups around as people don't seem to look for the history # file until they've restarted tkeden once or twice [Ash] April 2001 catch {file rename -force ${histfilename}.2 ${histfilename}.3} catch {file rename -force ${histfilename}.1 ${histfilename}.2} catch {file rename -force $histfilename ${histfilename}.1} set histfile [open $histfilename w] proc appendHist {text} { global histfile .hist.t.text config -state normal .hist.t.text insert end $text puts $histfile $text nonewline flush $histfile .hist.t.text see end .hist.t.text config -state disabled } set errorNo 0 set errorAppendNo 0 set error "" proc appendErr {text} { global errorNo errorAppendNo error .err.t.text config -state normal if {$errorAppendNo == 0} { .err.t.text insert end "## ERROR number [incr errorNo]:\n" } incr errorAppendNo append error $text .err.t.text insert end $text .err.t.text see end .err.t.text config -state disabled } proc errorComplete {beep} { global errorNo errorAppendNo error set errorInitialText [string range $error 0 55] if {[string length $error] > 55} {append errorInitialText "..."} appendHist "## ERROR number $errorNo: $errorInitialText\n" set errorAppendNo 0 set error "" set showerr 1 show err 1 raise .err if {$beep} {bell} # Force .err to refresh, meaning the new error information is # shown on the screen even if we are in a tight loop. This call # causes any events on windows to trigger, which may then # cause some Eden to execute - this was the cause of "bug42". update idletasks } # Previous text set pentries "" # Number of entries of previous text to keep set pmax 20 # Current (per-entry session) position in history set ppos 0 proc accept {} { global pentries pmax ppos set text [.text get 1.0 end] appendHist $text # 1) remove the spurious \n that comes from Tcl's text widget # 2) append this entry to the list we are keeping # 3) remove an old entry from the front of the list if necessary # 3) if {[llength $pentries] >= $pmax} { set pentries [lrange $pentries 1 end] } # 2), 1) lappend pentries [string range $text 0 [expr [string length $text]-2]] evaluate $text clearInputWindow set ppos [llength $pentries]; } proc previous {} { global pentries pmax ppos set text [.text get 1.0 end] clearInputWindow set ppos [expr $ppos - 1] if {$ppos < 0} { set ppos 0 bell } .text insert end [lindex $pentries $ppos] } proc next {} { global pentries pmax ppos set text [.text get 1.0 end] clearInputWindow incr ppos if {$ppos > [llength $pentries]} { set ppos [llength $pentries] bell } .text insert end [lindex $pentries $ppos] } proc clearInputWindow {} { .text delete 1.0 end } proc controlU {} { # delete the text to the left of the cursor .text delete {insert linestart} insert } proc interface {statement} { global _tkeden_variant _dtkeden_isServer appendHist $statement if {$_tkeden_variant == "dtkeden"} { if {! ($_dtkeden_isServer)} { # Patrick's change to client only - dunno why [Ash] set statement "$statement\n" } } todo $statement } # This is used in scout.init.e for TEXTBOX [Ash] proc interfaceTEXT {statement} { todo $statement } proc cleanup {w} { .$w.t.text config -state normal .$w.t.text delete 1.0 end .$w.t.text config -state disabled } proc Review {} { global viewToBeDefined viewOption viewScout viewDoNaLD viewSasami set viewOption 0 if {$viewScout} { set viewOption [expr $viewOption + 1] } if {$viewDoNaLD} { set viewOption [expr $viewOption + 2] } if {$viewSasami} { set viewOption [expr $viewOption + 4] } dumpeden $viewOption $viewToBeDefined } proc edenDefn {v n d} { set r [.eden.t.text tag ranges eden%$v] .eden.t.text config -state normal if [llength $r] { .eden.t.text delete eden%$v.first eden%$v.last .eden.t.text insert [lindex $r 0] $d [list $n eden%$v] } else { .eden.t.text insert end $d [list $n eden%$v] } .eden.t.text config -state disabled } proc scoutDefn {v d} { set r [.scout.t.text tag ranges scout%$v] .scout.t.text config -state normal if [llength $r] { .scout.t.text delete scout%$v.first scout%$v.last .scout.t.text insert [lindex $r 0] $d scout%$v } else { .scout.t.text insert end $d scout%$v } .scout.t.text config -state disabled } # This based on mkDialogue below... [Ash] proc fileDialogue {fileName w winTitle} { global variantversion env catch {destroy $w} toplevel $w -class Dialog wm title $w "$variantversion: $winTitle" wm iconname $w "$winTitle" # Create two frames in the main window. The top frame will hold the # message and the bottom one will hold the buttons. Arrange them # one above the other, with any extra vertical space split between # them. frame $w.top -relief raised -border 1 frame $w.bot -relief raised -border 1 pack $w.top $w.bot -side top -fill both -expand yes text $w.top.text -state disabled -width 78 -height 31 \ -yscrollcommand "$w.top.scroll set" -background white \ -foreground black -font edencode scrollbar $w.top.scroll -command "$w.top.text yview" pack $w.top.scroll -side right -fill y pack $w.top.text -side top -expand yes -padx 3 -pady 3 if [catch {open "$env(TKEDEN_LIB)/$fileName" r} fileId] { puts stderr "Cannot open $env(TKEDEN_LIB)/$fileName: $fileId" } else { $w.top.text config -state normal $w.top.text insert end [read $fileId] close $fileId $w.top.text config -state disabled } # Create as many buttons as needed and arrange them from left to right # in the bottom frame. Embed the left button in an additional sunken # frame to indicate that it is the default button, and arrange for that # button to be invoked as the default action for clicks and returns in # the dialog. set args "OK" if {[llength $args] > 0} { set arg [lindex $args 0] frame $w.bot.0 -relief sunken -border 1 pack $w.bot.0 -side left -expand yes -padx 10 -pady 10 button $w.bot.0.button -text [lindex $arg 0] \ -command "[lindex $arg 1]; destroy $w" pack $w.bot.0.button -expand yes -padx 6 -pady 6 bind $w "[lindex $arg 1]; destroy $w" focus $w set i 1 foreach arg [lrange $args 1 end] { button $w.bot.$i -text [lindex $arg 0] \ -command "[lindex $arg 1]; destroy $w" pack $w.bot.$i -side left -expand yes -padx 10 set i [expr $i+1] } } bind $w [list focus $w] focus $w } # Create the About key shortcuts dialogue box containing info... [Ash] # See the Tcl text(n) man page for some of the information in the file proc keys {} { fileDialogue "keys.txt" .keys "Key shortcuts" } proc changeLog {} { fileDialogue "change.log" .changeLog "ChangeLog" } proc credits {} { fileDialogue "credits.txt" .credits "Credits" } # this from Ousterhout "Tcl and the Tk toolkit" page 219 proc forAllMatches {w pattern script} { scan [$w index end] %d numLines for {set i 1} {$i < $numLines} {incr i} { $w mark set last $i.0 while {[regexp -indices $pattern \ [$w get last "last lineend"] indices]} { $w mark set first \ "last + [lindex $indices 0] chars" $w mark set last "last + 1 chars \ + [lindex $indices 1] chars" uplevel $script } } } # Translate text file markup into formatted text by adding appropriate tags # [Ash] proc setTags {w} { $w.top.text config -state normal # Surround text denoting optional stuff with !@O and !@P. See # Ousterhout "Tcl and the Tk toolkit" page 91 for information # about Tcl regular expressions forAllMatches $w.top.text {!@O[^!@]*!@P} { $w.top.text delete first "first + 3 char" $w.top.text delete "last - 3 char" last $w.top.text tag add optional first last } $w.top.text tag configure optional -foreground blue $w.top.text config -state disabled } proc edenQuickRef {} { fileDialogue "eden.txt" .edenQuickRef "Eden Quick Reference" setTags .edenQuickRef } proc scoutQuickRef {} { fileDialogue "scout.txt" .scoutQuickRef "Scout Quick Reference" } proc donaldQuickRef {} { fileDialogue "donald.txt" .scoutQuickRef "DoNaLD Quick Reference" } proc sasamiQuickRef {} { fileDialogue "sasami.txt" .sasamiQuickRef "Sasami Quick Reference" } proc reinit {} { global env #set wins "[winfo children .] ."; #foreach w $wins { destroy $w; } destroy . # This almost works: $_tkeden_win32_version is undefined tho :( source $env(TKEDEN_LIB)/edenio.tcl } # Create the About dialogue box containing version and other information [Ash] proc about {} { global _tkeden_variant _tkeden_version _tkeden_web_site \ _dtkeden_isServer tcl_patchLevel tk_patchLevel \ _tkeden_win32_version env variantversion haveImg toplevel .about -class Dialog wm title .about "$variantversion: About" label .about.variant -text "This is $_tkeden_variant, version $_tkeden_version" if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { label .about.isserver -text "Invoked in super-agent (server) mode" } else { label .about.isserver -text "Invoked in agent (client) mode" } } label .about.copyright -text "Copyright (C) The University of ÌÇÐÄTV. All rights reserved" label .about.separator1 -text "--------------------------------" label .about.usage -text "Invoke $_tkeden_variant with the -u option for details of command line options usage" label .about.website -text "See $_tkeden_web_site for more information" label .about.separator2 -text "--------------------------------" label .about.diagnosis -text "This information may be useful when diagnosing problems:" if {$_tkeden_win32_version != "0.0"} { label .about.win32version -text "Win32 version V$_tkeden_win32_version" } else { label .about.win32version -text "Unix version" } label .about.libfiles -text "Library files are located in \n$env(TKEDEN_LIB)" label .about.tclversion -text "Tcl is version $tcl_patchLevel, Tk is version $tk_patchLevel\nTk Img package (PNG, JPEG...) is [expr {$haveImg ? {available} : {not available}}]" button .about.ok -text OK -command {destroy .about} if {$_tkeden_variant == "dtkeden"} { pack .about.variant .about.isserver .about.copyright \ .about.separator1 .about.usage .about.website \ .about.separator2 .about.diagnosis .about.win32version \ .about.libfiles .about.tclversion \ .about.ok -pady 5 } else { pack .about.variant .about.copyright \ .about.separator1 .about.usage .about.website \ .about.separator2 .about.diagnosis .about.win32version \ .about.libfiles .about.tclversion \ .about.ok -pady 5 } } # These long extensions have been re-thought from the original .e, .d, # .s practice. [Ash] set fileTypes { {{All files} *} {{Eden files} {.eden}} {{DoNaLD files} {.donald}} {{Scout files} {.scout}} {{Sasami files} {.sasami}} {{Script (multi-notation) files} {.script}} } proc include style { global variantversion fileTypes notation _tkeden_win32_version if {$_tkeden_win32_version == "0.0"} { # tk_getOpenFile -multiple true isn't possible until 8.4a2 on UNIX # and I can't find where to download that version (and it's alpha) set fileNames [tk_getOpenFile \ -filetypes $fileTypes -parent . \ -title "$variantversion: $style" ] } else { # we're on Windows: -multiple is possible set fileNames [tk_getOpenFile \ -filetypes $fileTypes -parent . \ -multiple true \ -title "$variantversion: $style"] } foreach file $fileNames { # Change directory so that Eden include(...) is more likely to # work. 'cd [file dirname $file]' is the Tcl version, but # I've rewritten it in Eden so that the cwd() function will be # correctly re-evaluated eden "cd(dirname(\"$file\"));" if {$style == "Open"} { set errCode [catch {set incFile [open $file r]} string] if {$errCode == 0} { while {[gets $incFile line] >= 0} { .text insert end "$line\n" } .text see end close $incFile } else { tk_dialog .message "$variantversion: Warning" \ "Cannot open file \"$file\"" warning 0 OK } } elseif {$style == "Execute"} { appendHist "%eden\n" appendHist "include(\"$file\");\n" # want to do this: eden "include(\"$file\");" # but at evaluation level 0 (so that global variables such as # $radiosBg can be found). $file needs to be evaluated # now, but the rest must not be. set cmd {eden "include(\"} append cmd "$file" append cmd {\");"} uplevel #0 $cmd # now switch back to current notation appendHist "$notation\n" } else { error {internal error: include style unknown} } } } proc save w { global variantversion saveAsReusable fileTypes set fileName [tk_getSaveFile -initialfile untitled.$w -parent . \ -title "$variantversion: Save $w As" -defaultextension $w \ -filetypes $fileTypes] if {$fileName != ""} { SaveToFile $w $fileName $saveAsReusable } } proc SaveToFile {w file executable} { global viewOption viewToBeDefined _tkeden_variant _dtkeden_isServer if {[catch {open $file w} fid]} { mkDialog .error "-aspect 300 -text \{$fid\}" {OK {}} tkwait visibility .error grab .error } else { case $w { all { dumpeden 63 0 dumpscout dumpdonald if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { dumpLSD } } if {$executable} { edenDefn autocalc eden "" puts $fid {autocalc = 0;} eden {tcl("set vp_in_use {"//vp_in_use(DFscreen)//"}");} global vp_in_use foreach vp $vp_in_use { edenDefn $vp eden "" } puts $fid %scout SaveScout $fid $executable if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { puts $fid %lsd Savelsd $fid $executable } } puts $fid %donald SaveDonald $fid $executable puts $fid %eden SaveEden $fid $executable -omit masteragent scout donald system } else { puts $fid %scout SaveScout $fid $executable if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { puts $fid %lsd Savelsd $fid $executable } } puts $fid %donald SaveDonald $fid $executable puts $fid %eden SaveEden $fid $executable } if {$executable} { puts $fid {autocalc = 1;} } dumpeden $viewOption $viewToBeDefined } hist { puts $fid [.hist.t.text get 1.0 end] nonewline } eden { if {$executable} { dumpeden 63 0 edenDefn autocalc eden "" puts $fid {autocalc = 0;} eden {tcl("set vp_in_use {"//vp_in_use(DFscreen)//"}");} global vp_in_use foreach vp $vp_in_use { edenDefn $vp eden "" } SaveEden $fid $executable -omit masteragent system } else { dumpeden $viewOption $viewToBeDefined SaveEden $fid $executable } if {$executable} { puts $fid {autocalc = 1;} dumpeden $viewOption $viewToBeDefined } } scout { dumpscout puts $fid "%scout" SaveScout $fid $executable } lsd { # This code should never happen in client and plain tkeden dumpLSD puts $fid "%lsd" Savelsd $fid $executable } donald { dumpdonald puts $fid "%donald" SaveDonald $fid $executable } } close $fid } } proc SaveEden {fid executable args} { if {[lsearch $args -omit] == 0} { set args [lrange $args 1 end] } set lastline [lindex [split [.eden.t.text index end] "."] 0] for {set i 1} {$i <= $lastline} {incr i} { set in 1 set tags [.eden.t.text tag names $i.0] foreach filter $args { if {[lsearch $tags $filter] != -1} { set in 0 break } } if {$in} { puts $fid [.eden.t.text get $i.0linestart $i.0lineend] } } } proc SaveScout {fid executable} { if $executable { foreach t [.scout.t.text tag names] { if [string match scout%* $t] { set text [.scout.t.text get $t.first $t.last] set eq [string first = $text] if {$eq == -1} { puts $fid $text nonewline } else { puts $fid [string range $text 0 [expr $eq - 2]] nonewline puts $fid {;} } } } foreach t [.scout.t.text tag names] { if [string match scout%* $t] { set text [.scout.t.text get $t.first $t.last] set eq [string first = $text] if {$eq != -1} { puts $fid $text nonewline } } } } else { puts $fid [.scout.t.text get 1.0 end] nonewline } } proc SaveDonald {fid executable} { for {set i 1} {$i <= [.donald.t.text index end]} {incr i} { set line [.donald.t.text get $i.0 "$i.0 lineend"] if {![string match AGENT* $line]} { puts $fid $line } } } if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { proc Savelsd {fid executable} { for {set i 1} {$i <= [.lsd.t.text index end]} {incr i} { set line [.lsd.t.text get $i.0 "$i.0 lineend"] puts $fid $line } } } } proc TextSearch {w direction caseSensitive string} { if {[expr [string compare [.$w.t.text tag nextrange found 1.0] ""] \ && [string compare $direction -forwards] == 0]} { if {[expr [string compare [.$w.t.text index insert] \ [.$w.t.text index found.first]] == 0]} { .$w.t.text mark set insert [.$w.t.text index found.last] } } .$w.t.text tag remove found 1.0 end if {$caseSensitive} { set caseSwitch "-exact" } else { set caseSwitch "-nocase" } set index [.$w.t.text search $direction $caseSwitch -regexp \ -count len -- $string insert] if {[string length $index] > 0} { .$w.t.text mark set insert $index .$w.t.text see $index # This doesn't work on Linux as \c is an escape - rewritten [Ash] #.$w.t.text tag add found $index $index+$len\chars .$w.t.text mark set first $index .$w.t.text mark set last "$index + $len chars" .$w.t.text tag add found first last .$w.t.text tag configure found -background blue } else { bell } } proc find w { global variantversion catch {destroy .find} toplevel .find -class Dialog wm title .find "$variantversion: Find in $w" frame .find.top pack .find.top -fill both entry .find.top.e -relief sunken -textvariable searchString checkbutton .find.top.case -variable caseSensitive -text "case sensitive" pack .find.top.e .find.top.case -side left -padx 5 frame .find.bot pack .find.bot -fill both button .find.bot.forward -text "Forward" -underline 0 -width 8 \ -command "TextSearch $w -forwards \$caseSensitive \$searchString" button .find.bot.backward -text "Backward" -underline 0 -width 8 \ -command "TextSearch $w -backwards \$caseSensitive \$searchString" button .find.bot.cancel -text Cancel -command "destroy .find" -width 8 bind .find { .find.bot.forward invoke } bind .find { .find.bot.forward invoke } bind .find { .find.bot.backward invoke } bind .find { .find.bot.backward invoke } pack .find.bot.forward -side left -expand yes -padx 5 -pady 5 pack .find.bot.backward -side left -expand yes -padx 5 -pady 5 pack .find.bot.cancel -side left -expand yes -padx 5 -pady 5 tkwait visibility .find grab .find } set viewOption 0 set viewToBeDefined 0 set viewScout 0 set viewDoNaLD 0 set viewSasami 0 proc edenUpdate {} { global viewOption viewToBeDefined # save the position of the vertical scrollbar set yscroll [lindex [.eden.t.text yview] 0] # dumpeden is a tkeden Tcl command created in EX/ex.c dumpeden [expr $viewOption + 8] $viewToBeDefined .eden.t.text yview moveto $yscroll } # viewOption is called when the Rebuild button is pressed [Ash] proc viewOption {} { global variantversion _tkeden_sasamiAvail catch {destroy .view} toplevel .view -class Dialog wm title .view "$variantversion: View Options" wm transient .view .eden frame .view.left pack .view.left -fill both -side left -expand yes label .view.left.name -justify left \ -text "Highlight to view:\ncontrol-click: individual items,\nshift-click: a range:" pack .view.left.name -side top -fill none -anchor nw scrollbar .view.left.scroll -command ".view.left.list yview" pack .view.left.scroll -side right -fill y listbox .view.left.list -yscroll ".view.left.scroll set" \ -selectmode extended -relief sunken -width 20 -height 20 -setgrid yes pack .view.left.list -side left -fill both -expand yes frame .view.right pack .view.right -side right checkbutton .view.right.yet \ -text "with yet-to-be-defined variables" \ -variable viewToBeDefined checkbutton .view.right.scout \ -text "with translated Scout definitions" \ -variable viewScout checkbutton .view.right.donald \ -text "with translated DoNaLD definitions" \ -variable viewDoNaLD if {$_tkeden_sasamiAvail == "1"} { checkbutton .view.right.sasami \ -text "with translated Sasami definitions" \ -variable viewSasami } button .view.right.all -text "Select All" -width 12 -underline 0 \ -command { .view.left.list selection set 0 end } button .view.right.none -text "Clear All" -width 12 \ -command { .view.left.list selection clear 0 end } frame .view.right.ok -relief sunken -border 1 button .view.right.ok.button -text OK -width 12 \ -command { Review; destroy .view; raise .eden } pack .view.right.ok.button -padx 10 -pady 10 button .view.right.cancel -text Cancel -command "destroy .view" -width 12 pack .view.right.all .view.right.none -side top -padx 5 -pady 5 pack .view.right.yet .view.right.scout .view.right.donald \ -side top -anchor sw if {$_tkeden_sasamiAvail == "1"} { pack .view.right.yet .view.right.sasami -side top -anchor sw } pack .view.right.ok .view.right.cancel -side top -padx 5 -pady 5 bind .view { .view.right.ok.button invoke } bind .view { .view.right.all invoke } bind .view { .view.right.all invoke } # setupViewOptions is a tkeden Tcl command created in EX/ex.c setupViewOptions tkwait visibility .view grab .view } if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { proc selectClients {} { global clientSock sockName clientName variantversion if {[llength $clientSock] <= 0} { tk_dialog .message "$variantversion: Message" "No connected client" warning -1 OK return } else { catch {destroy .select} toplevel .select -class Dialog wm title .select "$variantversion: Select Clients" frame .select.left pack .select.left -fill both -side left -expand yes label .select.left.name -text "Select clients to receive:" pack .select.left.name -side top -fill none -anchor nw scrollbar .select.left.scroll -command ".select.left.list yview" pack .select.left.scroll -side right -fill y listbox .select.left.list -yscroll ".select.left.scroll set" \ -selectmode multiple -relief sunken -width 20 -height 10 -setgrid yes pack .select.left.list -side left -fill both -expand yes frame .select.right pack .select.right -side right # Something may be wrong here - emacs gets the formatting # wrong [Ash] button .select.right.all -text "Select All" -command { .select.left.list selection set 0 end } -width 12 button .select.right.none -text "Clear All" -command { .select.left.list selection clear 0 end } -width 12 button .select.right.ok -text OK -command { global sockName set text [.text get 1.0 end] set selectedClients {} foreach i [.select.left.list curselection] { set currClient [.select.left.list get $i] lappend selectedClients $sockName($currClient) } sendClientsSock $selectedClients $text .text delete 1.0 end destroy .select } -width 12 button .select.right.cancel -text Cancel -command "destroy .select" -width 12 pack .select.right.all .select.right.none -side top -padx 5 -pady 5 pack .select.right.ok .select.right.cancel -side top -padx 5 -pady 5 .select.left.list insert end "Own" foreach wsock $clientSock { # puts $clientName($wsock) .select.left.list insert end $clientName($wsock) } tkwait visibility .select grab .select } } } } # mkDialog w msgArgs list list ... # # Create a dialog box with a message and any number of buttons at # the bottom. # # Arguments: # w - Name to use for new top-level window. # msgArgs - List of arguments to use when creating the message of the # dialog box (e.g. text, justifcation, etc.) # list - A two-element list that describes one of the buttons that # will appear at the bottom of the dialog. The first element # gives the text to be displayed in the button and the second # gives the command to be invoked when the button is invoked. # # @(#) mkDialog.tcl 1.1 94/08/10 15:35:00 proc mkDialog {w msgArgs args} { global variantversion catch {destroy $w} toplevel $w -class Dialog wm title $w "$variantversion: Dialog Box" wm iconname $w "Dialog" # Create two frames in the main window. The top frame will hold the # message and the bottom one will hold the buttons. Arrange them # one above the other, with any extra vertical space split between # them. frame $w.top -relief raised -border 1 frame $w.bot -relief raised -border 1 pack $w.top $w.bot -side top -fill both -expand yes # Create the message widget and arrange for it to be centered in the # top frame. eval message $w.top.msg -justify center $msgArgs pack $w.top.msg -side top -expand yes -padx 3 -pady 3 # Create as many buttons as needed and arrange them from left to right # in the bottom frame. Embed the left button in an additional sunken # frame to indicate that it is the default button, and arrange for that # button to be invoked as the default action for clicks and returns in # the dialog. if {[llength $args] > 0} { set arg [lindex $args 0] frame $w.bot.0 -relief sunken -border 1 pack $w.bot.0 -side left -expand yes -padx 10 -pady 10 button $w.bot.0.button -text [lindex $arg 0] \ -command "[lindex $arg 1]; destroy $w" pack $w.bot.0.button -expand yes -padx 6 -pady 6 bind $w "[lindex $arg 1]; destroy $w" focus $w set i 1 foreach arg [lrange $args 1 end] { button $w.bot.$i -text [lindex $arg 0] \ -command "[lindex $arg 1]; destroy $w" pack $w.bot.$i -side left -expand yes -padx 10 set i [expr $i+1] } } bind $w [list focus $w] focus $w } proc show {w yes} { if $yes { wm deiconify .$w raise .$w case $w { scout {dumpscout} donald {dumpdonald} eden {viewOption} lsd {dumpLSD} } # the lsd above should never be matched in client # or plain tkeden [Ash] } else { wm withdraw .$w } } # Called when the user does %sasami open_display: called from Sasami render.c proc sasamiWindow {width height} { global variantversion toplevel .sasami -width $width -height $height wm title .sasami "$variantversion: Sasami" frame .sasami.f togl .sasami.f.togl -width $width -height $height -double true \ -privatecmap false -depth true -rgba true pack .sasami.f.togl -fill both -expand t pack .sasami.f -fill both -expand t bind .sasami.f.togl {sasamiB %x %y} bind .sasami.f.togl {sasamiB1Motion %x %y} bind .sasami.f.togl {sasamiB %x %y} bind .sasami.f.togl {sasamiB3Motion %x %y} } set sasamiOldX 0 set sasamiOldY 0 proc sasamiB { x y } { global sasamiOldX sasamiOldY set sasamiOldX $x set sasamiOldY $y } # This is called when mouse button 1 is pressed and moved in the Sasami # window: rotate about the X & Y axes. proc sasamiB1Motion { x y } { global sasamiOldX sasamiOldY set diffX [expr $x - $sasamiOldX] set diffY [expr $y - $sasamiOldY] .sasami.f.togl setXrot [expr [sasami_getXrot] - $diffY] .sasami.f.togl setYrot [expr [sasami_getYrot] - $diffX] .sasami.f.togl render set sasamiOldX $x set sasamiOldY $y } # This is called when mouse button 3 is pressed and moved in the Sasami # window: zoom in and out on the Z axis. proc sasamiB3Motion { x y } { global sasamiOldY set diffY [expr $y - $sasamiOldY] .sasami.f.togl setZpos [expr [sasami_getZpos] - $diffY] .sasami.f.togl render set sasamiOldX $x set sasamiOldY $y } proc sasamiWindowClose {} { destroy .sasami } # If the Img package (PNG etc) is available then load it set haveImg [expr ! [catch {package require Img}]] if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { source $env(TKEDEN_LIB)/server.tcl } else { source $env(TKEDEN_LIB)/client.tcl } } ton .find.bot.backward -text "Backward" -underline 0 -width 8 \ -command "TextSearch $w -backwards \$caseSensitive \$searchString" button .find.bot.cancel -text Cancel -command "destroy .find" -width 8 bind .find { .find.bot.forward invoke } bind .find { .find.bot.forward invoke } bind .find { .find.bot.backward invoke } bind .find { .find.bot.backward invoke } pack .find.bottkeden1.32/lib-tkeden/keys.txt010060000025250000147000000043360732335213000175570ustar00ashleydcsother00001250000011Some menus and buttons have key shortcuts. These are shown with an underlined letter, and can be activated by pressing Alt and that letter. For example: Accept the current input: Alt-a View the Eden Definitions window: Alt-v Alt-e Valid throughout Eden: Bring all Eden windows to the front: Shift-Control-Tab (in any window) Using the mouse in the input window: Select text: drag Select word: double-click Select words: drag after a double-click Select line: triple-click Select lines: drag after a triple-click Adjust ends of selection: Shift + drag button 1 Reposition cursor without affecting selection: Control + click Insert text at mouse cursor: click button 2 Scroll view: drag button 2 Using the keyboard in the input window: Move backwards in input history: Meta-Up or Control-Alt-Up or Alt-p Move forwards in input history: Meta-Down or Control-Alt-Down or Alt-n Cursor left: Left or Control-b Cursor right: Right or Control-f Move cursor by words: as above, with Control or Meta Move cursor to start of line: Home or Control-a Move cursor to end of line: End or Control-e Cursor up: Up or Control-p Cursor down: Down or Control-n Move cursor by paragraphs: as above, with Control Move cursor up one screenful: Prior (Page up) Move cursor down one screenful: Next (Page down) or Control-v Move cursor to start of text: Control-Home or Meta-< Move cursor to end of text: Control-End or Meta-> Select text: as above, with Shift Select all text: Control-/ Select no text: Control-\\ Copy selection to clipboard: Copy (F16) or Meta-w Cut selection to clipboard: Cut (F20) or Control-w Insert clipboard at cursor: Paste (F18) or Control-y Delete to left of cursor: Backspace or Control-h Delete to right of cursor: Delete or Control-d Delete word to right of cursor: Meta-d Delete word to left of cursor: Meta-Backspace or Meta-Delete Delete to end of line: Control-k Delete to beginning of line: Control-u Delete selection: Control-x Clear all text in input window: Meta-0 or Control-Alt-0 Open new line (insert newline): Control-o Reverse order of two characters to right of cursor: Control-t Indent: tab stops (use the Tab key) are set to two character widths w: Alt-v Alt-e Valid throughout Eden: Bring all Eden windows to the front: Shift-Control-Tab (in any window) Using the mouse in the input window: Select text: drag Select word: double-click Select words: drag after a double-click Select line: triple-click Select lines: dragtkeden1.32/lib-tkeden/macro.e010060000025250000147000000014150733254413000173100ustar00ashleydcsother00001250000011/* * $Id: macro.e,v 1.3 2001/08/03 15:50:48 cssbz Exp $ */ /*--------------------------------------------------------------------------- function expand(macro_str, para_str1, para_str2, .., para_strN) Expands 'macro_str' by substituting 'para_strI' for "?I" and returns the resultant string (ref.: Edward Yung, M.Sc. thesis, `89, vol.2). ---------------------------------------------------------------------------*/ func macro { auto i, j, l, m, n, c, s; s = ""; l = (m = $1)#; shift; i = 1; while (i <= l) { for (j = i; j <= l && m[j] != '?'; j++); if (i != j) s = s // substr(m, i, j - 1); if (j <= l) { j++; n = (c = (j > l) ? '?' : m[j]) - '0'; s = s // ((1 <= n && n <= $#) ? $[n] : c); } i = j + 1; } return s; } tkeden1.32/lib-tkeden/sasami.txt010060000025250000147000000037770731624233400200770ustar00ashleydcsother00001250000011------------------------- Sasami QUICK REFERENCE ----------------------------- -- SYNTAX -------------------------------------------------------------------- No semi-colons: line feeds are terminators # UNIX shell style one-line comments Whitespace and commas are command / parameter separators Escaping to Eden: ` (back-tick) is a one-line escape to Eden. -- COMMANDS ------------------------------------------------------------------ open_display close_display vertex [z] polygon poly_geom_vertex poly_tex_vertex poly_colour [a] poly_material material material_ambient [a] (ambient = in darkness) material_diffuse [a] (diffuse = in normal light) material_specular [a] (specular = in direct light) material_texture object object_poly object_pos object_rot object_scale light light_pos light_enabled light_directional light_attenuation light_ambient [a] light_diffuse [a] light_specular [a] load_full_obj load_obj (loads only objects and materials into Eden) bgcolour viewport -- VARIABLES ----------------------------------------------------------------- sasami_viewport_xsize sasami_viewport_ysize sasami_viewport_bpp sasami_bgcolour_r sasami_bgcolour_g sasami_bgcolour_b sasami_show_axes -- MORE INFORMATION ---------------------------------------------------------- See http://www.dcs.warwick.ac.uk/modelling/ for more detail. tkeden1.32/lib-tkeden/scout.txt010060000025250000147000000116520732606050400177440ustar00ashleydcsother00001250000011------------------ SCOUT (SCreen layOUT) QUICK REFERENCE --------------------- Warning: this documentation isn't quite finished yet... -- SYNTAX -------------------------------------------------------------------- Definitions are followed by the semi-colon; Attributes within a window field list can be separated by white space or commas or both (note the last item must not be followed by a comma). # UNIX shell style one-line comments Variables must be declared before use (even ones that already exist in Eden) Redeclaration of type is not possible Name space: can access Eden variables directly. -- DATA TYPES ---------------------------------------------------------------- string: "guides and scouts" integer: 123 real: 123.4 point: {10, 20}, or box . nw, or... box: [{10, 20}, point2], or [[{10, 20}, height, width], or... frame: (box1, [p1, {30, 1}], box42) window: {type: DONALD, box: b, pict: "FIGURE1" border:5} display: -- WINDOW ATTRIBUTES --------------------------------------------------------- type: TEXT, DONALD, ARCA, IMAGE or TEXTBOX frame: a frame: a list of boxes which the text will flow through (TEXT) box: a box: the geometry (DONALD, ARCA, IMAGE, TEXTBOX) string: a string: the contents (TEXT, TEXTBOX) pict: a string: the picture used (DONALD, ARCA, IMAGE) xmin, ymin, xmax, ymax: an integer: drawing coordinate system (DONALD) font: a string: "{family size style}"... (TEXT, TEXTBOX) family = times, courier or helvetica, size = in points (1/72th inch) style = normal, bold, roman, italic, underline, overstrike (multiple styles are possible: "{times 12 {bold italic}}") alignment: NOADJ, LEFT, RIGHT, EXPAND or CENTRE (TEXT, TEXTBOX) bgcolour or bgcolor: a string (all types) fgcolour or fgcolor: a string (all types) bdcolour or bdcolor or bordercolor or bordercolour: a string (all types) border: an integer (all types) relief: a string ("raised", "sunken", "flat", "ridge" or "groove") (all types) sensitive: ON, OFF, MOTION, ENTER, LEAVE or a sum of these (all types) -- SENSITIVE ----------------------------------------------------------------- OFF: user actions inside window cause no redefinition ON: mouse actions inside window cause redefinition: windowname_mouse = {button, type, state, x, y} (DONALD, IMAGE) windowname_mouse_boxnumber = {button, type, state, x, y} (TEXT) button: button number, type: 4=pressed, 5=released, state: shift +1, capslock +2, control +4, meta +8, was-pressed +256 x, y: mouse coordinates (in the window's coordinate system) key strokes inside window cause redefinition: windowname_key = {key, type, state, x, y} (DONALD, IMAGE) windowname_key_boxnumber = {key, type, state, x, y} (TEXT) key: ascii code of key pressed type, state, x, y: as above MOTION: mouse motion inside window causes redefinition windowname_mousePos = {x, y} (DONALD, IMAGE) windowname_mousePos_boxnumber = {x, y} (TEXT) ENTER: mouse motion into the window causes redefinition windowname_mouseEnter = 1; (DONALD, IMAGE) windowname_mouseEnter_boxnumber = 1; (TEXT) LEAVE: mouse motion out of the window causes redefinition windowname_mouseLeave = 1; (DONALD, IMAGE) windowname_mouseLeave_boxnumber = 1; (TEXT) -- FUNCTIONS ----------------------------------------------------------------- ImageFile(type, filename) type can be ppm, pgm or gif. If the Tk Img package is installed (see Help -> About tkeden to check), bmp, xbm, xpm, gif (with transparency), png, jpeg, tiff and postscript are also available. ImageScale(source, xscale, yscale) if condition then expression1 else expression2 endif strcat(string, string) substr(string, integer, integer) itos(integer) strlen(string) shift(box, integer, integer) intersect(box, box) centre(box, box) enclose(box, box) reduce(box, box) ? append(frame, integer, box) insert(list, position, expression) delete(list, position) delete(frame, integer) -- EXAMPLES ------------------------------------------------------------------ %scout window ash = { type: TEXT string: "Ash" frame: ([{10, 10}, {100, 100}]) sensitive: MOTION }; screen = ; ... %scout image source = ImageFile("png", "aphasia.png"); window firstImage = { type: IMAGE box: [{10,10}, {490,240}] pict: "source" border: 5 relief: "raise" }; screen = ; ... need more examples... -- MORE INFORMATION ---------------------------------------------------------- See http://www.dcs.warwick.ac.uk/modelling/ for more detail. tkeden1.32/lib-tkeden/scout.init.e010060000025250000147000000517430733254416200203240ustar00ashleydcsother00001250000011/* * $Id: scout.init.e,v 1.12 2001/08/03 15:51:14 cssbz Exp $ */ /**** * * * This file is the function library of the SCOUT system * * It contains definitions of attributes, EDEN version of * * some SCOUT functions, screen updating functions and * * its sub-functions and initialization procedures * * * ****/ /** Initialise EX **/ /* luckily these first two are the same as required by donald in donald.init.e. These must be the same values as are defined in the Scout namespace in Scout/lex.c (init_scout). Also define these in builtinf.h [Ash] */ OFF = 0; ON = 1; MOTION = 2; ENTER = 4; LEAVE = 8; CLIENT_LIST = []; /* declare a list for server end to list all connected clients */ DFfont = "{courier 10}"; DFscreen = "screen"; /* should not change this */ DFalign = 0; /* 0 - no, 1 - left, 2 - right, 3 - centre, 4 - left & right */ DFbgcolor = tcl(". cget -background"); DFfgcolor = "black"; DFbdcolor = "black"; DFborder = 0; DFrelief = "raise"; DFxmin = 0; DFymin = 0; DFxmax = 1000; DFymax = 1000; DFhighlight = 1; DFsensitive = OFF; DFwidth = 500; DFheight = 500; proc HandleDisplayResizeEvent { para widget, name, width, height; /* Ignore messages about child widgets */ if (widget == "." // name) { /* Don't redefine if the values haven't changed. This will cause "reference to undefined variable" notices if they are enabled the first time this is done. */ if ((`name//"_width"` != width) || (`name//"_height"` != height)) { execute("%scout\ninteger "//name//"_width="//str(width)// "; integer "//name//"_height="//str(height)//";"); } } } proc OpenDisplay { para name, width, height; if (name[1] >= 'A' && name[1] <= 'Z') name = "_"//name; tcl("toplevel ."//name//" -background "//DFbgcolor// " -width "//str(width)//" -height "//str(height)); tcl("wm protocol ."//name//" WM_DELETE_WINDOW { set show_"//name// " 0; show "//name//" 0;}"); tcl("wm title ."//name//" \""//name//" ($variantversion)\""); tcl("uplevel #0 {set show_"//name//" 1}"); /* the -underline here should really look through the other items in the * menu and find the first unique character to use as a key shortcut * [Ash], April 2001 */ tcl(".menu.show add checkbutton -label "//name// " -variable show_"//name//" -command {show "//name// " $show_"//name//"} -underline 1"); tcl("bind ."//name//" { " // "eden {~HandleDisplayResizeEvent(\"%W\", \""//name//"\", %w, %h);}" // " }"); HandleDisplayResizeEvent("."//name, name, width, height); execute("%scout\ndisplay ~" // name // ";\n%eden\n"); tcl("tkwait visibility ."//name); } proc DestroyDisplay { para name; if (name[1] >= 'A' && name[1] <= 'Z') name = "_"//name; tcl("destroy ."//name); tcl(".menu.show delete "//name); tcl("unset show_"//name); } func StringWidth { para win, font, string; if ((win == @) || (font == @) || (string == @)) return @; return int(tcl("font measure " // font // " -displayof ." // win // " " // "{" // string // "}")); } func FontWidth { para win, font; /* Measuring the width of the (wide) character 'W' */ return StringWidth(win, font, "W"); } func FontHeight { para win, font; return int(tcl("font metrics " // font // " -displayof ." // win // " -linespace")); } func DisplayDepth { para win; return int(tcl("winfo depth ." // win)); } /* This gets called when '%scout' is done for the first time */ proc scoutScreenInitOpen { OpenDisplay(DFscreen, DFwidth, DFheight); fontWidth is FontWidth(DFscreen, DFfont); fontHeight is FontHeight(DFscreen, DFfont); displayDepth is DisplayDepth(DFscreen); } /**** * SCOUT functions * ****/ func pt_add /* ( point, point) */ /* + (point addition) */ { return [$1[1] + $2[1], $1[2] + $2[2]]; } func pt_subtract /* ( point, point) */ /* - (point subtraction) */ { return [$1[1] - $2[1], $1[2] - $2[2]]; } func row { return $1 * fontHeight; } func column { return $1 * fontWidth; } proc update_row : fontHeight { touch(&row); } proc update_column : fontWidth { touch(&column); } func dotint /* ( list, int ) */ /* .1 (i.e. dotint(point, 1)) .2 (i.e. dotint(point, 2)) .type (i.e. dotint(window, 1)) .frame (i.e. dotint(window, 2)) .string (i.e. dotint(window, 3)) .box (i.e. dotint(window, 4)) .pict (i.e. dotint(window, 5)) .xmin (i.e. dotint(window, 6)) .ymin (i.e. dotint(window, 7)) .xmax (i.e. dotint(window, 8)) .ymax (i.e. dotint(window, 9)) .bg (i.e. dotint(window, 10)) .fg (i.e. dotint(window, 11)) .border (i.e. dotint(window, 12)) .align (i.e. dotint(window, 13)) .sensitive (i.e. dotint(window, 14)) .bordercolor (i.e. dotint(window, 15)) .font (i.e. dotint(window, 16)) .relief (i.e. dotint(window, 17)) .(int) (for frame and display) */ { return $1[int($2)]; } func dotne /* ( box ) */ /* .ne */ { return [$1[3], $1[2]]; } func dotnw /* ( box ) */ /* .nw */ { return [$1[1], $1[2]]; } func dotse /* ( box ) */ /* .se */ { return [$1[3], $1[4]]; } func dotsw /* ( box ) */ /* .sw */ { return [$1[1], $1[4]]; } func dotn /* ( box ) */ /* .n */ { return [($1[1] + $1[3]) / 2, $1[2]]; } func dote /* ( box ) */ /* .e */ { return [$1[3], ($1[2] + $1[4]) / 2]; } func dots /* ( box ) */ /* .s */ { return [($1[1] + $1[3]) / 2, $1[4]]; } func dotw /* ( box ) */ /* .w */ { return [$1[1], ($1[2] + $1[4]) / 2]; } func boxshift /* ( box, x, y ) */ { para box, x, y; return [box[1] + x, box[2] + y, box[3] + x, box[4] + y]; } func app /* ( list, position, element ) */ /* append (for both frame and display) */ { insert $1, int($2) + 1, $3; return $1; } func del /* ( list, position ) */ /* delete (for both frame and display) */ { delete $1, $2; return $1; } func list_append /* ( list, list ) */ /* & (for both frame and display) */ { return $1 // $2; } func formbox /* ( point, point ) */ /* constructor of box : < P1, P2 > */ { return [$1[1], $1[2], $2[1], $2[2]]; } proc update_textbox : column, row { touch(&textbox); } func textbox { return [$1[1], $1[2], $1[1] + column($3) + 1, $1[2] + row($2) - 1]; } func box_width /* ( box ) */ /* return the width of the box in pixel */ { return $1[3] - $1[1] + 1; } func box_height /* ( box ) */ /* return the height of the box in pixel */ { return $1[4] - $1[2] + 1; } func capacity /* ( box ) */ /* return [r, c], no of row and no of col the box can hold */ { return [($1[4] - $1[2] - 1) / fontHeight, ($1[3] - $1[1] - 1) / fontWidth]; } /*** * string manipulating functions * ***/ /* this doesn't seem to be used anywhere [Ash] */ func Quote { para s; auto ret, i; if (type(s) != "string") { return str(s); } ret = "\""; for (i = 1; i <= s#; i++) { switch (s[i]) { case '"': ret = ret // "\\\""; break; case '\\': ret = ret // "\\\\"; break; default: ret = ret // s[i]; break; } } return ret // "\""; } /** * image related functions * **/ /* return the height of an image */ func ImageHeight { return tcl("image height "//$1); } /* return the width of an image */ func ImageWidth { return tcl("image width "//$1); } /* read, name and return the image from file image format currently available are ppm and gif */ func ImageFile { para imageName, type, filename; xoutput("image create photo", imageName, "-format", type, "-file", filename); return imageName; } /* scale the srcImage, name and return the scaled image as imageName */ /* This function uses the external utility pnmscale to do the job as Tcl can only currently scale images by integer amounts, and requires "zoom" for positive and "subsample" for negative amounts. Unfortunately the pnm utilities seem to be quite a UNIX thing and getting this way of things to work on Windoz could be quite a headache. :(. Anyway - if you want to fudge a scaled image using only Tcl, use something like xoutput("image create photo ", imageName); xoutput(imageName, "copy", srcImage, "-subsample 3"); return imageName here. [Ash, Sept 2000] */ func ImageScale { para imageName, srcImage, xscale, yscale; tcl("image create photo "//imageName); xoutput(srcImage, "write /tmp/1"//imageName); xoutput("exec pnmscale -xscale", xscale, "-yscale", yscale, "/tmp/1"//imageName, "> /tmp/2"//imageName); xoutput(imageName, "read /tmp/2"//imageName); xoutput("exec rm /tmp/1"//imageName, "/tmp/2"//imageName); return imageName; } /* cut a rectangle out of the srcImage, name and return result as imageName */ func ImageCut { para imageName, srcImage, x, y, width, height; tcl("image create photo "//imageName); xoutput(srcImage, "write /tmp/1"//imageName); xoutput("exec pnmcut", x, y, width, height, "/tmp/1"//imageName, "> /tmp/2"//imageName); xoutput(imageName, "read /tmp/2"//imageName); xoutput("exec rm /tmp/1"//imageName, "/tmp/2"//imageName); return imageName; } /* create pattern using ppmpat */ /* ppmpat generates ascii PPM which cannot be recognised by Tk */ func ImagePat { para imageName, form, width, height; tcl("image create photo "//imageName); xoutput("exec ppmpat -"//form, width, height, "> /tmp/1"//imageName); xoutput(imageName, "read /tmp/1"//imageName); xoutput("exec rm /tmp/1"//imageName); return imageName; } /* procedure for displaying an image */ proc ShowImage { para I_source, source; auto command, i, width, height; for (i = 1; i <= (*source)#; i++) { command = "."//(*source)[i][1]//"."//(*source)[i][2]; width = int(tcl(command//" cget -width")); height = int(tcl(command//" cget -height")); xoutput(command, "create image", width / 2, height / 2, "-tags image -image", *I_source); } } / screen updating actions / func Position { para bd, width, just; auto x, j, anchor; switch (int(just)) { case 1: x = 0; j = "left"; anchor = "nw"; break; case 2: x = width; j = "right"; anchor = "ne"; break; case 3: x = width / 2; j = "center"; anchor = "n"; break; case 0: case 4: /* not supported by Tk */ default: x = 0; j = "left"; anchor = "nw"; break; } return str(int(bd + x))//" "//str(int(bd))//" -anchor "//anchor //" -justify "//j; } proc scout_show_2D /* display a DoNaLD/ARCA picture */ { para screen, winNo, boxName; /* writeln("scout_show_2D: ", $); */ scout_show_2D_window(`screen`[winNo], "."//screen//"."//boxName//"_1", boxName//"_1"); } proc dobinding { para sensitive, widget, windowName, var, boxNumber; auto mouseName, keyName, mousePosName, mouseEnterName, mouseLeaveName, xCoord, yCoord; sensitive = int(sensitive); /* yuk - integerhonest hack [Ash] */ if (boxNumber > 0) { /* TEXT - have the boxNumber within the frame to deal with */ mouseName = "~"//windowName//"_mouse_"//str(boxNumber); keyName = "~"//windowName//"_key_"//str(boxNumber); mousePosName = "~"//windowName//"_mousePos_"//str(boxNumber); mouseEnterName = "~"//windowName//"_mouseEnter_"//str(boxNumber); mouseLeaveName = "~"//windowName//"_mouseLeave_"//str(boxNumber); xCoord = "%x"; yCoord = "%y"; } else { /* not TEXT - no boxNumber but must correct for window coordinate system */ mouseName = "~"//windowName//"_mouse"; keyName = "~"//windowName//"_key"; mousePosName = "~"//windowName//"_mousePos"; mouseEnterName = "~"//windowName//"_mouseEnter"; mouseLeaveName = "~"//windowName//"_mouseLeave"; xCoord = "[expr (%x-$"//var//"_xOrigin)/$"//var//"_xScale]"; yCoord = "[expr (%y-$"//var//"_yOrigin)/$"//var//"_yScale]"; } if (sensitive bitand ON) { /* the window is interested in mouse actions and key strokes */ xoutput("bind", widget, "